Image moderation
This page documents the image moderation endpoint in models-model.md style: overview, auth, params table, request examples, response example.
Overview
- Method:
POST - Path:
/v1/moderations - Content-Type:
application/json
Authentication
- Use HTTP Bearer Token, e.g.
Authorization: Bearer sk-xxxxx
Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | yes | Image moderation model, e.g. gi-image-moderation |
| input | <object> | yes | Input list. Each item should be { type: 'image_url', image_url: { url: '...' } }. url can be an image URL or a base64 string |
Example structure:
json
{
"model": "gi-image-moderation",
"input": [
{ "type": "image_url", "image_url": { "url": "https://oss.chats.li/1744473372484_8815.png" } }
]
}Request examples
curl
bash
curl -X POST "https://api.gpt.ge/v1/moderations" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxx" \
-d '{"model":"gi-image-moderation","input":[{"type":"image_url","image_url":{"url":"https://oss.chats.li/1744473372484_8815.png"}}]}'JavaScript (fetch)
javascript
fetch('https://api.gpt.ge/v1/moderations', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer sk-xxxx' },
body: JSON.stringify({ model: 'gi-image-moderation', input: [{ type: 'image_url', image_url: { url: 'https://oss.chats.li/1744473372484_8815.png' } }] })
}).then(r => r.json()).then(console.log)Python (requests)
python
import requests
payload = {
'model': 'gi-image-moderation',
'input': [{ 'type': 'image_url', 'image_url': { 'url': 'https://oss.chats.li/1744473372484_8815.png' } }]
}
resp = requests.post('https://api.gpt.ge/v1/moderations', headers={'Content-Type':'application/json','Authorization':'Bearer sk-xxxx'}, json=payload)
print(resp.json())Response example (200)
json
{
"id": "abfc99e9-392e-44e3-aedd-e63f33079491",
"model": "nsfw-classifier",
"results": [
{
"flagged": false,
"categories": {
"neutral": false,
"drawings": true,
"sexy": false,
"hentai": false,
"porn": false
},
"category_scores": {
"neutral": 0.22734691202640533,
"drawings": 0.9943661689758301,
"sexy": 0.12325877696275711,
"hentai": 0.2198520451784134,
"porn": 0.05567243695259094
}
}
]
}