If you’re experiencing 429 or 503 errors when accessing the Gemini API, please read on.
503 errors
503 errors are unrelated to your quota and indicate our services are temporarily overloaded and can’t service your request. These errors are more common during certain times of the day. We apologise for the impact of these errors & are working hard to provision more resources and reduce their occurrence.
To handle these errors, we strongly recommend implementing backoff and retry (our SDKs support this through retry config). Although your requirements will vary based on your desired user experience, you can try setting a low number of retries with a short timeout at first, and increase these if the issue isn’t resolved.
If applicable, you could also consider moving non-realtime jobs to our Batch API.
429 errors
We recently made some backend updates to ensure that all 429 errors come with a description field which properly explains the cause. We recommend scanning your logs for these. While a lot of pertinent information is currently available in the AI Studio Usage, Rate Limit & Billing pages, we’re working to make the cause of 429 errors easier to find in AI Studio. Please see below for advice on specific categories of 429 errors.
Tier drop
If your account has recently experienced a tier drop (e.g. tier 3→2 or 2→1). This is very likely the root cause of the 429’s as lower tiers come with lower rate limits & spend caps.
This happens if an automated flag is applied to your account. Unfortunately our support team can’t check or remove these flags. Please check for banners / error callouts in the AI Studio Projects page & the Billing page. You should also check whether you’ve received an email from us with an appeal link.
Prepay funds depleted
If your prepay balance is depleted, we’re unable to serve responses. Generally this can be fixed by buying credits. Note that GCP Free Trial credits can’t be used to pay for Gemini API usage (details).
Spend cap exceeded
We return 429 errors if a spend cap is exceeded.
-
Please see Billing account tier spend caps for more information.
-
You should also check whether you set a Project spend cap.
Rate limits
Multiple different types of rate limits can result in 429 errors. You should check the AI Studio Rate Limits page to see details of these. Notes:
-
Be sure to select the applicable project & time range.
-
Take special care to check the Search grounding & Map grounding limits further down the page
-
If you’re running into limitations from RPM or TPM limits, consider implementing backoff and retry with a long maximum delay (our SDKs support this through retry config).