文本/图片审核入口
POST
/api/v1/moderation文本/图片审核入口,根据请求字段自动路由至 DFA 敏感词检测或 NSFW 图片检测引擎。支持文本(text)和图片(image_url / image_base64)两种输入,与 /api/v1/moderate 系列接口共用同一审核服务。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| text | string | 可选 | 待检测的文本内容(与 image_url/image_base64 二选一) |
| image_url | string | 可选 | 图片 URL(与 text 二选一) |
| image_base64 | string | 可选 | 图片 Base64 字符串(与 text 二选一) |
请求示例
bash
curl -X POST https://api.ogmiao.com/api/v1/moderation \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{"text": "待检测内容"}'响应示例(文本)
JSON
{
"is_safe": false,
"violations": [
{
"type": "other",
"description": "命中敏感词库",
"confidence": 1.0,
"matched_text": "敏感词",
"start_offset": 3,
"end_offset": 6
}
],
"total_violations": 1,
"engine": "go-sensitive-word",
"algorithm": "DFA"
}