内容审核

对文本或图像进行安全审核,返回各分类是否命中违规内容的判定,兼容 OpenAI Moderations 协议。

基本信息

方法POST 端点https://koprouter.kopglobal.com/v1/moderations 鉴权Authorization: Bearer sk-...

请求参数

参数 类型 必填 说明
model string 是 审核模型 ID
input string/array 是 待审核的文本或图像

请求示例

curl https://koprouter.kopglobal.com/v1/moderations \
  -H "Authorization: Bearer sk-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL_ID",
    "input": "I want to harm someone."
  }'

响应示例

{
  "id": "modr-abc123",
  "model": "MODEL_ID",
  "results": [
    {
      "flagged": true,
      "categories": {
        "hate": false,
        "violence": true
      },
      "category_scores": {
        "hate": 0.01,
        "violence": 0.98
      }
    }
  ]
}
`flagged` 为 `true` 表示命中违规分类,`category_scores` 给出各分类的置信度。