Skip to main content
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

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)

Typed Example

{
  "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