Multi-Upstream API Failover Router with Circuit Breaker
Single-vendor API integrations collapse under sudden HTTP 429 rate limits, silent regional brownouts, and CAPTCHA soft-bans. FuelRouter unifies 33 upstream slots across 5 capability pools behind a deterministic 3-state circuit breaker and SQLite WAL quota ledger.
Live 5-Pool Failover Topology & SLA Matrix
| Pool ID | Free $0 / Total | Outcome Price | Cache TTL (Min-Max) | Target SLA | Target p95 | Exhaustion Bill |
|---|---|---|---|---|---|---|
| ai_chat_json | 5 / 8 | $0.010 (10,000 micros) | 7d - 30d (604,800s - 2,592,000s) | 99.6% | 2,200 ms | $0.00 |
| embeddings_rerank | 3 / 6 | $0.004 (4,000 micros) | 14d - 30d (1,209,600s - 2,592,000s) | 99.7% | 950 ms | $0.00 |
| web_search | 3 / 6 | $0.008 (8,000 micros) | 7d - 21d (604,800s - 1,814,400s) | 99.5% | 1,800 ms | $0.00 |
| clean_scrape_extract | 4 / 6 | $0.012 (12,000 micros) | 7d - 21d (604,800s - 1,814,400s) | 99.4% | 3,500 ms | $0.00 |
| b2b_domain_dns_enrichment | 5 / 7 | $0.020 (20,000 micros) | 14d - 30d (1,209,600s - 2,592,000s) | 99.6% | 1,600 ms | $0.00 |
Deterministic 4-Tuple Candidate Ranking
Every live dispatch sorts eligible upstreams using an explicit 4-tuple key: ascending unit_cost_micros so $0 free-tier slots always execute before wholesale fallbacks, descending EWMA dynamic_health_score, descending remaining_free_quota_ratio across rolling RPM/RPD/monthly windows, and deterministic priority_rank.
Local routing, SQLite WAL quota reads, and archive cache lookups complete within <= 50 ms p95 overhead, ensuring automatic failover never stalls autonomous agent loops.
End-to-End Failover Pipeline Without Retry Tax
When an upstream returns HTTP 429, 5xx, a network timeout, an HTML interstitial, a login wall, or a CAPTCHA soft-ban, FuelRouter records telemetry atomically and fails over to the next ranked upstream within the exact same HTTP or MCP call.
If all candidates are OPEN, quota-exhausted, or return invalid shells, the gateway returns HTTP 503 all_upstreams_exhausted with charged_micros: 0 and billed_usd: 0.0.
Inspect Redacted Pool Health & Dispatch via REST
curl -fsSL "https://fuelrouter.fastmesh.dev/v1/router/pools"
curl -fsSL -X POST "https://fuelrouter.fastmesh.dev/v1/router/dispatch" \
-H "Content-Type: application/json" \
-d '{
"pool_id": "web_search",
"tenant_id": "prod_agent_fleet",
"inputs": {"query": "circuit breaker multi upstream failover", "max_results": 5},
"max_cost_micros": 40000
}'
Production Readiness Checkpoints for Multi-Upstream Routers
- Verify GET /health reports pools_loaded: 5, sqlite_wal: true, and zero_secret_mode: true before routing live traffic.
- Run zero-cost POST /v1/router/quote dry runs during canary deploys to validate planned candidate ordering.
- Monitor GET /v1/router/metrics to track failover frequency, cache hit ratio, and per-pool OPEN circuit counts.
- Set explicit max_cost_micros ceilings on every autonomous agent call to prevent unexpected wholesale fallback spend.
Frequently Asked Technical Questions
How fast does FuelRouter switch upstreams after an upstream failure?
Failover occurs immediately inside the same dispatch request with <= 50 ms local decision overhead, without requiring the caller to retry.
Are callers billed when multiple upstreams fail before a final exhaustion?
No. If all eligible upstreams fail or return fake-200 shells, FuelRouter returns HTTP 503 with charged_micros: 0 and billed_usd: 0.0.
Can an operator force a tripped circuit back to CLOSED after upstream maintenance?
Yes. POST /v1/router/circuit/reset resets a single upstream_id, an entire pool_id, or all pools immediately.
Live Try-Now Console & Machine Discovery
Test failover routing, dry-run quotes, and circuit breaker metrics on the live gateway or connect via JSON-RPC 2.0 MCP.
Related FuelRouter Architecture Guides
- Anti-Fake-200 HTTP Proxy Gateway: Blocking Silent Payload Corruption — anti-fake-200 HTTP proxy gateway
- Cross-Tenant API Response Cache & 100% Repeat-Margin Economics — cross-tenant API response cache 100% repeat margin
- Zero-Secret Credential Proxy for Autonomous AI Agents — zero-secret credential proxy for AI agents