Skip to main content
POST
Create a chat completion

Authorizations

Authorization
string
header
default:YOUR_API_KEY
required

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

Body

application/json
model
string
required
Example:

"glm-5.3-abliterated"

messages
object[]
required
max_tokens
integer

When omitted: the model's max output, else its context window minus the prompt. Clamped to the credit reservation.

max_completion_tokens
integer

Alias of max_tokens.

stream
boolean
default:false
tools
object[]

OpenAI function-calling tools. Counted toward the input-token reservation.

tool_choice
object

Passed through to the model.

response_format
object

Passed through to the model.

stream_options
object

e.g. {"include_usage": true}.

reasoning_effort
enum<string>

Model-card reasoning effort. effort is an alias. Other levels are rejected. off disables reasoning. Omitted requests on a model marked thinking-off run with reasoning off. Other models default to low.

Available options:
off,
low,
high,
max

Response

Chat completion (object) or event stream when stream=true

id
string
required
object
string
required
Example:

"chat.completion"

created
integer
required
model
string
required

Always echoes your public model id.

choices
object[]
required
usage
object
required