Bearer zowy_… key with the ai_chat scope. See Authentication.Авторизация: ключ Bearer zowy_… со scope ai_chat. См. Аутентификация.Avtorizatsiya: ai_chat ruxsatiga ega Bearer zowy_… kaliti. Autentifikatsiyani qarang.Модели
Pass one of these names in model. Names are case-sensitive. The list can change — GET /api/v1/models always returns the models available right now. The former zowy-1 has been retired; use zowy-2 instead.
Укажите одно из этих имён в поле model. Имена чувствительны к регистру. Список может меняться — GET /api/v1/models всегда возвращает модели, доступные сейчас. Прежняя модель zowy-1 выведена из эксплуатации — используйте zowy-2.
model maydonida shu nomlardan birini ko'rsating. Nomlar katta-kichik harfni farqlaydi. Ro'yxat o'zgarishi mumkin — GET /api/v1/models har doim hozir mavjud modellarni qaytaradi. Avvalgi zowy-1 modeli foydalanishdan chiqarilgan — zowy-2 dan foydalaning.
| Модель | Описание |
|---|---|
| zowy-2 | Recommended default. Text and image input, function calling, JSON mode. Thinks before answering (the reasoning is not returned).Рекомендуемая модель по умолчанию. Текст и изображения на входе, function calling, JSON-режим. Перед ответом обдумывает его (рассуждение не возвращается).Standart tavsiya etilgan model. Kirishda matn va rasmlar, function calling, JSON rejimi. Javob berishdan oldin o'ylaydi (mulohaza qaytarilmaydi). |
| zowy-1-pro | Alternative general-purpose model. Text and image input, function calling.Альтернативная универсальная модель. Текст и изображения на входе, function calling.Muqobil universal model. Kirishda matn va rasmlar, function calling. |
curl https://zowy.ai/api/v1/models \ -H "Authorization: Bearer $ZOWY_API_KEY"
{
"object": "list",
"data": [
{"id": "zowy-2", "object": "model", "created": 1700000000, "owned_by": "zowy"},
{"id": "zowy-1-pro", "object": "model", "created": 1700000000, "owned_by": "zowy"}
]
}
Тело запроса
JSON object in the OpenAI Chat Completions format.
JSON-объект в формате OpenAI Chat Completions.
OpenAI Chat Completions formatidagi JSON obyekt.
| Параметр | Описание |
|---|---|
| model string · обязательный |
Model name, e.g. zowy-2. See Models.Имя модели, например zowy-2. См. Модели.Model nomi, masalan zowy-2. Modellarni qarang. |
| messages array · обязательный |
Conversation so far. Every item is an object with role (system, user, assistant, tool) and content — a string or an array of parts (text, image_url).История диалога. Каждый элемент — объект с role (system, user, assistant, tool) и content — строкой или массивом частей (text, image_url).Muloqot tarixi. Har bir element — role (system, user, assistant, tool) va content ga ega obyekt; content — satr yoki qismlar massivi (text, image_url). |
| stream boolean · необязательный |
Stream the answer as server-sent events. Default false. See Streaming.Отдавать ответ потоком server-sent events. По умолчанию false. См. Streaming.Javobni server-sent events oqimi sifatida berish. Standart qiymat — false. Strimingni qarang. |
| stream_options object · необязательный |
{"include_usage": true} adds token usage to the final chunk of a stream.{"include_usage": true} добавляет расход токенов в последний чанк потока.{"include_usage": true} oqimning oxirgi chankiga token sarfini qo'shadi. |
| max_tokens integer · необязательный |
Upper limit for generated tokens. For zowy-2 it also covers reasoning tokens, so leave headroom.Верхний предел сгенерированных токенов. Для zowy-2 сюда входят и токены рассуждения — оставляйте запас.Generatsiya qilinadigan tokenlarning yuqori chegarasi. zowy-2 uchun bunga mulohaza tokenlari ham kiradi — zaxira qoldiring. |
| temperature number · необязательный |
Sampling temperature from 0 to 2. Lower values give more predictable answers.Температура сэмплирования от 0 до 2. Чем ниже, тем предсказуемее ответ.0 dan 2 gacha bo'lgan semplash harorati. Qanchalik past bo'lsa, javob shunchalik oldindan aytib bo'ladigan bo'ladi. |
| top_p number · необязательный |
Nucleus sampling, from 0 to 1. Change either this or temperature, not both.Nucleus sampling, от 0 до 1. Меняйте либо его, либо temperature.Nucleus sampling, 0 dan 1 gacha. Yo uni, yo temperature ni o'zgartiring. |
| tools array · необязательный |
Functions the model may call. See Function calling.Функции, которые модель может вызвать. См. Function calling.Model chaqira oladigan funksiyalar. Function callingni qarang. |
| tool_choice string | object · необязательный |
auto, none, required or {"type": "function", "function": {"name": "…"}}.auto, none, required или {"type": "function", "function": {"name": "…"}}.auto, none, required yoki {"type": "function", "function": {"name": "…"}}. |
| response_format object · необязательный |
{"type": "json_object"} forces valid JSON output. json_schema is not supported by zowy-2.{"type": "json_object"} — ответ строго в JSON. Тип json_schema модель zowy-2 не поддерживает.{"type": "json_object"} — javob qat'iy JSON ko'rinishida. json_schema turini zowy-2 modeli qo'llab-quvvatlamaydi. |
Other Chat Completions parameters (stop, seed, logprobs, user and so on) are passed to the model unchanged. Support differs between models: a parameter a model does not understand may be ignored or rejected with 400.
Остальные параметры Chat Completions (stop, seed, logprobs, user и т. д.) передаются модели без изменений. Поддержка зависит от модели: неизвестный ей параметр может быть проигнорирован или отклонён с кодом 400.
Chat Completions'ning boshqa parametrlari (stop, seed, logprobs, user va h.k.) modelga o'zgarishsiz uzatiladi. Qo'llab-quvvatlash modelga bog'liq: model bilmaydigan parametr e'tiborsiz qoldirilishi yoki 400 kodi bilan rad etilishi mumkin.
Пример запроса
curl https://zowy.ai/api/v1/chat/completions \ -H "Authorization: Bearer $ZOWY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "zowy-2", "messages": [ {"role": "system", "content": "You are a helpful assistant for an online store."}, {"role": "user", "content": "Salom! Yetkazib berish qancha turadi?"} ] }'
import os from openai import OpenAI client = OpenAI( api_key=os.environ["ZOWY_API_KEY"], base_url="https://zowy.ai/api/v1", ) response = client.chat.completions.create( model="zowy-2", messages=[ {"role": "system", "content": "You are a helpful assistant for an online store."}, {"role": "user", "content": "Salom! Yetkazib berish qancha turadi?"}, ], ) print(response.choices[0].message.content)
import OpenAI from "openai"; const client = new OpenAI({ apiKey: process.env.ZOWY_API_KEY, baseURL: "https://zowy.ai/api/v1", }); const response = await client.chat.completions.create({ model: "zowy-2", messages: [ { role: "system", content: "You are a helpful assistant for an online store." }, { role: "user", content: "Salom! Yetkazib berish qancha turadi?" }, ], }); console.log(response.choices[0].message.content);
Ответ
{
"id": "e4dbe203-465f-43d2-9597-2eaffe47da53",
"object": "chat.completion",
"created": 1792970991,
"model": "zowy-2",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Assalomu alaykum! Toshkent bo'ylab yetkazib berish ..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 231,
"completion_tokens": 58,
"total_tokens": 289
}
}
| Поле | Описание |
|---|---|
| id string |
Unique identifier of the completion.Уникальный идентификатор ответа.Javobning noyob identifikatori. |
| model string |
The model name you requested.Имя модели из запроса.So'rovdagi model nomi. |
| choices[].message object |
content — the answer; tool_calls — requested function calls.content — ответ; tool_calls — запрошенные вызовы функций.content — javob; tool_calls — so'ralgan funksiya chaqiruvlari. |
| choices[].finish_reason string |
stop — finished normally; tool_calls — waiting for function results; length — hit max_tokens. An empty content with length means reasoning used up the limit — raise max_tokens.stop — ответ завершён; tool_calls — модель ждёт результатов функций; length — достигнут max_tokens. Пустой content при length значит, что лимит ушёл на рассуждение — увеличьте max_tokens.stop — javob tugadi; tool_calls — model funksiya natijalarini kutmoqda; length — max_tokens ga yetildi. length bo'lganda content bo'sh bo'lsa, limit mulohazaga sarflangan — max_tokens ni oshiring. |
| usage object |
prompt_tokens, completion_tokens (includes reasoning) and total_tokens. total_tokens is what gets billed.prompt_tokens, completion_tokens (включая рассуждение) и total_tokens. Списывается именно total_tokens.prompt_tokens, completion_tokens (mulohaza bilan birga) va total_tokens. Aynan total_tokens hisobdan yechiladi. |
The response can contain additional fields; ignore the ones you don’t use.
В ответе могут быть и другие поля — игнорируйте те, что вам не нужны.
Javobda boshqa maydonlar ham bo'lishi mumkin — sizga keraksizlarini e'tiborsiz qoldiring.
Streaming
With "stream": true the answer arrives as text/event-stream: one data: line per chunk with a chat.completion.chunk object, and data: [DONE] at the end. Text is in choices[0].delta.content.
С "stream": true ответ приходит как text/event-stream: по строке data: на каждый чанк с объектом chat.completion.chunk, в конце — data: [DONE]. Текст — в choices[0].delta.content.
"stream": true bilan javob text/event-stream sifatida keladi: har bir chank uchun chat.completion.chunk obyektli bitta data: satri, oxirida — data: [DONE]. Matn — choices[0].delta.content da.
curl -N https://zowy.ai/api/v1/chat/completions \ -H "Authorization: Bearer $ZOWY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "zowy-2", "messages": [{"role": "user", "content": "Write a short welcome message"}], "stream": true, "stream_options": {"include_usage": true} }'
stream = client.chat.completions.create(
model="zowy-2",
messages=[{"role": "user", "content": "Write a short welcome message"}],
stream=True,
stream_options={"include_usage": True},
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
if chunk.usage:
print("\ntokens:", chunk.usage.total_tokens)
const stream = await client.chat.completions.create({ model: "zowy-2", messages: [{ role: "user", content: "Write a short welcome message" }], stream: true, stream_options: { include_usage: true }, }); for await (const chunk of stream) { const text = chunk.choices[0]?.delta?.content; if (text) process.stdout.write(text); if (chunk.usage) console.log("\ntokens:", chunk.usage.total_tokens); }
data: {"id":"055e9836-...","object":"chat.completion.chunk","created":1792971022,"model":"zowy-2","choices":[{"index":0,"delta":{"role":"assistant","content":null},"finish_reason":null}]} data: {"id":"055e9836-...","object":"chat.completion.chunk","created":1792971022,"model":"zowy-2","choices":[{"index":0,"delta":{"content":"Xush kelibsiz"},"finish_reason":null}]} data: {"id":"055e9836-...","object":"chat.completion.chunk","created":1792971022,"model":"zowy-2","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop"}],"usage":{"prompt_tokens":214,"completion_tokens":31,"total_tokens":245}} data: [DONE]
zowy-2 thinks before it answers. The reasoning itself is not returned, so the first chunks can arrive after a short pause; its tokens are counted in usage.completion_tokens (see completion_tokens_details.reasoning_tokens) and toward max_tokens.
zowy-2 обдумывает ответ перед тем, как ответить. Само рассуждение не возвращается, поэтому первые чанки могут прийти с небольшой паузой; его токены входят в usage.completion_tokens (см. completion_tokens_details.reasoning_tokens) и в лимит max_tokens.
zowy-2 javob berishdan oldin o'ylaydi. Mulohazaning o'zi qaytarilmaydi, shuning uchun birinchi chanklar biroz kechikib kelishi mumkin; uning tokenlari usage.completion_tokens ga (completion_tokens_details.reasoning_tokens ga qarang) va max_tokens limitiga kiradi.
data: event with an error object instead of chunks. Check each event for error.Если запрос не удался уже после открытия потока, вы получите HTTP 200 и одно событие data: с объектом error вместо чанков. Проверяйте каждое событие на поле error.Agar so'rov oqim ochilganidan keyin muvaffaqiyatsiz bo'lsa, chanklar o'rniga HTTP 200 va error obyektli bitta data: hodisasi keladi. Har bir hodisada error maydonini tekshiring.Function calling
Describe your functions in tools using JSON Schema. When the model decides to call one, it returns tool_calls with finish_reason: "tool_calls"; you run the function and send the result back in a tool message.
Опишите функции в tools через JSON Schema. Когда модель решает вызвать функцию, она возвращает tool_calls и finish_reason: "tool_calls"; вы выполняете функцию и отправляете результат обратно сообщением с ролью tool.
Funksiyalarni tools da JSON Schema orqali tavsiflang. Model funksiyani chaqirishga qaror qilganda tool_calls va finish_reason: "tool_calls" ni qaytaradi; siz funksiyani bajarasiz va natijani tool rolidagi xabar bilan qaytarib yuborasiz.
{
"model": "zowy-2",
"messages": [
{"role": "user", "content": "Is the order 10452 shipped yet?"}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_order_status",
"description": "Returns the delivery status of an order",
"parameters": {
"type": "object",
"properties": {
"order_id": {"type": "string"}
},
"required": ["order_id"]
}
}
}
],
"tool_choice": "auto"
}
"message": { "role": "assistant", "content": "", "tool_calls": [ { "id": "call_00_PYXmSsFVfcQaO8EwV1Qd1076", "type": "function", "function": { "name": "get_order_status", "arguments": "{\"order_id\": \"10452\"}" } } ] }, "finish_reason": "tool_calls"
Then repeat the request with the assistant message and the function result appended:
Затем повторите запрос, добавив сообщение ассистента и результат функции:
So'ng assistent xabari va funksiya natijasini qo'shib, so'rovni qayta yuboring:
"messages": [ {"role": "user", "content": "Is the order 10452 shipped yet?"}, {"role": "assistant", "content": "", "tool_calls": [ ... ]}, {"role": "tool", "tool_call_id": "call_00_PYXmSsFVfcQaO8EwV1Qd1076", "content": "{\"status\": \"in_transit\", \"eta\": \"2026-10-27\"}"} ]
Изображения
To send an image, make content an array of parts and add an image_url part. Pass the image as a base64 data: URL — links to remote files may fail to download.
Чтобы отправить изображение, передайте content массивом частей и добавьте часть image_url. Передавайте картинку как base64 data: URL — ссылки на внешние файлы могут не загрузиться.
Rasm yuborish uchun content ni qismlar massivi sifatida bering va image_url qismini qo'shing. Rasmni base64 data: URL sifatida yuboring — tashqi fayllarga havolalar yuklanmasligi mumkin.
{
"model": "zowy-2",
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "What product is in this photo?"},
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,/9j/4AAQSkZJRg..."}}
]
}
]
}
JSON-режим
"response_format": {"type": "json_object"} makes the model return a valid JSON object in content. Describe the keys you expect in the prompt — the format is not validated against a schema.
"response_format": {"type": "json_object"} заставляет модель вернуть в content корректный JSON-объект. Опишите ожидаемые ключи в промпте — ответ не проверяется по схеме.
"response_format": {"type": "json_object"} modelni content da to'g'ri JSON obyekt qaytarishga majbur qiladi. Kutilayotgan kalitlarni promptda tavsiflang — javob sxema bo'yicha tekshirilmaydi.
{
"model": "zowy-2",
"messages": [
{"role": "system", "content": "Extract the customer's name and phone. Reply in JSON with keys name and phone."},
{"role": "user", "content": "Men Aziz, raqamim +998 90 123 45 67"}
],
"response_format": {"type": "json_object"}
}
Системное сообщение ZOWY
Every request gets a short ZOWY system message at the start of messages; it sets the assistant’s identity as ZOWY AI. If your first message is system, the two are merged, with yours after ours. This message counts towards prompt_tokens (currently about 200 tokens) and can’t be turned off.
В начало messages каждого запроса добавляется короткое системное сообщение ZOWY — оно задаёт ассистенту идентичность ZOWY AI. Если ваше первое сообщение — system, они объединяются, ваше идёт после нашего. Это сообщение входит в prompt_tokens (сейчас около 200 токенов) и не отключается.
Har bir so'rovdagi messages boshiga ZOWY'ning qisqa tizim xabari qo'shiladi — u assistentga ZOWY AI identifikatsiyasini beradi. Agar sizning birinchi xabaringiz system bo'lsa, ular birlashtiriladi, siznikisi biznikidan keyin keladi. Bu xabar prompt_tokens ga kiradi (hozir taxminan 200 token) va o'chirilmaydi.
Оплата
Requests use tokens from your active AI Chat token package; usage.total_tokens is debited per request. Without available tokens the API returns 402. Packages and prices: Pricing.
Запросы расходуют токены из активного пакета AI Chat; за каждый запрос списывается usage.total_tokens. Если токенов нет, API вернёт 402. Пакеты и цены — на странице Цены.
So'rovlar faol AI Chat paketidagi tokenlarni sarflaydi; har bir so'rov uchun usage.total_tokens yechiladi. Tokenlar bo'lmasa, API 402 qaytaradi. Paketlar va narxlar — Narxlar sahifasida.
Ошибки
| Код | Когда |
|---|---|
| 400 | Invalid JSON, unknown model (the message lists available models), malformed messages, or a parameter the model rejected.Невалидный JSON, неизвестная model (в сообщении — список доступных), неверный формат messages или параметр, отклонённый моделью.Yaroqsiz JSON, noma'lum model (xabarda mavjudlari ro'yxati bor), messages formati noto'g'ri yoki model rad etgan parametr. |
| 401 | Missing, invalid or expired API key.Ключ не передан, неверный или истёк.Kalit yuborilmagan, noto'g'ri yoki muddati o'tgan. |
| 402 | No AI Chat tokens left.Закончились токены AI Chat.AI Chat tokenlari tugagan. |
| 403 | The key doesn’t have the ai_chat scope.У ключа нет scope ai_chat.Kalitda ai_chat ruxsati yo'q. |
| 429 | Rate limit exceeded — see Rate limits.Превышен лимит запросов — см. Лимиты запросов.So'rovlar limiti oshib ketdi — So'rovlar limitlarini qarang. |
| 502 · 503 · 504 | The model is temporarily unavailable or didn’t answer within 120 seconds. Retry with backoff.Модель временно недоступна или не ответила за 120 секунд. Повторите запрос с паузой.Model vaqtincha mavjud emas yoki 120 soniya ichida javob bermadi. Biroz kutib, so'rovni qayta yuboring. |
Error bodies look like {"error": {"message": "…", "type": "…"}}; 401 and 429 return {"detail": "…"}. Full list and retry advice: Errors.
Тело ошибки: {"error": {"message": "…", "type": "…"}}; для 401 и 429 — {"detail": "…"}. Полный список и советы по повторам — Ошибки.
Xato tanasi: {"error": {"message": "…", "type": "…"}}; 401 va 429 uchun — {"detail": "…"}. To'liq ro'yxat va qayta yuborish bo'yicha maslahatlar — Xatolar.