> ## Documentation Index
> Fetch the complete documentation index at: https://docs.naga.ac/llms.txt
> Use this file to discover all available pages before exploring further.

# Moderations API

> Classify text and image inputs against moderation categories and scores.

Use the `Moderations API` when you need to classify text, images, or mixed typed inputs for safety-related workflows.

This API helps you decide whether content should be allowed, blocked, reviewed, or routed differently before later steps in your product.

## When To Use It

* screening user-generated text before model inference
* classifying uploaded images
* combining text and image checks in a single request
* building policy, trust, and abuse-prevention workflows

## Request Model

Requests center on two fields:

* `model`
* `input`

`input` supports:

* a single string
* an array of strings
* an array of typed objects such as `{ "type": "text" }` and `{ "type": "image_url" }`

## Quick Example

<CodeGroup>
  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="https://api.naga.ac/v1",
      api_key="YOUR_API_KEY",
  )

  result = client.moderations.create(
      model="omni-moderation-latest",
      input="I want to hurt someone.",
  )

  print(result.results[0].flagged)
  ```

  ```javascript Node.js theme={null}
  import OpenAI from 'openai';

  const client = new OpenAI({
    baseURL: 'https://api.naga.ac/v1',
    apiKey: 'YOUR_API_KEY',
  });

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

  console.log(result.results[0].flagged);
  ```

  ```bash cURL theme={null}
  curl https://api.naga.ac/v1/moderations \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "omni-moderation-latest",
      "input": "I want to hurt someone."
    }'
  ```
</CodeGroup>

## Response Anatomy

```json theme={null}
{
  "id": "mdr_123",
  "model": "omni-moderation-latest",
  "results": [
    {
      "flagged": true,
      "categories": {
        "violence": true
      },
      "category_scores": {
        "violence": 0.98
      }
    }
  ]
}
```

## How to use the result

* use `flagged` for a quick allow-or-review gate
* inspect `categories` when you need policy-specific handling
* inspect `category_scores` when you want thresholds or human-review logic

## What To Learn Next

* [Text Moderation](/api/moderations/text-moderation)
* [Image Moderation](/api/moderations/image-moderation)
* [Mixed Inputs](/api/moderations/mixed-inputs)

## Reference

* [Create moderation](/api-reference/endpoints/moderations/create)
