Skip to main content
POST
OpenAI Chat Completions

Authorizations

Authorization
string
header
required

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

Body

application/json
model
string
required

ID of the chat model to use. See Models for the current model list, pricing, and endpoint support.

Example:

"claude-opus-4-5-20251101"

messages
object[]
required

The conversation so far, as an ordered list of messages.

stream
boolean
default:false

If true, partial deltas are streamed as Server-Sent Events.

max_tokens
integer

Maximum number of tokens to generate in the completion.

Example:

1024

max_completion_tokens
integer

OpenAI-compatible alias for maximum generated tokens.

Example:

1024

temperature
number

Sampling temperature. Higher values produce more random output.

Required range: 0 <= x <= 2
Example:

1

top_p
number

Nucleus sampling parameter.

Required range: 0 <= x <= 1
Example:

0.95

frequency_penalty
number

Penalizes repeated tokens.

Required range: -2 <= x <= 2
Example:

0

presence_penalty
number

Penalizes tokens based on whether they already appeared.

Required range: -2 <= x <= 2
Example:

0

stop
string[]

Up to 4 sequences where the API stops generating further tokens. The generated text will not contain the stop sequence.

tools
object[]

Optional tool definitions in the OpenAI Chat Completions format. Support can vary by selected model and provider.

tool_choice

Controls which tool the model may call. Support can vary by selected model and provider.

Available options:
auto,
none,
required
response_format
object

Optional structured-output format, such as { "type": "json_object" } or JSON schema. Support can vary by selected model and provider.

reasoning
object

Optional reasoning controls for models that expose reasoning behavior. Support can vary by selected model and provider.

Response

Chat completion result. When stream is true, the body is an SSE stream instead.

id
string
Example:

"chatcmpl-abc123"

object
string
Example:

"chat.completion"

created
integer

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

Example:

1716000000

model
string
Example:

"claude-opus-4-7"

choices
object[]
usage
object