OpenAI Compatible
Create Moderation
Classifies if text and/or image inputs are potentially harmful. Learn more in the moderation guide.
POST
/
v1
/
moderations
Create Moderation
curl --request POST \
--url https://aihubmix.com/v1/moderations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "I want to kill them."
}
'import requests
url = "https://aihubmix.com/v1/moderations"
payload = { "input": "I want to kill them." }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"model": "<string>",
"results": [
{
"flagged": true,
"categories": {
"hate": true,
"hate/threatening": true,
"harassment": true,
"harassment/threatening": true,
"illicit": true,
"illicit/violent": true,
"self-harm": true,
"self-harm/intent": true,
"self-harm/instructions": true,
"sexual": true,
"sexual/minors": true,
"violence": true,
"violence/graphic": true
},
"category_scores": {
"hate": 123,
"hate/threatening": 123,
"harassment": 123,
"harassment/threatening": 123,
"illicit": 123,
"illicit/violent": 123,
"self-harm": 123,
"self-harm/intent": 123,
"self-harm/instructions": 123,
"sexual": 123,
"sexual/minors": 123,
"violence": 123,
"violence/graphic": 123
},
"category_applied_input_types": {
"hate": [
"text"
],
"hate/threatening": [
"text"
],
"harassment": [
"text"
],
"harassment/threatening": [
"text"
],
"illicit": [
"text"
],
"illicit/violent": [
"text"
],
"self-harm": [
"text"
],
"self-harm/intent": [
"text"
],
"self-harm/instructions": [
"text"
],
"sexual": [
"text"
],
"sexual/minors": [
"text"
],
"violence": [
"text"
],
"violence/graphic": [
"text"
]
}
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}授权
Gateway-issued API key, formatted as sk-gateway-xxxxxxxx.
Used by OpenAI-shaped endpoints (/v1/chat/completions, etc.).
请求体
application/json
Input (or inputs) to classify. Can be a single string, an array of strings, or an array of multi-modal input objects similar to other models.
示例:
"I want to kill them."
The content moderation model you would like to use. Learn more in the moderation guide, and learn about available models here.
示例:
"omni-moderation-2024-09-26"
⌘I
Create Moderation
curl --request POST \
--url https://aihubmix.com/v1/moderations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "I want to kill them."
}
'import requests
url = "https://aihubmix.com/v1/moderations"
payload = { "input": "I want to kill them." }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"model": "<string>",
"results": [
{
"flagged": true,
"categories": {
"hate": true,
"hate/threatening": true,
"harassment": true,
"harassment/threatening": true,
"illicit": true,
"illicit/violent": true,
"self-harm": true,
"self-harm/intent": true,
"self-harm/instructions": true,
"sexual": true,
"sexual/minors": true,
"violence": true,
"violence/graphic": true
},
"category_scores": {
"hate": 123,
"hate/threatening": 123,
"harassment": 123,
"harassment/threatening": 123,
"illicit": 123,
"illicit/violent": 123,
"self-harm": 123,
"self-harm/intent": 123,
"self-harm/instructions": 123,
"sexual": 123,
"sexual/minors": 123,
"violence": 123,
"violence/graphic": 123
},
"category_applied_input_types": {
"hate": [
"text"
],
"hate/threatening": [
"text"
],
"harassment": [
"text"
],
"harassment/threatening": [
"text"
],
"illicit": [
"text"
],
"illicit/violent": [
"text"
],
"self-harm": [
"text"
],
"self-harm/intent": [
"text"
],
"self-harm/instructions": [
"text"
],
"sexual": [
"text"
],
"sexual/minors": [
"text"
],
"violence": [
"text"
],
"violence/graphic": [
"text"
]
}
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}