Hello,
I'm currently using the Gemini API to generate content for my app. I'm trying to specify the region in the API request, but I couldn't find how to do it in the documentation.
I tried appending ?location=us-central1 to the API URL like this:
https://us-central1-generativelanguage.googleapis.com/v1/models/gemini-1.0-pro-vision-latest:generateContent?key=MY_API_KEY
However, it doesn't seem to work and I get an error response(the URL seems to be wrong).
Could you please advise on the correct way to specify the region in the Gemini API request?
Thank you in advance for your help!
Best regards,
Hi @Yuma,
Thank you for joining our community.
The official document mentions available locations, indicating the regions where Gemini models are deployed.
Here's how it was written during HTTP requests:
I hope I was able to provide you with useful insights.
Very sorry for the delay in responding.
Thank you very much for your help.
Please help,
Where to specific the region in python client?
model = genai.GenerativeModel('gemini-1.5-flash') response = model.generate_content("some prompt")
@gaussfer Did you find any soltuion?
@gaussfer @shahmanish877 You should select a region during SDK initialisation:
vertexai.init(project=PROJECT_ID, location="us-central1")
See here for a full example.
Cheers,
Remik
This is using Vertex AI, but could it be configured with the Google Generative AI Python SDK?
@emerworth I double checked and unfortunately the Generative AI Python SDK doesn't support region selection at this moment. You'd need to migrate to Vertex AI for this functionality.
why my paid gemini api key doesn't work in UK?
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |