> ## Documentation Index
> Fetch the complete documentation index at: https://gccai.heqingsong.uk/llms.txt
> Use this file to discover all available pages before exploring further.

# omni-moderation-latest 内容审核

>  - 支持文本、图片以及图文混合内容审核
- 兼容单条文本、多条文本数组和内容块数组输入
- 图片支持公网 URL 和 base64 Data URI 

使用 `omni-moderation-latest` 对输入内容进行安全审核。该模型属于审核系列，不归类到图像、视频或音频生成系列。

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://gccai.heqingsong.uk/v1/moderations \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "omni-moderation-latest",
      "input": [
        {
          "type": "text",
          "text": "请审核这张图是否违规"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://gccai.heqingsong.uk/_gccai/cdn/files/1779955589195-wh950j4imqd.jpeg"
          }
        }
      ],
      "stream": false
    }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://gccai.heqingsong.uk/v1/moderations"

  payload = {
      "model": "omni-moderation-latest",
      "input": [
          {
              "type": "text",
              "text": "请审核这张图是否违规"
          },
          {
              "type": "image_url",
              "image_url": {
                  "url": "https://gccai.heqingsong.uk/_gccai/cdn/files/1779955589195-wh950j4imqd.jpeg"
              }
          }
      ],
      "stream": False
  }

  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
  }

  response = requests.post(url, json=payload, headers=headers)

  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const url = "https://gccai.heqingsong.uk/v1/moderations";

  const payload = {
    model: "omni-moderation-latest",
    input: [
      {
        type: "text",
        text: "请审核这张图是否违规",
      },
      {
        type: "image_url",
        image_url: {
          url: "https://gccai.heqingsong.uk/_gccai/cdn/files/1779955589195-wh950j4imqd.jpeg",
        },
      },
    ],
    stream: false,
  };

  const headers = {
    Authorization: "Bearer <token>",
    "Content-Type": "application/json",
  };

  fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(payload),
  })
    .then((response) => response.json())
    .then((data) => console.log(data))
    .catch((error) => console.error("Error:", error));
  ```
</RequestExample>

## 支持的模型

| 模型名                      | 说明       | 支持输入       |
| ------------------------ | -------- | ---------- |
| `omni-moderation-latest` | 通用内容审核模型 | 文本、图片、图文混合 |

## Authorizations

<ParamField header="Authorization" type="string" required>
  所有接口均需要使用 Bearer Token 进行认证。

  获取 API Key：

  访问 [API Key 管理页面](https://gccai.heqingsong.uk/keys) 获取您的 API Key。

  使用时在请求头中添加：

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## Body

<ParamField body="model" type="string" required>
  审核模型名称。

  * `omni-moderation-latest` - 通用内容审核模型
</ParamField>

<ParamField body="input" type="string | string[] | object[]" required>
  待审核内容。支持纯文本、文本数组、内容块数组。

  内容块数组可包含：

  * `text` - 文本内容块
  * `image_url` - 图片 URL 内容块
</ParamField>

<ParamField body="stream" type="boolean" default="false">
  是否流式返回。

  * `false`：非流式返回（默认，当前仅支持此值，不支持 `true`）
</ParamField>

## input 请求方式

### 图文混合

```json theme={null}
{
  "model": "omni-moderation-latest",
  "input": [
    {
      "type": "text",
      "text": "请审核这张图是否违规"
    },
    {
      "type": "image_url",
      "image_url": {
        "url": "https://gccai.heqingsong.uk/_gccai/cdn/files/1779955589195-wh950j4imqd.jpeg"
      }
    }
  ],
  "stream": false
}
```

### 纯文本（单条）

```json theme={null}
{
  "model": "omni-moderation-latest",
  "input": "I want to kill someone",
  "stream": false
}
```

### 纯文本（多条数组）

```json theme={null}
{
  "model": "omni-moderation-latest",
  "input": [
    "hello",
    "I hate you"
  ],
  "stream": false
}
```

### 纯图片（图片 URL）

```json theme={null}
{
  "model": "omni-moderation-latest",
  "input": [
    {
      "type": "image_url",
      "image_url": {
        "url": "https://gccai.heqingsong.uk/_gccai/cdn/files/1779955589195-wh950j4imqd.jpeg"
      }
    }
  ],
  "stream": false
}
```

### 纯图片（base64 Data URI）

```json theme={null}
{
  "model": "omni-moderation-latest",
  "input": [
    {
      "type": "image_url",
      "image_url": {
        "url": "data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAA..."
      }
    }
  ],
  "stream": false
}
```

## 使用说明

1. `input` 为内容块数组时，每个元素通过 `type` 区分内容类型。
2. 图片审核建议使用公网可访问 URL；若使用 base64，请使用标准 Data URI 格式：`data:image/{format};base64,{data}`。
3. 如无特殊需求，建议统一传 `stream: false`。
