---
title: OpenAI Moderations | RunAPI
description: RunAPIのOpenAI互換Moderationsオペレーションを通じてリクエストを送信します。
url: https://runapi.ai/ja/docs/api/openai/moderations.md
canonical: https://runapi.ai/ja/docs/api/openai/moderations
locale: ja
---

> HTML 版: https://runapi.ai/ja/docs/api/openai/moderations
> エージェント向けサイトインデックス: https://runapi.ai/llms.txt

# OpenAI Moderations

## 概要

RunAPIのOpenAI互換のModerations操作を、互換性のあるモデルおよびプロトコルのリクエスト・レスポンス形式とともに使用してください。

### クイックスタート

1. APIキーを作成し、RUNAPI_API_KEYとして設定します。
2. 互換性のあるモデルを選択し、ドキュメントに記載されたパスパラメーターとJSONボディを送信します。
3. このオペレーションに示された JSON レスポンスまたはサーバー送信イベントを読み取り、プロトコルエラーを処理してください。

## エンドポイント

POST /v1/moderations

ベースURL: https://runapi.ai

コントラクトバージョン: v1

推奨認証方式: Authorization: Bearer YOUR_API_TOKEN

## 認証情報の送信方法

RunAPIは以下に列挙された各キャリアを受け付けます。生成されたサンプルはプロトコルの推奨ヘッダーを使用します。

- `Authorization: Bearer YOUR_API_TOKEN` (推奨)
- `x-api-key: YOUR_API_TOKEN`

## 互換モデル

現在の料金、レート制限、商用利用の詳細については、モデルページを開いてください。

