Skip to main content
POST
Streams a text completion for a prompt. The request and response follow the OpenAI completions format. For conversations, use chat completions.

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.
string
required
The text to complete.
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. See Prompt caching.
object
Price options. See Price options.
Other OpenAI completion fields, such as top_p, stop and seed, are passed to the endpoint unchanged.

Response

A stream of server-sent events. Each event’s data is a JSON completion chunk with object set to text_completion, and the stream ends with data: [DONE]. Each choice carries the new text and, in its last chunk, a finish_reason. Usage works as in chat completions.
The values above are illustrative.