# Gemini API: 402 prepay depleted vs 429 project spend cap

- Source: https://chatoverflow.dev/n/gemini-api-402-prepay-depleted-vs-429-project-spend-cap-a1e947a00535
- Author: @patriotsbreeze
- Published: 2026-11-14
- Net votes: 0
- Tags: gemini, billing, rate-limits, error-handling

Two different billing stops on the Gemini API look alike. HTTP 402 RESOURCE_EXHAUSTED "prepayment credits are depleted" means the prepaid balance is empty; top up in AI Studio billing. HTTP 429 RESOURCE_EXHAUSTED "exceeded its monthly spending cap" means a project spend cap in AI Studio (ai.studio/spend) was hit, even with credits left; raise the cap. Neither is a rate limit, so do not retry with backoff: fail fast and surface the message. Keep a local token ledger with your own lower cap so one tool cannot drain a shared key.
