Artificial Intelligence

4 LLM Gateway Routing Decisions for Multi-Provider Stacks

Colored network cables plugged into a data center switch, representing requests routed between model endpoints
Brett Sayles

LLM gateway routing is the per-request decision about which model deployment answers a call when you run more than one provider, Region or key. The four decisions that matter are what the gateway layer owns, the order in which fallbacks are tried, how spend is capped per key, and which routes the provider already performs for you. Get these wrong and you pay twice: once for an extra hop that duplicates what Bedrock or Azure already do, and once for silent behavior changes when a fallback swaps models mid-conversation.

Gateway routers are not all the same. The LiteLLM Router, for example, documents several strategies: weighted picks driven by requests-per-minute or tokens-per-minute limits, rate-limit-aware and least-busy selection, latency-based routing and lowest-cost routing (LiteLLM Router documentation). The point of this guide is not to pick a product but to fix the four routing decisions before you deploy one.

Decide What the Gateway Owns

Start by writing down which responsibilities move into the gateway and which stay in the application. A useful split gives the gateway authentication to the model providers, the deployment list, retry and cooldown bookkeeping, the fallback order and per-key budgets. The application keeps the prompt, the evaluation of output quality and the decision about which product features may run on a weaker fallback model. If the application cannot tell which model actually answered, it cannot reason about quality drift after a failover, so the gateway must return the served deployment and the attempted route in its response headers.

Managed cloud gateways push you toward a similar split. The unified model API in API Management, in preview, exposes multiple backends through a single OpenAI-compatible endpoint and handles format translation automatically, so governance policies apply once across all models (Microsoft Learn). Microsoft also notes that this AI gateway extends the existing API gateway rather than being a separate product, and that capability availability varies by service tier. Check the tier before you design around a feature.

Self-hosted routers add a state question. LiteLLM documents that, in production, the Router can use Redis to track cooldowns and usage when managing per-minute limits. Without shared state, two proxy instances cool down different deployments and your least-busy logic is really least-busy on this pod. Budget the stateful component, its failure mode and its upgrade path as part of the decision. Treat the routing configuration as a release unit too: the deployment list, the fallback order and the budget rules change together, which is the same discipline described in gated model deployments.

Set the Fallback Order

Fallbacks run in the order you list them, and a call only reaches the second model group after the first has exhausted its retries. Fallbacks are not a single concept. LiteLLM keeps three lists: one for content-policy violations, one for context-window errors and one for every remaining error such as rate limits (LiteLLM fallbacks documentation). The distinction matters because the right fallback for a rate-limit error, the same model on another deployment, is usually wrong for a context-window error, which needs a larger window, and wrong again for a content-policy block, which needs a different filter if your policy allows one at all.

Order by what breaks, not by price. Put a second deployment of the same model in the same geography first, so the output distribution barely moves. Put a different model family last and mark it in your product, so users or downstream steps can handle a style change. Then decide what happens to conversation state. LiteLLM documents that a fallback to a deployment on another provider or another API key cannot decrypt the encrypted reasoning items the failed deployment produced on earlier turns; the fallback keeps only the readable summary and reasons fresh on that turn. If your agent relies on replayed reasoning across turns, pin those conversations to one provider or accept the behavior change explicitly.

Cap Spend per Route

Fallback moves traffic to deployments that may cost more per token, so a provider outage can turn into a budget incident. Attach the budget to the calling key, not only to the model, and decide in advance whether an exhausted budget blocks the request or downgrades it. LiteLLM documents a budget-aware path in which a gateway can refuse a fallback to a billed model once the caller has already passed its budget, returning the error from the cheaper model instead (LiteLLM fallbacks documentation). That is a deliberate choice to fail rather than overspend, and it only works if the service calling the gateway treats that error as retryable later.

Budgets also need a unit that finance and engineering share. Currency per key per day is easy to alert on; token budgets are easier to reason about for capacity. Reconcile both against the provider bill, using the approach in cost per request for shared cloud AI spend, and tag every gateway request with the serving deployment so the reconciliation can explain a spike by route rather than by provider alone.

Know What Providers Route

Before you build cross-Region logic in your own gateway, check what the provider already does. When you call a geographic inference profile, Amazon Bedrock selects a commercial Region inside that geography to process the request, and AWS charges no additional routing fee, because the price is calculated from the Region you call the profile from (AWS cross-Region inference). Your gateway adds value on top of that only when traffic must leave Bedrock entirely, for example to a different vendor, or when a per-team budget has to be enforced that Bedrock does not know about.

The same page notes that all data transmitted during cross-Region operations stays on the AWS network and is encrypted in transit between Regions, and that requests can be routed to Regions you have not manually enabled. For an EU-only workload, a geographic profile already bounds where processing happens, so a second vendor fallback inside the EU is a resilience decision rather than a compliance one. Make that choice in a table, with assumptions written down, rather than in a hallway.

The Decision Table

The table below is a template, not a recommendation for every team. Fill it in per product feature and store it next to the routing configuration.

DecisionOptionsChoose whenTrap
Gateway ownershipSelf-hosted router, managed API gateway or library inside the appMore than one provider or key, or a per-team budgetLibrary inside the app leaves no shared cooldown state across instances
Fallback orderSame model on another deployment, then a larger-window model, then another vendorEach step is matched to an error classOne list for every error type
Budget unitCurrency per key per day, tokens per key per dayCurrency for finance, tokens for capacity planningBudgets attached to the model instead of the caller
Shared stateIn-memory, Redis or equivalentMulti-instance proxy with per-minute limitsDifferent pods cooling down different deployments
Provider-side routingGeographic or global inference profileData residency bounded to a geographyRebuilding the same routing in your own gateway

Worked Example: A Three-Tier Order

The numbers in this example are hypothetical and exist to show the arithmetic, not a measured result. Assume a summarization feature that sends 200,000 requests per day through one gateway key, with a daily budget of 300 currency units. The routing order is a Bedrock geographic EU profile with the primary model, then a second vendor deployment in the EU with the same model family, then a smaller model from the second vendor as the last resort. Retries per deployment are set to two before the next tier is tried.

The sketch below is pseudo-configuration to fix the shape of the decision, not a file to paste.

router_settings:
  num_retries: 2
  fallbacks:
    - primary-eu: [secondary-eu, small-eu]
  context_window_fallbacks:
    - primary-eu: [large-context-eu]
# per-key budgets live on the virtual key, not on the model
# enforce_fallback_budget keeps fallbacks inside that budget

Read the example as a set of consequences. If the Bedrock profile fails for two retries, traffic moves to the second vendor and the cost per request changes; the per-key budget is what stops an outage from becoming an overspend. If the failure is a context-window error, the request skips the second vendor and goes to the larger-context deployment instead. If the key has passed its budget, the fallback to the billed small model is refused and the caller gets an error it can retry after the budget resets.

Keep Routing Decisions Observable

A routing decision that nobody can reconstruct is a routing decision nobody can defend. Record, per request, the requested model alias, the deployment that answered, the attempts made and the budget state. LiteLLM notes that when a budget blocks a fallback the response carries no attempted-fallbacks header, so the absence of that header is itself a signal to alert on. On the provider side, CloudTrail logs cross-Region Bedrock requests in the source Region, with an inferenceRegion field that identifies where the request was processed, so join gateway logs with CloudTrail to see both layers (AWS documentation).

Alert on the rate of fallbacks per hour and on the share of traffic served by the last-resort tier, not only on errors. A fallback rate that climbs slowly is how a degrading provider shows up before it pages anyone.

Sources

Keep exploring