text-moderation
Отправить синхронный запрос используя модель text-moderation-007
Чтобы отправлять авторизованные запросы нужно получить API ключ, как это сделать написано в разделе С чего начать?
Модерация текста
POST
https://gptunnel.ru/v1/moderations
Синхронный запрос к модели text-moderation-007
Headers
Name | Type | Description |
---|---|---|
Authorization* | string | API ключ |
Request Body
Name | Type | Description |
---|---|---|
input* | string | Контент |
useWalletBalance | bool | Использовать личный счет |
{
"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.00009054947440745309,
"hate": 0.00007182655826909468,
"harassment": 0.00016347762721125036,
"self-harm": 0.0000020744676021422492,
"sexual/minors": 0.000013518638297682628,
"hate/threatening": 0.0000010106600711878855,
"violence/graphic": 0.00001040412189468043,
"self-harm/intent": 4.586087243296788e-7,
"self-harm/instructions": 3.98835481973947e-7,
"harassment/threatening": 0.000023142851205193438,
"violence": 0.00013958947965875268
}
}
],
"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,
}
}
Пример запроса
import axios from 'axios'
const request = axios({
method: 'POST',
url: 'https://gptunnel.ru/v1/moderations',
headers: {
// use your API key here
Authorization: 'YOUR_API_KEY',
},
data: {
input: "Your text string goes here",
},
})
request.then((result) => {
console.log(result)
}).catch((error) => {
console.error(error)
})
curl --request POST \
--url https://gptunnel.ru/v1/moderations \
--header 'Authorization: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"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.00009054947440745309,
"hate": 0.00007182655826909468,
"harassment": 0.00016347762721125036,
"self-harm": 0.0000020744676021422492,
"sexual/minors": 0.000013518638297682628,
"hate/threatening": 0.0000010106600711878855,
"violence/graphic": 0.00001040412189468043,
"self-harm/intent": 4.586087243296788e-7,
"self-harm/instructions": 3.98835481973947e-7,
"harassment/threatening": 0.000023142851205193438,
"violence": 0.00013958947965875268
}
}
],
"usage": {
"prompt_tokens": 5,
"completion_tokens": 0,
"prompt_cost": 0.00005,
"completion_cost": 0,
"total_cost": 0.00005
}
}
Last updated