curl --request POST \
--url https://polza.ai/api/v1/systemone \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"state": {
"message": "Помогите! Выплаты не проходят уже 3 дня.",
"order_id": "A-104"
},
"model": "jev-latest",
"questions": {
"is_urgent": {
"type": "noul",
"instructions": "Does this convey urgency?"
},
"department": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Payments, refunds",
"technical": "Bugs, outages"
}
},
"frustration": {
"type": "score",
"instructions": "How frustrated is the customer?",
"criteria": [
"Calm",
"Angry"
]
}
},
"provider": {
"require_parameters": true,
"allow_fallbacks": true,
"order": [
"OpenAI",
"Anthropic"
],
"only": [
"OpenAI",
"Google"
],
"ignore": [
"DeepInfra"
],
"sort": "price",
"max_price": {
"prompt": 10,
"completion": 20,
"image": 5,
"audio": 15,
"request": 1,
"video_per_second": 50,
"stt_per_minute": 5,
"tts_per_million_characters": 1500
}
}
}
'import requests
url = "https://polza.ai/api/v1/systemone"
payload = {
"state": {
"message": "Помогите! Выплаты не проходят уже 3 дня.",
"order_id": "A-104"
},
"model": "jev-latest",
"questions": {
"is_urgent": {
"type": "noul",
"instructions": "Does this convey urgency?"
},
"department": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Payments, refunds",
"technical": "Bugs, outages"
}
},
"frustration": {
"type": "score",
"instructions": "How frustrated is the customer?",
"criteria": ["Calm", "Angry"]
}
},
"provider": {
"require_parameters": True,
"allow_fallbacks": True,
"order": ["OpenAI", "Anthropic"],
"only": ["OpenAI", "Google"],
"ignore": ["DeepInfra"],
"sort": "price",
"max_price": {
"prompt": 10,
"completion": 20,
"image": 5,
"audio": 15,
"request": 1,
"video_per_second": 50,
"stt_per_minute": 5,
"tts_per_million_characters": 1500
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
state: {message: 'Помогите! Выплаты не проходят уже 3 дня.', order_id: 'A-104'},
model: 'jev-latest',
questions: {
is_urgent: {type: 'noul', instructions: 'Does this convey urgency?'},
department: {
type: 'choice',
instructions: 'Which team should handle this?',
criteria: {billing: 'Payments, refunds', technical: 'Bugs, outages'}
},
frustration: {
type: 'score',
instructions: 'How frustrated is the customer?',
criteria: ['Calm', 'Angry']
}
},
provider: {
require_parameters: true,
allow_fallbacks: true,
order: ['OpenAI', 'Anthropic'],
only: ['OpenAI', 'Google'],
ignore: ['DeepInfra'],
sort: 'price',
max_price: {
prompt: 10,
completion: 20,
image: 5,
audio: 15,
request: 1,
video_per_second: 50,
stt_per_minute: 5,
tts_per_million_characters: 1500
}
}
})
};
fetch('https://polza.ai/api/v1/systemone', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://polza.ai/api/v1/systemone",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'state' => [
'message' => 'Помогите! Выплаты не проходят уже 3 дня.',
'order_id' => 'A-104'
],
'model' => 'jev-latest',
'questions' => [
'is_urgent' => [
'type' => 'noul',
'instructions' => 'Does this convey urgency?'
],
'department' => [
'type' => 'choice',
'instructions' => 'Which team should handle this?',
'criteria' => [
'billing' => 'Payments, refunds',
'technical' => 'Bugs, outages'
]
],
'frustration' => [
'type' => 'score',
'instructions' => 'How frustrated is the customer?',
'criteria' => [
'Calm',
'Angry'
]
]
],
'provider' => [
'require_parameters' => true,
'allow_fallbacks' => true,
'order' => [
'OpenAI',
'Anthropic'
],
'only' => [
'OpenAI',
'Google'
],
'ignore' => [
'DeepInfra'
],
'sort' => 'price',
'max_price' => [
'prompt' => 10,
'completion' => 20,
'image' => 5,
'audio' => 15,
'request' => 1,
'video_per_second' => 50,
'stt_per_minute' => 5,
'tts_per_million_characters' => 1500
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://polza.ai/api/v1/systemone"
payload := strings.NewReader("{\n \"state\": {\n \"message\": \"Помогите! Выплаты не проходят уже 3 дня.\",\n \"order_id\": \"A-104\"\n },\n \"model\": \"jev-latest\",\n \"questions\": {\n \"is_urgent\": {\n \"type\": \"noul\",\n \"instructions\": \"Does this convey urgency?\"\n },\n \"department\": {\n \"type\": \"choice\",\n \"instructions\": \"Which team should handle this?\",\n \"criteria\": {\n \"billing\": \"Payments, refunds\",\n \"technical\": \"Bugs, outages\"\n }\n },\n \"frustration\": {\n \"type\": \"score\",\n \"instructions\": \"How frustrated is the customer?\",\n \"criteria\": [\n \"Calm\",\n \"Angry\"\n ]\n }\n },\n \"provider\": {\n \"require_parameters\": true,\n \"allow_fallbacks\": true,\n \"order\": [\n \"OpenAI\",\n \"Anthropic\"\n ],\n \"only\": [\n \"OpenAI\",\n \"Google\"\n ],\n \"ignore\": [\n \"DeepInfra\"\n ],\n \"sort\": \"price\",\n \"max_price\": {\n \"prompt\": 10,\n \"completion\": 20,\n \"image\": 5,\n \"audio\": 15,\n \"request\": 1,\n \"video_per_second\": 50,\n \"stt_per_minute\": 5,\n \"tts_per_million_characters\": 1500\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://polza.ai/api/v1/systemone")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"state\": {\n \"message\": \"Помогите! Выплаты не проходят уже 3 дня.\",\n \"order_id\": \"A-104\"\n },\n \"model\": \"jev-latest\",\n \"questions\": {\n \"is_urgent\": {\n \"type\": \"noul\",\n \"instructions\": \"Does this convey urgency?\"\n },\n \"department\": {\n \"type\": \"choice\",\n \"instructions\": \"Which team should handle this?\",\n \"criteria\": {\n \"billing\": \"Payments, refunds\",\n \"technical\": \"Bugs, outages\"\n }\n },\n \"frustration\": {\n \"type\": \"score\",\n \"instructions\": \"How frustrated is the customer?\",\n \"criteria\": [\n \"Calm\",\n \"Angry\"\n ]\n }\n },\n \"provider\": {\n \"require_parameters\": true,\n \"allow_fallbacks\": true,\n \"order\": [\n \"OpenAI\",\n \"Anthropic\"\n ],\n \"only\": [\n \"OpenAI\",\n \"Google\"\n ],\n \"ignore\": [\n \"DeepInfra\"\n ],\n \"sort\": \"price\",\n \"max_price\": {\n \"prompt\": 10,\n \"completion\": 20,\n \"image\": 5,\n \"audio\": 15,\n \"request\": 1,\n \"video_per_second\": 50,\n \"stt_per_minute\": 5,\n \"tts_per_million_characters\": 1500\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://polza.ai/api/v1/systemone")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"state\": {\n \"message\": \"Помогите! Выплаты не проходят уже 3 дня.\",\n \"order_id\": \"A-104\"\n },\n \"model\": \"jev-latest\",\n \"questions\": {\n \"is_urgent\": {\n \"type\": \"noul\",\n \"instructions\": \"Does this convey urgency?\"\n },\n \"department\": {\n \"type\": \"choice\",\n \"instructions\": \"Which team should handle this?\",\n \"criteria\": {\n \"billing\": \"Payments, refunds\",\n \"technical\": \"Bugs, outages\"\n }\n },\n \"frustration\": {\n \"type\": \"score\",\n \"instructions\": \"How frustrated is the customer?\",\n \"criteria\": [\n \"Calm\",\n \"Angry\"\n ]\n }\n },\n \"provider\": {\n \"require_parameters\": true,\n \"allow_fallbacks\": true,\n \"order\": [\n \"OpenAI\",\n \"Anthropic\"\n ],\n \"only\": [\n \"OpenAI\",\n \"Google\"\n ],\n \"ignore\": [\n \"DeepInfra\"\n ],\n \"sort\": \"price\",\n \"max_price\": {\n \"prompt\": 10,\n \"completion\": 20,\n \"image\": 5,\n \"audio\": 15,\n \"request\": 1,\n \"video_per_second\": 50,\n \"stt_per_minute\": 5,\n \"tts_per_million_characters\": 1500\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"model": "jev-1.13.0",
"answers": {
"is_urgent": {
"type": "noul",
"noul": 0.95
},
"department": {
"type": "choice",
"choice": "billing",
"confidence": 0.9,
"probabilities": {
"billing": 0.94,
"technical": 0.06
}
}
},
"usage": {
"input_tokens": 394,
"output_tokens": 68,
"cost_rub": 0.0083
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}POST Systemone
Ответы на типизированные вопросы к тексту — да/нет, выбор из вариантов, оценка по шкале — с вероятностями
curl --request POST \
--url https://polza.ai/api/v1/systemone \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"state": {
"message": "Помогите! Выплаты не проходят уже 3 дня.",
"order_id": "A-104"
},
"model": "jev-latest",
"questions": {
"is_urgent": {
"type": "noul",
"instructions": "Does this convey urgency?"
},
"department": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Payments, refunds",
"technical": "Bugs, outages"
}
},
"frustration": {
"type": "score",
"instructions": "How frustrated is the customer?",
"criteria": [
"Calm",
"Angry"
]
}
},
"provider": {
"require_parameters": true,
"allow_fallbacks": true,
"order": [
"OpenAI",
"Anthropic"
],
"only": [
"OpenAI",
"Google"
],
"ignore": [
"DeepInfra"
],
"sort": "price",
"max_price": {
"prompt": 10,
"completion": 20,
"image": 5,
"audio": 15,
"request": 1,
"video_per_second": 50,
"stt_per_minute": 5,
"tts_per_million_characters": 1500
}
}
}
'import requests
url = "https://polza.ai/api/v1/systemone"
payload = {
"state": {
"message": "Помогите! Выплаты не проходят уже 3 дня.",
"order_id": "A-104"
},
"model": "jev-latest",
"questions": {
"is_urgent": {
"type": "noul",
"instructions": "Does this convey urgency?"
},
"department": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Payments, refunds",
"technical": "Bugs, outages"
}
},
"frustration": {
"type": "score",
"instructions": "How frustrated is the customer?",
"criteria": ["Calm", "Angry"]
}
},
"provider": {
"require_parameters": True,
"allow_fallbacks": True,
"order": ["OpenAI", "Anthropic"],
"only": ["OpenAI", "Google"],
"ignore": ["DeepInfra"],
"sort": "price",
"max_price": {
"prompt": 10,
"completion": 20,
"image": 5,
"audio": 15,
"request": 1,
"video_per_second": 50,
"stt_per_minute": 5,
"tts_per_million_characters": 1500
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
state: {message: 'Помогите! Выплаты не проходят уже 3 дня.', order_id: 'A-104'},
model: 'jev-latest',
questions: {
is_urgent: {type: 'noul', instructions: 'Does this convey urgency?'},
department: {
type: 'choice',
instructions: 'Which team should handle this?',
criteria: {billing: 'Payments, refunds', technical: 'Bugs, outages'}
},
frustration: {
type: 'score',
instructions: 'How frustrated is the customer?',
criteria: ['Calm', 'Angry']
}
},
provider: {
require_parameters: true,
allow_fallbacks: true,
order: ['OpenAI', 'Anthropic'],
only: ['OpenAI', 'Google'],
ignore: ['DeepInfra'],
sort: 'price',
max_price: {
prompt: 10,
completion: 20,
image: 5,
audio: 15,
request: 1,
video_per_second: 50,
stt_per_minute: 5,
tts_per_million_characters: 1500
}
}
})
};
fetch('https://polza.ai/api/v1/systemone', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://polza.ai/api/v1/systemone",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'state' => [
'message' => 'Помогите! Выплаты не проходят уже 3 дня.',
'order_id' => 'A-104'
],
'model' => 'jev-latest',
'questions' => [
'is_urgent' => [
'type' => 'noul',
'instructions' => 'Does this convey urgency?'
],
'department' => [
'type' => 'choice',
'instructions' => 'Which team should handle this?',
'criteria' => [
'billing' => 'Payments, refunds',
'technical' => 'Bugs, outages'
]
],
'frustration' => [
'type' => 'score',
'instructions' => 'How frustrated is the customer?',
'criteria' => [
'Calm',
'Angry'
]
]
],
'provider' => [
'require_parameters' => true,
'allow_fallbacks' => true,
'order' => [
'OpenAI',
'Anthropic'
],
'only' => [
'OpenAI',
'Google'
],
'ignore' => [
'DeepInfra'
],
'sort' => 'price',
'max_price' => [
'prompt' => 10,
'completion' => 20,
'image' => 5,
'audio' => 15,
'request' => 1,
'video_per_second' => 50,
'stt_per_minute' => 5,
'tts_per_million_characters' => 1500
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://polza.ai/api/v1/systemone"
payload := strings.NewReader("{\n \"state\": {\n \"message\": \"Помогите! Выплаты не проходят уже 3 дня.\",\n \"order_id\": \"A-104\"\n },\n \"model\": \"jev-latest\",\n \"questions\": {\n \"is_urgent\": {\n \"type\": \"noul\",\n \"instructions\": \"Does this convey urgency?\"\n },\n \"department\": {\n \"type\": \"choice\",\n \"instructions\": \"Which team should handle this?\",\n \"criteria\": {\n \"billing\": \"Payments, refunds\",\n \"technical\": \"Bugs, outages\"\n }\n },\n \"frustration\": {\n \"type\": \"score\",\n \"instructions\": \"How frustrated is the customer?\",\n \"criteria\": [\n \"Calm\",\n \"Angry\"\n ]\n }\n },\n \"provider\": {\n \"require_parameters\": true,\n \"allow_fallbacks\": true,\n \"order\": [\n \"OpenAI\",\n \"Anthropic\"\n ],\n \"only\": [\n \"OpenAI\",\n \"Google\"\n ],\n \"ignore\": [\n \"DeepInfra\"\n ],\n \"sort\": \"price\",\n \"max_price\": {\n \"prompt\": 10,\n \"completion\": 20,\n \"image\": 5,\n \"audio\": 15,\n \"request\": 1,\n \"video_per_second\": 50,\n \"stt_per_minute\": 5,\n \"tts_per_million_characters\": 1500\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://polza.ai/api/v1/systemone")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"state\": {\n \"message\": \"Помогите! Выплаты не проходят уже 3 дня.\",\n \"order_id\": \"A-104\"\n },\n \"model\": \"jev-latest\",\n \"questions\": {\n \"is_urgent\": {\n \"type\": \"noul\",\n \"instructions\": \"Does this convey urgency?\"\n },\n \"department\": {\n \"type\": \"choice\",\n \"instructions\": \"Which team should handle this?\",\n \"criteria\": {\n \"billing\": \"Payments, refunds\",\n \"technical\": \"Bugs, outages\"\n }\n },\n \"frustration\": {\n \"type\": \"score\",\n \"instructions\": \"How frustrated is the customer?\",\n \"criteria\": [\n \"Calm\",\n \"Angry\"\n ]\n }\n },\n \"provider\": {\n \"require_parameters\": true,\n \"allow_fallbacks\": true,\n \"order\": [\n \"OpenAI\",\n \"Anthropic\"\n ],\n \"only\": [\n \"OpenAI\",\n \"Google\"\n ],\n \"ignore\": [\n \"DeepInfra\"\n ],\n \"sort\": \"price\",\n \"max_price\": {\n \"prompt\": 10,\n \"completion\": 20,\n \"image\": 5,\n \"audio\": 15,\n \"request\": 1,\n \"video_per_second\": 50,\n \"stt_per_minute\": 5,\n \"tts_per_million_characters\": 1500\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://polza.ai/api/v1/systemone")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"state\": {\n \"message\": \"Помогите! Выплаты не проходят уже 3 дня.\",\n \"order_id\": \"A-104\"\n },\n \"model\": \"jev-latest\",\n \"questions\": {\n \"is_urgent\": {\n \"type\": \"noul\",\n \"instructions\": \"Does this convey urgency?\"\n },\n \"department\": {\n \"type\": \"choice\",\n \"instructions\": \"Which team should handle this?\",\n \"criteria\": {\n \"billing\": \"Payments, refunds\",\n \"technical\": \"Bugs, outages\"\n }\n },\n \"frustration\": {\n \"type\": \"score\",\n \"instructions\": \"How frustrated is the customer?\",\n \"criteria\": [\n \"Calm\",\n \"Angry\"\n ]\n }\n },\n \"provider\": {\n \"require_parameters\": true,\n \"allow_fallbacks\": true,\n \"order\": [\n \"OpenAI\",\n \"Anthropic\"\n ],\n \"only\": [\n \"OpenAI\",\n \"Google\"\n ],\n \"ignore\": [\n \"DeepInfra\"\n ],\n \"sort\": \"price\",\n \"max_price\": {\n \"prompt\": 10,\n \"completion\": 20,\n \"image\": 5,\n \"audio\": 15,\n \"request\": 1,\n \"video_per_second\": 50,\n \"stt_per_minute\": 5,\n \"tts_per_million_characters\": 1500\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"model": "jev-1.13.0",
"answers": {
"is_urgent": {
"type": "noul",
"noul": 0.95
},
"department": {
"type": "choice",
"choice": "billing",
"confidence": 0.9,
"probabilities": {
"billing": 0.94,
"technical": 0.06
}
}
},
"usage": {
"input_tokens": 394,
"output_tokens": 68,
"cost_rub": 0.0083
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"error": {
"code": "BAD_REQUEST",
"message": "Недопустимое значение параметра",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"details": {},
"metadata": {
"reason": "noProvidersForModel",
"raw": "The parameter `duration` specified in the request is not valid",
"provider_name": "openrouter",
"attempts": [
{
"provider": "OpenRouter",
"reason": "RATE_LIMIT"
}
]
}
},
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}state) и вопросы с известными вариантами ответа (questions) — получаете значения и вероятности, готовые для кода. Текст модель не генерирует.
https://polza.ai/api (без /v1) и ключом Polza.AI.
Доступные модели
| Модель | ID | Также принимаются |
|---|---|---|
| TypeSafe Jev | typesafe/jev | jev-latest, jev-preview, jev-1.13.0 |
Параметры запроса
| Параметр | Тип | Обязательный | Описание |
|---|---|---|---|
model | string | Да | ID модели |
state | string / object / array | Да | Оцениваемый текст. До 400 000 символов |
questions | object | Да | Вопросы: ключ — имя вопроса (придумываете сами), значение — объект вопроса. От 1 до 256 вопросов |
provider | object | Нет | Выбор провайдера |
Объект вопроса
| Поле | Тип | Обязательный | Описание |
|---|---|---|---|
type | string | Да | noul, choice или score |
instructions | string / object / array | Да | Сам вопрос |
criteria | зависит от типа | Для choice и score | Варианты ответа |
type | criteria | Поля ответа |
|---|---|---|
noul | Необязательно: { "true": "...", "false": "..." } | noul — вероятность «да», от 0 до 1 |
choice | Объект { "вариант": "описание" }; описание может быть null. До 255 вариантов | choice, probabilities, confidence |
score | Массив описаний уровней по возрастанию, от 2 до 10 | score, legend, probabilities, confidence |
Пример
curl -X POST "https://polza.ai/api/v1/systemone" \
-H "Authorization: Bearer $POLZA_AI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "typesafe/jev",
"state": "Кроссовки пришли не того размера. Можно обменять на 43-й? Это срочно, у меня соревнования в субботу.",
"questions": {
"is_urgent": {
"type": "noul",
"instructions": "Клиент сообщает о срочной проблеме?"
},
"department": {
"type": "choice",
"instructions": "Какая команда должна заняться обращением?",
"criteria": {
"returns": "Обмен, возврат, не тот или повреждённый товар",
"shipping": "Статус доставки, задержки, потерянные посылки",
"billing": "Списания, счета, проблемы с оплатой",
"other": "Ничего из перечисленного"
}
}
}
}'
import { TypeSafeClient, choice, noul } from '@typesafe-ai/sdk';
const client = new TypeSafeClient({
baseURL: 'https://polza.ai/api',
apiKey: '<POLZA_AI_API_KEY>',
defaultModel: 'typesafe/jev',
});
const response = await client.systemOne({
state: 'Кроссовки пришли не того размера. Можно обменять на 43-й? Это срочно, у меня соревнования в субботу.',
questions: {
is_urgent: noul('Клиент сообщает о срочной проблеме?'),
department: choice('Какая команда должна заняться обращением?', {
returns: 'Обмен, возврат, не тот или повреждённый товар',
shipping: 'Статус доставки, задержки, потерянные посылки',
billing: 'Списания, счета, проблемы с оплатой',
other: 'Ничего из перечисленного',
}),
},
});
from typesafe_sdk import Choice, Noul, TypeSafeClient
client = TypeSafeClient(
base_url="https://polza.ai/api",
api_key="<POLZA_AI_API_KEY>",
model="typesafe/jev",
)
response = client.system_one(
state="Кроссовки пришли не того размера. Можно обменять на 43-й? Это срочно, у меня соревнования в субботу.",
questions={
"is_urgent": Noul(instructions="Клиент сообщает о срочной проблеме?"),
"department": Choice(
instructions="Какая команда должна заняться обращением?",
criteria={
"returns": "Обмен, возврат, не тот или повреждённый товар",
"shipping": "Статус доставки, задержки, потерянные посылки",
"billing": "Списания, счета, проблемы с оплатой",
"other": "Ничего из перечисленного",
},
),
},
)
Ответ
{
"model": "jev-1.13.0",
"answers": {
"is_urgent": { "type": "noul", "noul": 0.97 },
"department": {
"type": "choice",
"choice": "returns",
"confidence": 1.0,
"probabilities": { "returns": 1.0, "shipping": 0.0, "billing": 0.0, "other": 0.0 }
}
},
"usage": { "input_tokens": 548, "output_tokens": 64, "cost_rub": 0.0115 }
}
| Поле | Описание |
|---|---|
model | Версия модели, которая ответила |
answers | Ответы под именами ваших вопросов |
usage.input_tokens | Входные токены — тарифицируются только они |
usage.output_tokens | Выходные токены — бесплатны |
usage.cost_rub | Стоимость запроса в рублях. Python SDK TypeSafe это поле отбрасывает; в TypeScript SDK и в HTTP-ответе оно есть |
Ошибки
Ошибки приходят в стандартном формате Polza.AI (error.code, error.message, trace_id). Дополнительно в поле detail дублируется форма TypeSafe — { "error_type", "message" }.
| Статус | Когда |
|---|---|
400 | Запрос не прошёл проверку — нашу или провайдера (у TypeSafe это 422); превышен контекст модели; модель не поддерживает эту ручку |
401 | Неверный API-ключ |
402 | Недостаточно средств (detail.error_type: insufficient_balance) |
429 | Превышен лимит запросов. SDK TypeSafe повторяют запрос сами |
503 | Провайдер недоступен или перегружен |
Авторизации
API ключ передаётся в заголовке: Authorization: Bearer <POLZA_AI_API_KEY>
Тело
Оцениваемый текст: строка, объект с именованными полями или массив сообщений
{
"message": "Помогите! Выплаты не проходят уже 3 дня.",
"order_id": "A-104"
}
Идентификатор модели
"jev-latest"
Вопросы по вашим идентификаторам; ответы приходят под теми же ключами. Типы: noul (да/нет), choice (выбор из вариантов criteria), score (оценка по уровням criteria). До 256 вопросов в запросе
Show child attributes
Show child attributes
{
"is_urgent": {
"type": "noul",
"instructions": "Does this convey urgency?"
},
"department": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Payments, refunds",
"technical": "Bugs, outages"
}
},
"frustration": {
"type": "score",
"instructions": "How frustrated is the customer?",
"criteria": ["Calm", "Angry"]
}
}
Ограничения выбора провайдера
Show child attributes
Show child attributes
Ответ
Версия модели, обработавшей запрос
"jev-1.13.0"
Ответы под идентификаторами вопросов. noul: { type, noul }; choice: { type, choice, probabilities, confidence }; score: { type, score, legend, probabilities, confidence }
Show child attributes
Show child attributes
{
"is_urgent": { "type": "noul", "noul": 0.95 },
"department": {
"type": "choice",
"choice": "billing",
"confidence": 0.9,
"probabilities": { "billing": 0.94, "technical": 0.06 }
}
}
Использование токенов и стоимость
Show child attributes
Show child attributes
Была ли эта страница полезной?