Skip to content

API reference: Chat Completions

POST /v1/chat/completions answers a list of messages. It follows the OpenAI Chat Completions API. For examples, read the Chat Completions guide. New projects can also use Responses; both share keys, tiers and limits.

POST https://dummydomain/v1/chat/completions
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Field Type Description
model string, required A tier: Instant, Fast, Smart or Genius
messages array, required Messages with roles system, developer, user, assistant and tool. content is a string or a list of text and image_url parts
max_tokens, max_completion_tokens integer The longest answer you want
temperature, top_p number Sampling. Use one of them
presence_penalty, frequency_penalty number Discourage repeats
stop string or array Text that ends the answer
seed integer Repeatable sampling where possible
stream boolean true sends chunks as the answer is written
response_format object text, json_object or json_schema. See Structured JSON output
tools, tool_choice, parallel_tool_calls Function tools on tiers whose capabilities.tools is true

Images go in image_url parts as data: URLs: up to 8 per request, 10 MiB each and 20 MiB in total. An https image address works only if your administrator has allowed its host; this is off by default, and the server then fetches the image itself, with no redirects.

{
"model": "Fast",
"messages": [
{"role": "system", "content": "Reply in one sentence."},
{"role": "user", "content": "What is GST?"}
]
}

When the model wants a function, the assistant message has tool_calls. Run each one and send its result as a tool message with the same tool_call_id:

{"role": "tool", "tool_call_id": "call_8f2c...", "content": "{\"status\": \"shipped\"}"}
{
"id": "chatcmpl-57b769...",
"object": "chat.completion",
"created": 1791959603,
"model": "Fast",
"choices": [
{
"index": 0,
"message": {"role": "assistant", "content": "GST is India's tax on the supply of goods and services."},
"finish_reason": "stop"
}
],
"usage": {"prompt_tokens": 24, "completion_tokens": 13, "total_tokens": 37}
}

finish_reason is stop, length (the answer reached the token limit) or tool_calls.

With "stream": true you get chat.completion.chunk objects. Each delta adds to the answer, and the stream ends with data: [DONE].

data: {"id":"chatcmpl-57b769...","object":"chat.completion.chunk","created":1791959603,"model":"Fast","choices":[{"index":0,"delta":{"content":"GST is"},"finish_reason":null}]}
data: [DONE]

Common questions

Is ZenithAI's /v1/chat/completions the same as OpenAI's?

It follows the same request and response format, so code written for OpenAI chat completions works after you change the base URL and use a tier name such as Fast as the model.