HTTP 429 Rate Limit & Retry-After Automatic Upstream Failover
Treating every non-200 HTTP status identically causes two opposite failures: hammering rate-limited providers during Retry-After windows, or failing over endlessly on malformed 400 client inputs. FuelRouter maps every status code to an exact deterministic policy.
HTTP Status Classification & Failover Action Matrix
| Status Class | HTTP Codes | Failover? | Circuit Impact | Cooldown Policy |
|---|---|---|---|---|
| Retryable Rate Limit | 429 Too Many Requests | Immediate failover | Increment failure / cooldown | Respect Retry-After header (capped at 300s) |
| Retryable Server/Timeout | 408, 500, 502, 503, 504 | Immediate failover | Increment consecutive_failures | Trips OPEN at 3 consecutive failures (45s-900s) |
| Upstream Auth Rot | 401, 403 | Immediate failover | Increment failure & flag vault | Prevents expired session from blocking healthy peers |
| Non-Retryable Client | 400, 422 | No failover | Zero circuit penalty | Returns HTTP 422 ($0 charged) to caller immediately |
Respecting Retry-After Without Enabling DoS Locks
When an upstream returns HTTP 429 with Retry-After: 90, FuelRouter honors that window by setting circuit_open_until_ts at least 90 seconds forward, preventing wasted probes while immediately serving the caller through another pool member.
To defend against misconfigured upstreams sending absurd values like Retry-After: 864000, FuelRouter enforces retry_after_cap_s: 300 (5 minutes) combined with global max_cooldown_s: 900.
Isolating 401/403 Session Expiration Across Vault Accounts
Cookie-backed and token-backed free tiers occasionally experience session expiration (HTTP 401 or 403). FuelRouter classifies 401 and 403 as auth_rot_http_statuses, failing over instantaneously to healthy vault accounts while recording the redacted failure event for operator inspection.
Conversely, HTTP 400 and 422 indicate an invalid caller payload—stopping failover immediately so bad requests do not waste quota across all 8 upstreams.
Inspect Cooldown & Retry-After Enforcement in Dispatch Trace
{
"ok": true,
"served_by": "search_valyu_free",
"charged_micros": 8000,
"trace": [
{"step": 1, "upstream_id": "search_tavily_free", "outcome": "http_429", "status_code": 429, "circuit_state": "OPEN"},
{"step": 2, "upstream_id": "search_valyu_free", "outcome": "hit", "status_code": 200, "circuit_state": "CLOSED"}
]
}
HTTP 429 & Status Handling Checklist
- Never sleep synchronously on a 429 inside the request path when healthy peer upstreams are ready.
- Cap parsed Retry-After headers at 300s (retry_after_cap_s) to guarantee bounded recovery.
- Separate 401/403 auth rot (fail over immediately) from 400/422 client validation errors (abort with $0).
- Monitor 429 counts per upstream via GET /v1/router/metrics to adjust local RPM limits if needed.
Frequently Asked Technical Questions
Does FuelRouter sleep during a 429 Retry-After window before failing over?
No. FuelRouter places the 429 upstream into cooldown and fails over immediately to the next healthy candidate within the same request.
Why cap Retry-After at 300 seconds?
Capping at 300s respects polite vendor rate limits while preventing a buggy header from taking an upstream offline for days.
What happens if an upstream returns 403 due to an expired vault cookie?
FuelRouter treats 403 as auth rot, fails over immediately to another vault slot, and logs a redacted trace without exposing any cookie.
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
- Hard Budget Lock (max_cost_micros) Guardrails for AI Agents — max_cost_micros hard API budget lock for autonomous agents
- Detecting HTTP 200 Login Walls & Empty SPA Shells in Proxy Responses — detect HTTP 200 login wall and empty SPA shell responses
- Adaptive TTL Cache Invalidation & force_refresh Semantics — adaptive TTL cache invalidation and force_refresh API