Aller au contenu principal

Modération

This page contains the endpoints related to content moderation.

Couverture Apifox

  • Create moderation requests

API de modèles / Modération

POST Create Moderation

POST /moderations

Classifies whether the input violates OpenAI content policies

Body Parameters

{
"model": "omni-moderation-latest",
"input": [
{ "type": "text", "text": "...text to classify goes here..." },
{
"type": "image_url",
"image_url": {
"url": "https://github.com/dianping/cat/raw/master/cat-home/src/main/webapp/images/logo/cat_logo03.png"
}
}
]
}

Request Parameters

NameInTypeRequiredDescription
AuthorizationheaderstringNonone
bodybodyobjectNonone
» inputbodystringYesInput text to classify.
» modelbodystringYesTwo moderation models are available: text-moderation-stable and text-moderation-latest. The default, text-moderation-latest, upgrades automatically over time so you always use the most accurate model. If you choose text-moderation-stable, you will receive advance notice before model updates. text-moderation-stable may be slightly less accurate than text-moderation-latest.

Response Example

200 Response

{
"id": "string",
"model": "string",
"results": [
{
"categories": {
"hate": true,
"hate/threatening": true,
"self-harm": true,
"sexual": true,
"sexual/minors": true,
"violence": true,
"violence/graphic": true
},
"category_scores": {
"hate": 0,
"hate/threatening": 0,
"self-harm": 0,
"sexual": 0,
"sexual/minors": 0,
"violence": 0,
"violence/graphic": 0
},
"flagged": true
}
]
}

Responses

StatusMeaningDescriptionModel
200OKnoneInline

Response Schema

Status 200

NameTypeRequiredConstraintsChinese NameDescription
» idstringtruenoneUnique identifier for the moderation request.
» modelstringtruenoneModel used for moderation.
» results[object]truenoneDetailed moderation results.
»» categoriesobjectfalsenoneAll category labels detected by the moderation model.
»»» hatebooleantruenoneWhether the moderation model detected hateful content.
»»» hatebooleantruenonenone
»»» self-harmbooleantruenoneWhether the moderation model detected self-harm content.
»»» sexualbooleantruenoneWhether the moderation model detected sexual content.
»»» sexualbooleantruenonenone
»»» violencebooleantruenoneWhether the moderation model detected violent content.
»»» violencebooleantruenonenone
»» category_scoresobjectfalsenoneScores produced by the moderation model for every category label.
»»» hatenumbertruenoneModeration-model score for hateful content.
»»» hatenumbertruenonenone
»»» self-harmnumbertruenoneModeration-model score for self-harm content.
»»» sexualnumbertruenoneModeration-model score for sexual content.
»»» sexualnumbertruenonenone
»»» violencenumbertruenoneModeration-model score for violent content.
»»» violencenumbertruenonenone
»» flaggedbooleanfalsenoneWhether the moderation model flagged the input as suspicious content.