Text moderation API

Moderate one text input and read classifications, scores, and billed usage.

Use an Official Group API key with omni-moderation-latest. Check availability on the model page.

Request

curl https://app.apipool.dev/v1/moderations \
  -H "Authorization: Bearer $APIPOOL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"omni-moderation-latest","input":"Text to check for moderation.","stream":false}'

input must be a nonempty string of at most 4,000 UTF-16 code units. Some emoji count as two units. Submit one plain-text input. Arrays, images, and streaming are unavailable. Omit stream or set it to false. Additional parameters are rejected.

Read the result

results[0].flagged indicates whether the input triggered a moderation category. categories gives each category's flag, category_scores provides category scores, and category_applied_input_types identifies the evaluated input types. Your application can choose its own policy thresholds.

usage.prompt_tokens is the billed input token count. completion_tokens is 0 and total_tokens equals the input count. The compatibility field input_tokens may report 0 even when billed usage exists. Incomplete or invalid responses and missing usage return an error without a charge based on estimated tokens.

Pricing and playground

The APIPool rate is US$0.17 per million input tokens. Check the model page for the active rate. Each request rounds up to the nearest US$0.000001. For example, 15 input tokens cost US$0.000003.

Choose your Official Group key in the playground and enter text to see classifications and usage. The playground uses the same rates. After a timeout, check your request history before trying again.