モデレーションを作成する
CometAPI の POST /v1/moderations を使用して、OpenAI互換のモデレーションリクエストでテキストまたはマルチモーダル入力をチェックします。
このエンドポイントは、ユーザー生成コンテンツを model エンドポイントに送信する前にチェックするために使用します。Documentation Index
Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
Use this file to discover all available pages before exploring further.
model と input の値を指定した OpenAI互換のモデレーションリクエストを送信してください。
Authorization: Bearer <COMETAPI_KEY>.リクエスト本文
| Field | Type | Required | Description |
|---|---|---|---|
input | string or array | Yes | チェックするコンテンツ。1つのテキスト入力には string、バッチでのテキストチェックには文字列の配列、またはテキストと image_url などの OpenAIスタイルのマルチモーダル parts を使用します。 |
model | string | Yes | モデレーション model ID。特定のモデレーション model が必要でない限り、テキストと画像のモデレーションには omni-moderation-latest を使用します。 |
omni-moderation-latest など、それをサポートする model を使用して OpenAIスタイルのマルチモーダル入力を送信します。公開画像 URL は CometAPI サーバーからダウンロード可能である必要があります。コピーして使える画像テストには、base64 data URL を使用してください。
リクエスト例
1つのテキスト入力のみを分類する必要がある場合は、単一のテキスト文字列を送信します。レスポンスの形状
レスポンスにはid、model、results、usage が含まれます。results 内の各項目では、対応する input がフラグ付けされたかどうか、カテゴリごとの真偽値、カテゴリスコア、各カテゴリに適用された入力タイプが報告されます。バッチのテキストリクエストでは、results には input 文字列ごとに1つの項目が含まれます。課金および監視用のフィールドには usage を使用します。承認
CometAPI API key used for model requests. Send it as Authorization: Bearer <COMETAPI_KEY>.
ボディ
Required moderation model ID. Use omni-moderation-latest for text and image moderation unless you have a specific moderation model requirement.
"omni-moderation-latest"
Content to check. Use a string for one text input, an array of strings for batch text checks, or OpenAI-style multimodal parts such as text plus image_url when the selected model supports it.
"I want to check this text before sending it to a model."
レスポンス
Moderation decisions and token usage.
Moderation request ID.
"modr-1594"
Model used for moderation.
"omni-moderation-latest"
Moderation decisions. For batch text input, this array contains one result per input string.
Token usage for the moderation request. Additional provider accounting fields can be present.