POST /v1/moderations
Classify text or image URLs for policy compliance.
- Method: POST
- Path: /v1/moderations
- Auth: Bearer token in Authorizationheader
- Content-Type: application/json
Request Parameters
- model(string, required): Moderation model (e.g.,- omni-moderation-latest).
- input(required): One of:- string (single text)
- string[] (multiple texts)
- array of objects mixing:
- Text input: { "type": "text", "text": "..." }
- Image URL input: { "type": "image_url", "image_url": { "url": "https://..." } }
 
- Text input: 
 
Example Request
- Python
- Node.js
- cURL
from openai import OpenAI
client = OpenAI(base_url="https://api.naga.ac/v1", api_key="YOUR_API_KEY")
# Single text
resp = client.moderations.create(
    model="omni-moderation-latest",
    input="Hello! Nice to meet you!"
)
print(resp)
# Mixed inputs (text + image URL)
resp2 = client.moderations.create(
    model="omni-moderation-latest",
    input=[
        {"type": "text", "text": "This is a test."},
        {"type": "image_url", "image_url": {"url": "https://yavuzceliker.github.io/sample-images/image-1021.jpg"}},
    ],
)
print(resp2)
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.naga.ac/v1", apiKey: "YOUR_API_KEY" });
// Single text
const resp = await client.moderations.create({
  model: "omni-moderation-latest",
  input: "Hello! Nice to meet you!",
});
console.log(resp);
// Mixed inputs (text + image URL)
const resp2 = await client.moderations.create({
  model: "omni-moderation-latest",
  input: [
    { type: "text", text: "This is a test." },
    { type: "image_url", image_url: { url: "https://yavuzceliker.github.io/sample-images/image-1021.jpg" } },
  ],
});
console.log(resp2);
# Single text
curl https://api.naga.ac/v1/moderations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "omni-moderation-latest",
    "input": "Hello! Nice to meet you!"
  }'
# Mixed inputs (text + image URL)
curl https://api.naga.ac/v1/moderations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "omni-moderation-latest",
    "input": [
      { "type": "text", "text": "This is a test." },
      { "type": "image_url", "image_url": { "url": "https://yavuzceliker.github.io/sample-images/image-1021.jpg" } }
    ]
  }'
Authentication
Provide your key as a Bearer token:
Authorization: Bearer YOUR_API_KEY
Response
Returns a moderation result compatible with OpenAI's moderation API, typically including categories and scores per input.
Response Fields
- id(string): Unique request identifier
- model(string): Model used for moderation
- results(array): Array of moderation results per input- flagged(boolean): Whether the content was flagged
- categories(object): Boolean flags for each category
- category_scores(object): Confidence scores (0-1) for each category
- category_applied_input_types(object): Which input types were checked for each category