from openai import OpenAI
client = OpenAI(base_url="https://gateway.weflayr.com/v1", api_key="<WEFLAYR_API_KEY>")
response = client.responses.create(
model="claude-opus-5-5",
instructions="Answer in one sentence.",
input="Hello",
max_output_tokens=256,
extra_headers={"x-weflayr-metadata": '{"feature_name": "support-chat"}'},
extra_body={"weflayr": {"customer_name": "acme", "call_name": "answer_question"}},
)
const OpenAI = require('openai');
const client = new OpenAI({ baseURL: 'https://gateway.weflayr.com/v1', apiKey: '<WEFLAYR_API_KEY>' });
const response = await client.responses.create(
{
model: 'claude-opus-5-5',
instructions: 'Answer in one sentence.',
input: 'Hello',
max_output_tokens: 256,
weflayr: { customer_name: 'acme', call_name: 'answer_question' },
},
{ headers: { 'x-weflayr-metadata': JSON.stringify({ feature_name: 'support-chat' }) } },
);
curl https://gateway.weflayr.com/v1/responses \
-H "Authorization: Bearer $WEFLAYR_API_KEY" \
-H "Content-Type: application/json" \
-H 'x-weflayr-metadata: {"feature_name": "support-chat"}' \
-d '{
"model": "claude-opus-5-5",
"instructions": "Answer in one sentence.",
"input": "Hello",
"max_output_tokens": 256,
"weflayr": {"customer_name": "acme", "call_name": "answer_question"}
}'
{
"id": "resp_6b1f0d2c8e4a4f7b9c3d5e1a2b4c6d8e",
"object": "response",
"created_at": 1792051200,
"status": "completed",
"model": "claude-opus-5-5",
"output": [
{
"type": "message",
"role": "assistant",
"content": [{"type": "output_text", "text": "Hello! How can I help you today?", "annotations": []}]
}
],
"usage": {"input_tokens": 14, "output_tokens": 12, "total_tokens": 26}
}
Gateway
Responses
Call any model of any provider with the OpenAI Responses format.
POST
/
v1
/
responses
from openai import OpenAI
client = OpenAI(base_url="https://gateway.weflayr.com/v1", api_key="<WEFLAYR_API_KEY>")
response = client.responses.create(
model="claude-opus-5-5",
instructions="Answer in one sentence.",
input="Hello",
max_output_tokens=256,
extra_headers={"x-weflayr-metadata": '{"feature_name": "support-chat"}'},
extra_body={"weflayr": {"customer_name": "acme", "call_name": "answer_question"}},
)
const OpenAI = require('openai');
const client = new OpenAI({ baseURL: 'https://gateway.weflayr.com/v1', apiKey: '<WEFLAYR_API_KEY>' });
const response = await client.responses.create(
{
model: 'claude-opus-5-5',
instructions: 'Answer in one sentence.',
input: 'Hello',
max_output_tokens: 256,
weflayr: { customer_name: 'acme', call_name: 'answer_question' },
},
{ headers: { 'x-weflayr-metadata': JSON.stringify({ feature_name: 'support-chat' }) } },
);
curl https://gateway.weflayr.com/v1/responses \
-H "Authorization: Bearer $WEFLAYR_API_KEY" \
-H "Content-Type: application/json" \
-H 'x-weflayr-metadata: {"feature_name": "support-chat"}' \
-d '{
"model": "claude-opus-5-5",
"instructions": "Answer in one sentence.",
"input": "Hello",
"max_output_tokens": 256,
"weflayr": {"customer_name": "acme", "call_name": "answer_question"}
}'
{
"id": "resp_6b1f0d2c8e4a4f7b9c3d5e1a2b4c6d8e",
"object": "response",
"created_at": 1792051200,
"status": "completed",
"model": "claude-opus-5-5",
"output": [
{
"type": "message",
"role": "assistant",
"content": [{"type": "output_text", "text": "Hello! How can I help you today?", "annotations": []}]
}
],
"usage": {"input_tokens": 14, "output_tokens": 12, "total_tokens": 26}
}
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 a Gateway API key.
OpenAI fields
The gateway readsmodel, input, instructions, tools, tool_choice, text, reasoning, max_output_tokens, temperature, top_p, parallel_tool_calls, service_tier, user, metadata, stream, stream_options, top_logprobs, include, store, prompt_cache_key, prompt_cache_retention, safety_identifier, max_tool_calls, truncation, previous_response_id, conversation, background and prompt.
previous_response_id, conversation, store: true, prompt, metadata, text.verbosity and most include entries work with OpenAI models only. background: true, n, and built-in tools other than web_search are refused for every model.Weflayr fields
The gateway reads these fields on top of the OpenAI ones and never sends them to the provider. With the OpenAI SDK, pass them inextra_body (Python) or as extra keys of the request object (Node.js).
string
required
A model name, as listed in the model picker of a benchmark (e.g.
claude-opus-5-5, gpt-5.6), or a routing strategy id: strategy/<id> for its latest version, strategy/<id>:<version> to pin one.string
Serve the model from this provider only:
alibaba, anthropic, azure, bedrock, google, mistral, openai, spacexai or vertex. Omit to let Weflayr pick one. Not allowed with a routing strategy.string
Serve the model from this region only:
GLOBAL, US, EU, or a provider’s own region (e.g. eu-west-1 on Bedrock). Not allowed with a routing strategy."on_with_warnings" | "on" | "off"
default:"\"on_with_warnings\""
What to do with a parameter the model does not take (e.g.
temperature on a reasoning model): on_with_warnings removes it and lists the change in weflayr_warnings, on removes it silently, off sends the request unchanged.list[string]
Parameters to remove when the model does not take them, even with
self_heal: "off": any of service_tier, temperature, tool_choice, reasoning, cache_breakpoints, parallel_tool_calls.object
Raw provider fields merged into the request sent to the provider, keyed by
common (every provider), an API family (e.g. anthropic_messages, gemini_generate_content) or a provider (e.g. openai).object
What the call is for, shown on your dashboards.
Show properties
Show properties
string
string
The name of this LLM call inside its feature, e.g.
summarize_ticket. A benchmark is set up per call name.{string: string}
Your own dimensions to filter on, e.g.
{"environment": "production"}.boolean
default:"true"
Keep the prompt and the answer. Set
false to keep only tokens, cost and latency. Benchmarks need the content.JSON object
The feature the call belongs to, as
{"feature_name": "support-chat"}. It also takes feature_run_uuid (32 hex characters, to group the calls of one feature run), customer_name, call_name and tags; the body’s weflayr values win over the header’s. The SDKs set this header for you.Response
An OpenAI Response object. Whenself_heal changed the request, the response also carries weflayr_warnings, a list of the changes.
With "stream": true, the gateway answers with OpenAI’s Responses events, from response.created to response.completed. Warnings then come first, in a weflayr.warnings event.
Errors
See Errors.from openai import OpenAI
client = OpenAI(base_url="https://gateway.weflayr.com/v1", api_key="<WEFLAYR_API_KEY>")
response = client.responses.create(
model="claude-opus-5-5",
instructions="Answer in one sentence.",
input="Hello",
max_output_tokens=256,
extra_headers={"x-weflayr-metadata": '{"feature_name": "support-chat"}'},
extra_body={"weflayr": {"customer_name": "acme", "call_name": "answer_question"}},
)
const OpenAI = require('openai');
const client = new OpenAI({ baseURL: 'https://gateway.weflayr.com/v1', apiKey: '<WEFLAYR_API_KEY>' });
const response = await client.responses.create(
{
model: 'claude-opus-5-5',
instructions: 'Answer in one sentence.',
input: 'Hello',
max_output_tokens: 256,
weflayr: { customer_name: 'acme', call_name: 'answer_question' },
},
{ headers: { 'x-weflayr-metadata': JSON.stringify({ feature_name: 'support-chat' }) } },
);
curl https://gateway.weflayr.com/v1/responses \
-H "Authorization: Bearer $WEFLAYR_API_KEY" \
-H "Content-Type: application/json" \
-H 'x-weflayr-metadata: {"feature_name": "support-chat"}' \
-d '{
"model": "claude-opus-5-5",
"instructions": "Answer in one sentence.",
"input": "Hello",
"max_output_tokens": 256,
"weflayr": {"customer_name": "acme", "call_name": "answer_question"}
}'
{
"id": "resp_6b1f0d2c8e4a4f7b9c3d5e1a2b4c6d8e",
"object": "response",
"created_at": 1792051200,
"status": "completed",
"model": "claude-opus-5-5",
"output": [
{
"type": "message",
"role": "assistant",
"content": [{"type": "output_text", "text": "Hello! How can I help you today?", "annotations": []}]
}
],
"usage": {"input_tokens": 14, "output_tokens": 12, "total_tokens": 26}
}