Skip to main content
POST
Create 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
string
required
Example:

"gpt-5.4"

messages
object[]
required
temperature
number

Sampling temperature.

Required range: 0 <= x <= 2
top_p
number

Nucleus sampling probability mass.

Required range: 0 <= x <= 1
max_tokens
integer
deprecated

Deprecated compatibility alias for max_completion_tokens. For Kimi K3, APIAny accepts either field and uses max_completion_tokens.

Required range: x >= 1
max_completion_tokens
integer

Maximum reasoning plus final-answer tokens. Model-specific limits apply; exhausting the budget can leave the answer incomplete. Kimi K3 defaults to 131072 when omitted and supports up to 1048576.

Required range: 1 <= x <= 1048576
reasoning_effort
enum<string>

Reasoning effort. These are syntactic values, not a support guarantee for every model. Supported values vary by model; unsupported values return 400. Kimi K3 supports low, high and max (default max); GPT-5.4/5.5 support none, low, medium, high, xhigh. See /models/chat-models for Claude and Gemini limits. Omission keeps the model default. Per-model levels, defaults and whether reasoning can be disabled are published in GET /v1/models under capability_metadata.reasoning.

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

Up to 4 stop sequences.

n
integer

Number of completions to generate.

Required range: x >= 1
frequency_penalty
number
Required range: -2 <= x <= 2
presence_penalty
number
Required range: -2 <= x <= 2
seed
integer

Best-effort deterministic sampling seed.

response_format
object

Force JSON object or JSON-schema output, e.g. { "type": "json_object" }.

tools
object[]

Tool / function declarations the model may call.

tool_choice

Tool selection: 'auto' | 'none' | 'required' | { type: 'function', function: { name } }.

logprobs
boolean
top_logprobs
integer
Required range: 0 <= x <= 20
logit_bias
object
user
string

End-user identifier for abuse monitoring.

stream
boolean

If true, partial deltas are streamed as server-sent events (OpenAI chat.completion.chunk), terminated by 'data: [DONE]'.

reasoning
object

Compatibility alias for reasoning_effort. When both effort forms are present, their values must match; conflicting values return 400.

Response

OpenAI-compatible chat completion.

id
string
required
object
string
required
Example:

"chat.completion"

created
integer
required
model
string
required
choices
object[]
required
usage
object