ZEKA API
The chat models of ZEKA Studio for your own apps and services. The API follows the OpenAI Chat Completions format, so the usual OpenAI libraries work by changing only the address and the key.
Start
Base URLhttps://api.zekastudio.site/v1
Authsend your key in the header Authorization: Bearer zk-…. Keep the key secret: never put it in a web page or an app that others can open.
Your key is issued by ZEKA and linked to your ZEKA account. Usage is paid from the credits of that account.
Chat
curl
curl https://api.zekastudio.site/v1/chat/completions \
-H "Authorization: Bearer $ZEKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-4-argon",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Write a two-line product caption for a linen shirt."}
]
}'
Python
from openai import OpenAI
client = OpenAI(base_url="https://api.zekastudio.site/v1", api_key="zk-...")
answer = client.chat.completions.create(
model="gemini-4-argon",
messages=[{"role": "user", "content": "Hello!"}],
)
print(answer.choices[0].message.content)
JavaScript
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.zekastudio.site/v1", apiKey: process.env.ZEKA_API_KEY });
const answer = await client.chat.completions.create({
model: "gemini-4-argon",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(answer.choices[0].message.content);
Parameters
| Field | Notes |
|---|---|
model | Required. An id from GET /v1/models. |
messages | Required. Roles: system, developer, user, assistant, tool. Content is text or a list of text / image_url parts. |
max_tokens / max_completion_tokens | Longest answer, reasoning included. Default 16384 when not sent; up to 128000 (or the model's own limit). |
stream, stream_options.include_usage | Server-sent events; with include_usage the last event carries the token usage. |
temperature, top_p, stop, seed, presence_penalty, frequency_penalty, logit_bias | As in the OpenAI format, when the model supports them. |
tools, tool_choice, parallel_tool_calls, response_format, reasoning_effort | As in the OpenAI format, when the model supports them. |
n | Only 1. |
Streaming
stream = client.chat.completions.create(
model="gemini-4-argon",
messages=[{"role": "user", "content": "Tell me a short story."}],
stream=True,
stream_options={"include_usage": True},
)
for event in stream:
if event.choices and event.choices[0].delta.content:
print(event.choices[0].delta.content, end="", flush=True)
Images in the question
Models marked "input": ["text", "image"] in /v1/models read images, as a URL or a data: URL. One request may be up to 20 MB.
{"role": "user", "content": [
{"type": "text", "text": "Describe this product photo for an online shop."},
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,/9j/4AAQ..."}}
]}
Tools (function calling)
Send tools in the OpenAI format; the answer returns tool_calls. Run the function yourself and send its result back as a tool message.
Models and balance
curl https://api.zekastudio.site/v1/models -H "Authorization: Bearer $ZEKA_API_KEY"
curl https://api.zekastudio.site/v1/balance -H "Authorization: Bearer $ZEKA_API_KEY"
/v1/models lists only the models your key may use. /v1/balance shows the credits available in your account.
Billing
- Every answer is charged by its real token usage (input, cached input and output, reasoning included), at the same rates as chat in ZEKA Studio.
- Before a request, credits for the largest possible answer are held; after the answer only the real usage is charged and the rest is released.
- A request that fails before an answer costs nothing. If an answer breaks off midway, the hold is reviewed by ZEKA and only what was really used is charged.
- If you close a streaming connection early, the model still finishes its answer and that answer is charged. Use
max_tokensto keep answers short. - Your key may have a daily spending cap, a requests-per-minute limit and a number of requests at the same time.
- Top up your credits at zekastudio.site or contact ZEKA.
Errors
Errors use the OpenAI shape: {"error": {"message", "type", "code"}}.
| HTTP | code | Meaning |
|---|---|---|
| 400 | invalid_request, invalid_json, model_required | The request is not valid. The message says what to fix. |
| 401 | invalid_api_key, api_key_disabled | Missing, wrong or switched-off key. |
| 402 | insufficient_credits | Not enough credits. Top up. |
| 403 | model_not_allowed, account_inactive | The key or account may not use this model. |
| 404 | model_not_found | Unknown model id. |
| 413 | request_too_large | The request is larger than 20 MB. |
| 429 | rate_limited, too_many_at_once, daily_cap_reached, spending_limit, model_busy | Slow down, wait or raise the limit with ZEKA. |
| 502 / 503 / 504 | unavailable, bad_answer, timeout, maintenance | Temporary. Retry after a short wait. |
© ZEKA Studio · zekastudio.site