gemini-api-php / client

Google Gemini API PHP Client allows you to use the Gemini AI model
MIT License
97 stars 16 forks source link

User location is not supported for the API use #32

Closed severfire closed 2 weeks ago

severfire commented 2 months ago

Hello,

First, thank you for great API PHP Client! This is something Google seems to forget, great support for PHP.

While trying your examples, I got error:

Fatal error: Uncaught RuntimeException: Gemini API operation failed: operation=models/gemini-pro:generateContent, status_code=400, response={ "error": { "code": 400, "message": "User location is not supported for the API use.", "status": "FAILED_PRECONDITION" } } in C:\xampp\htdocs\app\vendor\gemini-api-php\client\src\Client.php:250

in my Google Cloud I do have this: API_ENDPOINT="us-central1-aiplatform.googleapis.com" PROJECT_ID="my-secret" LOCATION_ID="us-central1"

I am located in Poland and I have Generative Language API and Vertex AI API enabled in Cloud Console

How can I fix it?

I do not know if its possible, but I would love to use: MODEL_ID="gemini-1.5-pro-preview-0409"

Thanks! a.