Chat Completions

Generate chat completions based on a conversation history.

Headers

AuthorizationstringRequired

Bearer authentication of the form Bearer <token>, where token is your auth token.

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_biasanyOptional

Modifies the likelihood of specified tokens appearing in a response.

max_completion_tokensintegerOptional

The maximum number of tokens in the generated completion.

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.

stopstring or list of stringsOptional
temperaturedoubleOptional

The temperature parameter for controlling randomness in completions.

top_pdoubleOptional

The diversity of the generated text based on nucleus sampling.

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.

idstringOptional

Unique ID for the chat completion.

objectstringOptional

Type of object (chat completion).

createdintegerOptional

Timestamp of when the chat completion was created.

modelstringOptional

The chat model used for generating completions.

choiceslist of objectsOptional

The set of result choices.

Errors