gpt4free icon indicating copy to clipboard operation
gpt4free copied to clipboard

[GeminiPro] "User location is not supported for the API use" workaround

Open iG8R opened this issue 1 year ago • 6 comments
trafficstars

Is there any way to implement workarounds for the "User location is not supported for the API use" issue in GeminiPro for those in geo-restricted countries, which are described here https://stackoverflow.com/questions/77659552/google-generative-ai-api-error-user-location-is-not-supported-for-the-api-use ?

iG8R avatar Feb 24 '24 19:02 iG8R

You need a proxy or a vpn in the country which are allowed by Google Gemini

feedain9 avatar Feb 24 '24 23:02 feedain9

Sure, I already use Netlify as a proxy, but it would be way more convenient if g4f had native support to workaround this issue.

iG8R avatar Feb 25 '24 00:02 iG8R

The proxy support is the native way. ?

hlohaus avatar Feb 25 '24 06:02 hlohaus

:) I meant that if g4f could access the GeminiPro API through VertexAPI, that would be considered the native way.

iG8R avatar Feb 25 '24 06:02 iG8R

I can't create a Vertex Account for me. Sorry

Edit: You have to change only the Url maybe:

const API_ENDPOINT = "us-central1-aiplatform.googleapis.com"; const URL = https://${API_ENDPOINT}/v1beta1/projects/${process.env.GOOGLE_KEY}/locations/us-central1/publishers/google/models/gemini-pro:streamGenerateContent;

edit: I added api_base as config: https://github.com/xtekky/gpt4free/pull/1630

Example api_base = "https://us-central1-aiplatform.googleapis.com/v1beta1/projects/${process.env.GOOGLE_KEY}/locations/us-central1/publishers/google"

hlohaus avatar Feb 25 '24 08:02 hlohaus

Thank you. I'll try it and report later.

iG8R avatar Feb 25 '24 14:02 iG8R

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

github-actions[bot] avatar Mar 04 '24 00:03 github-actions[bot]

Closing due to inactivity.

github-actions[bot] avatar Mar 12 '24 00:03 github-actions[bot]