Skip to main content
POST
Chat Completions

Authorizations

x-api-key
string
header
required

Body

application/json

Request for the chat completions endpoint.

Note that all parameters except for model, stream, and response_format are ignored.

model
string
required

The model to use for chat completions.

messages
ChatMessage · object[]
required

The messages to use for chat completions.

stream
boolean | null

Whether to stream the chat completions.

response_format
ResponseFormatText · object

Default response format. Used to generate text responses.

max_tokens
integer | null

The maximum number of tokens to generate. Unsupported.

temperature
number | null

The temperature to use for chat completions. Unsupported.

top_p
number | null

The top p to use for chat completions. Unsupported.

n
integer | null

The number of chat completions to generate. Unsupported.

presence_penalty
number | null

The presence penalty to use for chat completions. Unsupported.

frequency_penalty
number | null

The frequency penalty to use for chat completions. Unsupported.

previous_interaction_id
string | null

Interaction ID from a previous chat completion to use as context.

Response

Returns a ChatCompletion object for non-streaming requests (application/json), or a stream of ChatCompletionResponseChunk objects for streaming requests (text/event-stream) when stream=true is set in the request.

Chat completion response.

id
string
required

The id of the chat completion.

choices
Choice · object[]
required
created
integer
required
model
string
required
object
string
required
Allowed value: "chat.completion"
moderation
Moderation · object | null

Moderation results for the request input and generated output, if moderated completions were requested.

service_tier
enum<string> | null
Available options:
auto,
default,
flex,
scale,
priority
system_fingerprint
string | null
usage
CompletionUsage · object | null

Usage statistics for the completion request.

basis
FieldBasis · object[]

Basis for the chat completion, including citations and reasoning supporting the output.

interaction_id
string | null

Identifier for this interaction. Pass as previous_interaction_id for follow-ups.