Gemini API in cloudflare worker

Getting an error while using free gemini api from google ai studio in cloudflare worker
(error) Error: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:streamGenerateContent?alt=sse: [400 Bad Request] User location is not supported for the API use without a billing account linked.
(error) Error: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:streamGenerateContent?alt=sse: [400 Bad Request] User location is not supported for the API use without a billing account linked.
3 Replies
Cyb3r-Jak3
Cyb3r-Jak3•6mo ago
Looks like a google error that you can't call the API from the location where the worker handled the request
Mrinank
MrinankOP•6mo ago
Yeah, it's not available in EU regions and my worker may run in those regions 🙂 can i force worker to run in a specific region?
Cyb3r-Jak3
Cyb3r-Jak3•6mo ago
The only official way is with the jurisdiction on ENT. I think there is a hacky workaround where if you make a D1 DB in the US it will run there but I have no idea if that still works
Want results from more Discord servers?
Add your server