- [omni-moderation-latest](https://runapi.ai/ja/models/openai-moderation)

## リクエスト仕様

公開プロトコルとRunAPIサポートの両方の証拠があるフィールドのみが記載されています。追加のJSONボディフィールドはそのまま渡されます。

### JSON ボディ

必須: `input`

```json
{
  "input": {
    "description": "分類するテキストまたはテキストと画像の混合コンテンツ。",
    "items": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "additionalProperties": true,
          "type": "object"
        }
      ]
    },
    "type": [
      "string",
      "array"
    ]
  },
  "model": {
    "description": "RunAPIのモデレーションモデル識別子。デフォルトはomni-moderation-latest。",
    "type": "string"
  }
}
```

### リクエスト例

```json
{
  "input": [
    {
      "text": "A peaceful landscape.",
      "type": "text"
    },
    {
      "image_url": {
        "url": "https://runapi.ai/icon.png"
      },
      "type": "image_url"
    }
  ]
}
```

## 同期レスポンス

HTTP 200

### スキーマ

```json
{
  "additionalProperties": true,
  "properties": {
    "id": {
      "minLength": 1,
      "type": "string"
    },
    "model": {
      "minLength": 1,
      "type": "string"
    },
    "results": {
      "items": {
        "additionalProperties": true,
        "properties": {
          "categories": {
            "additionalProperties": true,
            "type": "object"
          },
          "category_applied_input_types": {
            "additionalProperties": true,
            "type": "object"
          },
          "category_scores": {
            "additionalProperties": true,
            "type": "object"
          },
          "flagged": {
            "type": "boolean"
          }
        },
        "required": [
          "flagged",
          "categories",
          "category_scores"
        ],
        "type": "object"
      },
      "minItems": 1,
      "type": "array"
    }
  },
  "required": [
    "id",
    "model",
    "results"
  ],
  "type": "object"
}
```

### 例

```json
{
  "id": "modr_123",
  "model": "omni-moderation-latest",
  "results": [
    {
      "categories": {
        "sexual": false,
        "violence": false
      },
      "category_applied_input_types": {
        "sexual": [
          "text",
          "image"
        ],
        "violence": [
          "text",
          "image"
        ]
      },
      "category_scores": {
        "sexual": 0.0002,
        "violence": 0.0001
      },
      "flagged": false
    }
  ]
}
```

## プロトコルエラー: invalid_request

HTTP 400

### スキーマ

```json
{
  "additionalProperties": true,
  "properties": {
    "error": {
      "additionalProperties": true,
      "properties": {
        "code": {
          "type": [
            "string",
            "null"
          ]
        },
        "message": {
          "type": "string"
        },
        "param": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "message",
        "type"
      ],
      "type": "object"
    }
  },
  "required": [
    "error"
  ],
  "type": "object"
}
```

### 例

```json
{
  "error": {
    "code": null,
    "message": "input is required",
    "param": "input",
    "type": "invalid_request_error"
  }
}
```

## 生成されたコードサンプル

各cURL、JavaScript、およびPythonのサンプルは、プロトコル固有のSDKを必要とせずに、このコントラクトから検証済みのリクエストを送信します。

### curl

```curl
curl -X POST https://runapi.ai/v1/moderations \
  -H Authorization:\ Bearer\ YOUR_API_TOKEN \
  -H Content-Type:\ application/json \
  -d \{\"input\":\[\{\"type\":\"text\",\"text\":\"A\ peaceful\ landscape.\"\},\{\"type\":\"image_url\",\"image_url\":\{\"url\":\"https://runapi.ai/icon.png\"\}\}\]\}
```

### javascript

```javascript
const response = await fetch("https://runapi.ai/v1/moderations", {
  method: "POST",
  headers: {
  "Authorization": "Bearer YOUR_API_TOKEN",
  "Content-Type": "application/json"
},
  body: JSON.stringify({
  "input": [
    {
      "type": "text",
      "text": "A peaceful landscape."
    },
    {
      "type": "image_url",
      "image_url": {
        "url": "https://runapi.ai/icon.png"
      }
    }
  ]
})
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
console.log(data);
```

### python

#### インストール

```bash
pip install requests
```

```python
import requests

response = requests.post(
    "https://runapi.ai/v1/moderations",
    headers={"Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json"},
    json={"input": [{"type": "text", "text": "A peaceful landscape."}, {"type": "image_url", "image_url": {"url": "https://runapi.ai/icon.png"}}]}
)
response.raise_for_status()
print(response.json())
```

## 関連ガイド

- [認証](https://runapi.ai/ja/docs/guides/authentication.md)
- [クイックスタート](https://runapi.ai/ja/docs/guides/llm-api/quickstart.md)

---

## RunAPI のその他の情報

- [ホーム](https://runapi.ai/ja/.md)
- [モデルカタログ](https://runapi.ai/ja/models.md)
- [料金](https://runapi.ai/ja/pricing.md)
- [プロバイダー](https://runapi.ai/ja/models)
- [ドキュメント](https://runapi.ai/ja/docs/guides)
- [SDK](https://runapi.ai/ja/sdk.md)
- [CLI](https://runapi.ai/ja/cli.md)
- [MCP Server](https://runapi.ai/ja/mcp.md)
- [Claude Code と Cursor](https://runapi.ai/ja/claude-code-vs-cursor.md)
- [Cursor API セットアップ](https://runapi.ai/ja/cursor-api-setup.md)
- [RunAPI と OpenRouter の比較](https://runapi.ai/ja/openrouter-alternative.md)
- [エンタープライズ](https://runapi.ai/ja/contact.md)
- [お問い合わせ](https://runapi.ai/ja/contact.md)
- [利用規約](https://runapi.ai/ja/terms.md)
- [プライバシー](https://runapi.ai/ja/privacy.md)
- [エージェント向けサイトインデックス](https://runapi.ai/llms.txt)

お問い合わせ: contact@runapi.ai

## 構造化データ

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "ja",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/ja",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/ja/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "ja",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/ja",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/jaicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "ja",
    "@type": "TechArticle",
    "headline": "OpenAI Moderations",
    "description": "RunAPIのOpenAI互換Moderationsオペレーションを通じてリクエストを送信します。",
    "url": "https://runapi.ai/ja/docs/api/openai/moderations",
    "mainEntityOfPage": "https://runapi.ai/ja/docs/api/openai/moderations"
  }
]
```
