503 "The model is overloaded" is being counted against the rate limits

Background

I was fiddling around with an application that auto-retries upon failure.

Error received - Model is Overloaded

I’m OK with this and will simply retry.

google.genai.errors.ServerError: 503 UNAVAILABLE. {'error': {'code': 503, 'message': 'The model is overloaded. Please try again later.', 'status': 'UNAVAILABLE'}}

After a bunch of iterations, I unexpectedly got quota exceeded

google.genai.errors.ClientError: 429 RESOURCE_EXHAUSTED. {'error': {'code': 429, 'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, head to: https://ai.google.dev/gemini-api/docs/rate-limits. To monitor your current usage, head to: https://ai.dev/usage?tab=rate-limit. \n* Quota exceeded for metric: generativelanguage.googleapis.com/generate_content_free_tier_requests, limit: 50, model: gemini-2.5-pro\nPlease retry in 48.805646254s.', 'status': 'RESOURCE_EXHAUSTED', 'details': [{'@type': 'type.googleapis.com/google.rpc.Help', 'links': [{'description': 'Learn more about Gemini API quotas', 'url': 'https://ai.google.dev/gemini-api/docs/rate-limits'}]}, {'@type': 'type.googleapis.com/google.rpc.QuotaFailure', 'violations': [{'quotaMetric': 'generativelanguage.googleapis.com/generate_content_free_tier_requests', 'quotaId': 'GenerateRequestsPerDayPerProjectPerModel-FreeTier', 'quotaDimensions': {'model': 'gemini-2.5-pro', 'location': 'global'}, 'quotaValue': '50'}]}, {'@type': 'type.googleapis.com/google.rpc.RetryInfo', 'retryDelay': '48s'}]}}

But, if you look at the usage dashboard on AI studio, 31/50 of the requests were due to “The model is overloaded”


Questions

  1. Shouldn’t “The model is overloaded“ not be counted against the limits?
  2. If I transition to a paid tier, would I be billed for 503?

These are errors on Google’s end and not the user.

Every time you send a request and receive a 503 response, Google records it as successful and counts your quota.

Hii @Flipp_Fuzz

Thank you for reaching out to us.

Could you please let us know which model you are using?? This will help us better understand and analyze the problem so we can provide you with a more accurate and helpful response.

It is in the image. gemini-2.5-pro

Hi @Flipp_Fuzz and @Setapca,
Thanks for reporting this issue.
Could you please confirm, if you are still facing this issue?