Text Moderation
Модерация текста
POST
https://gptunnel.ru/v1/moderations Синхронный запрос к модели text-moderation-latest.
Headers
| Параметр | Тип | Описание |
|---|---|---|
Authorization* | string | API ключ |
Request Body
| Параметр | Тип | Описание |
|---|---|---|
input* | string | Текст для модерации |
useWalletBalance | bool | Использовать личный счёт |
Пример запроса
import axios from 'axios'
const response = await axios({ method: 'POST', url: 'https://gptunnel.ru/v1/moderations', headers: { Authorization: 'YOUR_API_KEY', }, data: { input: 'Your text string goes here', },})
console.log(response.data)import requests
response = requests.post( 'https://gptunnel.ru/v1/moderations', headers={'Authorization': 'YOUR_API_KEY'}, json={'input': 'Your text string goes here'},)
print(response.json())curl -X POST https://gptunnel.ru/v1/moderations \ -H 'Authorization: YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{"input": "Your text string goes here"}'Пример ответа
{ "id": "modr-9b51yQZrBNIHDrIeX5bBcftbj5wgs", "model": "text-moderation-007", "results": [ { "flagged": false, "categories": { "sexual": false, "hate": false, "harassment": false, "self-harm": false, "sexual/minors": false, "hate/threatening": false, "violence/graphic": false, "self-harm/intent": false, "self-harm/instructions": false, "harassment/threatening": false, "violence": false }, "category_scores": { "sexual": 0.00009054, "hate": 0.00007182, "harassment": 0.00016347, "self-harm": 0.0000020744, "sexual/minors": 0.00001351, "hate/threatening": 0.0000010106, "violence/graphic": 0.00001040, "self-harm/intent": 0.0000004586, "self-harm/instructions": 0.0000003988, "harassment/threatening": 0.00002314, "violence": 0.00013958 } } ], "usage": { "prompt_tokens": 5, "completion_tokens": 0, "prompt_cost": 0.00005, "completion_cost": 0, "total_cost": 0.00005 }}Ошибки
{ "error": { "message": "The model 'gpt-5' does not exist", "type": "invalid_request_error", "param": null, "code": "model_not_found" }}{ "error": { "message": "Organization balance is too low to use API", "type": "insufficient_balance_error", "param": null, "code": null }}{ "error": { "message": "Unauthorized", "type": "unauthorized_request_error", "param": null, "code": null }}