Create a chat completion

Generates a response from a model given a prompt or a series of messages.

Authentication

Authorizationstring
API Key authentication via header

Request

Request body for creating a chat completion.
modelstringRequired
The ID of the model to use for this request.
messageslist of objectsOptional
A list of messages comprising the conversation so far.
promptstringOptional
A simple string prompt. The API will automatically convert this into a user message.
max_tokensintegerOptional>=1
The maximum number of tokens to generate in the completion.
temperaturedoubleOptional
Controls randomness. Lower values produce more deterministic results.
toolslist of objectsOptional
A list of tools the model may call.
tool_choiceenum or objectOptional

Controls which (if any) function is called by the model.

Response

Successful response containing the model's choices.
request_idstring or nullformat: "uuid"
choiceslist of objects or null
requestobject or null

A copy of the original request, excluding prompt and messages.

usageobject or null