Issue with Quota Limit in Gemini API

I’m using the Gemini API, but I’m experiencing issues with the usage quota limit per minute.
The Gemini API returns a 429 status error with the message " Resource has been exhausted (e.g. check quota)" when the quota limit is exceeded.
I’ve tried handling this situation using specific exceptions provided by the API, but I haven’t been successful.
Additionally, I haven’t found a function to determine how much quota (RPM) I’ve been consuming.
My main goal is to find a solution using Python’s try to prevent the application from failing due to this quota error.

I appreciate any guidance or suggestions to resolve this issue.
Thank you!

AFAIK there are no headers in the response that include rate-limit information.

One of the ways you could handle this is with retries.