Skip to content

Moderations

Check whether text (or multimodal content) violates usage policy. Uses the standard Moderations protocol format.

POST https://wrouter.ai/v1/moderations

Body

ParameterTypeRequiredNotes
inputstring | arrayA single string, or an array of strings / multimodal objects
modelstringe.g. omni-moderation-latest, text-moderation-stable; omit for gateway default

Response

json
{
  "id": "modr-xxx",
  "model": "omni-moderation-latest",
  "results": [
    {
      "flagged": true,
      "categories": {
        "hate": false,
        "harassment": true,
        "self-harm": false,
        "sexual": false,
        "violence": false,
        "...": false
      },
      "category_scores": {
        "harassment": 0.87,
        "...": 0.01
      }
    }
  ]
}

results is parallel to the input array.

Examples

bash
curl https://wrouter.ai/v1/moderations \
  -H "Authorization: Bearer $WROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input": "Text to be moderated"}'
python
from openai import OpenAI
client = OpenAI(api_key="sk-...", base_url="https://wrouter.ai/v1")
r = client.moderations.create(input="Text to be moderated")
if r.results[0].flagged:
    print("Violation:", r.results[0].categories)

When to use

  • Pre-screen user input before calling Chat Completions
  • Post-screen model output after the stream completes
  • Bulk UGC compliance as an assistive moderation tool

This endpoint only returns categories and scores. It does not auto-block; the decision is yours.