Skip to main content
POST
This API endpoint allows you to send text and images as inputs, and the model will generate the next message in the conversation.

Create Chat Completion

To create a chat completion, use the following endpoint: POST /v1/chat/completions

Request Body

string
required
The model id to use for completion (“gpt-4o”, “gpt-4o-mini”, “deepseek-r”, )
array
required
An array of message objects that form the conversation
integer
The maximum number of tokens to generate
string
Sampling temperature, a value between 0 and 2.
boolean
Whether to enable streaming responses
integer
Tells the model not to repeat a word that has already been used multiple times in the conversation.
integer
Prevents the model from repeating a word, even if it’s only been used once
array
Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.

Authorizations

Authorization
string
header
required

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

Headers

x-api-key
string

Body

application/json
model
string
required
messages
ChatMessage · object[]
required
Minimum array length: 1
tools
Tool · object[] | null
tool_choice
functions
any[]
function_call
response_format
TextResponseFormat · object
temperature
number | null
Required range: 0 <= x <= 2
top_p
number | null
Required range: 0 <= x <= 1
stream
boolean | null
default:false
stream_options
StreamOptions · object | null
stop
max_tokens
integer | null
Required range: x >= 1
max_completion_tokens
integer | null
Required range: x >= 1
presence_penalty
number | null
Required range: -2 <= x <= 2
frequency_penalty
number | null
Required range: -2 <= x <= 2
logit_bias
Logit Bias · object
reasoning_effort
enum<string> | null
Available options:
none,
minimal,
low,
medium,
high,
xhigh

Response

Successful Response

id
string
required

A unique identifier for the chat completion.

created
integer
required

The Unix timestamp (in seconds) of when the chat completion was created.

model
string
required

The model used for the chat completion.

choices
ChatCompletionChoice · object[]
required

A list of chat completion choices.

usage
ChatCompletionUsage · object
required

Usage statistics for the completion request.

object
string
default:chat.completion

The object type, which is always chat.completion.

Allowed value: "chat.completion"
system_fingerprint
string | null

This fingerprint represents the backend configuration that the model runs with.