Використовуйте OpenAI Responses API для розмов. Responses API — найновіший формат API OpenAI з гнучкішим введенням.
/api/ai/v1/responsesBearer YOUR_API_KEY| Параметр | Тип | Обов'язково | Опис |
|---|---|---|---|
model | string | Обов'язково | Назва моделі, напр. deepseek-v4.1-flash, qwen3.8-max |
input | string | Обов'язково | Вхідний текст або вміст розмови |
max_tokens | integer | Необов'язково | Максимальна кількість вихідних токенів |
temperature | float | Необов'язково | Температура семплювання, контролює випадковість (0-2) |
stream | boolean | Необов'язково | Увімкнути потокову відповідь, встановіть true для SSE |
| Параметр | Тип | Опис |
|---|---|---|
id | string | Унікальний ідентифікатор відповіді |
model | string | Фактично використана модель |
output | string | Згенерований текстовий вивід |
usage | object | Статистика використання токенів, включно з prompt_tokens, completion_tokens, total_tokens |
curl --location 'https://your-domain.com/api/ai/v1/responses' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
"model": "deepseek-v4.1-flash",
"input": "Hello, who are you?",
"max_tokens": 1000,
"temperature": 0.7
}'import requests
response = requests.post(
"https://your-domain.com/api/ai/v1/responses",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
},
json={
"model": "deepseek-v4.1-flash",
"input": "Hello, who are you?",
"max_tokens": 1000,
"temperature": 0.7
}
)
print(response.json())curl --location 'https://your-domain.com/api/ai/v1/responses' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
"model": "deepseek-v4.1-flash",
"input": "Hello",
"max_tokens": 1000,
"stream": true
}'