Create a chat completion
OpenAI chat-completions schema, passed through to the upstream provider.
- Request body limit is **2 MiB** (oversized bodies return `400 invalid_request`).
- `stream: true` returns Server-Sent Events (`text/event-stream`):
`data: {chunk}\n\n` events terminated by `data: [DONE]`. The gateway
injects `stream_options: {"include_usage": true}` upstream, so the
final chunk before `[DONE]` carries `usage`.
- Streams have no overall deadline; an idle upstream is cut after 90 s
of silence.
- If the model defines fallback models, upstream 429/5xx/connect errors
are retried on the next provider **only before the first byte** is
streamed. After the first byte, errors surface as a dropped connection.
- Disconnecting mid-stream still bills for tokens generated so far.
- Parameters unsupported by a given provider are stripped, not rejected.
Authentication
AuthorizationBearer
A Kontinent API key: Authorization: Bearer sk-kt-<43 base62 chars>
(49 chars total). Shown once at creation; only a SHA-256 hash is
stored. No expiry; revocation takes effect within ~30 s.
Request
This endpoint expects an object.
model
Kontinent model id in provider/model form. Discover via GET /v1/models.
messages
stream
If true, partial deltas are sent as Server-Sent Events.
temperature
top_p
max_tokens
Maximum number of tokens to generate in the completion.
stop
n
Response
A chat completion. When stream is true, the response is an SSE stream instead.
id
object
created
model
choices
usage
Errors
400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
404
Not Found Error
429
Too Many Requests Error
500
Internal Server Error
502
Bad Gateway Error

