Moderations
Classifies text/images against safety policies for content moderation, returning category flags and confidence scores.
RequestREQUEST
POST
https://test.kailin.com.cn/v1/moderationsResponseRESPONSE
Fill in the request and hit Send — the response shows up here
Request
curl https://test.kailin.com.cn/v1/moderations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-token" \
-d '{
"model": "omni-moderation-latest",
"input": "text to review"
}'
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | No | Defaults to omni-moderation-latest, supports multimodal input |
input | string / array | Yes | Text to review; for multimodal, pass a content array |
Multimodal input (text + image):
{
"model": "omni-moderation-latest",
"input": [
{ "type": "moderation_text", "text": "some text" },
{ "type": "moderation_image", "image_url": "https://example.com/img.jpg" }
]
}
Response
{
"id": "modr-abc123",
"model": "omni-moderation-latest",
"results": [
{
"flagged": false,
"categories": {
"harassment": false,
"hate": false,
"sexual": false,
"violence": false
},
"category_scores": {
"harassment": 0.0001,
"hate": 0.0001,
"sexual": 0.0002,
"violence": 0.0003
}
}
]
}
| Field | Description |
|---|---|
results[].flagged | Whether the content hit a policy |
results[].categories | Boolean results per category (more categories exist, e.g. harassment_threatening, self-harm) |
results[].category_scores | Confidence 0–1 per category |
Typical Usage
def check(text: str) -> bool:
resp = client.moderations.create(model="omni-moderation-latest", input=text)
return resp.results[0].flagged # True means the content should be blocked
note
Moderation is free or low-cost (depends on the channel). Call it on both user input and model output for two-way safety.