Skip to main content
POST
Create a chat completion

Body

application/json

Request body for chat completions endpoint describing conversation and generation parameters.

messages
object[]
required

List of messages (role + content) forming the chat history. Required.

temperature
number | null

Sampling temperature; higher values increase randomness.

top_p
number | null

Nucleus sampling cumulative probability threshold.

top_k
integer | null

Keep only the top_k tokens by probability at each generation step.

max_completion_tokens
integer | null

Maximum number of tokens the model may generate for the completion.

stream
boolean
default:false

If true, the server may stream partial responses as they are generated.

frequency_penalty
number | null

Penalty applied based on frequency of tokens to reduce repetition.

presence_penalty
number | null

Penalty applied to discourage new token presence (encourages topic shifting).

logit_bias
object | null

Mapping from token id (string or int) to a bias value added to the token logits.

logprobs
boolean
default:false

If true, include logprob information in the response.

top_logprobs
integer | null

Return the top N token logprobs at each position if logprobs enabled.

stop

Stop sequence or list of sequences where generation should halt.

seed
integer | null

Optional random seed for reproducibility.

tools
object[] | null

Optional list of tool/function definitions that the model may call.

tool_choice

Controls which tool the model calls: auto, none, required, or a specific function.

Available options:
auto,
none,
required
reasoning_effort
enum<string> | null

Constrains reasoning depth for supported reasoning models. Higher values generally increase quality and latency.

Available options:
none,
minimal,
low,
medium,
high,
xhigh

Response

200 - application/json

Chat completion response

Response schema for the chat completions endpoint.

id
string
required

Unique identifier for this chat completion.

object
string
default:chat.completion
required

Type of the returned object; defaults to 'chat.completion'.

created
integer
required

Unix timestamp (seconds) of creation.

model
string
required

Model identifier used to generate the chat response.

choices
object[]
required

List of chat choices returned by the model.

usage
object
required

Token usage details for the chat completion.