Skip to main content
POST
Streams a chat completion from one of the model’s endpoints. The request and response follow the OpenAI chat completions format.

Request

string
required
Bearer ask_..., an inference key.
string
required
A model slug from the catalog, or <model-slug>/ep/<endpoint> to pin one endpoint.
object[]
required
The conversation, in the OpenAI messages format.
boolean
required
Must be true.
integer
Maximum tokens to generate. At least 1.
number
Sampling temperature, from 0 to 2.
boolean
default:"false"
Set to true to receive token usage in the final chunk.
string
Requests with the same key are routed to the same endpoint so its prompt cache is reused. See Prompt caching.
object
Price options. See Price options.
Other OpenAI chat completion fields, such as tools, tool_choice, response_format, top_p, stop and seed, are passed to the endpoint unchanged. Support depends on the endpoint’s capabilities.

Response

The response is a stream of server-sent events. Each event’s data is a JSON chat completion chunk, and the stream ends with data: [DONE].
string
Identifier for the completion.
string
chat.completion.chunk.
string
The model you requested.
object[]
object | null
Only sent when stream_options.include_usage is true, in the final chunk.
The values above are illustrative. Chunks come from the endpoint that served the request, so extra fields it sends, such as reasoning content, are passed through.

Errors during a stream

Errors before the stream starts return an HTTP error status. See Errors. If the endpoint fails after the stream has started, you receive an error event and then data: [DONE]:
Output delivered before the error is billed.