myt AI Cloud

By Mauritius Telecom

Beta
⌘K
Core features

Content moderation

Classify text against safety categories using the moderations endpoint.

POST

/v1/moderations

Classifies input text against a set of policy categories and returns per-category scores and a top-level flagged boolean.

Request body

FieldTypeRequiredNotes
inputstring or arrayYesText to classify. Pass an array to classify multiple strings in one call.
modelstringNoA safety/moderation model id from your catalog, e.g. Nemotron-3.5-Content-Safety.

Example request

{
  "model": "Nemotron-3.5-Content-Safety",
  "input": "I want to learn how to make sourdough bread."
}

Batch request

{
  "model": "Nemotron-3.5-Content-Safety",
  "input": [
    "I want to learn how to make sourdough bread.",
    "How do I pick a lock?"
  ]
}

Response

{
  "id": "modr-abc123",
  "model": "Nemotron-3.5-Content-Safety",
  "results": [
    {
      "flagged": false,
      "categories": {
        "hate": false,
        "hate/threatening": false,
        "harassment": false,
        "harassment/threatening": false,
        "self-harm": false,
        "self-harm/intent": false,
        "self-harm/instructions": false,
        "sexual": false,
        "sexual/minors": false,
        "violence": false,
        "violence/graphic": false
      },
      "category_scores": {
        "hate": 0.000012,
        "hate/threatening": 0.000001,
        "harassment": 0.000034,
        "harassment/threatening": 0.000002,
        "self-harm": 0.000001,
        "self-harm/intent": 0.000001,
        "self-harm/instructions": 0.000001,
        "sexual": 0.000005,
        "sexual/minors": 0.000001,
        "violence": 0.000021,
        "violence/graphic": 0.000003
      }
    }
  ]
}

flagged: true means at least one category exceeded the model's threshold. Use category_scores for custom thresholds in your application.

Errors

StatusWhen
400Input missing or empty
401API key missing or invalid
429Rate limit or budget exceeded

Code examples

curl -sS --request "POST" \
  --url "$MYT_BASE_URL/moderations" \
  --header "Authorization: Bearer $MYT_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{"model":"Nemotron-3.5-Content-Safety","input":"Hello world"}'

Full parameter reference: Moderations.

On this page