Skip to main content
POST /{org}/{agent}/v1/chat/completions Speaks the OpenAI Chat Completions shape - the widely-supported messages-array format. Auth: a session token or a kt_live_... key.

Request

messages
array
The conversation so far, as { "role": "...", "content": "..." } items. The last user message is what runs. It defaults to empty rather than being enforced, so omitting it returns a 200 with empty message content.
model
string
Accepted for OpenAI-client compatibility and echoed back in the response, but it does not select the model. The model is configured per agent and org on the platform.
stream
boolean
default:"false"
true -> SSE chunks; false -> a single completion object.

Unary response

Streaming

Each chunk is a bare data: line carrying a chat.completion.chunk object - there is no SSE event: field. The stream ends with data: [DONE].

Using the OpenAI SDK

Point an OpenAI client’s base URL at your agent and pass the session token as the API key:

Status codes

200 (unary or stream), 401, 402 (budget or instance cap), 404 (unknown agent / cross-tenant / no active release), 409 (release not materialized), 422 (malformed body). See Errors.