Hello Google Gemini API team,
I am developing Denzong Stay AI, a hospitality assistant for hotels and homestays, using Cloudflare Workers and the Gemini API.
My Gemini API key works in Google AI Studio, but API requests sent through my Cloudflare Worker fail with HTTP 400 and this message:
User location is not supported for the API use.
Technical details:
- API endpoint:
https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent
- Hosting: Cloudflare Workers
- Runtime: JavaScript
- API access: Gemini API free tier
- Worker response: HTTP 502 after the upstream Gemini API returns HTTP 400
- Cloudflare Worker deployment: Active
- API key: Configured as a Cloudflare runtime secret; the key is not included in this report.
Could you please clarify why requests from Cloudflare Workers are being rejected for location reasons and recommend an officially supported solution that allows me to continue using the free tier?
Thank you.
Hello @Travel_Sikkim ,
Please try the below steps:
-
Make sure you’re in one of the supported regions.
-
Turn off any VPN, proxy or iCloud Private Relay, and connect directly.
-
Make sure you’re 18 or older and have verified your age.
-
Try a different network, for example your phone’s hotspot.
If none of these help, please share the details using this form so we can investigate further: Gemini API & Google AI Studio Location Issue Report
Hello,
Thank you for your response and suggestions.
I have already verified my age on my Google Account. I also submitted the Gemini API location issue investigation form you provided.
My application, Denzong Stay AI, runs on a Cloudflare Worker and calls the Gemini API from the server side. The Worker is online, but requests to Gemini fail with the following error:
HTTP 400: “User location is not supported for the API use.”
I would appreciate further assistance in identifying the cause of this restriction. Since the request originates from a Cloudflare Worker, could the server’s outbound location or IP address be contributing to this issue?
I would prefer to continue using the Gemini API free tier if possible.
Please let me know if you need any additional information to investigate this issue.
Thank you for your time and support.
Hello @Travel_Sikkim ,
Sorry to hear about this, in theory calls should be allowed from all available regions. First you should check if you’re using a VPS IP registered to an unsupported region, and/or consider using a different VPS. If this doesn’t resolve the issue, you can: