curl --request POST \
--url https://polza.ai/api/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "Hello, how are you?",
"model": "openai/gpt-4",
"instructions": "You are a helpful assistant",
"metadata": {},
"tools": [
"<unknown>"
],
"tool_choice": "auto",
"parallel_tool_calls": false,
"models": [
"<string>"
],
"text": {
"format": "text",
"verbosity": "medium"
},
"reasoning": {
"effort": "medium",
"summary": "auto",
"max_tokens": 5000,
"enabled": true
},
"max_output_tokens": 1000,
"temperature": 0.7,
"top_p": 1,
"top_logprobs": 5,
"max_tool_calls": 5,
"presence_penalty": 0,
"frequency_penalty": 0,
"top_k": 40,
"image_config": {},
"modalities": [],
"prompt_cache_key": "<string>",
"previous_response_id": "<string>",
"stream": false,
"provider": {
"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
}
},
"user": "user-123",
"session_id": "<string>",
"plugins": [
"<string>"
]
}
'import requests
url = "https://polza.ai/api/v1/responses"
payload = {
"input": "Hello, how are you?",
"model": "openai/gpt-4",
"instructions": "You are a helpful assistant",
"metadata": {},
"tools": ["<unknown>"],
"tool_choice": "auto",
"parallel_tool_calls": False,
"models": ["<string>"],
"text": {
"format": "text",
"verbosity": "medium"
},
"reasoning": {
"effort": "medium",
"summary": "auto",
"max_tokens": 5000,
"enabled": True
},
"max_output_tokens": 1000,
"temperature": 0.7,
"top_p": 1,
"top_logprobs": 5,
"max_tool_calls": 5,
"presence_penalty": 0,
"frequency_penalty": 0,
"top_k": 40,
"image_config": {},
"modalities": [],
"prompt_cache_key": "<string>",
"previous_response_id": "<string>",
"stream": False,
"provider": {
"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
}
},
"user": "user-123",
"session_id": "<string>",
"plugins": ["<string>"]
}
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({
input: 'Hello, how are you?',
model: 'openai/gpt-4',
instructions: 'You are a helpful assistant',
metadata: {},
tools: ['<unknown>'],
tool_choice: 'auto',
parallel_tool_calls: false,
models: ['<string>'],
text: {format: 'text', verbosity: 'medium'},
reasoning: {effort: 'medium', summary: 'auto', max_tokens: 5000, enabled: true},
max_output_tokens: 1000,
temperature: 0.7,
top_p: 1,
top_logprobs: 5,
max_tool_calls: 5,
presence_penalty: 0,
frequency_penalty: 0,
top_k: 40,
image_config: {},
modalities: [],
prompt_cache_key: '<string>',
previous_response_id: '<string>',
stream: false,
provider: {
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}
},
user: 'user-123',
session_id: '<string>',
plugins: ['<string>']
})
};
fetch('https://polza.ai/api/v1/responses', 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/responses",
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([
'input' => 'Hello, how are you?',
'model' => 'openai/gpt-4',
'instructions' => 'You are a helpful assistant',
'metadata' => [
],
'tools' => [
'<unknown>'
],
'tool_choice' => 'auto',
'parallel_tool_calls' => false,
'models' => [
'<string>'
],
'text' => [
'format' => 'text',
'verbosity' => 'medium'
],
'reasoning' => [
'effort' => 'medium',
'summary' => 'auto',
'max_tokens' => 5000,
'enabled' => true
],
'max_output_tokens' => 1000,
'temperature' => 0.7,
'top_p' => 1,
'top_logprobs' => 5,
'max_tool_calls' => 5,
'presence_penalty' => 0,
'frequency_penalty' => 0,
'top_k' => 40,
'image_config' => [
],
'modalities' => [
],
'prompt_cache_key' => '<string>',
'previous_response_id' => '<string>',
'stream' => false,
'provider' => [
'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
]
],
'user' => 'user-123',
'session_id' => '<string>',
'plugins' => [
'<string>'
]
]),
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/responses"
payload := strings.NewReader("{\n \"input\": \"Hello, how are you?\",\n \"model\": \"openai/gpt-4\",\n \"instructions\": \"You are a helpful assistant\",\n \"metadata\": {},\n \"tools\": [\n \"<unknown>\"\n ],\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": false,\n \"models\": [\n \"<string>\"\n ],\n \"text\": {\n \"format\": \"text\",\n \"verbosity\": \"medium\"\n },\n \"reasoning\": {\n \"effort\": \"medium\",\n \"summary\": \"auto\",\n \"max_tokens\": 5000,\n \"enabled\": true\n },\n \"max_output_tokens\": 1000,\n \"temperature\": 0.7,\n \"top_p\": 1,\n \"top_logprobs\": 5,\n \"max_tool_calls\": 5,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 0,\n \"top_k\": 40,\n \"image_config\": {},\n \"modalities\": [],\n \"prompt_cache_key\": \"<string>\",\n \"previous_response_id\": \"<string>\",\n \"stream\": false,\n \"provider\": {\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 }\n },\n \"user\": \"user-123\",\n \"session_id\": \"<string>\",\n \"plugins\": [\n \"<string>\"\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/responses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"Hello, how are you?\",\n \"model\": \"openai/gpt-4\",\n \"instructions\": \"You are a helpful assistant\",\n \"metadata\": {},\n \"tools\": [\n \"<unknown>\"\n ],\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": false,\n \"models\": [\n \"<string>\"\n ],\n \"text\": {\n \"format\": \"text\",\n \"verbosity\": \"medium\"\n },\n \"reasoning\": {\n \"effort\": \"medium\",\n \"summary\": \"auto\",\n \"max_tokens\": 5000,\n \"enabled\": true\n },\n \"max_output_tokens\": 1000,\n \"temperature\": 0.7,\n \"top_p\": 1,\n \"top_logprobs\": 5,\n \"max_tool_calls\": 5,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 0,\n \"top_k\": 40,\n \"image_config\": {},\n \"modalities\": [],\n \"prompt_cache_key\": \"<string>\",\n \"previous_response_id\": \"<string>\",\n \"stream\": false,\n \"provider\": {\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 }\n },\n \"user\": \"user-123\",\n \"session_id\": \"<string>\",\n \"plugins\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://polza.ai/api/v1/responses")
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 \"input\": \"Hello, how are you?\",\n \"model\": \"openai/gpt-4\",\n \"instructions\": \"You are a helpful assistant\",\n \"metadata\": {},\n \"tools\": [\n \"<unknown>\"\n ],\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": false,\n \"models\": [\n \"<string>\"\n ],\n \"text\": {\n \"format\": \"text\",\n \"verbosity\": \"medium\"\n },\n \"reasoning\": {\n \"effort\": \"medium\",\n \"summary\": \"auto\",\n \"max_tokens\": 5000,\n \"enabled\": true\n },\n \"max_output_tokens\": 1000,\n \"temperature\": 0.7,\n \"top_p\": 1,\n \"top_logprobs\": 5,\n \"max_tool_calls\": 5,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 0,\n \"top_k\": 40,\n \"image_config\": {},\n \"modalities\": [],\n \"prompt_cache_key\": \"<string>\",\n \"previous_response_id\": \"<string>\",\n \"stream\": false,\n \"provider\": {\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 }\n },\n \"user\": \"user-123\",\n \"session_id\": \"<string>\",\n \"plugins\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "gen_581761234567890123",
"object": "response",
"created_at": 1234567890,
"model": "openai/gpt-4",
"status": "completed",
"output_text": "Hello! How can I help you today?",
"output": "<array>",
"completed_at": {},
"error": {
"code": "invalid_request",
"message": "Invalid input format",
"metadata": {}
},
"incomplete_details": {},
"usage": {
"input_tokens": 10,
"output_tokens": 20,
"total_tokens": 30,
"prompt_tokens": 10,
"completion_tokens": 20,
"input_tokens_details": {
"cached_tokens": 0,
"audio_tokens": 0,
"video_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 100,
"audio_tokens": 0,
"image_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0
},
"prompt_tokens_details": {
"cached_tokens": 0,
"audio_tokens": 0,
"video_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 100,
"audio_tokens": 0,
"image_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0
},
"server_tool_use": {
"web_search_requests": 1
},
"cost_rub": 0.04131306,
"cost": 0.04131306,
"plugins": {
"masker": {
"operations": [
{
"operation": "mask",
"latency_ms": 15,
"cost_rub": 0.001
},
{
"operation": "unmask",
"latency_ms": 8,
"cost_rub": 0
}
],
"total_cost_rub": 0.001
}
},
"plugin_post_process_error": true
},
"metadata": {}
}POST Responses
Responses API — альтернативный формат запросов
curl --request POST \
--url https://polza.ai/api/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "Hello, how are you?",
"model": "openai/gpt-4",
"instructions": "You are a helpful assistant",
"metadata": {},
"tools": [
"<unknown>"
],
"tool_choice": "auto",
"parallel_tool_calls": false,
"models": [
"<string>"
],
"text": {
"format": "text",
"verbosity": "medium"
},
"reasoning": {
"effort": "medium",
"summary": "auto",
"max_tokens": 5000,
"enabled": true
},
"max_output_tokens": 1000,
"temperature": 0.7,
"top_p": 1,
"top_logprobs": 5,
"max_tool_calls": 5,
"presence_penalty": 0,
"frequency_penalty": 0,
"top_k": 40,
"image_config": {},
"modalities": [],
"prompt_cache_key": "<string>",
"previous_response_id": "<string>",
"stream": false,
"provider": {
"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
}
},
"user": "user-123",
"session_id": "<string>",
"plugins": [
"<string>"
]
}
'import requests
url = "https://polza.ai/api/v1/responses"
payload = {
"input": "Hello, how are you?",
"model": "openai/gpt-4",
"instructions": "You are a helpful assistant",
"metadata": {},
"tools": ["<unknown>"],
"tool_choice": "auto",
"parallel_tool_calls": False,
"models": ["<string>"],
"text": {
"format": "text",
"verbosity": "medium"
},
"reasoning": {
"effort": "medium",
"summary": "auto",
"max_tokens": 5000,
"enabled": True
},
"max_output_tokens": 1000,
"temperature": 0.7,
"top_p": 1,
"top_logprobs": 5,
"max_tool_calls": 5,
"presence_penalty": 0,
"frequency_penalty": 0,
"top_k": 40,
"image_config": {},
"modalities": [],
"prompt_cache_key": "<string>",
"previous_response_id": "<string>",
"stream": False,
"provider": {
"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
}
},
"user": "user-123",
"session_id": "<string>",
"plugins": ["<string>"]
}
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({
input: 'Hello, how are you?',
model: 'openai/gpt-4',
instructions: 'You are a helpful assistant',
metadata: {},
tools: ['<unknown>'],
tool_choice: 'auto',
parallel_tool_calls: false,
models: ['<string>'],
text: {format: 'text', verbosity: 'medium'},
reasoning: {effort: 'medium', summary: 'auto', max_tokens: 5000, enabled: true},
max_output_tokens: 1000,
temperature: 0.7,
top_p: 1,
top_logprobs: 5,
max_tool_calls: 5,
presence_penalty: 0,
frequency_penalty: 0,
top_k: 40,
image_config: {},
modalities: [],
prompt_cache_key: '<string>',
previous_response_id: '<string>',
stream: false,
provider: {
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}
},
user: 'user-123',
session_id: '<string>',
plugins: ['<string>']
})
};
fetch('https://polza.ai/api/v1/responses', 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/responses",
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([
'input' => 'Hello, how are you?',
'model' => 'openai/gpt-4',
'instructions' => 'You are a helpful assistant',
'metadata' => [
],
'tools' => [
'<unknown>'
],
'tool_choice' => 'auto',
'parallel_tool_calls' => false,
'models' => [
'<string>'
],
'text' => [
'format' => 'text',
'verbosity' => 'medium'
],
'reasoning' => [
'effort' => 'medium',
'summary' => 'auto',
'max_tokens' => 5000,
'enabled' => true
],
'max_output_tokens' => 1000,
'temperature' => 0.7,
'top_p' => 1,
'top_logprobs' => 5,
'max_tool_calls' => 5,
'presence_penalty' => 0,
'frequency_penalty' => 0,
'top_k' => 40,
'image_config' => [
],
'modalities' => [
],
'prompt_cache_key' => '<string>',
'previous_response_id' => '<string>',
'stream' => false,
'provider' => [
'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
]
],
'user' => 'user-123',
'session_id' => '<string>',
'plugins' => [
'<string>'
]
]),
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/responses"
payload := strings.NewReader("{\n \"input\": \"Hello, how are you?\",\n \"model\": \"openai/gpt-4\",\n \"instructions\": \"You are a helpful assistant\",\n \"metadata\": {},\n \"tools\": [\n \"<unknown>\"\n ],\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": false,\n \"models\": [\n \"<string>\"\n ],\n \"text\": {\n \"format\": \"text\",\n \"verbosity\": \"medium\"\n },\n \"reasoning\": {\n \"effort\": \"medium\",\n \"summary\": \"auto\",\n \"max_tokens\": 5000,\n \"enabled\": true\n },\n \"max_output_tokens\": 1000,\n \"temperature\": 0.7,\n \"top_p\": 1,\n \"top_logprobs\": 5,\n \"max_tool_calls\": 5,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 0,\n \"top_k\": 40,\n \"image_config\": {},\n \"modalities\": [],\n \"prompt_cache_key\": \"<string>\",\n \"previous_response_id\": \"<string>\",\n \"stream\": false,\n \"provider\": {\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 }\n },\n \"user\": \"user-123\",\n \"session_id\": \"<string>\",\n \"plugins\": [\n \"<string>\"\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/responses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"Hello, how are you?\",\n \"model\": \"openai/gpt-4\",\n \"instructions\": \"You are a helpful assistant\",\n \"metadata\": {},\n \"tools\": [\n \"<unknown>\"\n ],\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": false,\n \"models\": [\n \"<string>\"\n ],\n \"text\": {\n \"format\": \"text\",\n \"verbosity\": \"medium\"\n },\n \"reasoning\": {\n \"effort\": \"medium\",\n \"summary\": \"auto\",\n \"max_tokens\": 5000,\n \"enabled\": true\n },\n \"max_output_tokens\": 1000,\n \"temperature\": 0.7,\n \"top_p\": 1,\n \"top_logprobs\": 5,\n \"max_tool_calls\": 5,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 0,\n \"top_k\": 40,\n \"image_config\": {},\n \"modalities\": [],\n \"prompt_cache_key\": \"<string>\",\n \"previous_response_id\": \"<string>\",\n \"stream\": false,\n \"provider\": {\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 }\n },\n \"user\": \"user-123\",\n \"session_id\": \"<string>\",\n \"plugins\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://polza.ai/api/v1/responses")
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 \"input\": \"Hello, how are you?\",\n \"model\": \"openai/gpt-4\",\n \"instructions\": \"You are a helpful assistant\",\n \"metadata\": {},\n \"tools\": [\n \"<unknown>\"\n ],\n \"tool_choice\": \"auto\",\n \"parallel_tool_calls\": false,\n \"models\": [\n \"<string>\"\n ],\n \"text\": {\n \"format\": \"text\",\n \"verbosity\": \"medium\"\n },\n \"reasoning\": {\n \"effort\": \"medium\",\n \"summary\": \"auto\",\n \"max_tokens\": 5000,\n \"enabled\": true\n },\n \"max_output_tokens\": 1000,\n \"temperature\": 0.7,\n \"top_p\": 1,\n \"top_logprobs\": 5,\n \"max_tool_calls\": 5,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 0,\n \"top_k\": 40,\n \"image_config\": {},\n \"modalities\": [],\n \"prompt_cache_key\": \"<string>\",\n \"previous_response_id\": \"<string>\",\n \"stream\": false,\n \"provider\": {\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 }\n },\n \"user\": \"user-123\",\n \"session_id\": \"<string>\",\n \"plugins\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "gen_581761234567890123",
"object": "response",
"created_at": 1234567890,
"model": "openai/gpt-4",
"status": "completed",
"output_text": "Hello! How can I help you today?",
"output": "<array>",
"completed_at": {},
"error": {
"code": "invalid_request",
"message": "Invalid input format",
"metadata": {}
},
"incomplete_details": {},
"usage": {
"input_tokens": 10,
"output_tokens": 20,
"total_tokens": 30,
"prompt_tokens": 10,
"completion_tokens": 20,
"input_tokens_details": {
"cached_tokens": 0,
"audio_tokens": 0,
"video_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 100,
"audio_tokens": 0,
"image_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0
},
"prompt_tokens_details": {
"cached_tokens": 0,
"audio_tokens": 0,
"video_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 100,
"audio_tokens": 0,
"image_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0
},
"server_tool_use": {
"web_search_requests": 1
},
"cost_rub": 0.04131306,
"cost": 0.04131306,
"plugins": {
"masker": {
"operations": [
{
"operation": "mask",
"latency_ms": 15,
"cost_rub": 0.001
},
{
"operation": "unmask",
"latency_ms": 8,
"cost_rub": 0
}
],
"total_cost_rub": 0.001
}
},
"plugin_post_process_error": true
},
"metadata": {}
}О Responses API
Основные параметры
| Параметр | Тип | Описание |
|---|---|---|
model | string | ID модели |
input | string / array | Текст или массив сообщений |
instructions | string | Системные инструкции |
stream | boolean | Потоковая передача через SSE |
Дополнительные параметры
| Параметр | Тип | Описание |
|---|---|---|
tools | array | Определения инструментов |
tool_choice | string/object | Выбор инструмента: none, auto, required |
reasoning | object | Настройки reasoning (effort: xhigh/high/medium/low/minimal/none) |
max_output_tokens | integer | Максимум выходных токенов |
temperature | float (0-2) | Температура генерации |
top_p | float (0-1) | Nucleus sampling |
top_logprobs | integer (0-20) | Количество log probabilities |
previous_response_id | string | ID предыдущего ответа для продолжения |
models | array | Массив fallback-моделей |
text | object | Формат текста: text, json_object, json_schema |
metadata | object | Произвольные key-value данные |
Примеры
curl -X POST "https://polza.ai/api/v1/responses" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o",
"input": "Расскажи о квантовых компьютерах"
}'
import requests
response = requests.post(
'https://polza.ai/api/v1/responses',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
json={
'model': 'openai/gpt-4o',
'input': [
{"role": "user", "content": "Привет!"}
],
'instructions': 'Отвечай кратко и по делу'
}
)
data = response.json()
print(data['output'][0]['content'][0]['text'])
Streaming
Приstream: true ответ приходит в формате SSE с типами событий:
| Событие | Описание |
|---|---|
response.created | Ответ создан |
response.output_item.added | Новый элемент вывода |
response.content_part.delta | Инкрементальный контент |
response.content_part.done | Часть контента завершена |
response.done | Ответ завершён |
Авторизации
API ключ передаётся в заголовке: Authorization: Bearer <POLZA_AI_API_KEY>
Тело
Input for response - can be string or array of messages
"Hello, how are you?"
Model to use
"openai/gpt-4"
System instructions
"You are a helpful assistant"
Metadata key-value pairs
Tools available for the model
Tool choice strategy
none, auto, required "auto"
Enable parallel tool calls
Alternative models to try
Text output configuration
Show child attributes
Show child attributes
Reasoning configuration
Show child attributes
Show child attributes
Maximum output tokens
1000
Temperature (0-2)
0 <= x <= 20.7
Top P (nucleus sampling)
0 <= x <= 11
Top logprobs
0 <= x <= 205
Maximum tool calls
5
Presence penalty (-2 to 2)
-2 <= x <= 2Frequency penalty (-2 to 2)
-2 <= x <= 2Top K sampling
40
Image configuration options
Output modalities
text, image Prompt cache key
Previous response ID
Enable streaming
Provider preferences
Show child attributes
Show child attributes
Уникальный идентификатор конечного пользователя для отслеживания и предотвращения злоупотреблений
"user-123"
Session identifier (max 128 chars)
Плагины для расширения функциональности (web search, file parser и др.)
Ответ
Response ID
"gen_581761234567890123"
response "response"
Created timestamp
1234567890
Model used
"openai/gpt-4"
completed, incomplete, in_progress, failed, cancelled, queued "completed"
Full output text (convenience field)
"Hello! How can I help you today?"
Output items array
Completed timestamp
Error information
Show child attributes
Show child attributes
Details about incomplete response
Usage information
Show child attributes
Show child attributes
Metadata key-value pairs
Была ли эта страница полезной?