> ## 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.

# Text Moderation

> Classify text inputs for moderation decisions.

Use this when you want to screen text before generation, storage, publishing, or user display.

The simplest moderation request sends a plain string, but typed text input is a better habit if you may later mix text with images.

## Simple 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>

## Typed Example

```json theme={null}
{
  "model": "omni-moderation-latest",
  "input": [
    { "type": "text", "text": "I want to hurt someone." }
  ]
}
```

Typed inputs are a better habit when you may later mix text and images in one request.

## Common uses

* checking user prompts before sending them to a generation model
* screening chat messages, comments, or forum posts
* flagging risky text for review instead of hard-blocking it immediately

## Common mistakes

* treating moderation as a perfect binary truth signal instead of a policy input
* hard-coding only one category when your policy may evolve later
* using plain strings everywhere when your pipeline may later need mixed typed inputs
