Skip to main content
POST
Error

Authorizations

Authorization
string
header
required

API key passed as a Bearer token.

Body

application/json
model
string
required

Model identifier (e.g. gpt-4o, claude-3-sonnet).

messages
object[]
required

List of messages comprising the conversation.

temperature
number<double> | null

Sampling temperature (0–2).

max_completion_tokens
integer | null

Maximum number of tokens to generate.

top_p
number<double> | null

Nucleus sampling parameter.

frequency_penalty
number<double> | null

Frequency penalty (−2.0 to 2.0).

presence_penalty
number<double> | null

Presence penalty (−2.0 to 2.0).

stop
string[]

Stop sequences.

stream
boolean
default:false

Whether to stream partial responses via SSE.

tools
object[]

List of tools the model may call.

tool_choice
any

Controls which tool is called. Can be "none", "auto", or an object like {"type": "function", "function": {"name": "my_fn"}}.

response_format
object
seed
integer | null

Seed for deterministic sampling.

user
string

End-user identifier for abuse monitoring.

n
integer | null

Number of completions to generate.

logprobs
boolean | null

Whether to return log probabilities.

top_logprobs
integer | null

Number of most likely tokens to return (0–20).

stream_options
object

Response

Chat completion response (non-streaming)

id
string
object
string
Example:

"chat.completion"

created
integer<int64>
model
string
choices
object[]
usage
object
system_fingerprint
string