POST
/v1/moderationsModerations
Classify text against safety policies. This endpoint is free (it meters at $0), so you can run it inline before or after a chat call without worrying about cost. For automatic screening on chat itself, use the moderation parameter on /v1/chat/completions instead of calling this directly.
Request
- HTTP
- POST
- URL
- /v1/moderations
- Auth
- api_key, client_token
Try it
curl https://api.fightclub.pro/v1/moderations \
-H "Authorization: Bearer $FC_API_KEY" -H "Content-Type: application/json" \
-d '{"input":"is this safe?"}'
# => { "id":"modr_...", "model":"omni-moderation-latest",
# "results":[{"flagged":false,"categories":{...},"category_scores":{...}}] }Example response
{
"id": "modr_3aB",
"model": "omni-moderation-latest",
"results": [
{
"flagged": false,
"categories": { "hate": false, "violence": false, "sexual": false, "self-harm": false },
"category_scores": { "hate": 0.0001, "violence": 0.0003, "sexual": 0.0, "self-harm": 0.0001 }
}
]
}A representative 200 body. Ids and timestamps are illustrative.
Body parameters
| Name | Type | Default | Description |
|---|---|---|---|
| input* | string | string[] | — | One string, or an array of strings to classify. Each is scored independently. |
| model | string | omni-moderation-latest | Moderation model. Pass another to override the default. |
| user | string | optional | Opaque end-user id passed through to the provider. |
* required.
Response fields
| Name | Type | Description |
|---|---|---|
| id | string | Moderation request id. |
| model | string | The moderation model that ran. |
| results | array | One per input: { flagged, categories, category_scores }. categories are booleans (e.g. hate, violence, sexual); category_scores are 0-1 confidences. |
Errors
- 401
missing_tokenNo Authorization header was sent. - 401
invalid_auth_schemeThe scheme was neither Bearer nor Client. - 401
invalid_token_formatA Bearer token not prefixed ko_. - 401
invalid_tokenThe API key is unknown, revoked or expired. - 403
insufficient_scopeThe key is valid but lacks the required scope. - 400
invalid_jsonBody is not valid JSON. - 400
missing_inputinput is absent.
See the full error reference.
Notes
- ·Moderation calls cost $0 and do not draw down your wallet.
- ·flagged is the overall verdict; branch on it. category_scores give you per-category confidences if you want a stricter or looser custom threshold.