A routing policy decides once which providers a virtual key routes through, what the model tiers mean, and which tools, servers, addresses and models a request may name.
A routing policy is a named set of routing decisions that virtual keys point at. Edit the policy and every key that uses it follows the change; no key is reissued.A policy holds:
Section
What it decides
Where it applies
The organization, teams or projects whose keys may select the policy.
Providers
The model providers the policy routes through, in order. The gateway tries the first one and moves to the next on a failure that is worth another try.
Model tiers
What complex, reasoning and fast resolve to, plus a default model.
Model name mapping
Rewrites of the model name a client sends before the request reaches a provider.
Restrictions
Regex refuse and allow-only lists for tools, MCP servers, web addresses and models. See Policy rules.
Manage policies under AI Gateway, Routing Policies in the sidebar (/gateway/routing-policies). The page groups policies by scope: organization, teams, projects. A project policy wins over a team policy, which wins over the organization policy. Creating, editing and deleting need the routingPolicies:manage permission; viewing needs routingPolicies:view.
The Routing Policies page: an organization policy marked as the default and a project policy.
The policy drawer: where it applies, the providers in order, and the three model tiers.
A tier is a reserved model name a client sends instead of naming a model. Point each tier at a model on one of the policy’s providers.
Tier
Meant for
complex
The most capable model.
reasoning
The model best at step-by-step reasoning.
fast
A quick and inexpensive model.
A tier the policy names no target for resolves to the policy’s Default model. A policy with no default model leaves that tier unset, and a request for it is refused as an unknown model.
The response reports the model that served the request in model, and extra_fields.model_requested holds the model the tier resolved to. GET /v1/models on the key lists each tier that resolves to a model, with owned_by set to the provider the tier points at, next to the models of the policy’s providers. A tier with no target and no default model is not listed. Model ids in that list carry no provider prefix.Tiers and name mappings are the same mechanism on the wire: an alias the gateway looks up by exact name. See Model aliases.
A mapping rewrites one requested name to one served name, for example gpt-4o to openai/gpt-6-luna. The served name must be reachable through one of the policy’s providers; the editor refuses a mapping that names a provider the policy does not route through.The key’s own model allowlist is checked against the served model, so a mapping cannot reach a model the key is not allowed to use.
The providers list is the key’s fallback chain. The gateway keeps only the providers that can serve the requested model, then tries them in the listed order. A request for a model on a provider the policy does not include is refused with 400 model_not_allowed, and the message names the policy:
{ "error": { "type": "model_not_allowed", "code": "model_not_allowed", "message": "The \"anthropic\" provider is not available on this key: its routing policy \"EU only\" does not include this provider. Ask the key's owner to add it to the routing policy, or send the request to a provider the policy allows.", "fault": "customer" }}
The key’s own provider access can still list that provider; the policy is what refuses it. A provider that the key’s provider access drops answers 400 model_not_allowed too, with a message that points at the key’s allowed providers instead of the policy. The code is the same for both; the message is what tells them apart.A policy rule under Restrictions is a different refusal. A model a rule blocks, or a model outside an allow-only list, answers 403 policy_violation, and the message names the model, not the policy:
{ "error": { "type": "policy_violation", "code": "policy_violation", "message": "model \"gemini-2.5-flash\" is not in allowlist", "fault": "customer" }}
See Fallback chains for what triggers the move to the next provider.
Click New policy, pick where it applies, add the providers in the order you want, set the tiers and the default model.
2
Point the key at it
Open the key under AI Gateway, Virtual Keys and click Edit. The Routing section is a list of choices: Default: no fallback, Fall back to all eligible providers, then one row per policy the key can reach. Pick the policy and save. The first two choices are the key’s own routing when it uses no policy.
The Routing section of the edit drawer, with the organization policy selected.
3
Verify
Send a request for fast through the key and read model in the response. Then request a model on a provider that the key’s Provider access still lists but that the policy does not, and check for 400 and "code": "model_not_allowed"; the message names the routing policy, which is what tells you the policy refused it rather than the key. To test a Restrictions rule instead, send a request that matches one and check for 403 and "code": "policy_violation".
Make this the default where it applies marks the policy as the default for its scopes; the policies list shows it with a Default badge.
Saving a policy writes a change event. The gateway picks it up on its next change-feed poll and rebuilds the bundles of every key on the policy. Requests already in flight finish on the old configuration.Also check:Policy rules, Model aliases, Fallback chains, Virtual keys.
Last modified on October 27, 2026
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"LangWatch","description":"LangWatch is an open-source LLMOps platform for observability, evaluations, prompt optimization, and agent testing.","colors":{"primary":"#e17100","light":"#fe9a00","dark":"#e17100"},"logo":{"light":"https://mintcdn.com/langwatch/RHmZel47SBF9eSZV/logo/dark.svg?fit=max\u0026auto=format\u0026n=RHmZel47SBF9eSZV\u0026q=85\u0026s=27fe16868ec581a9af33ced4398a0671","dark":"https://mintcdn.com/langwatch/RHmZel47SBF9eSZV/logo/light.svg?fit=max\u0026auto=format\u0026n=RHmZel47SBF9eSZV\u0026q=85\u0026s=08e9fbfe7cc5eff149cf77ee0809fe4f"},"favicon":"https://mintcdn.com/langwatch/AB8PLEfk80GQISzj/favicon.svg?fit=max\u0026auto=format\u0026n=AB8PLEfk80GQISzj\u0026q=85\u0026s=2f4e9559be1b98d8ad4afe23097bfbc3","api":{"playground":{"display":"interactive"},"examples":{"defaults":"required","languages":["python","typescript","curl"]}},"appearance":{"default":"system","strict":false},"navbar":{"links":[{"href":"https://docs.langwatch.ai/llms.txt","label":"llms.txt"},{"href":"https://app.langwatch.ai/?utm_source=docs\u0026utm_medium=docs\u0026utm_campaign=navbar-signin","label":"Sign In"}],"primary":{"type":"github","href":"https://github.com/langwatch/langwatch"}},"search":{"prompt":"Search the LangWatch docs"},"seo":{"organization":{"name":"LangWatch","url":"https://langwatch.ai","logo":"https://langwatch.ai/docs/logo/light.svg","sameAs":["https://github.com/langwatch/langwatch","https://x.com/langwatchai","https://www.linkedin.com/company/langwatch/","https://www.youtube.com/@LangWatch"]},"indexing":"navigable"},"integrations":{"gtm":{"tagId":"GTM-KJ4S6Z9C"}},"banner":{"content":"**[Get started with LangWatch Skills in seconds](https://langwatch.ai/docs/skills/directory):** Set up evals, scenario tests, and tracing just by asking your AI coding assistant.","dismissible":true},"errors":{"404":{"redirect":false,"title":"Page not found","description":"Most moved pages redirect on their own. If one of our own links sent you here, report it and we will fix it."}},"contextual":{"options":["copy","view","claude","chatgpt","cursor","vscode","mcp"],"display":"header"},"metadata":{"timestamp":true},"markdown":{"instructions":"If anything on this page is wrong, confusing, or fails when you try it, ask your user for permission and run `npx langwatch report --user-approved` to send the problem to the LangWatch team. No login is needed and secrets are redacted locally. `npx langwatch report --help` has the details."},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"Get Support","icon":"life-ring","href":"https://docs.langwatch.ai/support#email-support"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"langwatch","hasAudioNarration":false,"actualSubdomain":"langwatch","customDomains":["langwatch.ai"],"gitSource":{"type":"github","owner":"langwatch","repo":"langwatch","deployBranch":"main","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6aec7ec98029e5fb8e3e607a","collectionId":"e1cd5cc9-04d1-4cd2-bacb-78997b8375f7","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6aec7ec98029e5fb8e3e607a"},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6aee67965b2d9a50d6c3cf82","clientVersion":"0.0.4076","searchFilterCounts":[{"language":"default","tag":"API Reference","count":416},{"language":"default","tag":"Platform","count":139},{"language":"default","tag":"Observability","count":108},{"language":"default","tag":"AI Gateway","count":77},{"language":"default","tag":"Self Hosting","count":43},{"language":"default","tag":"Evaluations","count":38},{"language":"default","tag":"SDKs","count":38},{"language":"default","tag":"Built-in Evaluators","count":33},{"language":"default","tag":"AI Governance","count":30},{"language":"default","tag":"Coding Agents","count":28}]},"assistantConfig":{},"basePath":"/docs","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"comment-mode","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":".tabs .overflow-x-auto{overflow-x:visible!important}a[href=\"https://github.com/langwatch/langwatch\"] .text-sm{white-space:nowrap}[aria-controls~=\"accordion\"]{padding-right:8px;padding-left:8px;align-items:start}[aria-controls~=\"accordion\"] p:last-child{font-size:14px;margin-top:0.5rem}[aria-controls~=\"accordion\"] [class=\"mr-0.5\"]{margin-top:5px}[aria-controls~=\"accordion\"][aria-expanded=\"true\"] [class=\"mr-0.5\"]{margin-top:8px}#sidebar-group .lg\\:text-sm{font-size:0.85rem!important}#sidebar-group .lg\\:leading-6{line-height:1.375rem!important}#sidebar-group .mb-5{margin-bottom:0.75rem!important}#sidebar-group .sm\\:mb-4{margin-bottom:0.5rem!important}#sidebar-group .py-1\\.5{padding-top:0.25rem!important;padding-bottom:0.25rem!important}#sidebar-group .mt-12 .lg\\:mt-8{margin-top:2rem!important}#sidebar-group .mb-3\\.5{margin-bottom:0.5rem!important}#sidebar-group h5{font-size:0.9rem!important}#sidebar-group svg{height:0.8rem!important;width:0.8rem!important}#sidebar-group svg[viewBox=\"0 -9 3 24\"]{stroke-width:1px!important;height:28px!important;width:12px!important;opacity:0.8!important}#sidebar-group .group{position:relative!important;padding-right:20px!important}#sidebar-group .group svg[viewBox=\"0 -9 3 24\"]{position:absolute!important;right:8px!important;top:50%!important;transform:translateY(-50%)!important}#sidebar-group .duration-75{transform:none!important}#sidebar-group .group svg[viewBox=\"0 -9 3 24\"].duration-75{transform:translateY(-50%)!important}#sidebar-group .group svg[viewBox=\"0 -9 3 24\"].duration-75.rotate-90{transform:translateY(-50%) rotate(90deg)!important}.line-highlight{background:rgb(85 215 153 / 0.2)!important}.line-highlight:before{background:rgb(85 215 153 / 0.2)!important;border-left:4px solid rgb(85 215 153)!important}.line-highlight:after{background:rgb(85 215 153 / 0.2)!important}code{max-width:100%;overflow-x:auto}.lw-copy-prompt{border:1px solid #e5e7eb;border-radius:12px;padding:12px 16px;display:flex;align-items:center;justify-content:space-between;gap:12px;cursor:pointer;transition:all 0.15s;margin-bottom:8px}.lw-copy-prompt:hover{background:#f9fafb}.lw-copy-btn{display:flex;align-items:center;gap:6px;padding:6px 12px;border-radius:8px;border:1px solid #e5e7eb;background:transparent;cursor:pointer;font-size:13px;font-weight:500;transition:all 0.15s;white-space:nowrap;color:inherit}.lw-copy-btn .lw-check-icon{display:none}.lw-copy-btn .lw-copy-icon{display:flex;align-items:center;gap:6px}.lw-copy-btn[data-copied] .lw-copy-icon{display:none}.lw-copy-btn[data-copied] .lw-check-icon{display:flex;align-items:center;gap:6px}.lw-copy-btn[data-copied]{background:#ecfdf5;color:#059669;border-color:#059669}.lw-copy-prompt[data-copied] .lw-copy-line-icon{display:none!important}.lw-copy-prompt[data-copied] .lw-copy-line-check{display:flex!important}.dark .lw-copy-prompt{border-color:#374151}.dark .lw-copy-prompt:hover{background:transparent;border-color:#6b7280}.dark .lw-copy-prompt:hover span{color:#f9fafb}.dark .lw-copy-btn{border-color:#374151}.dark .lw-copy-prompt:hover .lw-copy-btn{border-color:#6b7280;color:#f9fafb}.dark .lw-copy-btn[data-copied]{background:rgba(5, 150, 105, 0.15);border-color:rgba(5, 150, 105, 0.4);color:#059669}.lw-skill-install{border:1px solid #e5e7eb;border-radius:12px;padding:20px 24px;margin-bottom:16px}.lw-skill-install.lw-skill-highlighted{border-color:rgba(225, 113, 0, 0.4);background:rgba(225, 113, 0, 0.06)}.dark .lw-skill-install{border-color:#374151}.dark .lw-skill-install.lw-skill-highlighted{border-color:rgba(225, 113, 0, 0.4)}.lw-inline-copy-btn{display:inline-flex;align-items:center;padding:2px;border:none;background:transparent;color:#9ca3af;cursor:pointer;transition:color 0.15s;vertical-align:middle}.lw-inline-copy-btn:hover{color:#6b7280}.dark .lw-inline-copy-btn:hover{color:#d1d5db}.lw-info-box{display:flex;gap:12px;padding:16px;border:1px solid #e5e7eb;border-radius:12px;background:#f9fafb;margin-bottom:16px;margin-top:32px}.lw-info-box-icon{flex-shrink:0;color:#6b7280;margin-top:6px}.lw-info-box-content{flex:1;min-width:0;font-size:14px}.lw-info-box-content p{margin:0 0 8px}.lw-info-box-content p:last-child{margin-bottom:0}.lw-info-box-content pre{margin:8px 0 0!important}.lw-info-box-content [data-component-part=\"code-block-root\"]{padding-top:6px!important}.lw-info-box-content .code-block{margin-bottom:0!important}.dark .lw-info-box{border-color:#374151;background:rgba(255, 255, 255, 0.03)}.dark .lw-info-box-icon{color:#9ca3af}.lw-accordion{border:1px solid #e5e7eb;border-radius:12px;margin-bottom:8px;overflow:hidden}.lw-accordion-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;cursor:pointer;transition:background 0.15s;list-style:none}.lw-accordion-header:hover{background:#f9fafb}.lw-accordion-title{font-size:14px}.lw-accordion-chevron{flex-shrink:0;transition:transform 0.2s;color:#9ca3af}.lw-accordion[data-open] .lw-accordion-chevron{transform:rotate(180deg)}.lw-accordion-body{display:none;padding:0 16px 16px;border-top:1px solid #e5e7eb}.lw-accordion[data-open] .lw-accordion-body{display:block}.lw-accordion-static .lw-accordion-header{cursor:default}.lw-accordion-static .lw-accordion-header:hover{background:transparent}.lw-prompt-source{display:none}.lw-accordion-commands{display:flex;gap:16px;margin-top:12px}.lw-accordion-cmd-col{flex:1;min-width:0}.lw-accordion-cmd-label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.05em;color:#6b7280;margin-bottom:6px}.lw-accordion-cmd-box{display:flex;align-items:center;gap:8px;padding:8px 12px;background:#f9fafb;border-radius:8px;border:1px solid #e5e7eb;cursor:pointer;transition:border-color 0.15s}.lw-accordion-cmd-box:hover{border-color:#d1d5db}.lw-accordion-cmd-box code{font-size:13px;font-family:var(--font-mono, monospace);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0;background:transparent!important;padding:0!important;border:none!important}.lw-slash-command{color:#e17100;font-weight:600}.lw-accordion-cmd-box[data-copied]{border-color:#059669;background:#ecfdf5}.lw-accordion-cmd-box[data-copied] .lw-copy-line-icon{display:none!important}.lw-accordion-cmd-box[data-copied] .lw-copy-line-check{display:inline-flex!important}.lw-accordion-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}.lw-accordion-action{display:flex;align-items:center;gap:8px;padding:6px 12px 6px 6px;border:1px solid #e5e7eb;border-radius:8px;background:transparent;cursor:pointer;text-decoration:none;color:inherit;transition:all 0.15s;text-align:left}.lw-accordion-action:hover{background:#f9fafb;border-color:#d1d5db}.lw-accordion-action-icon{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid #e5e7eb;border-radius:6px;color:#6b7280;flex-shrink:0}.lw-accordion-action-text{display:flex;flex-direction:column;line-height:1.2}.lw-accordion-action-title{font-size:13px;font-weight:500}.lw-accordion-action-subtitle{font-size:11px;font-weight:400;color:#9ca3af}.lw-accordion-action[data-copied]{background:#ecfdf5;border-color:#059669}.lw-accordion-action[data-copied] .lw-copy-line-icon{display:none!important}.lw-accordion-action[data-copied] .lw-copy-line-check{display:flex!important}.dark .lw-accordion{border-color:#374151}.dark .lw-accordion-header:hover{background:rgba(255, 255, 255, 0.03)}.dark .lw-accordion-static .lw-accordion-header:hover{background:transparent}.dark .lw-accordion-body{border-top-color:#374151}.dark .lw-accordion-cmd-box{background:rgba(255, 255, 255, 0.05);border-color:#374151}.dark .lw-accordion-cmd-box:hover{border-color:#6b7280}.dark .lw-accordion-cmd-box[data-copied]{background:rgba(5, 150, 105, 0.15);border-color:rgba(5, 150, 105, 0.4)}.dark .lw-accordion-action{border-color:#374151}.dark .lw-accordion-action-icon{border-color:#374151}.dark .lw-accordion-action:hover{background:rgba(255, 255, 255, 0.03);border-color:#6b7280}.dark .lw-accordion-action[data-copied]{background:rgba(5, 150, 105, 0.15);border-color:rgba(5, 150, 105, 0.4)}.dark .lw-accordion-chevron{color:#6b7280}.dark .lw-slash-command{color:#fe9a00}#sidebar-group .group>img{align-self:center}#footer{flex-wrap:wrap;row-gap:0}.lw-agent-report{flex:0 0 100%;font-size:14px;color:#9ca3af;padding-bottom:12px}.lw-agent-report a{color:inherit;text-decoration:underline;text-underline-offset:2px}.lw-agent-report a:hover{color:#6b7280}.lw-agent-report code{font-size:13px;white-space:nowrap;background:rgba(0, 0, 0, 0.04);border:1px solid #e5e7eb;border-radius:4px;padding:1px 5px}.dark .lw-agent-report{color:#6b7280}.dark .lw-agent-report a:hover{color:#9ca3af}.dark .lw-agent-report code{background:rgba(255, 255, 255, 0.05);border-color:#374151}"}],"page":{"pagePath":"ai-gateway/governance/routing-policies","slug":"/ai-gateway/governance/routing-policies","pageMetadata":{"title":"Routing Policies","description":"A routing policy decides once which providers a virtual key routes through, what the model tiers mean, and which tools, servers, addresses and models a request may name.","sidebarTitle":"Routing policies","href":"/ai-gateway/governance/routing-policies"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"A routing policy decides once which providers a virtual key routes through, what the model tiers mean, and which tools, servers, addresses and models a request may name.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,Frame,Heading,OptimizedImage,Step,Steps,Table}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Frame)_missingMdxReference(`Frame`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Step)_missingMdxReference(`Step`,true);if(!Steps)_missingMdxReference(`Steps`,true);if(!Table)_missingMdxReference(`Table`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`what-a-routing-policy-is`,children:`What a routing policy is`}),`\n`,_jsx(_components.p,{children:`A routing policy is a named set of routing decisions that virtual keys point at. Edit the policy and every key that uses it follows the change; no key is reissued.`}),`\n`,_jsx(_components.p,{children:`A policy holds:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Section`}),_jsx(_components.th,{children:`What it decides`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Where it applies`}),_jsx(_components.td,{children:`The organization, teams or projects whose keys may select the policy.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Providers`}),_jsx(_components.td,{children:`The model providers the policy routes through, in order. The gateway tries the first one and moves to the next on a failure that is worth another try.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Model tiers`}),_jsxs(_components.td,{children:[`What `,_jsx(_components.code,{children:`complex`}),`, `,_jsx(_components.code,{children:`reasoning`}),` and `,_jsx(_components.code,{children:`fast`}),` resolve to, plus a default model.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Model name mapping`}),_jsx(_components.td,{children:`Rewrites of the model name a client sends before the request reaches a provider.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Restrictions`}),_jsxs(_components.td,{children:[`Regex refuse and allow-only lists for tools, MCP servers, web addresses and models. See `,_jsx(_components.a,{href:`/ai-gateway/policy-rules`,children:`Policy rules`}),`.`]})]})]})]}),`\n`,_jsxs(_components.p,{children:[`Manage policies under `,_jsx(_components.strong,{children:`AI Gateway, Routing Policies`}),` in the sidebar (`,_jsx(_components.code,{children:`/gateway/routing-policies`}),`). The page groups policies by scope: organization, teams, projects. A project policy wins over a team policy, which wins over the organization policy. Creating, editing and deleting need the `,_jsx(_components.code,{children:`routingPolicies:manage`}),` permission; viewing needs `,_jsx(_components.code,{children:`routingPolicies:view`}),`.`]}),`\n`,_jsx(Frame,{caption:`The Routing Policies page: an organization policy marked as the default and a project policy.`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/routing-policies-list.png?fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=886e5f7ff687259f664ee764fc7e02d2`,alt:`The Routing Policies page with the Organization, Teams and Projects groups`,\"data-og-width\":`1227`,width:`1227`,\"data-og-height\":`604`,height:`604`,\"data-path\":`images/ai-gateway/routing-policies-list.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/routing-policies-list.png?w=280\u0026fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=b3cca48a150cfdc2bf65ff2c18afdf65 280w, https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/routing-policies-list.png?w=560\u0026fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=27e84352fd7607aba6a6545dc5c8a74f 560w, https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/routing-policies-list.png?w=840\u0026fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=6375a9384fa774ca4122b5993f1ba450 840w, https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/routing-policies-list.png?w=1100\u0026fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=3fa31165082cd90290dcb363e324782c 1100w, https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/routing-policies-list.png?w=1650\u0026fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=0305f13d2ee9a36514a7fc7ca41fe7a0 1650w, https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/routing-policies-list.png?w=2500\u0026fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=cc9254cb65751e8b686233bc59570015 2500w`})}),`\n`,_jsx(Frame,{caption:`The policy drawer: where it applies, the providers in order, and the three model tiers.`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/routing-policy-editor.png?fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=e266b5a5e9cfb0f5ab23cfea8a62c73d`,alt:`The New routing policy drawer with the name, scope, ordered providers and model tiers`,\"data-og-width\":`520`,width:`520`,\"data-og-height\":`1150`,height:`1150`,\"data-path\":`images/ai-gateway/routing-policy-editor.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/routing-policy-editor.png?w=280\u0026fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=d2405d0f019ea02ea376d87103674813 280w, https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/routing-policy-editor.png?w=560\u0026fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=1e25b51023bc236bd29cdc7f297ad75a 560w, https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/routing-policy-editor.png?w=840\u0026fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=374884b23701b49ee8484ba475422c63 840w, https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/routing-policy-editor.png?w=1100\u0026fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=5d007b564ac64cc370e7c0eeea9bf1dc 1100w, https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/routing-policy-editor.png?w=1650\u0026fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=7282a0d1c1b19335b8a942c894eedaa6 1650w, https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/routing-policy-editor.png?w=2500\u0026fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=774fa6bdf98cf50998cfbf8b6ddc398f 2500w`})}),`\n`,_jsx(Heading,{level:`2`,id:`model-tiers`,children:`Model tiers`}),`\n`,_jsx(_components.p,{children:`A tier is a reserved model name a client sends instead of naming a model. Point each tier at a model on one of the policy’s providers.`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Tier`}),_jsx(_components.th,{children:`Meant for`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`complex`})}),_jsx(_components.td,{children:`The most capable model.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`reasoning`})}),_jsx(_components.td,{children:`The model best at step-by-step reasoning.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`fast`})}),_jsx(_components.td,{children:`A quick and inexpensive model.`})]})]})]}),`\n`,_jsxs(_components.p,{children:[`A tier the policy names no target for resolves to the policy’s `,_jsx(_components.strong,{children:`Default model`}),`. A policy with no default model leaves that tier unset, and a request for it is refused as an unknown model.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://gateway.langwatch.ai/v1/chat/completions`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Authorization: Bearer `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$LANGWATCH_VIRTUAL_KEY`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{\"model\": \"fast\", \"messages\": [{\"role\": \"user\", \"content\": \"Summarize this ticket.\"}]}'`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The response reports the model that served the request in `,_jsx(_components.code,{children:`model`}),`, and `,_jsx(_components.code,{children:`extra_fields.model_requested`}),` holds the model the tier resolved to. `,_jsx(_components.code,{children:`GET /v1/models`}),` on the key lists each tier that resolves to a model, with `,_jsx(_components.code,{children:`owned_by`}),` set to the provider the tier points at, next to the models of the policy’s providers. A tier with no target and no default model is not listed. Model ids in that list carry no provider prefix.`]}),`\n`,_jsxs(_components.p,{children:[`Tiers and name mappings are the same mechanism on the wire: an alias the gateway looks up by exact name. See `,_jsx(_components.a,{href:`/ai-gateway/model-aliases`,children:`Model aliases`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`model-name-mapping`,children:`Model name mapping`}),`\n`,_jsxs(_components.p,{children:[`A mapping rewrites one requested name to one served name, for example `,_jsx(_components.code,{children:`gpt-4o`}),` to `,_jsx(_components.code,{children:`openai/gpt-6-luna`}),`. The served name must be reachable through one of the policy’s providers; the editor refuses a mapping that names a provider the policy does not route through.`]}),`\n`,_jsx(_components.p,{children:`The key’s own model allowlist is checked against the served model, so a mapping cannot reach a model the key is not allowed to use.`}),`\n`,_jsx(Heading,{level:`2`,id:`provider-order`,children:`Provider order`}),`\n`,_jsxs(_components.p,{children:[`The providers list is the key’s fallback chain. The gateway keeps only the providers that can serve the requested model, then tries them in the listed order. A request for a model on a provider the policy does not include is refused with `,_jsx(_components.code,{children:`400 model_not_allowed`}),`, and the message names the policy:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"model_not_allowed\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"model_not_allowed\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"The `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`anthropic`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` provider is not available on this key: its routing policy `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`EU only`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` does not include this provider. Ask the key's owner to add it to the routing policy, or send the request to a provider the policy allows.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"fault\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"customer\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The key’s own provider access can still list that provider; the policy is what refuses it. A provider that the key’s provider access drops answers `,_jsx(_components.code,{children:`400 model_not_allowed`}),` too, with a message that points at the key’s allowed providers instead of the policy. The code is the same for both; the message is what tells them apart.`]}),`\n`,_jsxs(_components.p,{children:[`A `,_jsx(_components.a,{href:`/ai-gateway/policy-rules`,children:`policy rule`}),` under `,_jsx(_components.strong,{children:`Restrictions`}),` is a different refusal. A model a rule blocks, or a model outside an allow-only list, answers `,_jsx(_components.code,{children:`403 policy_violation`}),`, and the message names the model, not the policy:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"policy_violation\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"policy_violation\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"model `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`gemini-2.5-flash`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` is not in allowlist\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"fault\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"customer\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`See `,_jsx(_components.a,{href:`/ai-gateway/providers/fallback-chains`,children:`Fallback chains`}),` for what triggers the move to the next provider.`]}),`\n`,_jsx(Heading,{level:`2`,id:`attach-a-policy-to-a-key`,children:`Attach a policy to a key`}),`\n`,_jsxs(Steps,{children:[_jsx(Step,{title:`Create the policy`,children:_jsxs(_components.p,{children:[`Click `,_jsx(_components.strong,{children:`New policy`}),`, pick where it applies, add the providers in the order you want, set the tiers and the default model.`]})}),_jsxs(Step,{title:`Point the key at it`,children:[_jsxs(_components.p,{children:[`Open the key under `,_jsx(_components.strong,{children:`AI Gateway, Virtual Keys`}),` and click `,_jsx(_components.strong,{children:`Edit`}),`. The `,_jsx(_components.strong,{children:`Routing`}),` section is a list of choices: `,_jsx(_components.strong,{children:`Default: no fallback`}),`, `,_jsx(_components.strong,{children:`Fall back to all eligible providers`}),`, then one row per policy the key can reach. Pick the policy and save. The first two choices are the key’s own routing when it uses no policy.`]}),_jsx(Frame,{caption:`The Routing section of the edit drawer, with the organization policy selected.`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/vk-routing-section.png?fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=ba17be4a3ac84eb538d202deeeee88a3`,alt:`The Edit virtual key drawer showing Provider access and the Routing choices`,\"data-og-width\":`520`,width:`520`,\"data-og-height\":`480`,height:`480`,\"data-path\":`images/ai-gateway/vk-routing-section.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/vk-routing-section.png?w=280\u0026fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=ac797a84a68ab83f2d46726a7f606c9c 280w, https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/vk-routing-section.png?w=560\u0026fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=9a2f1dfdcf456071b6dc8ebf69ec5f4e 560w, https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/vk-routing-section.png?w=840\u0026fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=d1b8844452524404f81676744e121bad 840w, https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/vk-routing-section.png?w=1100\u0026fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=170c7613b0923c7f64bc425777c7e573 1100w, https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/vk-routing-section.png?w=1650\u0026fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=9f29d2b1ee9a0ed286af050a36cff818 1650w, https://mintcdn.com/langwatch/wO3-TTO2H2BW8Pk1/images/ai-gateway/vk-routing-section.png?w=2500\u0026fit=max\u0026auto=format\u0026n=wO3-TTO2H2BW8Pk1\u0026q=85\u0026s=2aba192add83e198ab05c8a826fb6d03 2500w`})})]}),_jsx(Step,{title:`Verify`,children:_jsxs(_components.p,{children:[`Send a request for `,_jsx(_components.code,{children:`fast`}),` through the key and read `,_jsx(_components.code,{children:`model`}),` in the response. Then request a model on a provider that the key’s `,_jsx(_components.strong,{children:`Provider access`}),` still lists but that the policy does not, and check for `,_jsx(_components.code,{children:`400`}),` and `,_jsx(_components.code,{children:`\"code\": \"model_not_allowed\"`}),`; the message names the routing policy, which is what tells you the policy refused it rather than the key. To test a `,_jsx(_components.strong,{children:`Restrictions`}),` rule instead, send a request that matches one and check for `,_jsx(_components.code,{children:`403`}),` and `,_jsx(_components.code,{children:`\"code\": \"policy_violation\"`}),`.`]})})]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Make this the default where it applies`}),` marks the policy as the default for its scopes; the policies list shows it with a `,_jsx(_components.strong,{children:`Default`}),` badge.`]}),`\n`,_jsx(Heading,{level:`2`,id:`propagation`,children:`Propagation`}),`\n`,_jsx(_components.p,{children:`Saving a policy writes a change event. The gateway picks it up on its next change-feed poll and rebuilds the bundles of every key on the policy. Requests already in flight finish on the old configuration.`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Also check:`}),` `,_jsx(_components.a,{href:`/ai-gateway/policy-rules`,children:`Policy rules`}),`, `,_jsx(_components.a,{href:`/ai-gateway/model-aliases`,children:`Model aliases`}),`, `,_jsx(_components.a,{href:`/ai-gateway/providers/fallback-chains`,children:`Fallback chains`}),`, `,_jsx(_components.a,{href:`/ai-gateway/virtual-keys`,children:`Virtual keys`}),`.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Routing Policies","description":"A routing policy decides once which providers a virtual key routes through, what the model tiers mean, and which tools, servers, addresses and models a request may name.","sidebarTitle":"Routing policies","href":"/ai-gateway/governance/routing-policies"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"What a routing policy is","slug":"what-a-routing-policy-is","depth":2,"children":[]},{"title":"Model tiers","slug":"model-tiers","depth":2,"children":[]},{"title":"Model name mapping","slug":"model-name-mapping","depth":2,"children":[]},{"title":"Provider order","slug":"provider-order","depth":2,"children":[]},{"title":"Attach a policy to a key","slug":"attach-a-policy-to-a-key","depth":2,"children":[]},{"title":"Propagation","slug":"propagation","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/langwatch/1c7dbbb4aa0b0c87/expand-menus.js","/docs/_mintlify/custom/langwatch/fdd2d1ee81d630a0/posthog.js"],"subdomain":"langwatch","siteName":"LangWatch","title":"Routing Policies - LangWatch","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-27T16:32:32.653Z","gitLastModified":"2026-10-27T16:31:08.000Z","originalFileLocation":"ai-gateway/governance/routing-policies.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"A routing policy decides once which providers a virtual key routes through, what the model tiers mean, and which tools, servers, addresses and models a request may name.\">\u003cmeta data-mint-head name=\"application-name\" content=\"LangWatch\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/langwatch/kXoUUhFGtPYqSZK4/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/langwatch/kXoUUhFGtPYqSZK4/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/langwatch/kXoUUhFGtPYqSZK4/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/langwatch/kXoUUhFGtPYqSZK4/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/langwatch/kXoUUhFGtPYqSZK4/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/langwatch/kXoUUhFGtPYqSZK4/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/langwatch/kXoUUhFGtPYqSZK4/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/langwatch/kXoUUhFGtPYqSZK4/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/langwatch/kXoUUhFGtPYqSZK4/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Routing Policies - LangWatch\">\u003cmeta data-mint-head property=\"og:description\" content=\"A routing policy decides once which providers a virtual key routes through, what the model tiers mean, and which tools, servers, addresses and models a request may name.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"LangWatch\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://langwatch.ai/docs/ai-gateway/governance/routing-policies\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://langwatch.mintlify.site/docs/_mintlify/api/og/v2?division=Governance\u0026amp;title=Routing+Policies\u0026amp;description=A+routing+policy+decides+once+which+providers+a+virtual+key+routes+through%2C+what+the+model+tiers+mean%2C+and+which+tools%2C+servers%2C+addresses+and+models+a+request+\u0026amp;theme=c82022416a7a1873b973b6a4\u0026amp;signature=8afb6cfd21e10bfb146291fc7a7c3453c795cb79e8a6a609fe164276cf23b2db\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Routing Policies - LangWatch\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"A routing policy decides once which providers a virtual key routes through, what the model tiers mean, and which tools, servers, addresses and models a request may name.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://langwatch.mintlify.site/docs/_mintlify/api/og/v2?division=Governance\u0026amp;title=Routing+Policies\u0026amp;description=A+routing+policy+decides+once+which+providers+a+virtual+key+routes+through%2C+what+the+model+tiers+mean%2C+and+which+tools%2C+servers%2C+addresses+and+models+a+request+\u0026amp;theme=c82022416a7a1873b973b6a4\u0026amp;signature=8afb6cfd21e10bfb146291fc7a7c3453c795cb79e8a6a609fe164276cf23b2db\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/langwatch/kXoUUhFGtPYqSZK4/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"LangWatch\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#e17100\">\u003clink data-mint-head rel=\"canonical\" href=\"https://langwatch.ai/docs/ai-gateway/governance/routing-policies\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/ai-gateway/governance/routing-policies.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://langwatch.ai/#organization\",\"name\":\"LangWatch\",\"url\":\"https://langwatch.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://langwatch.ai/docs/logo/light.svg\"},\"sameAs\":[\"https://github.com/langwatch/langwatch\",\"https://x.com/langwatchai\",\"https://www.linkedin.com/company/langwatch/\",\"https://www.youtube.com/@LangWatch\"]},{\"@type\":\"WebSite\",\"@id\":\"https://langwatch.ai/docs#website\",\"name\":\"LangWatch\",\"url\":\"https://langwatch.ai/docs\",\"publisher\":{\"@id\":\"https://langwatch.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://langwatch.ai/docs/ai-gateway/governance/routing-policies#webpage\",\"url\":\"https://langwatch.ai/docs/ai-gateway/governance/routing-policies\",\"name\":\"Routing Policies\",\"description\":\"A routing policy decides once which providers a virtual key routes through, what the model tiers mean, and which tools, servers, addresses and models a request may name.\",\"dateModified\":\"2026-10-27T16:31:08.000Z\",\"isPartOf\":{\"@id\":\"https://langwatch.ai/docs#website\"},\"breadcrumb\":{\"@id\":\"https://langwatch.ai/docs/ai-gateway/governance/routing-policies#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://langwatch.ai/docs/ai-gateway/governance/routing-policies#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Governance\",\"item\":\"https://langwatch.ai/docs/ai-gateway/governance/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Routing Policies\",\"item\":\"https://langwatch.ai/docs/ai-gateway/governance/routing-policies\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://langwatch.ai/docs/ai-gateway/governance/routing-policies#article\",\"headline\":\"Routing Policies\",\"name\":\"Routing Policies\",\"description\":\"A routing policy decides once which providers a virtual key routes through, what the model tiers mean, and which tools, servers, addresses and models a request may name.\",\"url\":\"https://langwatch.ai/docs/ai-gateway/governance/routing-policies\",\"mainEntityOfPage\":{\"@id\":\"https://langwatch.ai/docs/ai-gateway/governance/routing-policies#webpage\"},\"dateModified\":\"2026-10-27T16:31:08.000Z\",\"publisher\":{\"@id\":\"https://langwatch.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://langwatch.ai/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"LangWatch\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"LangWatch","nav":{"global":{"anchors":[{"anchor":"Get Support","icon":"life-ring","href":"https://docs.langwatch.ai/support#email-support"}]},"anchors":[{"anchor":"Platform","icon":"book-open","pages":[{"title":"Platform","href":"/introduction"}]},{"anchor":"Observability","icon":"plug","pages":[{"title":"Observability","href":"/integration/overview"}]},{"anchor":"AI Gateway","icon":"route","groups":[{"group":"Get Started","pages":[{"title":"LangWatch AI Gateway","sidebarTitle":"Overview","href":"/ai-gateway/overview"},{"title":"Quickstart","sidebarTitle":"Quickstart","href":"/ai-gateway/quickstart"},{"title":"Concepts","sidebarTitle":"Concepts","href":"/ai-gateway/concepts"}]},{"group":"SDK Integration","pages":[{"group":"Python","icon":"python","pages":[{"title":"Python","sidebarTitle":"Python","href":"/ai-gateway/sdks/python"}]},{"group":"TypeScript","icon":"typescript","pages":[{"title":"TypeScript","sidebarTitle":"TypeScript","href":"/ai-gateway/sdks/typescript"}]},{"group":"Go SDK","icon":"/images/logos/golang.svg","pages":[{"title":"Go","sidebarTitle":"Go SDK","href":"/ai-gateway/sdks/go"}]},{"group":"HTTP and other clients","icon":"globe","pages":[{"title":"Any OpenAI-compatible client","sidebarTitle":"HTTP and other clients","href":"/ai-gateway/sdks/http"}]}]},{"group":"Virtual Keys \u0026 Budgets","pages":[{"title":"Virtual Keys","sidebarTitle":"Virtual Keys","href":"/ai-gateway/virtual-keys"},{"title":"Budgets","sidebarTitle":"Budgets","href":"/ai-gateway/budgets"},{"title":"Rate limits","sidebarTitle":"Rate limits","href":"/ai-gateway/rate-limits"},{"title":"RBAC","sidebarTitle":"RBAC","href":"/ai-gateway/rbac"}]},{"group":"Billing \u0026 Metering","pages":[{"title":"Billing and spend events","sidebarTitle":"Billing and spend events","href":"/ai-gateway/billing-events"},{"title":"Webhooks","sidebarTitle":"Webhooks","href":"/features/webhooks"},{"title":"Metering and rebilling your customers through the gateway","sidebarTitle":"Metering \u0026 Rebilling","href":"/ai-gateway/cookbooks/metering-and-rebilling"},{"title":"Voice in a consumer app: one budget per end user","sidebarTitle":"Consumer voice app","href":"/ai-gateway/cookbooks/consumer-voice-app"},{"title":"Demo: a rebilling agent platform","sidebarTitle":"Demo: Rebilling Platform","href":"/ai-gateway/demo-agent-platform"}]},{"group":"Governance","pages":[{"title":"Governance overview","sidebarTitle":"Overview","href":"/ai-gateway/governance/overview"},{"title":"Personal keys","sidebarTitle":"Personal keys","href":"/ai-gateway/governance/personal-keys"},{"title":"Admin setup","description":"Add model providers, set the routing handle and the fallback order, create a routing policy, set budgets, then verify the LangWatch AI Gateway with one request.","sidebarTitle":"Admin setup","href":"/ai-gateway/governance/admin-setup"},{"title":"Routing Policies","sidebarTitle":"Routing policies","href":"/ai-gateway/governance/routing-policies"},{"title":"Retention","description":"What the LangWatch AI Gateway stores for each request, and which setting governs how long each record lives.","sidebarTitle":"Retention","href":"/ai-gateway/governance/retention"},{"title":"OCSF / SIEM export","sidebarTitle":"OCSF / SIEM export","href":"/ai-gateway/governance/ocsf-export"},{"title":"LangWatch AI Gateway architecture","sidebarTitle":"Architecture","href":"/ai-gateway/governance/architecture"}]},{"group":"Providers","pages":[{"title":"Providers","sidebarTitle":"Overview","href":"/ai-gateway/providers/overview"},{"title":"OpenAI","sidebarTitle":"OpenAI","href":"/ai-gateway/providers/openai"},{"title":"Anthropic","sidebarTitle":"Anthropic","href":"/ai-gateway/providers/anthropic"},{"title":"Azure OpenAI","sidebarTitle":"Azure OpenAI","href":"/ai-gateway/providers/azure-openai"},{"title":"AWS Bedrock","sidebarTitle":"AWS Bedrock","href":"/ai-gateway/providers/bedrock"},{"title":"Google Vertex AI","sidebarTitle":"Vertex AI","href":"/ai-gateway/providers/vertex"},{"title":"Google Gemini","sidebarTitle":"Gemini","href":"/ai-gateway/providers/gemini"},{"title":"xAI","sidebarTitle":"xAI","href":"/ai-gateway/providers/xai"},{"title":"Groq","sidebarTitle":"Groq","href":"/ai-gateway/providers/groq"},{"title":"Cerebras","sidebarTitle":"Cerebras","href":"/ai-gateway/providers/cerebras"},{"title":"DeepSeek","sidebarTitle":"DeepSeek","href":"/ai-gateway/providers/deepseek"},{"title":"Doubleword","sidebarTitle":"Doubleword","href":"/ai-gateway/providers/doubleword"},{"title":"Voyage AI","sidebarTitle":"Voyage AI","href":"/ai-gateway/providers/voyage"},{"title":"ElevenLabs","sidebarTitle":"ElevenLabs","href":"/ai-gateway/providers/elevenlabs"},{"title":"OpenAI account","sidebarTitle":"OpenAI account","href":"/ai-gateway/providers/openai-account"},{"title":"Custom OpenAI-compatible","sidebarTitle":"Custom OpenAI-compatible","href":"/ai-gateway/providers/custom-openai-compatible"},{"title":"Fallback Chains","sidebarTitle":"Fallback chains","href":"/ai-gateway/providers/fallback-chains"}]},{"group":"Features","pages":[{"group":"Caching \u0026 Performance","pages":[{"title":"Cache Control","sidebarTitle":"Cache control","href":"/ai-gateway/cache-control"},{"title":"Streaming","sidebarTitle":"Streaming","href":"/ai-gateway/streaming"}]},{"group":"Safety \u0026 Governance","pages":[{"title":"Guardrails","sidebarTitle":"Guardrails","href":"/ai-gateway/guardrails"},{"title":"Security \u0026 Trust","sidebarTitle":"Security \u0026 Trust","href":"/ai-gateway/security"},{"title":"Policy Rules","sidebarTitle":"Policy rules","href":"/ai-gateway/policy-rules"},{"title":"Audit log","sidebarTitle":"Audit log","href":"/ai-gateway/audit"}]},{"title":"Model Naming","sidebarTitle":"Model Naming","href":"/ai-gateway/model-naming"},{"title":"Parameter mapping","sidebarTitle":"Parameter mapping","href":"/ai-gateway/parameter-mapping"},{"title":"Model Aliases","sidebarTitle":"Model Aliases","href":"/ai-gateway/model-aliases"},{"group":"Operations","pages":[{"title":"Observability","sidebarTitle":"Observability","href":"/ai-gateway/observability"},{"title":"Troubleshooting","sidebarTitle":"Troubleshooting","href":"/ai-gateway/troubleshooting"}]}]},{"group":"API Reference","pages":[{"title":"POST /v1/chat/completions","sidebarTitle":"Chat Completions","href":"/ai-gateway/api/chat-completions"},{"title":"POST /v1/messages","sidebarTitle":"Messages","href":"/ai-gateway/api/messages"},{"title":"POST /v1/responses","sidebarTitle":"Responses","href":"/ai-gateway/api/responses"},{"title":"POST /v1/embeddings","sidebarTitle":"Embeddings","href":"/ai-gateway/api/embeddings"},{"title":"POST /v1/decisions","sidebarTitle":"Decisions","href":"/ai-gateway/api/decisions"},{"title":"POST /v1/audio/*","sidebarTitle":"Audio (TTS + STT)","href":"/ai-gateway/api/audio"},{"title":"POST /v1/images/*","sidebarTitle":"Images","href":"/ai-gateway/api/images"},{"title":"ElevenLabs API paths","sidebarTitle":"ElevenLabs","href":"/ai-gateway/api/elevenlabs"},{"title":"Realtime voice","href":"/ai-gateway/api/realtime"},{"title":"Gemini native (/v1beta)","sidebarTitle":"Gemini Native","href":"/ai-gateway/api/gemini-native"},{"title":"GET /v1/models","sidebarTitle":"Models","href":"/ai-gateway/api/models"},{"title":"Error Envelope","sidebarTitle":"Errors","href":"/ai-gateway/api/errors"},{"title":"Management REST API","sidebarTitle":"Management REST","href":"/ai-gateway/api/management"}]},{"group":"Self-Hosting","pages":[{"title":"Helm chart","sidebarTitle":"Helm","href":"/ai-gateway/self-hosting/helm"},{"title":"Post-install checklist","href":"/ai-gateway/self-hosting/post-install-checklist"},{"title":"Config","sidebarTitle":"Config","href":"/ai-gateway/self-hosting/config"},{"title":"DNS and TLS","sidebarTitle":"DNS \u0026 TLS","href":"/ai-gateway/self-hosting/dns-and-tls"},{"title":"Health Checks","sidebarTitle":"Health Checks","href":"/ai-gateway/self-hosting/health-checks"},{"title":"Scaling","sidebarTitle":"Scaling","href":"/ai-gateway/self-hosting/scaling"}]},{"group":"Cookbooks","pages":[{"title":"CI smoke test","sidebarTitle":"CI smoke test","href":"/ai-gateway/cookbooks/ci-smoke-test"},{"title":"Migrate from direct provider calls","sidebarTitle":"Migrate from direct","href":"/ai-gateway/cookbooks/migrate-from-direct"},{"title":"Migrate from Portkey","sidebarTitle":"Migrate from Portkey","href":"/ai-gateway/cookbooks/migrate-from-portkey"},{"title":"Migrate from LiteLLM","sidebarTitle":"Migrate from LiteLLM","href":"/ai-gateway/cookbooks/migrate-from-litellm"},{"title":"Credential-leak incident response","sidebarTitle":"Responding to credential leaks","href":"/ai-gateway/cookbooks/credential-leak-incident"},{"title":"Prometheus alert rules","sidebarTitle":"Prometheus alerts","href":"/ai-gateway/cookbooks/prometheus-alerts"},{"title":"Grafana dashboard","sidebarTitle":"Grafana dashboard","href":"/ai-gateway/cookbooks/grafana-dashboard"}]}]},{"anchor":"AI Governance","icon":"shield-check","pages":[{"title":"AI Governance","href":"/ai-governance/overview"}]},{"anchor":"Coding Agents","icon":"square-terminal","pages":[{"title":"Coding Agents","href":"/coding-agents/overview"}]},{"anchor":"Langy","icon":"robot","pages":[{"title":"Langy","href":"/langy/overview"}]},{"anchor":"Self Hosting","icon":"server","pages":[{"title":"Self Hosting","href":"/self-hosting/overview"}]},{"anchor":"API Reference","icon":"code","pages":[{"title":"API Reference","href":"/api-reference/introduction"}]}]},"basePath":"","title":"Routing Policies - LangWatch","buildId":"dpl_ATnXPMW25DMPUr9VBw6kL6MfBt6T","deploymentId":"dpl_ATnXPMW25DMPUr9VBw6kL6MfBt6T","dynamics":["10e4515597","07c022d89b","a74be98ba7"],"chunks":["BannerMarkdown-B5WzX-8C.js","dist-BPypQKlo.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","clsx-6wHzaN2_.js","html-void-elements-mCSPHezU.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","Frame-BDAj7nBh.js","DynamicMarkdown-Bq09mRwR.js","zoom-image-lightbox-CypZe82l.js","lightbox-handle-r17bVUz3.js"]}