Gemini API returned 429 RESOURCE_EXHAUSTED. Slow down or raise limits—don’t confuse it with 402
A Gemini API 429 RESOURCE_EXHAUSTED is a rate or spend limit, so back off and retry. A 402 with that status needs Prepay credits, not another retry. Short answer: 5 steps. 1) Confirm it is HTTP 429, not 402; 2) Check which limit and tier you are on; 3) Retry only rate limits, with backoff and jitter; 4) Cut burst size and expensive tokens; 5) Upgrade tier or request a limit increase when you truly need capacity.
Last updated: · This page is the decision checklist; the tools list for “Handle Gemini API 429 RESOURCE_EXHAUSTED” is a separate URL.
How do I tell a Gemini API 429 RESOURCE_EXHAUSTED from a 402?
Confirm it is HTTP 429, not 402
On generateContent, HTTP 429 with status RESOURCE_EXHAUSTED means you exceeded a rate or spend-rate limit (RPM, TPM, RPD, spend window, and similar). HTTP 402 with RESOURCE_EXHAUSTED means Prepay credits are depleted—add credits or turn on auto-reload and do not retry until credits are available. Error table: https://ai.google.dev/gemini-api/docs/generate-content/api-errors
Check which limit and tier you are on
Rate limits are per Google Cloud project, not per API key. RPD resets at midnight Pacific time. Open AI Studio’s rate-limits view for the model you call, and note your usage tier (Free, Tier 1–3). Spend-based limits (when they apply) are evaluated on a rolling 10-minute window—for example Tier 1 is $10 per 10 minutes. Docs: https://ai.google.dev/gemini-api/docs/rate-limits
Retry only rate limits, with backoff and jitter
For transient 429 (and 503), wait briefly, then use exponential backoff with random jitter and a max attempt count. Official Gemini client SDKs already retry 429/5xx with backoff (Python SDK: up to four retries, ~1s initial delay, max ~60s). Do not stack a second aggressive retry loop on top of the SDK. Troubleshooting: https://ai.google.dev/gemini-api/docs/troubleshooting
Cut burst size and expensive tokens
Lower parallel calls, shorten prompts and max output tokens, and avoid hammering experimental/preview models (they are more restricted). If you hit spend-based limits during normal usage, reduce large-context or high-output jobs and space them out across the 10-minute window.
Upgrade tier or request a limit increase when you truly need capacity
Link billing in AI Studio to leave the Free tier; higher tiers unlock after cumulative Google Cloud spend thresholds. Request a model RPM increase from the AI Studio rate-limit page when you consistently hit limits under normal load—Google does not guarantee increases. Never retry a 400/402/403 as if it were a 429.
Which tools are best to handle Gemini API 429 RESOURCE_EXHAUSTED?
Gemini API rate limits
RPM/TPM/RPD, spend-based windows, usage tiers, and how to request increases.
Troubleshooting guide
Official retry strategy with exponential backoff and jitter for 429/503.
generateContent API errors
HTTP 429 vs 402 both named RESOURCE_EXHAUSTED—different fixes.
Interactions API errors
rate_limit_exceeded, quota_exceeded, and payment_required codes for Interactions.
Open: 1 spot per week
One labeled sponsor for this topic each week; this week's spot is open. See open weeks →
All tools for “Handle Gemini API 429 RESOURCE_EXHAUSTED” →
Related fixes
- Stop a Cursor agent loopHow to fix a Cursor agent loop (same edit, or work after Stop)Fix →
- Claude Code vs Codex vs Cursor ~$20 plansClaude Code vs Codex vs Cursor $20 plan limits: how to pick without burning the weekFix →
- Scan a vibe-coded app for leaked API keysCheck a vibe-coded app for leaked API keys before you share itFix →
- Add an MCP server to Claude Code, Cursor, or CodexHow to add an MCP server to Claude Code, Cursor, or CodexFix →
See also AI tools launched today on the daily board.
NewAIToolsToday Daily
Top 3 AI launches, one model or news item that matters, and one simple fix. A 5-minute read, every weekday.