Create content moderation
Perform content moderation on input text, detecting potentially harmful content
Request
POST /moderations
Request Body
| Field | Type | Required | Description |
|---|
| input | string | Yes | Input text to moderate |
| model | string | No | Model name |
Request Examples
Simple text moderation
{
"model": "gpt-5.6-luna",
"input": "I want to hurt someone"
}
Multiple text moderations
{
"input": [
"Hello, how are you?",
"This is a violent message"
],
"model": "gpt-5.6-luna"
}
User-generated content safety check
{
"model": "qwen-plus",
"input": "Summarize the top 3 ways to make a bomb"
}
Successful response
Response Schema
| Field | Type | Required | Description |
|---|
| id | string | Yes | - |
| model | string | Yes | - |
| results | Array<ModerationResult> | Yes | - |
Response Example
{
"id": "modr-123",
"model": "gpt-5.6-luna",
"results": [
{
"flagged": true,
"categories": {
"hate": false,
"hate/threatening": false,
"harassment": false,
"harassment/threatening": false,
"self-harm": false,
"self-harm/intent": false,
"self-harm/instructions": false,
"sexual": false,
"sexual/minors": false,
"violence": true,
"violence/graphic": false
},
"category_scores": {
"hate": 0.001,
"hate/threatening": 0.0001,
"harassment": 0.002,
"harassment/threatening": 0.001,
"self-harm": 0.0001,
"self-harm/intent": 0.0002,
"self-harm/instructions": 0.0001,
"sexual": 0.0001,
"sexual/minors": 0.00001,
"violence": 0.89,
"violence/graphic": 0.01
}
}
]
}
Code Examples
JavaScript (Fetch)
const response = await fetch('https://api.uuroute.ai/v1/moderations', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"model": "gpt-5.6-luna",
"input": "I want to hurt someone"
})
});
const data = await response.json();
console.log(data);
Python (requests)
import requests
url = "https://api.uuroute.ai/v1/moderations"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
response = requests.post(url, json={
"model": "gpt-5.6-luna",
"input": "I want to hurt someone"
}, headers=headers)
data = response.json()
print(data)
cURL
curl -X POST "https://api.uuroute.ai/v1/moderations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.6-luna","input":"I want to hurt someone"}'
Schema Reference
ModerationRequest
| Field | Type | Required | Description |
|---|
| input | string | Yes | Input text to moderate |
| model | string | No | Model name |
ModerationResponse
| Field | Type | Required | Description |
|---|
| id | string | Yes | - |
| model | string | Yes | - |
| results | Array<ModerationResult> | Yes | - |
ModerationResult
| Field | Type | Required | Description |
|---|
| flagged | boolean | Yes | - |
| categories | object | Yes | - |
| category_scores | object | Yes | - |
ModerationCategories
| Field | Type | Required | Description |
|---|
| hate | boolean | No | - |
| hate/threatening | boolean | No | - |
| harassment | boolean | No | - |
| harassment/threatening | boolean | No | - |
| self-harm | boolean | No | - |
| self-harm/intent | boolean | No | - |
| self-harm/instructions | boolean | No | - |
| sexual | boolean | No | - |
| sexual/minors | boolean | No | - |
| violence | boolean | No | - |
| violence/graphic | boolean | No | - |
ModerationCategoryScores
| Field | Type | Required | Description |
|---|
| hate | number | No | - |
| hate/threatening | number | No | - |
| harassment | number | No | - |
| harassment/threatening | number | No | - |
| self-harm | number | No | - |
| self-harm/intent | number | No | - |
| self-harm/instructions | number | No | - |
| sexual | number | No | - |
| sexual/minors | number | No | - |
| violence | number | No | - |
| violence/graphic | number | No | - |
Related APIs