Skip to main content
The chat completions endpoint takes standard OpenAI-format requests and returns text. Point any OpenAI-compatible client at the Kyara base URL to use it. The endpoint is text-only. See Unsupported Features for the capabilities, such as tool calling, that are not available.

Request

Request bodies are limited to 16 MB. Larger requests are rejected with a 413 error.
string
required
The model ID to use for the request. Find available model IDs in the catalog or call GET /v1/models. An unknown ID returns a 400 error with the code model_not_found.
array
required
An array of message objects forming the conversation. Each object requires a role (system, developer, user, or assistant) and a content string. Content must be plain text. Multimodal arrays are rejected.A message can also carry an optional name (string) and, for assistant turns you are sending back, reasoning (string), reasoning_content (string), or reasoning_details (array). Any other field inside a message is rejected with a 400 error.
number
Sampling temperature between 0 and 2. Higher values produce more varied output; lower values produce more focused, deterministic output. Support varies per model.
number
Nucleus sampling probability mass. The model considers only the tokens comprising the top top_p probability mass. Support varies per model.
integer
Kyara extension. Limits sampling to the top k most likely tokens. Accepted by many models beyond the OpenAI standard.
number
Kyara extension. Discards tokens whose probability is below min_p times the probability of the most likely token. Support varies per model.
number
Penalizes tokens that have already appeared in the text so far, encouraging the model to move on to new topics. Support varies per model.
number
Penalizes tokens in proportion to how often they have appeared so far, reducing verbatim repetition. Support varies per model.
number
Kyara extension. Multiplicative penalty on repeated tokens, as used by many open-weight models. Values above 1 discourage repetition. Support varies per model.
integer
Maximum number of tokens to generate. You can use max_completion_tokens interchangeably. If you set neither, the limit defaults to 8192. Values above the model’s maximum output length are lowered to that maximum rather than rejected.
integer
Alias for max_tokens. Maximum number of tokens to generate in the completion. Defaults to 8192 and is capped at the model’s maximum output length.
boolean
Set to true to receive the response as Server-Sent Events. Defaults to false. See Streaming.
object
Accepted for compatibility. Token usage is always included in the final stream chunk, so you do not need to set include_usage.
object
Controls reasoning behaviour for models that support it. Pass an object with any of:
  • effort (string), one of "max", "xhigh", "high", "medium", "low", "minimal", or "none"
  • max_tokens (integer), the maximum tokens to spend on reasoning
  • enabled (boolean), turns reasoning on or off for models that support toggling it
  • exclude (boolean), when true the model still reasons but the reasoning text is left out of the response
The top-level reasoning_effort is also accepted and is folded into reasoning.effort. If you set both, reasoning.effort takes precedence.
string
Kyara extension. Groups requests that belong to one conversation so they are served from the same prompt cache, which lowers latency and cost on long chats. Send the same value for every turn of a conversation. Maximum 256 characters. If you omit it, every request from your account shares one session. See Sessions and prompt caching.
integer
Number of completion choices to generate. Only 1 is supported; any other value returns a 400 error. Defaults to 1.
string | array
One or more sequences where the model will stop generating further tokens.
integer
A seed for deterministic sampling. Passing the same seed and request parameters should produce the same result, though determinism is not guaranteed.
boolean
Whether to return log probabilities of the output tokens. Support varies per model.
integer
Number of most likely tokens to return at each position, with their log probabilities. Requires logprobs: true. Support varies per model.
string
An identifier for the end user of your application. If you omit it, Kyara fills it with your account ID.

Response

A successful request returns a JSON object matching the OpenAI chat completions schema.
string
A unique identifier for the completion.
string
Always "chat.completion" for non-streaming responses.
integer
Unix timestamp (seconds) of when the completion was created.
string
The model ID you requested. This always matches the public catalog ID.
array
An array of completion choices.
object
Token usage for the request.
Responses can include a few additional OpenAI-compatible fields, such as choices[].logprobs and choices[].message.refusal, which are passed through when present. Fields that are not part of the public contract, such as system_fingerprint, are never included.

Streaming

Set "stream": true to receive the response as Server-Sent Events. Each data: event carries a chat.completion.chunk object. The stream terminates with data: [DONE].
curl
A few things to expect from the stream:
  • The first chunk usually carries only the assistant role. Reasoning models then send chunks with delta.reasoning before any delta.content.
  • The final chunk has an empty choices array and carries the usage object. You do not need stream_options.include_usage; usage is always sent.
  • If generation fails partway through, the stream ends with an error event instead of [DONE], and you are not charged for the request:
  • If you close the connection early, generation stops and you are charged only for the output produced up to that point.

Sessions and prompt caching

Kyara keeps requests that share a session_id on the same prompt cache, so each turn of a long conversation reuses the cached prefix instead of re-processing it. This lowers latency and input cost. Cached prompt tokens are reported in usage.prompt_tokens_details.cached_tokens. Pass a stable session_id per conversation (a chat ID, for example). If you omit it, all requests from your account share one session, which works well for a single user and less well for an app that serves many conversations in parallel. session_id is accepted on every request and never changes what the model sees.

Errors

Errors use the OpenAI error envelope: { "error": { "message", "type", "param", "code" } }. Failed requests are never billed, whether they fail before generation starts or partway through a stream.
Model IDs and pricing can change during early access. Use the models page as the current source of truth for available models.
Features such as tool calling, structured outputs, vision, and embeddings are not supported. See Unsupported Features for the complete list.