Skip to main content
POST
Create a chat completion (OpenAI-compatible)

Authorizations

Authorization
string
header
required

Gateway API key (imp-rt-...) from POST /v1/accounts or /v1/keys.

Body

application/json
model
string
required
Example:

"openai/gpt-4o-mini"

messages
object[]
required
stream
boolean
default:false
stream_options
object
temperature
number
top_p
number
max_tokens
integer
max_completion_tokens
integer
tools
object[]

Function tools the model may call (relay mode — the gateway does not execute them).

tool_choice

auto, none, required, or { type: function, function: { name } }.

Available options:
auto,
none,
required
parallel_tool_calls
boolean
reasoning_effort
enum<string>

Translated to model and route-specific reasoning controls. A level the model lacks moves to the nearest one it has (ties to the lower), so max runs at the model's highest level. A model's reasoning field on GET /v1/models lists the levels that make a difference; the x-impossibl-reasoning response header reports what was applied.

Available options:
none,
minimal,
low,
medium,
high,
xhigh,
max
service_tier
enum<string> | null

Processing tier. Omitted, null, auto and default are standard processing at the model's normal rates. ultrafast is OpenAI's low-latency tier, available only for openai/gpt-6-astra and openai/gpt-6.1-sol: it is served only by OpenAI's own API (never another host, never a silent fallback to standard) and billed at Ultrafast rates. fast uses native Anthropic only for anthropic/claude-opus-5-5, billed at Fast rates; Foundry pins conflict with Fast. priority and flex return 400. See the Speed tiers guide.

Available options:
auto,
default,
ultrafast,
fast
cache_control
object

Request-level Anthropic prompt-caching breakpoint. The gateway places one breakpoint on the last cacheable block and advances it as the conversation grows. A per-part cache_control anywhere in the request takes precedence and this is ignored. Non-Anthropic routes cache implicitly and ignore it.

Response

A chat.completion object. When stream: true, the body is instead an SSE stream of chat.completion.chunk objects terminated by data: [DONE].

Non-streaming chat completion (OpenAI chat.completion).

id
string
Example:

"chatcmpl-..."

object
string
Allowed value: "chat.completion"
created
integer

Unix seconds

model
string
Example:

"openai/gpt-4o-mini"

choices
object[]
usage
object

OpenAI-style token usage.

service_tier
string | null

Present only when the request set service_tier: the tier the provider reports it actually processed the request at: fast or standard for Anthropic, ultrafast or default for OpenAI. A confirmed standard downgrade is billed at standard rates. null when unreported; missing or unknown metadata bills the requested premium tier. Any reported string is preserved verbatim, including unknown values. The gateway never invents a delivered tier.