Generate an LLM response, as JSON or as a server-sent event stream

Generates a response for the supplied conversation history. With stream omitted or false the body is a single application/json LLMResponse; with stream true the body is a text/event-stream whose event payloads are documented by the ResponseCreated, ResponseItemAdded, ResponseTextDelta, ResponseFunctionCallArgumentsDelta, ResponseItemCompleted, ResponseCompleted, and ErrorEnvelope schemas. Response ids are Speko-minted (resp_<request-id>); provider response and conversation ids never appear in output — they are captured only as content-free telemetry evidence. There is no previous_response_id anywhere in the contract: callers resend full history, including function results, on every request.

post/v1/llm/responses

Headers

Idempotency-Keystring required

Required on every POST. The Router persists only the key, a content hash, and the request's execution status — never the content itself. For single-part bodies the content hash covers the raw body bytes exactly as sent; for multipart bodies it covers the decoded part payload bytes only — no part headers, no boundary bytes — concatenated in part order (request, then audio), so per-retry boundary strings never change the hash. Reusing a key with the same hash while the original admission is still live returns request_in_progress (retryable); after dispatch it returns request_already_started with the original request id, because stateless mode cannot replay output; reusing a key with a different hash returns idempotency_conflict. Keys are opaque; the Router imposes no format beyond the length bound, and the normative bound is 256 BYTES — maxLength below counts code points, which JSON Schema cannot avoid, so multi-byte keys hit the byte bound first.

Request body

max_output_tokensinteger required
temperaturenumber
top_pnumber

Must be greater than 0 and at most 1.

streamboolean

When true the response is a text/event-stream instead of a single JSON body.

Response

The generated response, as a JSON body (stream omitted or false) or as a server-sent event stream (stream true).

idstring required
stop_reason'stop' | 'max_output_tokens' | 'tool_call' required

Why generation ended. The set is closed.

Changes

Changed in 1 of the 7 revisions of this API.1