POST /v1/moderations and NagaAI returns a verdict per input: whether any category tripped, and a score for each category. Use it to screen user messages before they reach a chat model, or model output before it reaches a user. The endpoint follows the OpenAI Moderations format, and the OpenAI SDK works unchanged. Choose a model whose operations include moderation in GET /v1/models.
Check a message
results has flagged, categories and category_scores. The response below is shortened to two categories:
Check text and images together
model is required. input is a string, a list of strings, or a list of text and image_url parts. Parts in one list are judged together as a single input. An image is an https URL or a data: URI.
omni-moderation-latest also returns category_applied_input_types, which says whether text, an image or both triggered each category. Other models, such as mistral-moderation, have their own category set, so read categories from the response instead of hard-coding names.
Billing
NagaAI charges eachimage_url part as a flat 250 input tokens, and text by its token count. The response carries no usage field, so read the charge in your activity log. See Balance, metrics and logs.
Troubleshooting
400 model_not_found
The model does not exist or has no moderation operation. Check its operations in GET /v1/models.
400 with Failed to read the file or Failed to validate the image
NagaAI downloads each image URL before it moderates, and the download failed or the file is not an image. Check that the URL is public and loads in a browser, or send the image as a data: URI.