Gemini api requests failing on a brand new api key?

I just generated this api key 30 minutes ago, been failing to integrate into project and wondering why, ran the test curl command and it says my (free tier) quota has been used!?
elapt1c@fedora:~$ curl “``https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent``” -H ‘Content-Type: application/json’ -H ‘X-goog-api-key: xxxxxxxxxxxxxxxxxxxxxxxx-bxxxxxxxQ’ -X POST -d ‘{
“contents”: [
{
“parts”: [
{
“text”: “Explain how AI works in a few words”
}
]
}
]
}’
{
“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/rate-limit. \n* Quota exceeded for metric: ``generativelanguage.googleapis.com/generate_content_free_tier_input_token_count``, limit: 0, model: gemini-2.0-flash\n* Quota exceeded for metric: ``generativelanguage.googleapis.com/generat
e_content_free_tier_requests, limit: 0, model: gemini-2.0-flash\n* Quota exceeded for metric: ``generativelanguage.googleapis.com/generate_content_free_tier_requests``, limit: 0, model: gemini-2.0-flash\nPlease retry in 4.013024782s.”,
“status”: “RESOURCE_EXHAUSTED”,
“details”: [
{
“@typetype”: “``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”: “``type.googleapis.com/google.rpc.QuotaFailure``”,
“violations”: [
{
“quotaMetric”: “``generativelanguage.googleapis.com/generate_content_free_tier_input_token_count``”,
“quotaId”: “GenerateContentInputTokensPerModelPerMinute-FreeTier”,
“quotaDimensions”: {
“location”: “global”,
“model”: “gemini-2.0-flash”
}
},
{
“quotaMetric”: “``generativelanguage.googleapis.com/generate_content_free_tier_requests``”,
“quotaId”: “GenerateRequestsPerMinutePerProjectPerModel-FreeTier”,
“quotaDimensions”: {
“location”: “global”,
“model”: “gemini-2.0-flash”
}
},
{
“quotaMetric”: “``generativelanguage.googleapis.com/generate_content_free_tier_requests``”,
“quotaId”: “GenerateRequestsPerDayPerProjectPerModel-FreeTier”,
“quotaDimensions”: {
“model”: “gemini-2.0-flash”,
“location”: “global”
}
}
]
},
{
“@type”: “``type.googleapis.com/google.rpc.RetryInfo``”,
“retryDelay”: “4s”
}
]
}
}

1 Like

I too am experiencing a rate limit error on a new API key (Free Tier), failing on the first prompt near immediately. My troubleshooting has given a near identical log as OP.

Figured out my issue, Gemini-CLI was working for all prompts except the first one I attempted, “Identify the system and storage”. Apparently this was triggering a safety protocol but returning an error for quota limit. And since it was my first prompt it sent me down the wrong hole.

Am also facing this challenge

it might be gemini cli (which isnt using any direct api key) but idk, im trying to use gemini cli to build an app that uses the gemnini api inside of it, but honestly i dont know.

Do you have a billing method attached to your account in AI Studio?

You can create an API key, but will get that 429 error until you add a billing method to your account through Google Cloud. That will “activate “ the free tier and your API calls should work, with daily quotas on generation.

After you add a billing method, in AI Studio with your API key, you should see a link to “Activate Billing”. This will move you off the free tier! As long as you don’t activate billing you will stay on the free tier, but once activated you will have increased quotas, but will be paying for it.

The trick is that you NEED the billing method attached to the key, but not activated.

i want to understand is the free tier is really free. if i have to add a billing and when i add billing its not free any more. so how do i use a completely free tier. if i have to add billing and will get charged on that.

Background:

  • You can use an API key generated from a project without billing.
  • Rate limits for free tier projects / keys will be lower, and may be 0 for some models.
  • You can see your rate limits in: AI Studio > Dashboard > API Keys > View usage (the small chart symbol) > Rate Limit.

@elapt1c, to address your exact scenario:

The gemini-2.0-flash model is slated for deprecation and it’s rate limit is set to 0 in the free tier. I’d recommend you pick a different model, e.g. gemini-2.5-flash or gemini-3-flash-preview.

I’m getting rate limit errors even though I’m not even close to hitting my rate limit. Tier 1 paid account, Nano Banana Pro, using it through AI Studio with a paid API key.

When I view the rate limits page it says 0/1500 available.. Yet I still get quota error.

Switching to 2.5 worked for me