generative-ai-python
generative-ai-python copied to clipboard
429 Quota exceeded for quota metric 'Generate Content API requests per minute' and limit 'GenerateContent request limit per minute for a region' of service 'generativelanguage.googleapis.com' for consumer 'project_number:************'. [reason: "RATE_LIMIT_EXCEEDED"
Description of the bug:
I am facing this error since last 2 weeks It says the rate limit has exceeded, but I did not request to GEMINI API more than 60 times per minute
ERROR:
429 Quota exceeded for quota metric 'Generate Content API requests per minute' and limit 'GenerateContent request limit per minute for a region' of service 'generativelanguage.googleapis.com' for consumer 'project_number:**********'. [reason: "RATE_LIMIT_EXCEEDED"
domain: "googleapis.com"
metadata {
key: "service"
value: "generativelanguage.googleapis.com"
}
metadata {
key: "quota_metric"
value: "generativelanguage.googleapis.com/generate_content_requests"
}
metadata {
key: "quota_location"
value: "us-west4"
}
metadata {
key: "quota_limit"
value: "GenerateContentRequestsPerMinutePerProjectPerRegion"
}
metadata {
key: "quota_limit_value"
value: "0"
}
metadata {
key: "consumer"
value: "projects/***********"
}
, links {
description: "Request a higher quota limit."
url: "https://cloud.google.com/docs/quota#requesting_higher_quota"
}
]
Actual vs expected behavior:
No response
Any other information you'd like to share?
No response
My solution is to reapply for a new key at https://aistudio.google.com/app/apikey. Please note to select a new Google Cloud project. The new key will then have normal access.
metadata {
key: "quota_limit_value"
value: "0"
}
Some reason the quota is zero in that log.
It's possible that key, or project was disabled. I believe google disables any key that it finds on github, for example.
I'm getting that error when I attempt to call count_tokens()
with a large string.
!
How large? How many times did you call it?
Hi dears, My code worked properly till last week and now I am facing the same issue. I also created a new GCP project and generate a new Google API key for the project but still the issue exists. Gemini Pro is free as I know and the number or requests should be less than 60 as I know (Mine is 30!), do you have any other suggestion please?
Is your prompt over 32k tokens? Gemini-Pro-1.5 seems to be limited to 32k tokens per minute... (seems like a mistake compared to other models)
Are solve about questions? I have same problems, i tried in different account but nothing fix the program
Are solve about questions? I have same problems, i tried in different account but nothing fix the program
metadata { key: "quota_limit_value" value: "0" }
Some reason the quota is zero in that log.
It's possible that key, or project was disabled. I believe google disables any key that it finds on github, for example.
How then do I enable the API Key again. I have tried regenerating it and they all do not work.
Prompts over 32k definitely work.
Can you give enough details that I can replicate this? A link to a Colab would be great.
Solved, I used a lot of API keys, with multi thread combined. How to do it? Here instead of having to buy a Google Console, I bought a lot of daily Gmail accounts (in my case, I bought 50 Gmail accounts for $0.33 or $0.0066 per account).
It's very, very cheap and able to analyze and rate my code even to 300k lines of code and 31 million characters without limitations.
Example code:
# API keys and configuration
api_keys = [
# Add API keys here
]
current_api_key_index = 0
api_key_lock = Lock()
key_usage_semaphore = Semaphore(len(api_keys) * 15) # 15 RPM per key
request_lock = Lock()
api_limit_reached = []
# Configure Generative AI with the first API key
genai.configure(api_key=api_keys[current_api_key_index])
# Initialize model
model = genai.GenerativeModel('gemini-1.5-flash-latest')
Prompts over 32k definitely work.
Can you give enough details that I can replicate this? A link to a Colab would be great.
@sultanzio, be careful not to post your API keys (I deleted them for you).