# Content moderation

> Review one image, video, or audio file plus optional text. Poll for pass, review, or block; errors fail without a verdict or charge.

## 📖 接入指引

**Endpoint**: `POST /api/v1/actions/see2ai_content_moderation_v1`

**认证方式**: Bearer Token (租户 API Key)

### Endpoints

| Method | Path | Purpose |
| --- | --- | --- |
| `POST` | `/api/v1/actions/see2ai_content_moderation_v1` | Submit the standard action request. |

> **⚠️ 重要提示**
> 
> 本 API 是 SEE2AI 平台标准化封装后的接口，**参数格式与任何上游 API 不同**。
> 请直接使用下方 Schema 中定义的参数，无需参考其他文档。
> 
> *例如：*
> *- 文本模型参数可能是 `query` 而不是 `messages` 数组*
> *- 视频模型参数可能是 `brief` (创意简报) 而不是复杂的配置项*

## 📥 输入参数 (Input Schema)

```json
{
  "examples": [
    {
      "media_type": "video",
      "media_url": "https://example.com/video.mp4",
      "sync": false
    }
  ],
  "properties": {
    "media_url": {
      "description": "Public HTTP(S) URL of one image, video, or audio file.",
      "title": "Media Url",
      "type": "string"
    },
    "media_type": {
      "description": "image, video, or audio.",
      "examples": [
        "video"
      ],
      "title": "Media Type",
      "type": "string"
    },
    "text": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional text to review with the media, up to 10,000 UTF-8 bytes.",
      "title": "Text"
    },
    "idempotency_key": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional 1-128 printable ASCII caller key; must match the header if both are supplied.",
      "title": "Idempotency Key"
    },
    "sync": {
      "default": false,
      "description": "Must be false. Submit a task, then poll for the verdict.",
      "title": "Sync",
      "type": "boolean"
    }
  },
  "required": [
    "media_url",
    "media_type"
  ],
  "title": "ActionInput",
  "type": "object"
}
```

### 参数说明

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| `media_url` | string | ✅ 是 | `-` | Public HTTP(S) URL of one image, video, or audio file. |
| `media_type` | string | ✅ 是 | `-` | image, video, or audio. |
| `text` | string / null | ❌ 否 | `-` | Optional text to review with the media, up to 10,000 UTF-8 bytes. |
| `idempotency_key` | string / null | ❌ 否 | `-` | Optional 1-128 printable ASCII caller key; must match the header if both are supplied. |
| `sync` | boolean | ❌ 否 | `False` | Must be false. Submit a task, then poll for the verdict. |

## 📤 输出结果 (Output Schema)

```json
{
  "$defs": {
    "ModalitySummary": {
      "properties": {
        "verdict": {
          "enum": [
            "pass",
            "review",
            "block"
          ],
          "title": "Verdict",
          "type": "string"
        },
        "labels": {
          "items": {
            "enum": [
              "porn",
              "violence",
              "terror",
              "politics",
              "illegal",
              "ads",
              "abuse",
              "other"
            ],
            "type": "string"
          },
          "title": "Labels",
          "type": "array"
        }
      },
      "required": [
        "verdict"
      ],
      "title": "ModalitySummary",
      "type": "object"
    }
  },
  "properties": {
    "input_tokens": {
      "default": 0,
      "description": "输入消耗的词元数量",
      "title": "Input Tokens",
      "type": "integer"
    },
    "output_tokens": {
      "default": 0,
      "description": "输出消耗的词元数量",
      "title": "Output Tokens",
      "type": "integer"
    },
    "total_tokens": {
      "default": 0,
      "description": "总消耗的词元数量",
      "title": "Total Tokens",
      "type": "integer"
    },
    "model": {
      "default": "",
      "description": "实际使用的 SEE2AI 化身模型名称（由各 action 显式填写）",
      "title": "Model",
      "type": "string"
    },
    "source": {
      "default": "see2ai",
      "description": "服务来源（统一 `see2ai`；真实路由仅平台内部可见）",
      "title": "Source",
      "type": "string"
    },
    "cost_points": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "预先计算的扣费词元（如果插件内部已经计算好费用，则直接使用此值，忽略基于词元的计算）",
      "title": "Cost Points"
    },
    "task_id": {
      "title": "Task Id",
      "type": "string"
    },
    "status": {
      "enum": [
        "running",
        "success",
        "failed"
      ],
      "title": "Status",
      "type": "string"
    },
    "verdict": {
      "anyOf": [
        {
          "enum": [
            "pass",
            "review",
            "block"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Verdict"
    },
    "labels": {
      "items": {
        "enum": [
          "porn",
          "violence",
          "terror",
          "politics",
          "illegal",
          "ads",
          "abuse",
          "other"
        ],
        "type": "string"
      },
      "title": "Labels",
      "type": "array"
    },
    "modalities": {
      "additionalProperties": {
        "$ref": "#/$defs/ModalitySummary"
      },
      "title": "Modalities",
      "type": "object"
    },
    "estimated_cost": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Estimated Cost"
    },
    "error_code": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Error Code"
    },
    "error_message": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Error Message"
    },
    "retryable": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Retryable"
    },
    "retry_after_seconds": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Retry After Seconds"
    },
    "warnings": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Warnings"
    }
  },
  "required": [
    "task_id",
    "status"
  ],
  "title": "ActionOutput",
  "type": "object"
}
```

