Looking for comprehensive provider routing documentation?For a detailed guide covering how adaptive load balancing works with governance routing, the two-level architecture (provider + key selection), Model Catalog integration, and example scenarios, see the Provider Routing Guide.This page focuses on the technical implementation and performance characteristics of adaptive load balancing.
Overview

Architecture
The load balancing system operates at two levels:- Direction-level (provider + model): Decides which provider to use for a given model
- Route-level (provider + model + key): Decides which API key to use within a provider
How Weight Calculation Works
Every 5 seconds, the system recalculates a weight for each route from its recent performance. Three signals drive the score, in priority order:
Which signals apply depends on the route’s health: healthy routes are scored mainly
on errors and latency, while routes that are actively recovering are scored on latency
and recovery progress so they aren’t held back by stale error history. The combined
score maps to a weight on a fixed scale - lower penalties mean higher weight, which
means more traffic - with a floor so no route is ever fully starved while it has a
chance to recover.
Key Capabilities
- Automatic Route Health Management: Routes automatically transition between 4 states (Healthy, Degraded, Failed, Recovering) based on error rates and latency. No manual intervention required when a route fails or recovers.
- Fair Traffic Distribution: The system prevents any single route from being overloaded while still favoring better performers. Low-weight routes always get minimum traffic to prove recovery.
- Real-time Dashboard: Provides visibility into weight distribution, performance metrics (error rates, latency), state transitions, and actual vs expected traffic per route.

- Multi-Factor Scoring: Routes are scored from error rate (the primary, time-decayed signal), a token-aware latency score (comparing a route both to its peers and to its own recent baseline), and fair-share utilization. Recovering routes are scored to favor quick, safe recovery.
- Smart Key Selection: Traffic is distributed probabilistically - higher-weight keys get proportionally more requests, but lower-weight keys keep a small share so potentially-recovered routes are continually re-probed instead of always picking the single best route.
- Performance Thresholds: Pre-tuned error-rate and latency triggers drive state transitions - a route is marked Degraded at the first signs of trouble, Failed on sustained errors or a rate-limit hit, and promoted back to Healthy only after it has proven itself on live traffic.
Configuration
Adaptive load balancing ships pre-tuned - the scoring weights, thresholds, and recovery timings are not user-configurable by design. The operator controls are four switches:
The two selection switches default on; the two failed-direction behaviors are opt-in. All four take effect live (no restart) and propagate across the cluster.
All four switches can be changed from the dashboard, via the API, or in
config.json.
- Web UI
- API
- config.json
The load balancer settings page exposes the four switches; changes apply immediately across the cluster.

Scope & Limitations
- Per-node weights: Each node load-balances on its own observed metrics. The only signal shared across nodes is a rate-limit (TPM) backoff, and only within the same region - there is no global weight consensus or cross-region coordination. This is deliberate: latency and error profiles differ per region, so importing another region’s metrics would pollute a node’s view of route health.
- ~5-second adaptation: Weight and state changes lag live traffic by up to one recompute cycle. Immediate per-request resilience (key rotation and fallback failover) is handled separately and is not subject to this delay.
- Optimistic cold start: A brand-new key or provider enters at full weight and competes at roughly fair share before it has been measured, then self-corrects within a cycle or two.
- Relative, not absolute: Routes are ranked against their peers, not against a fixed latency or cost target. The system is not cost-, org-, or session-aware, and does not accept manual per-key weights for the adaptive path - those concerns are handled by governance routing.
Next Steps
- Provider Routing - How adaptive load balancing composes with governance rules and the Model Catalog
- Circuit Breaker - Header-signal-driven failover to a backup provider when a primary endpoint degrades
- Clustering - Multi-node deployments and the gossip layer behind cross-node load balancer signals

