← All free LLM API errors

Google Gemini API · checked October 10, 2026

Gemini: "User location is not supported for the API use"

The Gemini API decides your location from the IP address of the machine that sends the request, not from where you are. A 400 FAILED_PRECONDITION with this message means that address is in a country outside Google's supported list. The usual surprise is a cloud region, an edge runtime, a Colab instance or an IPv6 route.

The exact error

What you see.

HTTP 400 from the native and the OpenAI-compatible endpoints. The same body appears in reports from 2023 through September 2026.

{
  "error": {
    "code": 400,
    "message": "User location is not supported for the API use.",
    "status": "FAILED_PRECONDITION"
  }
}

Causes

Why it happens.

  1. 1

    Your server or edge function runs in an unsupported region

    Edge runtimes and proxies send the request from wherever they happen to run. Cloudflare Workers users report this even with a placement hint, and Vercel or Cloudflare proxies show the same pattern.

  2. 2

    IPv6 egress resolves to a different country

    A server can geolocate correctly over IPv4 and incorrectly over IPv6. One report had curl working on the host while the same request from a Docker container failed.

  3. 3

    Colab or another hosted notebook

    Google's note is explicit: the region is judged by where the Colab instance runs, not where the user is.

  4. 4

    The country is not supported

    Google's list (updated April 28, 2026) does not include China, Hong Kong, Macao, Russia, Belarus, Iran, Cuba, Syria, North Korea, Myanmar or Afghanistan. The UK, EU countries and Switzerland are on it.

  5. 5

    The hosting IP was reclassified

    A server that worked for months can start failing when its provider's address range is geolocated differently.

Fixes

How to fix it.

Check where your requests actually come from

Run the check from the same machine, container or runtime that calls Gemini, over both IPv4 and IPv6.

curl -4 https://ipinfo.io/country
curl -6 https://ipinfo.io/country   # a different answer here explains "works on the host, fails in Docker"

Run the caller in a supported region

Pin the region of your Cloud Run service, VM or function, or set a placement for your edge runtime, so requests leave from a supported country.

Force IPv4 if IPv6 is the problem

Disable IPv6 egress for the container or prefer IPv4 in your HTTP client so the request resolves to the right country.

Use Google Cloud's enterprise offering

For countries the Gemini API does not serve, Google points to Gemini Enterprise Agent Platform (formerly Vertex AI).

EU, UK and Switzerland: read the terms

The API works there, but Google's terms say that if you make an API client available to users in the EEA, Switzerland or the UK, you may use only paid services.

With freelm

Handle it automatically.

freelm reads this error as "this key cannot be used from here": it disables that Gemini key for the rest of the process and the same call continues on your other providers, such as Groq, OpenRouter, Cloudflare Workers AI or Mistral, which have their own region rules. freelm doctor prints the message next to the key, so you can see which provider is blocked from your server.

freelm doctor
#  google   AQ.Ab8...x9yz   FAIL  key rejected (400): User location is not supported for the API use.
#  groq     gsk_ab...12cd   OK    openai/gpt-oss-20b · 320 ms

freelm is an open-source Python and Node.js library that pools the free tiers of Gemini, Groq, OpenRouter, Cloudflare Workers AI, Mistral, NVIDIA NIM, Z.ai and Cohere behind one OpenAI-compatible call. See how its failover works.

Questions

Related questions.

Why does Gemini work on my laptop but not on my server?

The check uses the outbound IP address of whatever sends the request. Your laptop and your server, container or edge function can resolve to different countries.

Is the Gemini API available in the EU and the UK?

Yes. Both are on Google's supported list as of the April 28, 2026 update. Google's terms require paid services if you make an API client available to users in the EEA, Switzerland or the UK.

Will a VPN fix it?

Routing requests through another country to get around a regional restriction can breach a provider's terms. The supported fixes are running your server in a supported region or using Google Cloud's enterprise offering.