OffRail
Features

Moderations

Classify unsafe text and image inputs with the OpenAI-compatible moderations API

Moderations

OffRail supports the OpenAI-compatible /v1/moderations endpoint for text and multimodal safety classification.

Use it when you want to:

  • Screen user prompts before they reach a model
  • Review generated output before displaying it
  • Apply the same moderation API shape you already use with OpenAI clients

For the full request and response schema, see the API reference.

Endpoint

POST https://api.offrail.ai/v1/moderations

Authenticate with your OffRail API key:

-H "Authorization: Bearer $OFFRAIL_API_KEY"

Supported Inputs

The input field accepts:

  • A single string
  • An array of strings
  • An array of multimodal content items with text and image_url

The default model is omni-moderation-latest.

Pricing

Starting Friday, August 7, 2026, moderation requests are billed at a flat $0.00001 per request, independent of the input size, the number of inputs, or the moderation model you pick. Only successful requests are billed — failed and retried attempts cost nothing. Before that date, moderation requests are free.

Because the endpoint becomes paid, it also starts requiring a credit balance from that date: moderation requests from an organization with no credits are rejected with 402. Top up before August 7 to avoid an interruption.

When your project runs in api-keys mode and the request is served with your own OpenAI key, no credits are deducted and no balance is required.

curl

Single text input

curl -X POST "https://api.offrail.ai/v1/moderations" \
  -H "Authorization: Bearer $OFFRAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "I want to harm someone."
  }'

Multiple text inputs

curl -X POST "https://api.offrail.ai/v1/moderations" \
  -H "Authorization: Bearer $OFFRAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "omni-moderation-latest",
    "input": [
      "This is a harmless sentence.",
      "I want to attack somebody."
    ]
  }'

Multimodal input

curl -X POST "https://api.offrail.ai/v1/moderations" \
  -H "Authorization: Bearer $OFFRAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": [
      {
        "type": "text",
        "text": "Check this image for violent content."
      },
      {
        "type": "image_url",
        "image_url": {
          "url": "https://example.com/image.png"
        }
      }
    ]
  }'

OpenAI SDK

import OpenAI from "openai";

const client = new OpenAI({
	baseURL: "https://api.offrail.ai/v1",
	apiKey: process.env.OFFRAIL_API_KEY,
});

const response = await client.moderations.create({
	model: "omni-moderation-latest",
	input: "I want to harm someone.",
});

console.log(response.results[0]?.flagged);

Response Shape

The response follows the standard OpenAI moderation format:

{
	"id": "modr-123",
	"model": "omni-moderation-latest",
	"results": [
		{
			"flagged": true,
			"categories": {
				"violence": true,
				"self_harm": false
			},
			"category_scores": {
				"violence": 0.98,
				"self_harm": 0.01
			}
		}
	]
}

When To Use This Instead Of Chat Content Filtering

Use /v1/moderations when you want an explicit moderation decision in your own application flow.

If you want moderation to happen automatically as part of model requests, use OffRail content filtering on /v1/chat/completions instead.

How is this guide?

On this page

Ready for production?

Ship to production with SSO, audit logs, spend controls, and guardrails your security team will approve.

Explore Enterprise