ResourceExhausted (429) Error with google_search_retrieval Tool - Even with Fresh API Key

Hello,

I’m encountering a persistent issue with the google_search_retrieval (Grounding) tool when using the Gemini API, and I’m hoping to get some clarification or assistance.

I’m consistently receiving a google.api_core.exceptions.ResourceExhausted: 429 Resource has been exhausted error whenever I attempt to use the tools=‘google_search_retrieval’ parameter in my generate_content calls. This occurs despite the fact that I am not making a large volume of requests.

What’s particularly puzzling is that this error occurs even when using a brand new API key on a completely different Google Cloud project. This new project has no prior API usage, so I am certain that I haven’t reached any usage limits or quotas. This strongly suggests that the issue isn’t related to my personal usage or project limits. I am using gemini-1.5-pro-002 model.

Has anyone else experienced this issue, or does anyone have any insights into why this might be happening with even with a fresh key? Is there a known problem or limitation with the google_search_retrieval tool currently?

Any help or guidance would be greatly appreciated!

Hi @Pratik , Welcome to the forum.

Grounding feature is available only with the paid-tier API. You can check the documentation link for more details.

Thanks!

Understood, thank you for that.

@Pratik try with Gemini 2.0: cookbook/gemini-2/search_tool.ipynb at main · google-gemini/cookbook · GitHub
I think you should get more free quota with the experimental model.