Skip to main content

Moderations

POST /v1/moderations

Classifies text/images against safety policies for content moderation, returning category flags and confidence scores.

RequestREQUEST
POSThttps://test.kailin.com.cn/v1/moderations
ResponseRESPONSE
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​

ParameterTypeRequiredDescription
modelstringNoDefaults to omni-moderation-latest, supports multimodal input
inputstring / arrayYesText 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
}
}
]
}
FieldDescription
results[].flaggedWhether the content hit a policy
results[].categoriesBoolean results per category (more categories exist, e.g. harassment_threatening, self-harm)
results[].category_scoresConfidence 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.