Routing rules now available on AI Gateway
By Steven Van ·
Rewrite or deny rules reroute AI Gateway requests to a different model without an application code change, managed via the Vercel CLI.
Vercel's AI Gateway now supports routing rules, firewall-style rules that control which models a team can use, applied at the gateway level instead of in application code. When a model goes down or gets retired, a single rule reroutes every request instantly instead of requiring a code change.
- Rewrite: serves a request for one model using another, transparently. Useful for keeping traffic flowing when a model is unavailable, migrating off a retired model, standardizing on one model, or routing an expensive model to a cheaper one.
- Deny: blocks requests for a model; blocked requests return a 403. Useful for keeping a team off models it hasn't approved.
Rules apply to every request made with a team's AI Gateway credentials and are managed through the Vercel CLI. They only change which model serves a request: everything else set up for the destination model, including BYOK, model fallbacks, sorting, the only filter, provider options, Zero Data Retention, and the provider allowlist, still applies. Routing rules are in beta.