Skip to main content
POST
The body is an OpenAI Responses 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 or A/B test 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.
string
required
The prompt: a text, or a list of input items as the OpenAI Responses API writes them. 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.
string
The system prompt, placed before input.
object[]
The tools the model may call: function tools (type: "function", name, description, parameters, strict) and the built-in web_search tool.
string
auto, required or none, a function to call ({"type": "function", "name": "..."}), or {"type": "web_search"} to make the model search the web.
object
The answer’s format.
object
How much the model thinks before it answers. Through a routing strategy, its effort wins over the effort the strategy sets.
integer
The most tokens the answer can have, reasoning tokens included.
number
The sampling temperature.
number
Nucleus sampling: the model samples among the tokens making up this share of the probability.
boolean
Whether the model may call several tools in one turn.
string
auto, default, flex, priority or ultrafast. flex, priority and ultrafast keep only the providers that offer that tier.
string
An id of your end user, passed to the provider.
object
Up to 16 key-value pairs stored with the response by the provider.
boolean
default:"false"
true streams the answer as server-sent events (see Response).
object
include_obfuscation: false leaves out the padding OpenAI adds to each streamed event.
integer
The number of most likely tokens to return at each position, with their log probabilities. Needs message.output_text.logprobs in include.
string[]
Extra data to return in the response, such as message.output_text.logprobs or reasoning.encrypted_content.
boolean
Whether the provider stores the response, so a later request can name it in previous_response_id. Some providers (Meta and DeepSeek today) are always called with store: false: a request routed to one is refused with a 400 naming the field when it sets store: true or another field that provider does not serve.
string
The id of a stored response to continue from, in place of sending the earlier turns in input.
string
The provider’s conversation this response belongs to: its id, or {"id": "..."}.
object
A prompt template stored at the provider, with its id, version and variables.
string
A key grouping requests that share a prompt prefix, to improve prompt cache hits. Used by OpenAI, Azure, xAI, Meta, 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 response.
string
auto drops the earliest input items when the prompt is longer than the model’s context, disabled (the default) refuses it.
boolean
Only false is accepted: the gateway does not run responses in the background.

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. A request body of 4 MiB or more is answered with a 503 large_requests_overloaded and a Retry-After header when other large bodies take all the memory the gateway reserves for them and none frees up within 5 seconds. Smaller requests are never refused for this reason. A request sent without a Content-Length header (chunked) counts for the bytes the gateway has read of it so far, once they reach 4 MiB. Such a body, and any chunked one, must be received within 10 seconds plus 1 second per MiB (of its Content-Length, or of the bytes received so far when chunked), or the request is answered with a 408 request_body_too_slow.

Response

An OpenAI Response 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. An answer an Anthropic model stopped because the prompt and the answer filled its context window has "status": "incomplete" and "incomplete_details": {"reason": "model_context_window_exceeded"} (finish_reason: "model_context_window_exceeded" on Chat Completions). The gateway adds these fields to the answer, in the same format as OpenRouter.
number | null
What Weflayr bills the call, in USD: the cost of its tokens, or the Weflayr fee when the call was made with your own provider key. null when the gateway could not price the call.
boolean
Whether the call was made with your own provider key.
object | null
The token cost at the provider’s prices, in USD. The Responses API names the fields input and output instead of prompt and completions. null when usage.cost is.
object
The provider, model and region that answered the call, e.g. {"provider": "anthropic", "model": "claude-opus-5-5", "region": "GLOBAL"}.
With "stream": true, the gateway answers with OpenAI’s Responses events, from response.created to response.completed. Warnings are then the weflayr_warnings field of the response that response.created, response.in_progress and response.completed (or response.incomplete) carry. The usage, with its cost, and weflayr_deployment are in the response of response.completed (or response.incomplete). A stream the provider cuts short ends with an error event instead, which carries neither.

Errors

See Errors.