图像违规检测
检测图片是否含色情、违禁、恶心、敏感文字等违规内容。传入公网图片地址或 Base64。
调用地址:https://api.ynlskj.com.cn/gateway/imgreview
复制
请求方法:POST
在其他地方怎么调用
请求地址用上面的调用地址,把 JSON 放在请求体里
方法用 POST
API Key 只能放在请求头 X-API-Key,不要写进网址,也不要写进 Query 框
Key 在「个人中心 → API Key」里复制,登录后会自动填入你自己的 Key
参数说明
参数 位置 必填 说明
img_urlBody JSON 二选一 待检测图片的公网 URL。也可用 imgUrl / url
img_base64Body JSON 二选一 图片 Base64,不要带 data:image 前缀;也可传完整 Data URI。也可用 imgBase64
img_typeBody JSON 否 0 静态图(默认),1 表示 GIF。也可用 imgType
X-API-KeyHeader 是 你的 API Key
请求示例
场景 Body 示例
用图片地址 {"img_url":"https://img.alicdn.com/tfs/TB1U4r9AeH2gK0jSZJnXXaT1FXa-2880-480.png"}
用 Base64 {"img_base64":"/9j/4AAQ..."}
GIF 动图 {"img_url":"https://example.com/a.gif","img_type":1}
图片需为 PNG / JPG / JPEG / BMP / GIF / WebP / TIFF,建议 5KB–4MB。大图请用 img_url,不要把超大 Base64 塞进请求体。
返回说明
字段 说明
retok 成功,err 失败
code200 表示上游调用成功(是否违规看 data.result / data.pass)
data.passtrue 表示合规通过
data.result1 合规,2 不合规,3 疑似,4 审核失败
data.desc结果说明,如「合规」「不合规」
data.suggestionpass 通过 / block 拦截 / review 人工复核 / fail 失败
data.items命中的违规项数组,合规则为 []
msg本站提示,如「次数充足,剩余 99 次」或「次数不足,剩余 0 次」
remain_quota本次调用后的剩余次数
可直接复制的代码
未登录时示例只显示「你的密钥」。登录后会自动填入你自己的 Key,不会展示别人的。
PHP
Python
Go
JavaScript
Java
C#
cURL
复制
<?php
$ch = curl_init('https://api.ynlskj.com.cn/gateway/imgreview');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['X-API-Key: 你的密钥', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{
"img_url": "https://img.alicdn.com/tfs/TB1U4r9AeH2gK0jSZJnXXaT1FXa-2880-480.png"
}',
]);
echo curl_exec($ch);
复制
import requests
url = 'https://api.ynlskj.com.cn/gateway/imgreview'
headers = {'X-API-Key': '你的密钥'}
resp = requests.post(url, headers=headers, json={
"img_url": "https://img.alicdn.com/tfs/TB1U4r9AeH2gK0jSZJnXXaT1FXa-2880-480.png"
}, timeout=15)
print(resp.text)
复制
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader(`{
"img_url": "https://img.alicdn.com/tfs/TB1U4r9AeH2gK0jSZJnXXaT1FXa-2880-480.png"
}`)
req, _ := http.NewRequest("POST", "https://api.ynlskj.com.cn/gateway/imgreview", body)
req.Header.Set("X-API-Key", "你的密钥")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
}
复制
fetch('https://api.ynlskj.com.cn/gateway/imgreview', {
method: 'POST',
headers: {
'X-API-Key': '你的密钥',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"img_url": "https://img.alicdn.com/tfs/TB1U4r9AeH2gK0jSZJnXXaT1FXa-2880-480.png"
})
})
.then(res => res.json())
.then(data => console.log(data));
复制
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.ynlskj.com.cn/gateway/imgreview"))
.header("X-API-Key", "你的密钥")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{\n \"img_url\": \"https://img.alicdn.com/tfs/TB1U4r9AeH2gK0jSZJnXXaT1FXa-2880-480.png\"\n}"))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
复制
using System.Net.Http;
using System.Text;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "你的密钥");
var content = new StringContent("{\n \"img_url\": \"https://img.alicdn.com/tfs/TB1U4r9AeH2gK0jSZJnXXaT1FXa-2880-480.png\"\n}", Encoding.UTF8, "application/json");
var result = await client.PostAsync("https://api.ynlskj.com.cn/gateway/imgreview", content);
Console.WriteLine(await result.Content.ReadAsStringAsync());
复制
curl -X POST "https://api.ynlskj.com.cn/gateway/imgreview" \
-H "X-API-Key: 你的密钥" \
-H "Content-Type: application/json" \
-d '{
"img_url": "https://img.alicdn.com/tfs/TB1U4r9AeH2gK0jSZJnXXaT1FXa-2880-480.png"
}'
请求参数演示
{"img_url":"https://img.alicdn.com/tfs/TB1U4r9AeH2gK0jSZJnXXaT1FXa-2880-480.png"}
响应演示
{"ret":"ok","code":200,"success":true,"errmsg":"成功","data":{"pass":true,"result":1,"desc":"合规","suggestion":"pass","items":[]}}