references/ai-gateway/dynamic-routing.md
AI Gateway Dynamic Routing
Use a dynamic route when model selection, traffic splitting, quotas, or fallbacks should be controlled in the gateway. For a simple retry or fallback sequence, check the request-handling and fallback guides before introducing a routing flow.
| Task | Current documentation | |------|-----------------------| | Design conditional routes, A/B splits, quotas, model fallbacks, and version rollbacks | Dynamic routing | | Invoke a route from an SDK, HTTP request, or Worker; inspect route response metadata | Using a dynamic route | | Define route elements and connections programmatically | JSON configuration | | Provide metadata used by routing conditions | Custom metadata | | Configure model/provider fallbacks | Fallbacks | | Configure retries, backoff, and timeouts | Request handling | | Inspect request outcomes, costs, and errors | Analytics and logging |
Check the usage guide's authentication and stored-key prerequisites. Dynamic routes still use the Unified API compatibility endpoint; its single-model deprecation does not make the REST inference endpoint a replacement for route invocation.