---
title: "OpenAI 429 & Gemini 503 failover guide"
canonical: "https://rawroute.dev/guides/429-503-llm-rate-limit-failover"
lang: "en"
last_verified: "2026-11-28"
description: "Handle OpenAI 429 rate_limit_exceeded and Gemini 503 / 429 RESOURCE_EXHAUSTED with clean retry rules and multi-provider failover."
---

# OpenAI 429 & Gemini 503 failover guide

Not every 429 or 503 should be retried blindly: transient RPM/TPM 429s and Gemini 503 bursts recover on alternate providers immediately, whereas 400/401/403 must stop immediately. rawroute routes across up to 4 providers per model on 429/502/503 and returns real HTTP status codes so client SDKs never misread failures.

## Client retry matrix for LLM gateways

| HTTP Status | Meaning | Gateway & client action |
|---|---|---|
| 429 / 502 / 503 | Rate limit or upstream provider failure | Auto-failover to next provider (up to 4); safe to retry with backoff |
| 504 | Upstream request timed out | Not billed; retry idempotent requests with backoff |
| 400 / 401 / 403 / 404 | Bad payload, invalid key, spend limit, unknown model | Do NOT retry — fix request or key limit first |

## Why Gemini 4 & 3.8 Flash spike on 503

Gemini endpoints regularly experience regional capacity bursts that return 503 UNAVAILABLE even when your account is healthy. rawroute distributes each Gemini model ($1.00 / $5.00) across 4 distinct providers so one region's congestion routes seamlessly to another.

### OpenAI SDK · TypeScript

```js
import OpenAI from "openai"

const client = new OpenAI({
  baseURL: "https://api.rawroute.dev/v1",
  apiKey: process.env.RAWROUTE_API_KEY,
  maxRetries: 3, // OpenAI SDK automatically retries 429, 502, 503 with jitter
  timeout: 60_000,
})

const res = await client.chat.completions.create({
  model: "gemini-4-argon",
  messages: [{ role: "user", content: "Return JSON health check." }],
})
```

## When NOT to use rawroute

- Do not expect retries to fix HTTP 400 validation errors or HTTP 401 spend-limit caps—those fail fast intentionally to protect your budget.
