Create a chat completion

Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.

Authentication

AuthorizationBearer
API key as bearer token in Authorization header

Request

Chat completion request parameters
messageslist of objectsRequired
providerobject or nullOptional
When multiple model providers are available, optionally indicate your routing preference.
pluginslist of objectsOptional
Plugins you want to enable for this request, including their settings.
routeenum or nullOptional

Routing strategy for multiple models: “fallback” (default) uses secondary models as backups, “sort” sorts all endpoints together by routing criteria.

Allowed values:
userstringOptional
session_idstringOptional<=128 characters

A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.

modelstringOptional
modelslist of stringsOptional
frequency_penaltydouble or nullOptional-2-2
logit_biasmap from strings to doubles or nullOptional
logprobsboolean or nullOptional
top_logprobsdouble or nullOptional0-20
max_completion_tokensdouble or nullOptional>=1
max_tokensdouble or nullOptional>=1
metadatamap from strings to stringsOptional
presence_penaltydouble or nullOptional-2-2
reasoningobjectOptional
response_formatobjectOptional
seedinteger or nullOptional-9007199254740991-9007199254740991
stopstring or list of strings or nullOptional
streambooleanOptionalDefaults to false
stream_optionsobject or nullOptional
temperaturedouble or nullOptional0-2Defaults to 1
tool_choice"none" or "auto" or "required" or objectOptional
toolslist of objectsOptional
top_pdouble or nullOptional0-1Defaults to 1
debugobjectOptional

Response

Successful chat completion response
idstring
choiceslist of objects
createddouble
modelstring
object"chat.completion"
system_fingerprintstring or null
usageobject or null

Errors