Generate chat completions based on a conversation history.
Request
This endpoint expects an object.
modelstringRequired
The chat model to use for generating completions.
messagesstring or list of objectsRequired
frequency_penaltydoubleOptional
A value between -2.0 and 2.0, with positive values increasingly penalizing new tokens based on their frequency so far in order to decrease further occurrences.
logit_biasobjectOptional
Modifies the likelihood of specified tokens appearing in a response.
max_completion_tokensintegerOptional
The maximum number of tokens in the generated completion.
parallel_tool_callsbooleanOptional
Whether to enable parallel function calling during tool use.
presence_penaltydoubleOptional
A value between -2.0 and 2.0, with positive values causing a flat reduction of new tokens based on their existing presence so far in order to decrease further occurrences.
reasoning_effortstringOptional
Constrains effort on reasoning for reasoning models. Currently supported values are low, medium, and high. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response. Only supported by reasoning models.
stopstring or list of stringsOptional
streambooleanOptional
Whether to stream back the model response.
stream_optionsobjectOptional
Extra parameters used when streaming the response.
temperaturedoubleOptional
The temperature parameter for controlling randomness in completions. Supports a range of 0.0-2.0.
tool_choicestring or objectOptional
toolslist of objectsOptional
The content of the tool call.
top_pdoubleOptional
The diversity of the generated text based on nucleus sampling. Supports a range of 0.0-1.0.
top_kintegerOptional
The diversity of the generated text based on top-k sampling.
outputobjectOptional
Options to affect the output of the response.
inputobjectOptional
Options to affect the input of the request.
max_tokensintegerOptional
Deprecated. Please use max_completion_tokens.
Response
Successful response.
idstring
Unique ID for the chat completion.
objectstring
Type of object (chat completion).
createdinteger
Timestamp of when the chat completion was created.
modelstring
The chat model used for generating completions.
choiceslist of objects
The set of result choices.
usageobject
The amount of tokens used in the request.