Модерация
This page contains the endpoints related to content moderation.
Охват Apifox
- Create moderation requests
API моделей / Модерация
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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | No | none |
| body | body | object | No | none |
| » input | body | string | Yes | Input text to classify. |
| » model | body | string | Yes | Two 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
| Status | Meaning | Description | Model |
|---|---|---|---|
| 200 | OK | none | Inline |
Response Schema
Status 200
| Name | Type | Required | Constraints | Chinese Name | Description |
|---|---|---|---|---|---|
| » id | string | true | none | Unique identifier for the moderation request. | |
| » model | string | true | none | Model used for moderation. | |
| » results | [object] | true | none | Detailed moderation results. | |
| »» categories | object | false | none | All category labels detected by the moderation model. | |
| »»» hate | boolean | true | none | Whether the moderation model detected hateful content. | |
| »»» hate | boolean | true | none | none | |
| »»» self-harm | boolean | true | none | Whether the moderation model detected self-harm content. | |
| »»» sexual | boolean | true | none | Whether the moderation model detected sexual content. | |
| »»» sexual | boolean | true | none | none | |
| »»» violence | boolean | true | none | Whether the moderation model detected violent content. | |
| »»» violence | boolean | true | none | none | |
| »» category_scores | object | false | none | Scores produced by the moderation model for every category label. | |
| »»» hate | number | true | none | Moderation-model score for hateful content. | |
| »»» hate | number | true | none | none | |
| »»» self-harm | number | true | none | Moderation-model score for self-harm content. | |
| »»» sexual | number | true | none | Moderation-model score for sexual content. | |
| »»» sexual | number | true | none | none | |
| »»» violence | number | true | none | Moderation-model score for violent content. | |
| »»» violence | number | true | none | none | |
| »» flagged | boolean | false | none | Whether the moderation model flagged the input as suspicious content. |