Skip to main content
POST
Chat completion

Authorizations

Authorization
string
header
required

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

Body

application/json
model
enum<string>
required

model ID

Available options:
gpt-5.1-chat-latest
Example:

"gpt-5.1-chat-latest"

messages
object[]
required

List of conversation messages.

Minimum array length: 1
Example:
max_tokens
integer

Maximum number of tokens to generate.

Required range: x >= 1
temperature
number
default:1

Sampling temperature. Higher values make the output more random.

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

1

top_p
number

Nucleus sampling threshold.

Required range: 0 <= x <= 1
frequency_penalty
number
default:0

Penalize repeated tokens based on frequency.

Required range: -2 <= x <= 2
presence_penalty
number
default:0

Penalize tokens that have already appeared.

Required range: -2 <= x <= 2
stream
boolean
default:false

When enabled, results are streamed back via SSE.

stop

Character sequences that stop generation.

n
integer
default:1

How many completion choices to generate for each input message.

Required range: x >= 1
response_format
object

Specify the model output format. Set {"type": "json_object"} to enable JSON mode.

tools
object[]

A list of tools the model can call. Currently only functions are supported.

tool_choice

Controls which tool the model calls.

user
string

A unique identifier representing the end user.

Response

Reply generated successfully

id
string
required
Example:

"chatcmpl-abc123"

object
string
required
Example:

"chat.completion"

created
integer
required

Unix timestamp

model
string
required
Example:

"gpt-5.1-chat-latest"

choices
object[]
required
usage
object