Create Chat Completion
Last updated September 1, 2026
An OpenAI Chat Completions compatible endpoint for any model that supports this protocol.
This endpoint is compatible with OpenAI Chat Completions. Keep using the official SDKs and point base_url and your API key to Amux.
The table below covers the main request parameters, including accepted ranges, cross-protocol behavior, and any preconditions. Fields not called out individually are usually preserved on same-protocol direct routes, but may not survive cross-protocol conversion or platform-side filtering.
https://gateway.amux.ai/v1/chat/completionsAuthorization
headerAuthorizationstringRequiredBearer <your Amux key> An Amux key created in the console. If you lose it, you can view it again on the keys page.
Content-TypestringRequiredDefault "application/json"Always application/json.
anthropic-betastringAnthropic beta feature switch. Not supported on this endpoint — it is not forwarded even when the request is converted and routed to an Anthropic upstream. Use /v1/messages if you need it.
Request
application/jsonmodelstringRequiredCanonical ID shaped like vendor/model. The colon suffix does one of two things: :provider pins one provider (anthropic/claude-opus-5:anthropic; a pinned provider that fails means the request fails, with no automatic failover), and :@strategy chooses the ordering for this call (:@price / :@latency / :@throughput / :@reliability / :@balanced). They cannot be combined — see the overview for what each means.
messagesarray<object>RequiredThe conversation messages. The system and developer roles are equivalent; the latter is OpenAI's alias for reasoning models.
›messagesarray<object>
role"system" | "developer" | "user" | "assistant" | "tool"RequiredThe role of the message author.
contentstringRequiredMessage content. Multimodal models also accept an array whose items look like { type: "text" | "image_url" }; which modalities a given model supports is listed in that manufacturer's parameter reference.
max_tokensintegerMaximum tokens to generate. Values above the model's ceiling are clamped to it, and the adjustment is recorded in the conversion notes.
max_completion_tokensintegerSame as max_tokens; the field name newer OpenAI models use. If both are given, this one wins.
temperaturenumberSampling temperature, 0–2. Clamped to 1 when the upstream speaks Anthropic (its ceiling); the clamp is recorded in the conversion notes.
top_pnumberNucleus sampling. Pick this or temperature; the vendors recommend against tuning both.
nintegerHow many candidates to generate. Not carried across protocols — the other three have no equivalent. On same-protocol requests the upstream decides.
streambooleanDefault falseReturn an SSE stream. Usage arrives in the final data chunk.
stream_optionsobjectStreaming options. With include_usage: true, the client receives a final usage-only chunk. include_obfuscation pads streaming deltas with random bytes and is passed through to upstreams that support it.
›stream_optionsobject
include_usagebooleanWhether the client should receive the final usage-only chunk. The platform may request usage upstream for internal billing, but it does not expose extra usage-only tail chunks to clients that did not ask for them.
include_obfuscationbooleanPads streaming deltas with random bytes to weaken packet-length side channels. Passed through to upstreams that support it.
stopstring | array<string>Stop sequences — a bare string for one, an array for several, at most 4. Gemini allows 5 and Anthropic has no cap; going the other way truncates and records a note. The newest reasoning models (o3, o4-mini and the like) reject this parameter; that is an upstream limitation.
presence_penaltynumberPresence penalty, -2 to 2. Anthropic and Responses have no equivalent, so it is dropped with a note.
frequency_penaltynumberFrequency penalty, -2 to 2. Same as above.
logit_biasobjectPer-token bias map. Chat-only; not carried across protocols by default.
logprobsbooleanReturn token log probabilities. Not carried across protocols.
top_logprobsintegerHow many alternatives to return per position; requires logprobs. Not carried across protocols.
response_formatobjectJSON output constraint. On Gemini upstreams it becomes responseMimeType + responseJsonSchema. Anthropic has no equivalent, so it does not apply on that link — structured output there means defining a tool and forcing a call to it.
›response_formatobject
type"text" | "json_object" | "json_schema"text constrains nothing; json_object only guarantees valid JSON; json_schema enforces the schema you supply.
json_schemaobjectThe schema itself when type is json_schema: { name, schema, strict }. Converts into responseJsonSchema for Gemini.
seedintegerSampling seed. Gemini has an equivalent; Anthropic and Responses do not.
toolsarray<object>Callable tools, shaped { type: "function", function: { name, description, parameters } }. The four protocols shape tools differently; cross-protocol requests are rewritten for you.
tool_choicestringauto / none / required, or { type: "function", function: { name } } to force one. All four protocols have matching values and are mapped automatically.
parallel_tool_callsbooleanWhether the model may issue several tool calls at once. On Anthropic it is inverted into tool_choice.disable_parallel_tool_use; Gemini has no such switch. Only sent when tools is present, otherwise the upstream rejects the whole request.
reasoning_effort"none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max"Reasoning effort level. The accepted values follow the model generation; the list here is the union. minimal belongs to GPT-5.4 / 5.5 and is gone from GPT-5.6 on; xhigh and max are the reverse, 5.6 and later only. none means no reasoning at all. Passing a level a given model does not know is rejected upstream — we do not gate it.
none is translated into each vendor's "thinking off": no thinking block for Anthropic, thinkingBudget: 0 for Gemini. The other levels convert to thinking.budget_tokens for Anthropic and to thinkingLevel for Gemini.
userstringEnd-user identifier, used upstream for abuse detection. Written to metadata.user_id for Anthropic. It also drives session affinity: passing it keeps one conversation on one provider, which is what makes prompt caching hit.
OpenAI is replacing it with safety_identifier plus prompt_cache_key. We accept both and user keeps working; but if you have already moved to safety_identifier, switch session affinity to prompt_cache_key — safety_identifier is passed through untouched and takes no part in routing.
prompt_cache_keystringSession key, taking precedence over user. Requests sharing a value are routed to the same provider so the upstream prompt cache hits. Without it we infer the session from the system prompt and the first message.
metadataobjectFree-form key/value pairs passed through to the upstream.
storebooleanWhether the upstream should retain this conversation. Passed through unchanged; we do not retain request bodies ourselves.
service_tier"auto" | "default" | "flex" | "scale" | "priority" | "fast"Service tier. Not supported — we forward it to no upstream, on either path. Sending it is not an error. What was stripped is reported back: amux.droppedParams in the body, or the x-amux-dropped-params header when streaming.
verbosity"low" | "medium" | "high"Output verbosity, available from the GPT-5 family on. Written to text.verbosity for Responses (different place, same thing). Anthropic and Gemini have no equivalent, so it is dropped there with a note.
safety_identifierstringEnd-user identifier; OpenAI uses it in place of user for abuse detection. Passed through unchanged, not carried across protocols by default — the other vendors have no equivalent field.
Note that it takes no part in session affinity: sending only this and no prompt_cache_key lets one conversation land on different providers, and the upstream prompt cache misses every time.
prompt_cache_optionsobjectExplicit prompt-cache breakpoints. Supported on gpt-5.6 and later only; earlier models use prompt_cache_retention instead. Under mode: explicit you place the breakpoints with prompt_cache_breakpoint; implicit (the default) lets the upstream pick one. Passed through unchanged, not carried across protocols by default.
›prompt_cache_optionsobject
ttl"30m"How long a cache entry survives. Only 30m is accepted today.
mode"implicit" | "explicit"implicit (default) lets the upstream pick a breakpoint; under explicit you place them yourself with prompt_cache_breakpoint.
prompt_cache_retention"in_memory" | "24h"How long prompt cache entries survive. in_memory is minutes to an hour, 24h keeps them up to a day. This is the field for models before gpt-5.6; 5.6 and later use prompt_cache_options. Passed through unchanged, no effect on pricing, not carried across protocols by default.
predictionobjectPredicted Outputs, { type: "content", content }. Cuts latency noticeably when most of the output is known ahead of time (editing a few lines in a file). Passed through unchanged, not carried across protocols by default.
web_search_optionsobjectBuilt-in web search, { user_location, search_context_size }. Passed through to upstreams that support it, not carried across protocols by default — the built-in tools have entirely different shapes per vendor and do not map onto one another.
moderationobjectModeration configuration, { model, policy }. Passed through unchanged, not carried across protocols by default.
Response
200responseInference succeeded. model comes back as the canonical ID — the same value you sent.
402responseInsufficient balance. These are never retried and never count against any provider's health.
On models and protocols
This endpoint can call any model that supports the protocol, not just OpenAI models. Each model page lists the entry protocols actually available for that model.
Unsupported combinations fail with a clear error. They are never silently rerouted to another entry point.
Errors
Errors come back in OpenAI's error shape. The type values and their retry semantics are in errors and retries.
curl https://gateway.amux.ai/v1/chat/completions \
-H "Authorization: Bearer $AMUX_API_KEY" \
-H "Content-Type: application/json" \
-H "anthropic-beta: <value>" \
-d '{
"model": "anthropic/claude-opus-5",
"messages": [
{
"role": "user",
"content": "Hello!"
}
]
}'{
"id": "chatcmpl-8f3c1a",
"object": "chat.completion",
"model": "anthropic/claude-opus-5",
"choices": [
{
"index": 0,
"message": {
"role": "user",
"content": "Hello!"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0
}
}