Moderation

Classify text (and, on supported models, images) for potentially harmful content before you display or store it.

POSThttps://onerouter.com/v1/moderations

Troubleshooting

Errors carry an HTTP status and a JSON error body. See Errors & Retries for the full list.

Model availability

Use a moderation-class model ID supported by the upstream (shown as <moderation-model-id> below); multimodal moderation models can also classify images. Moderation models are not listed on the website catalog — confirm the exact ID with your provider.

Overview

The Moderation endpoint is compatible with OpenAI's moderations API. It checks whether text (or, on multimodal models, images) violates common safety categories such as hate, harassment, self-harm, sexual content, and violence. Use it to screen user input before sending it to a model, or to filter generated output before showing it. Each result returns a flagged flag plus per-category booleans and confidence scores.

Request headers

ParameterTypeRequiredDescription
Authorizationstring · requiredrequiredBearer token, formatted as `Bearer YOUR_API_KEY`.
Content-Typestring · requiredrequiredMust be `application/json`.

Request body

ParameterTypeRequiredDescription
modelstringrequiredModeration model ID, e.g. an omni-moderation class model.
inputstring | arrayrequiredText to classify, or an array of text/image parts on multimodal moderation models.

The response

Each item in results has a flagged boolean, per-category booleans in categories, and confidence scores in category_scores (see the panel on the right). Treat flagged as the headline signal and the scores for finer thresholds.

Model-dependent features

OneRouter keeps protocol compatibility and forwards model-specific parameters where supported. Features such as tool calling, structured output, reasoning, prompt caching, web search, image input, audio input, video generation, and provider-specific options depend on the selected model and upstream provider. Check the model detail page before relying on a feature in production.