AI文本违规检测
AI文本违规检测 — 一键检测文本是否违规,覆盖色情、暴力、仇恨言论、政治敏感、辱骂、垃圾信息、诈骗、隐私泄露8大类别,返回详细风险评分和处理建议
GET
https://api.tinyaii.cn/v1/text/detect
请求参数
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| text | string | 必填 | 待检测文本(最多5000字符) | 你好世界 |
| lang | string | 可选 | 回答语言,zh=中文(默认),en=英文 | zh |
返回字段
| 字段 | 类型 | 说明 |
|---|---|---|
| flagged | boolean | 是否违规(true/false) |
| verdict | string | 鉴定结论:安全/违规/疑似违规 |
| confidence | number | 置信度(0-100) |
| risk_level | string | 风险等级:安全/低危/中危/高危/严重 |
| overall_score | number | 综合风险评分(0-100,越高越危险) |
| categories | object | 核心检测类别,含politic/porn/insult/violence,值为安全/低/中/高 |
| category_scores | object | 核心检测指数,含politic/porn/insult/violence,值为0-100整数 |
| detail_categories | object | 8大类别详细检测:色情/暴力/仇恨言论/政治敏感/辱骂/垃圾信息/诈骗/隐私泄露,各含detected/score/description |
| flagged_segments | array | 违规片段列表,含text/category/severity/reason |
| analysis | string | 详细分析总结 |
| suggestion | string | 处理建议 |
| text_length | number | 文本长度 |
返回示例
{
"code": 200,
"message": "success",
"data": {
"flagged": false,
"verdict": "安全",
"confidence": 98,
"risk_level": "安全",
"overall_score": 0,
"categories": {
"politic": "安全",
"porn": "安全",
"insult": "安全",
"violence": "安全"
},
"category_scores": {
"politic": 0,
"porn": 0,
"insult": 0,
"violence": 0
},
"detail_categories": {
"色情": {
"detected": false,
"score": 0,
"description": "无色情内容"
},
"暴力": {
"detected": false,
"score": 0,
"description": "无暴力内容"
},
"仇恨言论": {
"detected": false,
"score": 0,
"description": "无仇恨言论"
},
"政治敏感": {
"detected": false,
"score": 0,
"description": "无政治敏感内容"
},
"辱骂": {
"detected": false,
"score": 0,
"description": "无辱骂内容"
},
"垃圾信息": {
"detected": false,
"score": 0,
"description": "无垃圾信息"
},
"诈骗": {
"detected": false,
"score": 0,
"description": "无诈骗内容"
},
"隐私泄露": {
"detected": false,
"score": 0,
"description": "无隐私泄露"
}
},
"flagged_segments": [],
"analysis": "文本内容为普通问候语,不包含任何违规信息。",
"suggestion": "内容安全,可正常发布。",
"text_length": 12
}
}
调用示例
curl "https://api.tinyaii.cn/v1/text/detect?text=你好世界" \
-H "Authorization: Bearer YOUR_API_KEY"const res = await fetch("https://api.tinyaii.cn/v1/text/detect?text=你好世界", {
headers: { "Authorization": "Bearer YOUR_API_KEY" },
});
console.log(await res.json());import requests
resp = requests.get(
"https://api.tinyaii.cn/v1/text/detect",
params={"text": "你好世界"},
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=10,
)
print(resp.json())把 YOUR_API_KEY 换成你的密钥即可直接运行。密钥只保存在你自己的设备上。