메인 콘텐츠로 건너뛰기
POST
/
v1
/
moderations
curl https://api.cometapi.com/v1/moderations \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $COMETAPI_KEY" \
  -d '{
  "model": "omni-moderation-latest",
  "input": "I want to bake cookies for my family."
}'
{
  "id": "modr-1594",
  "model": "omni-moderation-latest",
  "results": [
    {
      "flagged": false,
      "categories": {
        "harassment": false,
        "harassment/threatening": false,
        "hate": false,
        "hate/threatening": false,
        "illicit": false,
        "illicit/violent": false,
        "self-harm": false,
        "self-harm/intent": false,
        "self-harm/instructions": false,
        "sexual": false,
        "sexual/minors": false,
        "violence": false,
        "violence/graphic": false
      },
      "category_scores": {
        "harassment": 0.0001,
        "harassment/threatening": 0.0001,
        "hate": 0.0001,
        "hate/threatening": 0.0001,
        "illicit": 0.0001,
        "illicit/violent": 0.0001,
        "self-harm": 0.0001,
        "self-harm/intent": 0.0001,
        "self-harm/instructions": 0.0001,
        "sexual": 0.0001,
        "sexual/minors": 0.0001,
        "violence": 0.0001,
        "violence/graphic": 0.0001
      },
      "category_applied_input_types": {
        "harassment": [
          "text"
        ],
        "harassment/threatening": [
          "text"
        ],
        "hate": [
          "text"
        ],
        "hate/threatening": [
          "text"
        ],
        "illicit": [
          "text"
        ],
        "illicit/violent": [
          "text"
        ],
        "self-harm": [
          "text"
        ],
        "self-harm/intent": [
          "text"
        ],
        "self-harm/instructions": [
          "text"
        ],
        "sexual": [
          "text"
        ],
        "sexual/minors": [
          "text"
        ],
        "violence": [
          "text"
        ],
        "violence/graphic": [
          "text"
        ]
      }
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 0,
    "total_tokens": 12,
    "input_tokens": 12,
    "output_tokens": 0,
    "prompt_tokens_details": {
      "cached_tokens": 0
    },
    "completion_tokens_details": {
      "reasoning_tokens": 0
    },
    "input_tokens_details": null,
    "claude_cache_creation_1_h_tokens": 0,
    "claude_cache_creation_5_m_tokens": 0
  }
}
이 엔드포인트를 사용하여 사용자가 생성한 콘텐츠를 모델 엔드포인트로 보내기 전에 확인합니다. modelinput 값을 포함한 OpenAI 호환 모더레이션 요청을 보냅니다.
Bearer 헤더에 CometAPI API 키를 사용하세요: Authorization: Bearer $COMETAPI_KEY.

요청 본문

FieldTypeRequiredDescription
inputstring or arrayYes확인할 콘텐츠입니다. 하나의 텍스트 입력에는 문자열을 사용하고, 여러 텍스트를 일괄 확인할 때는 문자열 배열을 사용하며, 텍스트와 image_url 같은 OpenAI 스타일의 멀티모달 파트를 사용할 수도 있습니다.
modelstringYes모더레이션 model ID입니다. 특정 모더레이션 model 요구 사항이 없는 한 텍스트 및 이미지 모더레이션에는 omni-moderation-latest를 사용하세요.
멀티모달 모더레이션의 경우, 이를 지원하는 model, 예를 들어 omni-moderation-latest를 사용하여 OpenAI 스타일의 멀티모달 입력을 보내세요. 공개 이미지 URL은 CometAPI 서버가 다운로드할 수 있어야 합니다. 이미지를 직접 복사해 테스트하려면 base64 data URL을 사용하세요.

요청 예시

텍스트 입력 하나만 분류하면 될 때는 단일 텍스트 문자열을 보내세요:
curl https://api.cometapi.com/v1/moderations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $COMETAPI_KEY" \
  -d '{
    "model": "omni-moderation-latest",
    "input": "I want to bake cookies for my family."
  }'
한 번의 요청으로 여러 텍스트 입력을 확인하려면 문자열 배열을 보내세요:
curl https://api.cometapi.com/v1/moderations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $COMETAPI_KEY" \
  -d '{
    "model": "omni-moderation-latest",
    "input": [
      "I want to bake cookies.",
      "I want to kill someone."
    ]
  }'
모더레이션 입력에 CometAPI가 다운로드할 수 있는 이미지가 포함되어 있다면 텍스트와 이미지 URL을 함께 보내세요:
curl https://api.cometapi.com/v1/moderations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $COMETAPI_KEY" \
  -d '{
    "model": "omni-moderation-latest",
    "input": [
      { "type": "text", "text": "...text to classify goes here..." },
      {
        "type": "image_url",
        "image_url": {
          "url": "https://www.gstatic.com/webp/gallery/1.png"
        }
      }
    ]
  }'
자체 포함형 이미지 요청이 필요할 때는 base64 data URL을 사용하세요:
curl https://api.cometapi.com/v1/moderations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $COMETAPI_KEY" \
  -d '{
    "model": "omni-moderation-latest",
    "input": [
      { "type": "text", "text": "...text to classify goes here..." },
      {
        "type": "image_url",
        "image_url": {
          "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAADElEQVR4nGP4//8/AAX+Av4N70a4AAAAAElFTkSuQmCC"
        }
      }
    ]
  }'

응답 형태

응답에는 id, model, results, usage가 포함됩니다. results의 각 항목은 일치하는 입력이 플래그되었는지 여부, 카테고리 불리언 값, 카테고리 점수, 그리고 각 카테고리에 적용된 입력 유형을 보고합니다. 배치 텍스트 요청의 경우 results에는 입력 문자열마다 하나의 항목이 포함됩니다. 청구 및 모니터링 필드에는 usage를 사용하세요.

인증

Authorization
string
header
필수

CometAPI API key used for model requests. Send it as Authorization: Bearer $COMETAPI_KEY.

본문

application/json
model
string
필수

Required moderation model ID. Use omni-moderation-latest for text and image moderation unless you have a specific moderation model requirement.

예시:

"omni-moderation-latest"

input
필수

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.

id
string
필수

Moderation request ID.

예시:

"modr-1594"

model
string
필수

Model used for moderation.

예시:

"omni-moderation-latest"

results
object[]
필수

Moderation decisions. For batch text input, this array contains one result per input string.

usage
object
필수

Token usage for the moderation request. Additional provider accounting fields can be present.