Completions V2
Guarded chat completions with model selection, model family, and auto-routing.
Guide: Completions
Error Reference: Completions V2
Authorizations
Bearer authentication header of the form Bearer <api-key>, where <api-key> is your API key.
Headers
Body
Request body for the completions v2 endpoint. Exactly one routing mechanism (auto_routing, model, or model_family) must be specified. Messages are optional when omitted and default to a single user message of "Hello world!". An explicit empty messages array is invalid and returns 400.
Sampling temperature controlling randomness, from 0 to 1; a value above 1 returns 422. Lower values (e.g., 0.2) make output more focused, higher values (e.g., 0.9) more varied. If you don't set it, the model's own default applies. A model that does not take one (Claude 5 models, and OpenAI GPT-5 and later models while they reason) does not get it, and it is listed in ignored_params (X-Ignored-Params on a stream).
0 <= x <= 1Maximum output, in tokens. It holds the reasoning as well as the answer. When the model is reasoning, a value below 8,192 is raised to 8,192; a larger one is sent as you set it, up to the model's maximum output. With reasoning_effort 'none' on a model that can turn reasoning off (can_disable: true in the model catalog), from any provider, the value is sent as you set it, up to the model's maximum output. With no value, a reasoning model gets its full output allowance (up to 65,536) and other models get 2,048. A value of 0 or less counts as no value. See Set your output limit for reasoning models.
How much a reasoning model thinks: 'none', 'minimal', 'low', 'medium', 'high', 'xhigh' or 'max'. The nested form reasoning: {effort, summary} is accepted too; this field wins if both are sent. An effort other than 'none' also returns the model's reasoning: on a non-streamed answer as message.reasoning_content, and on a stream as delta.reasoning_content chunks before the answer. The reasoning is not moderated. A level the model does not run as sent (a model that does not reason, or a level it does not have) is not refused: it runs at the nearest level the model has, or without an effort, and is listed in ignored_params (X-Ignored-Params on a stream). See the Reasoning guide (/api-guides/reasoning).
Response
Successful completion response. If stream is false or omitted, the response is JSON. If stream=true, the response is a Server-Sent Events stream. Once streaming has started, failures are delivered as stream events rather than non-2xx HTTP responses. Content moderation ends the stream with a content_filter event.
Response from the completions v2 endpoint.

