429 Error while using image generation model

I’m using free tier for billing, in text models i’m not getting this issue. what needs to be done to get rid of 429 error

{‘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: 0, model: gemini-2.5-flash-preview-image\n* Quota exceeded for metric: ``generativelanguage.googleapis.com/generate_content_free_tier_requests``, limit: 0, model: gemini-2.5-flash-preview-image\n* Quota exceeded for metric: ``generativelanguage.googleapis.com/generate_content_free_tier_input_token_count``, limit: 0, model: gemini-2.5-flash-preview-image\nPlease retry in 856.559356ms.’, ‘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’: {‘location’: ‘global’, ‘model’: ‘gemini-2.5-flash-preview-image’}}, {‘quotaMetric’: ‘``generativelanguage.googleapis.com/generate_content_free_tier_requests’``, ‘quotaId’: ‘GenerateRequestsPerMinutePerProjectPerModel-FreeTier’, ‘quotaDimensions’: {‘location’: ‘global’, ‘model’: ‘gemini-2.5-flash-preview-image’}}, {‘quotaMetric’: ‘``generativelanguage.googleapis.com/generate_content_free_tier_input_token_count’``, ‘quotaId’: ‘GenerateContentInputTokensPerModelPerMinute-FreeTier’, ‘quotaDimensions’: {‘location’: ‘global’, ‘model’: ‘gemini-2.5-flash-preview-image’}}]}, {‘@type’: ‘``type.googleapis.com/google.rpc.RetryInfo’``, ‘retryDelay’: ‘0s’}]}}

What to do when you get a 429? A familiar error! You need to switch to a paid plan as you just ran out of your quota for today. :slight_smile:

Or wait a day… or two, and try again…

Yeah, I’ve seen the same error plenty of times. The text ‘GenerateRequestsPerDayPerProjectPerModel-FreeTier’ in the error message already indicates you’re using a free tier and ran out of your quota.

I do understand that i’m using free tier, but in error message it’s indicating limit as 0 and I couldn’t find any rate limit information for free tier in https://ai.google.dev/gemini-api/docs/rate-limits. I’ve also not exceeded my quota for sure
Do I need to switch to paid plan If i want to use image generation api ?

1 Like

You should be able to keep a free tier, but the 429 indicates that you are hitting your rate limit in some way. I got it often when trying to make too many images at once, so now I limit my app to just five AI jobs at the same time, implementing a queue for all AI requests my code makes. This seems to work quite well for me.

The rate limits tend to vary a lot depending on the model you use and other factors so they don’t specify the exact limits. It’s just that you get the 429 error telling you to slow down or wait some time. I have a Tier 1 account, but prefer to use the free tier instead. When I run against the 429, I can switch to my tier 1 account by switching the API key. (My apps also have an input dialog for the API key.)

But my best advisse for your app is to implement a job queue. (Let the AI make it.) This queue would have four types of jobs: Pending, Running, Succeeded and Failed. It is told to limit the number of running jobs to five so my app tends to have a long pending queue for AI jobs. I have counters in my status bar that show me the total number of each job and if I click on those, I can delete them all or check any details. For the Failed jobs queue, I also have a retry option.

1 Like