Skip to main content
  1. On 429, wait at least Retry-After.
  2. On 502/503 without Retry-After, double the wait each attempt (1s, 2s, 4s, 8s).
  3. Add random jitter.
  4. Cap attempts and maximum wait, then surface the error with its X-Request-ID.
Retry-After beats your computed backoff.

Pseudocode

Which codes are retryable: Retry behavior.

Circuit Breaker

After consecutive provider failures the gateway stops routing to that provider for a cooldown window, then probes before reopening. During cooldown you may see 503 unavailable or 502 provider_error; an open-circuit rejection never dispatched, so it is safe to retry with backoff.