How to resolve "Image generation not available" for Gemini in a deployed Firebase app?

Hi everyone,

I’m hitting a wall with a regional restriction error when trying to use Gemini for image generation in my Firebase Studio app. The specific error is [400 Bad Request] Image generation is not available in your country.

I’m using the gemini-2.0-flash-exp model. I know this feature is region-locked, so I tried using a VPN set to the US during deployment and testing, but it didn’t solve the problem. This makes me think the restriction isn’t just based on the client’s IP.

Has anyone successfully deployed a Firebase app with Gemini image generation from a restricted country? What is the correct configuration or architecture to make this work? Do I need to force all my Firebase functions to a specific US region, and if so, how is that best accomplished?

Any guidance would be greatly appreciated.

i have this exact problem…sometimes it works and sometimes not? I am deployed in us central1 via studio

I understand that the gemini-2.0-flash-exp model is no longer working.
I am on the hunt for what I should use instead. I hope this helps.

Jono

I was getting error generating image as well. I switched models etc. I found out it might be my region, I’m in Poland. You are where your credit card is not where your server.

I switched image generation to replicate all problems are gone. Much simpler and you have so many wonderful models.