Create Chat Completion
Chat
Chat Completions
Create a chat completion
POST
Create Chat Completion
Create Chat Completion
POST /v1/chat/completions
Request Body
string
required
Model to use for completion (e.g.,
gpt-4o, gpt-5.1, claude-sonnet-4-6, deepseek-r1). Append :reasoning-exclude to disable reasoning output for a single request.array
required
Array of message objects forming the conversation.
integer
Maximum number of tokens to generate. Reasoning tokens are billed as output tokens and counted against this limit.
number
Sampling temperature between 0 and 2.
boolean
Enable streaming responses (SSE).
string
Controls reasoning depth on supported models. One of
none, minimal, low, medium, high, xhigh. Silently ignored for models that don’t support reasoning_effort.object
Reasoning configuration object. Supports:
reasoning.effort— same enum asreasoning_effort.reasoning.exclude(boolean) — strip reasoning from the response entirely.reasoning.delta_field—"reasoning"or"reasoning_content"; overrides the streaming/non-streaming field name regardless of which endpoint variant was hit.
string
Shorthand for
reasoning.delta_field. Accepts "reasoning" or "reasoning_content".boolean
Shorthand: set to
true to force the legacy reasoning_content field, equivalent to reasoning.delta_field = "reasoning_content".Endpoint Variants (Reasoning Output)
Some models emit a separate reasoning / thinking stream in addition to the final answer. Three base paths control how that stream is surfaced — all of them accept the same request shape and model names.
Per-request overrides (
reasoning.delta_field, reasoning_delta_field, reasoning_content_compat) take precedence over the endpoint default. If a model does not emit reasoning, these fields are simply absent from the response.
Streaming output shape
When reasoning is delivered as a separate field, deltas are interleaved — reasoning chunks come first, followed by content chunks:/v1legacy/chat/completions the same deltas use delta.reasoning_content instead of delta.reasoning.
Against /v1thinking/chat/completions everything appears in delta.content:
Non-streaming output shape
reasoning becomes reasoning_content on /v1legacy/. On /v1thinking/, the reasoning stays embedded inside content ("<think>...</think>The answer...") and no separate field is emitted.
Disabling Reasoning Output
Reasoning can be hidden in three equivalent ways — the model still pays the cost for reasoning compute, but the tokens are stripped from the response:- Request body:
{ "reasoning": { "exclude": true } } - Model suffix:
"model": "deepseek-r1:reasoning-exclude" - Request body:
{ "reasoning_effort": "none" }(only honored on OpenAI-shaped models — safely ignored elsewhere for API parity).
reasoning field nor <think> tags appear in the response, regardless of which endpoint variant was hit.
Example
Streaming
Enable real-time responses with streaming:Function Calling
Use function calling for tool integration:Authorizations
Enter your API key (starts with 'ek-')
Body
application/json
Model to use for completion
Example:
"gpt-4o"
List of messages
Enable streaming
Maximum tokens to generate
Sampling temperature
Required range:
0 <= x <= 2Nucleus sampling
Required range:
0 <= x <= 1Top-k sampling
Required range:
-2 <= x <= 2Required range:
-2 <= x <= 2List of tools
Available options:
none, auto Enable web search
- Option 1
- Option 2
Reasoning effort level. Silently ignored for models that do not support reasoning_effort, so clients can send a single shared request across providers.
Available options:
none, minimal, low, medium, high, xhigh Reasoning configuration. Per-request override for reasoning output behavior.
Shorthand for reasoning.delta_field.
Available options:
reasoning, reasoning_content Shorthand: set to true to force the legacy reasoning_content field, equivalent to reasoning.delta_field = "reasoning_content".
