Gemini API Hanging Without Response What to Do?

I generated the API key in AI Studio and connected a billing account on Google Cloud.

Most of the time, my requests do not receive a response and simply hang. Whether I’m using the Python SDK, Gemini CLI, or a simple cURL command with my API key, the behavior is consistent.

I’m not talking about receiving rate-limiting or quota errors. I’m talking about not receiving any response at all, even after a significant wait.

This happens more often with Gemini 2.5 Pro than Flash.

In contrast, while this is happening, AI Studio Chat functions as expected.

Is there anything I can do?

1 Like

Hi @atacan,

I couldn’t reproduce this issue on my end. Can you confirm if you’re still experiencing it?

Thank you!

1 Like

I am facing a similar issues, although it started occuring on only on Gemini 2.5-flash stable version , all the preview versions were working fine but for some reason the stable version sometime hangs and give response back after 3-4 mins which is not ideal , any idea what is happneing in the backend for this lag.

I met the same problem and I found the reason for my case is adding transport=“rest” as a parameter in the configure, e.g. genai.configure(api_key=api_key, transport="rest"), it works for me and gemini told me it’s a communication protocol problem.