Adaptive Routing: AI Load Balancing and LLM Failover | Bifrost
Adaptive Routing in Bifrost Enterprise load balances LLM traffic across providers and API keys by live health, with automatic failover when one fails.
ADAPTIVE ROUTING
Adaptive Routing: AI Load Balancing and Automatic Failover for LLMs
When a provider goes down or an API key hits a rate limit, Bifrost Enterprise moves LLM traffic to the healthiest provider and key on its own, and moves it back as they recover.
Bifrost Enterprise | Live Traffic Only | No Health Checks [Book a demo] [Read the docs]
DEFINITION
What Adaptive Routing Does
Adaptive Routing is a Bifrost Enterprise feature that routes every request to the healthiest provider and key, holds back keys a provider refuses, and shows what it did and why. It judges health from your live traffic: errors count the most, then latency, then load, recalculated every few seconds. A provider or key that starts failing loses traffic within seconds and earns it back as it recovers. [Bifrost Enterprise]
- 01Provider selection. For a request that does not name a provider, the healthiest provider for the model is picked and the other healthy ones become its fallbacks.
- 02Key selection. Within the chosen provider, the key is picked by live health, latency and load instead of only the weights you set.
- 03Held keys. A key the provider refuses is taken out of rotation on every node and checked again by a single live request after a wait.
- 04Redirecting named providers. Optional. A request that names a provider that is failing for its model can be sent to a healthy provider, or to its own fallbacks.
- 05Routing history and incidents. Every node records key and provider health and every decision it changes, so the dashboard can show what happened, when, and what adaptive routing did about it.
- No requests of its own. Adaptive routing never sends health checks, pings or test calls to a provider. Even a held key is checked by letting one of your real requests through to it.
Provider Selection
For a request that does not name a provider, adaptive routing picks the healthiest provider that serves the model.
The other healthy providers become its fallbacks, best first. A provider that has failed for the model is left out until a key recovers. Providers that governance does not allow for the request are never considered. Each node keeps the health of every provider from the requests it sends, and recalculates it every few seconds. [How adaptive routing works]
Key Selection
On the provider the request goes to, adaptive routing picks the key by live health, latency and load instead of only the weights you set.
Healthier, faster and less loaded keys get more of the traffic. Every usable key keeps a share, so a key that has recovered is noticed. Errors count the most, then latency, then load. While Adaptive Key Selection is on, the weights set on keys are not used. [How health is judged]
Held Keys
Some provider answers repeat on every request until something changes, so waiting for an error rate to climb only costs requests.
A held key is out of rotation on every node, in every region. After a wait, one live request per node is let through to check it. The wait starts at 30 seconds and doubles after each failed check, or follows the wait the provider states. A key that serves its check goes to Recovering and earns its traffic back. [Held keys]
Redirecting Named Providers
Optional. A request that names a provider that is failing for its model can be sent to a healthy provider, or to its own fallbacks.
Redirect To: Best healthy provider moves the request to another healthy provider for the same model. Redirect To: The request’s own fallbacks moves it to its first fallback that is not failing. The failing provider stays as the last fallback. If nothing healthier is available, the request stays on the named provider rather than failing. [Requests that name a provider]
Routing History and Incidents
Every node records key and provider health and every decision it changes, so the dashboard can show what happened, when, and what adaptive routing did about it.
The dashboard shows Incidents detected, Requests saved, Requests failed and Chosen by adaptive routing. Health over time has one row per provider and model, with its keys underneath. Each incident has a status, from Needs attention to Resolved, and says what to do. Every request log starts its Routing tab with an Adaptive Routing card. [Incidents and monitoring] [AI observability]
STATES
Provider and Key States
A key has a state for each model it serves. A provider has a state for each model, rolled up from the keys that can serve that model.
| Key state | What it means | Traffic |
|---|---|---|
| Healthy | Serving normally. | Its full share. |
| Degraded | A small share of its requests fail, or it is much slower than usual. | Less than its share. |
| Failed | Failing steadily, or held because the provider refused it. | None, apart from the single request that checks a held key. |
| Recovering | Back after a failure or a hold. | A reduced share that grows as it serves cleanly, until it is Healthy again. |
HELD KEYS
What Holds a Key
Six provider answers hold a key. A hold on one model leaves the key serving its other models. Network errors, timeouts and plain `5xx` responses never hold a key.
| Reason (dashboard) | failure_class | What is held | Longest wait without a provider hint |
|---|---|---|---|
| Key rejected | credential | The whole key, for every model | 15 minutes |
| Out of quota | quota | The whole key, for every model | 5 minutes |
| No model access | model_access | The model | 5 minutes |
| Model retired | model_gone | The model | 30 minutes |
| Region blocked | region_blocked | The model | 15 minutes |
| Rate limited | rate_limit | The model | 2 minutes |
SETTINGS
Adaptive Routing Settings
The scoring, thresholds and wait times are tuned in Bifrost and are not configurable. The settings decide what adaptive routing is allowed to change, and how it records history. [All settings]
| Setting (UI) | Key | Default |
|---|---|---|
| Adaptive Provider Selection | direction_selection_enabled | On |
| Adaptive Key Selection | route_selection_enabled | On |
| Add Fallbacks When a Provider Is Named | append_fallbacks_to_pinned | Off |
| Redirect Away from Failing Providers | reroute_failed_directions | Off |
| Redirect To | reroute_target | pool |
| Skip Failing Fallbacks | prune_failed_fallbacks | Off |
| Record Routing History | history_enabled | On |
| History Retention (days) | history_retention_days | 7 (1 to 30) |
| Save Routing State Every (seconds) | snapshot_persist_interval_seconds | 300 (5 to 86400) |
Common Setups
- Callers send bare model names. The defaults. Turn on Skip Failing Fallbacks if callers send their own fallbacks.
- Callers, routing rules or virtual keys name providers. Add Fallbacks When a Provider Is Named on, Redirect Away from Failing Providers on, and Redirect To set to Best healthy provider.
- Strictly pinned traffic (compliance, data residency, direct keys). Add Fallbacks When a Provider Is Named and Redirect Away from Failing Providers off. Restrict providers with governance.
Change Settings
Open Adaptive Routing, then Settings, in the sidebar, use the `/api/adaptive-routing/config` API, or add a top-level `load_balancer_config` block to `config.json`. Only the keys you list are applied; the rest keep their defaults.
{
"load_balancer_config": {
"reroute_failed_directions": true,
"reroute_target": "fallbacks",
"history_retention_days": 14
}
}WHERE IT FITS
With Other Routing Features
Adaptive routing runs after routing rules and virtual keys, and before session affinity. To choose a model by how hard a request is, pair it with an LLM router. [LLM router]
- 01Routing rules. Run before adaptive routing. A rule that sets a provider makes the request named, and its fallbacks become the request’s own. [Routing rules docs]
- 02Virtual keys. Limit every provider adaptive routing picks or adds. Their weighted provider configs pick before adaptive routing, so that traffic is named. [Virtual keys docs]
- 03Adaptive routing. Picks the provider for requests that name none, and the key on the provider the request goes to. [Adaptive routing docs]
- 04Session affinity. Runs after adaptive routing and can keep a session on its provider and key, but not on one that is failing or held on this node. [Session affinity docs]
- 05Retries and fallbacks. Run per attempt on the chain adaptive routing leaves, and decide which failures retry a key, rotate to another, or move to the next fallback. [Retries and fallbacks docs]
COMMON CASES
Common Cases
How each case shows up on the dashboard timeline and its incident, what it means, and what to do. [All common cases]
- Key rejected. OpenAI · gpt-4o · prod-key-2. Incident: Needs attention, Key rejected; held the key, checked 9 times. The provider returned an authentication error for the key, for example because it was revoked or rotated outside Bifrost. The provider’s other keys carry its traffic. What to do: Replace the key in the provider’s settings. Editing the key releases the hold, and adaptive routing checks the new key with live traffic.
- Key rate limited. Azure · gpt-4o · eu-key-1. Incident: Resolved, Rate limited; held the key, checked once. The provider rate limited the key for one model. Adaptive routing held it for as long as the provider asked, sent its traffic to the other keys, and the first check after the wait served. What to do: Nothing, unless it keeps happening. Frequent rate limits on one key mean it needs more capacity or another key alongside it.
- Provider outage. AWS Bedrock · claude-sonnet-4-5. Incident: Resolved, Every key under it failed; moved traffic off. The provider was down or erroring for the model. Requests that did not name a provider were sent to the other providers for the model. What to do: Nothing for requests adaptive routing could move. If requests failed with nothing healthier to send them to, add another provider for the model or a fallback.
- Requests kept on a failing provider. OpenAI · gpt-4o-mini. Incident: Needs attention, Redirecting is off; kept on it. These requests named the provider and Redirect Away from Failing Providers is off, so adaptive routing left them on it. What to do: Turn on Redirect Away from Failing Providers, and Add Fallbacks When a Provider Is Named if those requests should fall back while the provider recovers.
LIMITS
Limits
Four things to know before you rely on it. Budgets and rate limits per team or customer belong to AI governance, and running several nodes is covered in enterprise scalability. [AI governance] [Enterprise scalability]
- Health is per node. Each node scores providers and keys from its own traffic, so two nodes can briefly disagree, and nodes in different regions see their own latency. Held keys are shared across the cluster.
- Changes follow traffic. Health is recalculated every few seconds, so a provider that starts failing loses traffic within seconds, not on the first error. Retries and fallbacks protect each request in the meantime.
- New keys start at full share. A key or provider adaptive routing has not measured yet competes at a fair share and settles within a cycle or two.
- Ranking is relative. Providers and keys are ranked against each other, not against a fixed latency or cost target. Cost and budget decisions belong to governance.
See Adaptive Routing on Your Own Traffic
Adaptive Routing is part of Bifrost Enterprise, which you can try free for 14 days. [Book a demo] [See pricing] [A closer look at Bifrost adaptive routing]
Open Source & Enterprise
OSS Features
- 01Model Catalog. Access 25+ providers and 10,000+ AI models through a unified interface. Also supports custom deployed models.
- 02Budgeting. Set spending limits and track costs across teams, projects, and models.
- 03Provider Fallback. Automatic failover between providers keeps your applications available when a provider fails.
- 04MCP Gateway. Centralize all MCP tool connections, governance, security, and auth. Your AI can safely use MCP tools with centralized policy enforcement. [MCP Gateway resource]
- 05Virtual Key Management. Create different virtual keys for different use cases with independent budgets and access control.
- 06Unified Interface. One consistent API for all providers. Switch models without changing code.
- 07Drop-in Replacement. Replace your existing SDK with just one line change. Compatible with OpenAI, Anthropic, LiteLLM, Google GenAI, LangChain, and more. [Drop-in replacement docs]
- 08Built-in Observability. Out-of-the-box OpenTelemetry support. Built-in dashboard for quick visibility without complex setup.
- 09Community Support. Active Discord community with responsive support and regular updates.
Enterprise Features
- 01Governance. SAML support for SSO and role-based access control with policy enforcement for team collaboration. [Governance resource]
- 02Adaptive Load Balancing. Automatically optimizes traffic distribution across provider keys and models based on real-time performance metrics.
- 03Cluster Mode. High availability deployment with automatic failover and load balancing. Peer-to-peer clustering where every instance is equal.
- 04Alerts. Real-time notifications for budget limits, failures, and performance issues on Email, Slack, PagerDuty, Teams, Webhook, and more.
- 05Log Exports. Export and analyze request logs, traces, and telemetry data from Bifrost with enterprise-grade data export for compliance, monitoring, and analytics.
- 06Audit Logs. Comprehensive logging and audit trails for compliance and debugging.
- 07Vault Support. Secure API key management with HashiCorp Vault, AWS Secrets Manager, Google Secret Manager, and Azure Key Vault integration.
- 08VPC Deployment. Deploy Bifrost within your private cloud infrastructure with VPC isolation, custom networking, and enhanced security controls. [Enterprise deployment resource]
- 09Guardrails. Automatically detect and block unsafe model outputs with real-time policy enforcement and content moderation across all agents. [Guardrails resource]
FAQ
What is adaptive routing?
Adaptive Routing is a Bifrost Enterprise feature that picks where each LLM request goes from what it observes on live traffic. It makes two choices for every request: the provider that serves the model, and the API key within that provider. A provider or key that starts failing loses its traffic and gets it back as it recovers, without anyone editing weights or fallbacks.
Is adaptive routing the same as adaptive load balancing?
Adaptive load balancing is the general technique: share traffic by live measurements instead of fixed weights. Adaptive Routing is how Bifrost Enterprise applies it to LLM traffic, at two levels, provider and key, and it adds held keys, optional redirects for requests that name a provider, and a recorded history of incidents. For the general concept, read [what adaptive load balancing is](https://www.getmaxim.ai/articles/what-is-adaptive-load-balancing/).
How is adaptive routing different from weighted LLM load balancing?
Weighted load balancing splits traffic by the weights you set and keeps doing so when a key starts failing. With Adaptive Key Selection on, the weights set on keys are not used: the key is picked from live health, latency and load, with errors counting the most. Turn Adaptive Key Selection off when your key weights must decide the split, for example to divide traffic by contract. Held keys are still skipped either way.
Does adaptive routing send health checks to my providers?
No. Adaptive routing never sends requests of its own to a provider: no health checks, pings or test calls. Everything it knows comes from your live traffic and from how its routing decisions turned out. Even a held key is checked by letting one of your real requests through to it.
How does adaptive routing handle LLM failover during a provider outage?
When every key that can serve a model on a provider has failed, the provider is Failed for that model and is left out. Requests that do not name a provider go to the healthiest remaining provider, with the other healthy ones as fallbacks. Requests that name the failing provider are moved only when Redirect Away from Failing Providers is on. See also [automatic failover and load balancing for LLM apps](https://www.getmaxim.ai/articles/automatic-failover-and-load-balancing-for-llm-apps/).
What happens when a provider rate limits or rejects an API key?
Adaptive routing holds the key. A held key is out of rotation on every node, and after a wait one live request is let through to check it. A rate limit holds the key for one model for as long as the provider asks, or up to 2 minutes when it does not say. A rejected key is held for every model, with waits that climb to 15 minutes, until it is replaced, edited or released.
How quickly does adaptive routing react to a failing provider?
Health is recalculated every few seconds, so a provider that starts failing loses traffic within seconds, not on the first error. Retries and fallbacks protect each request in the meantime. A sharp burst of errors moves a key straight to Failed without passing through Degraded.
Is Adaptive Routing available in open-source Bifrost?
No. Adaptive Routing is part of [Bifrost Enterprise](/enterprise). Open-source Bifrost includes retries, fallbacks and weighted load balancing across keys and providers, which you configure yourself.
Can I keep some requests pinned to one provider?
Yes. By default adaptive routing keeps a request that names a provider on that provider with its own fallbacks, and only picks the key. For strictly pinned traffic such as compliance or data residency, leave Add Fallbacks When a Provider Is Named and Redirect Away from Failing Providers off, and restrict providers with governance.