> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apimart.ai/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://api.apimart.ai/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://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
          }
        }
      ],
      "stream": false
    }'
  ```

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

  url = "https://api.apimart.ai/v1/moderations"

  payload = {
      "model": "omni-moderation-latest",
      "input": [
          {
              "type": "text",
              "text": "この画像が違反していないかモデレーションしてください"
          },
          {
              "type": "image_url",
              "image_url": {
                  "url": "https://cdn.apimart.ai/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://api.apimart.ai/v1/moderations";

  const payload = {
    model: "omni-moderation-latest",
    input: [
      {
        type: "text",
        text: "この画像が違反していないかモデレーションしてください",
      },
      {
        type: "image_url",
        image_url: {
          url: "https://cdn.apimart.ai/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://apimart.ai/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://cdn.apimart.ai/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://cdn.apimart.ai/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` で統一することを推奨します。
