Skip to main content
POST
Creates a chat completion. Pass stream: true to stream the completion as server-sent events.

Body

string
required
Model tag.
Message[]
required
Messages comprising the conversation so far.
boolean
Whether to stream the completion as server-sent events. Defaults to false.
Tool[]
Function tools the model may call.
string
Tool choice mode: auto or none. Defaults to auto.
string
Reasoning effort for reasoning models: none, minimal, low, medium, high, or xhigh.
integer
Maximum number of tokens to generate. Also accepted as max_tokens.
number
Sampling temperature.
number
Nucleus sampling coefficient.
integer
Sampling seed for reproducible outputs.

Response

string
required
Chat completion identifier.
string
required
Object type, always chat.completion.
integer
required
Unix timestamp, in seconds, when the completion was created.
string
required
Model tag.
Choice[]
required
Generated completion choices.
Usage
Token usage.