Create a chat completion

Als Markdown anzeigen
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.

Authentifizierung

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.

Anfrage

This endpoint expects an object.
modelstringErforderlich

Kontinent model id in provider/model form. Discover via GET /v1/models.

messageslist of objectsErforderlich
streambooleanOptionalStandardwert ist false

If true, partial deltas are sent as Server-Sent Events.

temperaturedoubleOptional0-2
top_pdoubleOptional0-1
max_tokensintegerOptional
Maximum number of tokens to generate in the completion.
stopstring or list of stringsOptional
nintegerOptionalStandardwert ist 1

Antwort

A chat completion. When stream is true, the response is an SSE stream instead.

idstring
objectstring
createdinteger
modelstring
choiceslist of objects
usageobject

Fehler

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