cocodot
← Back to guides
Local card declined, direct access hard? cocodot does both
TroubleshootingUpdated 2026-09

Gemini API Returns 403 or User Location Is Not Supported: Three Causes, Three Fixes

Google AI Studio has a counter-intuitive property: being able to load the page tells you nothing about whether the API will work. Account country, request-time IP, and billing region fail in three different ways and need three different fixes.

TL;DR: The page loading is not the test — Google gates the API separately from the web UI. Diagnose in this order. **(1) Can you create an API key at all?** If not, the restriction is on your **account country** (the region on the Google account, not where you are sitting). **(2) Key created but calls fail?** Read the error: `User location is not supported` or a 403 on the call points at the **egress IP at request time**, which is often a server in a different region than you assume. **(3) Free tier works but upgrading to paid does not?** That is the **billing region** — the address and country on the billing profile, a separate setting again. Each has a different fix, and applying the wrong one wastes hours.

Why loading the page misleads you

The marketing site, the docs, and often the console itself are served globally. API eligibility is evaluated separately, against different signals. So the everyday inference — I can see it, therefore I can use it — is exactly backwards here. Treat page access as no evidence at all and go straight to the three checks.

Cause one: account country

Google accounts carry a region that governs product eligibility, and it is not simply where you are right now. If key creation itself is refused, this is where to look first. Note that this is an account-level property — no per-session workaround changes it, and attempting to appear otherwise tends to create account-standing problems that are worse than the original blocker.

Cause two: the egress IP at request time

This one produces the most confusion because it is environment-dependent. The same key can work from your laptop and fail from CI, a container, or a cloud function — because the request leaves from somewhere else. Before changing anything, confirm the actual egress: make a call to any IP-echo service from the exact environment that is failing. People routinely spend a day on the wrong theory because they assumed the server was where they are.

Cause three: billing region

The distinguishing symptom is that everything works on the free tier and breaks the moment you try to pay. Billing carries its own country and address, evaluated separately from account eligibility. Both need to be in a supported region, and a mismatch between the billing address and the payment instrument adds a second failure mode on top.

The shortest path if you just need Gemini calls working

If your goal is working Gemini calls rather than owning a Google billing relationship, an OpenAI-compatible gateway removes all three variables at once — you change base_url, keep the model name, and the region question stops being yours. That is a real tradeoff, not a free win: you gain a working call today and you take on the job of verifying the provider. If you go that way, run the model-authenticity check first.

Symptom to cause

SymptomCauseFix
Cannot create an API key; page loads fineAccount countryThe account region governs eligibility — the browser session does not override it
Key works locally, 403 from your serverEgress IP at request timeCheck where the request actually leaves from; hosted environments often differ from your laptop
Free tier fine, paid upgrade blockedBilling regionA separate profile from the account country; both must be eligible

FAQ

Will changing my account country fix it?

Sometimes, but account region is not a field to flip casually — Google ties it to account history and payment instruments, and inconsistency creates its own problems. Diagnose which of the three causes you actually have before changing anything account-level.

My key works locally but not in production. Same cause?

Usually cause two. Your laptop and your production environment egress from different places. Verify the actual outbound IP from the failing environment before assuming anything about the key.

About cocodot

cocodot is a payment and AI access service for developers and cross-border teams in mainland China. It provides US-BIN virtual cards issued by a licensed institution — used to pay for overseas subscriptions and ad accounts — and an OpenAI-compatible AI API gateway for calling Claude, GPT and Gemini from within mainland China. Both share one wallet, funded by Alipay and accounted in USD. Card: $9.9 to open, 3% to load, 0% on spend, $1 per active card per month.

Service scope, pricing and limits →
Gemini API Returns 403 or User Location Is Not Supported: Three Causes, Three Fixes · cocodot