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