Skip to main content
POST
The body is an OpenAI Chat Completions request, whatever the provider: the gateway translates it for Anthropic, Google, Bedrock, Mistral and the others, and answers in OpenAI’s format. Point any OpenAI client at https://gateway.weflayr.com/v1 with an API key with the Gateway scope.

Request body

string
required
A model name (e.g. claude-opus-5-5, gpt-6-luna), as GET /v1/models lists them, or a routing strategy slug: strategy/<slug> for its latest version (strategy/<slug>:latest is the same), strategy/<slug>:<version> to pin one. Any other text after the : returns a 400 invalid_routing_strategy_version. Do not prefix the name with the provider (openai/gpt-6-luna is not found): set provider instead. A list of model names is tried in order (see fallback); a routing strategy cannot be in a list.
object[]
required
The conversation, as the OpenAI Chat Completions API writes it. A content part can mark a cache breakpoint with Anthropic’s cache_control or OpenAI’s prompt_cache_breakpoint, whatever the model: the gateway writes it the way the provider reads it.
integer
The most tokens the answer can have, reasoning tokens included. The deprecated max_tokens is read too; send one or the other.
number
The sampling temperature.
number
Nucleus sampling: the model samples among the tokens making up this share of the probability. Removed by self-heal on models that refuse it, such as Claude Opus 4.7 and later.
integer
The model samples among this many most likely tokens. Removed by self-heal on OpenAI, Azure and xAI, which have no such field.
string
Text, or a list of texts, that ends the answer when the model writes it. Removed by self-heal on OpenAI, Azure and xAI.
number
Lowers the odds of tokens already in the answer. Removed by self-heal on OpenAI, Azure, xAI, Anthropic and Bedrock, like frequency_penalty.
number
Lowers the odds of tokens by how often they already appear in the answer.
integer
Makes sampling repeatable where the provider supports it. Removed by self-heal on OpenAI, Azure, xAI, Anthropic and Bedrock.
integer
default:"1"
The number of answers to write. Above 1, removed by self-heal on OpenAI, Azure, xAI, Anthropic and Bedrock.
boolean
true returns the log probability of each answer token. Removed by self-heal on Anthropic, Bedrock and xAI.
integer
The number of most likely tokens to return at each position, with their log probabilities. Needs logprobs: true.
object[]
The function tools the model may call (type: "function", with its name, description, parameters and strict).
string
auto, required or none, or a function to call ({"type": "function", "function": {"name": "..."}}).
boolean
Whether the model may call several tools in one turn.
object
Lets the model search the web (search_context_size, user_location), on the providers that run a web search.
object
{"type": "text"}, {"type": "json_object"}, or {"type": "json_schema", "json_schema": {"name": "...", "schema": {...}, "strict": true}} for a structured output.
string
none, minimal, low, medium, high, xhigh or max. A level the model does not take is replaced with the closest one it does if self-heal is on. Send it or reasoning, not both. Through a routing strategy, it wins over the effort the strategy sets.
object
How much the model thinks before it answers, with more control than reasoning_effort.
string
auto, default, flex or priority. flex and priority keep only the providers that offer that tier.
string
An id of your end user, passed to the provider.
boolean
default:"false"
true streams the answer as server-sent events (see Response).
object
include_usage: true adds a last chunk with the token usage. include_obfuscation: false leaves out the padding OpenAI adds to each streamed chunk.
string
A key grouping requests that share a prompt prefix, to improve prompt cache hits. Used by OpenAI, Azure, xAI, Mistral and the Bedrock models called through their Responses API (e.g. some of OpenAI’s or Kimi K3). Claude, Gemini and the other Bedrock models refuse it. Without one, the gateway sends these providers a key of its own per organization and model.
string
in_memory or 24h: how long OpenAI keeps the cached prompt prefix. Sent to OpenAI, Azure and Bedrock’s Responses API models; with self-heal on, removed for Claude, Gemini, the other Bedrock models and xAI, which have no such field. To set a lifetime on any model taking cache breakpoints, use the breakpoint’s ttl: self-heal moves it to the closest lifetime the provider offers.
object
{"mode": "explicit"} turns off GPT-5.6+‘s implicit cache, so only your breakpoints are cached. Sent and removed like prompt_cache_retention.
string
A stable id of your end user, hashed, which the provider uses to detect abuse.
integer
The most built-in tool calls the model can make in one answer.
string
auto drops the earliest messages when the prompt is longer than the model’s context, disabled (the default) refuses it.

Cache breakpoints

Mark cache breakpoints with OpenAI’s prompt_cache_breakpoint (with an optional ttl): it works on every provider, for every model that takes cache breakpoints, such as Claude, GPT-5.6 and later, Kimi, Qwen, GLM and Nova. Anthropic’s cache_control is accepted too. With self-heal on, the gateway removes the breakpoints on a model where they write no cache, and replaces a ttl the provider does not offer with the closest one it does: 5m or 1h on Claude, 30m or 12h on OpenAI and Azure.

Response

An OpenAI Chat Completion object. When the gateway changed the request or a routing strategy setting, or moved the request to another deployment, the response also has weflayr_warnings, the list of changes. With "stream": true, the gateway answers with OpenAI’s server-sent events, ending with data: [DONE]. Warnings then come first, in a chunk with no choice.

Errors

See Errors.