### 输出字段说明

| 字段名 | 类型 | 说明 |
|--------|------|------|
| `input_tokens` | integer | 输入消耗的词元数量 |
| `output_tokens` | integer | 输出消耗的词元数量 |
| `total_tokens` | integer | 总消耗的词元数量 |
| `model` | string | 实际使用的 SEE2AI 化身模型名称（由各 action 显式填写） |
| `source` | string | 服务来源（统一 `see2ai`；真实路由仅平台内部可见） |
| `cost_points` | integer / null | 预先计算的扣费词元（如果插件内部已经计算好费用，则直接使用此值，忽略基于词元的计算） |
| `task_id` | string |  |
| `status` | string enum |  |
| `verdict` | string enum / null |  |
| `labels` | array |  |
| `modalities` | object |  |
| `estimated_cost` | integer / null |  |
| `error_code` | string / null |  |
| `error_message` | string / null |  |
| `retryable` | boolean / null |  |
| `retry_after_seconds` | integer / null |  |
| `warnings` | array / null |  |

## 💡 调用示例

### cURL 示例

```bash
curl -X POST "https://see2ai.com/api/v1/actions/see2ai_content_moderation_v1" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer sk-your-tenant-api-key" \
     -d '{
  "media_type": "video",
  "media_url": "https://example.com/video.mp4",
  "sync": false
}'
```

### Python 示例

```python
import requests

API_KEY = "sk-your-tenant-api-key"
ENDPOINT = "https://see2ai.com/api/v1/actions/see2ai_content_moderation_v1"

headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {API_KEY}"
}

payload = {
  "media_type": "video",
  "media_url": "https://example.com/video.mp4",
  "sync": false
}

response = requests.post(ENDPOINT, json=payload, headers=headers)
result = response.json()

print(f"结果：{result}")
```

## 💰 计费说明

> Image CNY 0.005 per success; video CNY 0.44/minute; audio CNY 0.066/minute. Each video/audio task rounds up to whole minutes. Optional text adds CNY 0.005. Success only.

**注意**: 所有费用都以词元为单位，系统会自动从租户余额中扣除。

## ⚠️ 常见错误码

| HTTP 状态码 | 错误原因 | 解决方案 |
| --- | --- | --- |
| `400` | Invalid or unreadable media | 请稍后重试 |
| `402` | Insufficient balance for the review hold | 请稍后重试 |
| `409` | Idempotency conflict | 请稍后重试 |
| `503` | Review or settlement unavailable | 请稍后重试 |

## 📞 技术支持

- **文档问题**: 查看 [SEE2AI 官方文档](https://see2ai.com/docs)
- **API 状态**: 访问 [服务状态页面](https://see2ai.com/status)
- **问题反馈**: 联系技术支持团队

---

**API 版本**: see2ai_content_moderation_v1
**最后更新**: 2026-03-23
