Shape
scopes
adds one organization, one team, or one project.
Model tiers
A client can send a tier name in themodel field. The policy maps
the tier name to a model. When you move to a newer model, you change
the policy. The client code does not change.
The gateway knows three tier names:
The client sends the tier name where a model name goes:
defaultModel. A tier without a model and without defaultModel is
not a known name. The gateway refuses a request that sends it.
defaultModel applies only to the three tier names. A model name
with a typo in it still gets a refusal. The gateway does not put the
default model in its place.
Write a full model id, for example openai/gpt-5-mini. Do not write
a name that changes over time, for example openai/latest. The
gateway reads the value as one literal model name, so it would call
a model named latest. The app refuses to save such a name.
GET /v1/models lists each tier that has a model. The tier shows in
a model picker with the other names. If you set defaultModel, the
list has all three tiers. A tier without a model and without
defaultModel is not in the list, because the gateway refuses it.
Model name mapping
modelAliases also maps usual model names. Use it to point an old
name to its replacement. Use it to give a model the name your teams
already use.
Restrictions
policyRules has four groups of patterns. Each group has a deny
list and an allow list.
tools: the name of each tool in the request.mcp: the name and the address of each MCP server in the request.urls: each address in the request. This includes messages, system prompts, and tool arguments.models: the model that the request resolves to.
models group after the name mapping. A
mapping cannot go around it.
Provider order
modelProviderIds is an ordered list. The gateway tries the first
provider. If the request fails in a way that a different provider
can answer, the gateway tries the next one.
The gateway does not call a provider that cannot serve the model. A
chain across two vendors only moves over for models that the two
vendors serve. To give one model a backup, map its name to a model
from each vendor, or point a tier to a model from each vendor.
The gateway also removes a provider that the key cannot reach. This
occurs, for example, when an admin removes the provider from the
key’s scope.
A model name that contains a provider, for example
openai/gpt-5-mini, runs only on that provider. If the key cannot
reach the provider, the gateway refuses the request. It does not
send the request to a different vendor. A tier or a mapping that
points to a removed provider gets the same refusal, and
GET /v1/models stops listing it.
Defaults
One policy in each scope can be the default. When you make a policy the default, the app clears the flag on the other policies in the same scope. This occurs in one step. Two policies are never both the default for one scope. A key routes through the policy that it names. The default policy is the one the app offers first when someone makes a key in that scope.Manage in the app
Open AI Gateway → Routing Policies. The page lists your policies by where they apply. Select New policy, or open the actions menu on a policy and select Edit. In the editor you can:- Give the policy a name and a description.
- Select where it applies.
- Select the providers and put them in order.
- Select a model for each tier, and a default model.
- Map other model names.
- Add restrictions.
Manage with tRPC
create, update, setDefault, and delete need the
routingPolicies:manage permission. list, get, and
tierSuggestions need routingPolicies:view.
Keys that name no policy
A key that names no policy uses its own routing mode.NONE sends
the request to one provider and returns that provider’s answer.
FALLBACK_ALL tries the providers that the key can reach, in a set
order.
To move a key to a policy:
- Make a policy with the providers that the key uses.
- Set the key’s routing policy.
- Send a request. Make sure that it reaches the provider you expect.