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
modelstringRequired
frequency_penaltydouble or nullOptional>=-2<=2
logit_biasmap from strings to doubles or nullOptional
logprobsboolean or nullOptional
top_logprobsdouble or nullOptional>=0<=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
stopstring or list of strings or nullOptional
streamboolean or nullOptionalDefaults to false
stream_optionsobject or nullOptional
temperaturedouble or nullOptional>=0<=2Defaults to 1
tool_choice"none" or "auto" or "required" or objectOptional
toolslist of objectsOptional
top_pdouble or nullOptional>=0<=1Defaults to 1
userstringOptional

Response

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

Errors