US home broadband IP One-tap connect · no VPS needed Learn more Ad opens in a new tab

Guides ·

Gemini CLI proxy settings: which exit matters for region errors?

Gemini CLI 0.46.0 does not inherit a working browser route automatically. It checks HTTPS_PROXY, https_proxy, HTTP_PROXY, then http_proxy, and uses the first value it finds. If you get a region error, verify the IPv4 and IPv6 exits from the same terminal that launches Gemini CLI, then compare that location with Google’s Gemini API / AI Studio region list. A proxy variable changes the terminal’s network path; it does not change service eligibility.

Where Gemini CLI gets its proxyGemini CLI 0.46.0 checks HTTPS_PROXY, https_proxy, HTTP_PROXY, then http_proxy and uses the first value found. A browser or operating-system proxy does not automatically become a terminal variable. Variables can be set in the current shell or an environment file loaded by Gemini CLI. Where Gemini CLI gets its proxy Browser / system proxyNot inherited A working browser says nothing about the terminal path First set value winsRead 1HTTPS_PROXY 2https_proxy 3HTTP_PROXY 4http_proxy Set in the shell or ~/.gemini/.env Gemini CLI v0.46.0 source and configuration docs
Start with the terminal environment: Gemini CLI checks four variables in a fixed order and uses the first value it finds.

This page was checked on October 16, 2026 against the Gemini CLI v0.46.0 source, its official configuration and authentication docs, and Google AI for Developers’ available-regions page. The region-error text below comes from a user report filed in the official repository on June 26, 2025; it is not Google’s diagnosis of every case.

Which proxy setting does Gemini CLI actually read?

It reads the terminal environment, not the browser setting. In v0.46.0 the official source checks these values in order and stops at the first one set:

  1. HTTPS_PROXY
  2. https_proxy
  3. HTTP_PROXY
  4. http_proxy

If upper- and lower-case variables contain different URLs, the earlier value wins. The current help and source do not define a --proxy startup option; Unknown argument: proxy means you should use environment variables instead.

How do I set it on macOS or Linux?

Use the HTTP or mixed port exposed by your approved network proxy. For one launch only:

HTTPS_PROXY=http://127.0.0.1:7890 \
HTTP_PROXY=http://127.0.0.1:7890 gemini

For future terminal sessions, add the values to ~/.zshrc or ~/.bashrc:

export HTTPS_PROXY=http://127.0.0.1:7890
export HTTP_PROXY=http://127.0.0.1:7890

Open a new terminal before starting Gemini CLI. Never publish a proxy URL that embeds a username or password in screenshots or logs.

How do I set it in Windows PowerShell?

For the current PowerShell window:

$env:HTTPS_PROXY = "http://127.0.0.1:7890"
$env:HTTP_PROXY = "http://127.0.0.1:7890"
gemini

Variables set in one PowerShell window do not retroactively reach other terminals or desktop apps. Launch Gemini CLI from that same window when testing.

Can I put the values in .gemini/.env?

Yes. The authentication docs describe project-level .gemini/.env and user-level ~/.gemini/.env files:

HTTPS_PROXY=http://127.0.0.1:7890
HTTP_PROXY=http://127.0.0.1:7890

Gemini CLI loads the first environment file it finds; it does not merge several files. If one project works and another goes direct, check whether a project or parent directory supplies an earlier file. Treat API keys as secrets and keep them out of Git.

What should I check for “User location is not supported”?

Start with the exit used by the terminal that sent the request. A user filed this exact English output in the official repository on June 26, 2025. As of this review, the official docs and that report only show the English string; a separate Chinese error string was not verified:

✕ [API Error: User location is not supported for the API use. (Status: FAILED_PRECONDITION)]

Run these from the same terminal:

curl ipjudge.org/en
curl -6 ipjudge.org/en

The first command shows the IPv4 exit and a separate “Gemini API” line. The second checks whether IPv6 leaves through another region. Google’s regions page makes the execution environment relevant: for example, Colab restrictions use the instance’s region rather than the user’s region.

As checked on October 16, 2026, Google lists Taiwan, Singapore, Japan and the United States for Gemini API / AI Studio, but not mainland China, Hong Kong or Macau. When the request originates outside the list, Google’s page points to Gemini Enterprise Agent Platform. This guide does not describe bypassing regional restrictions.

How do transport, region, and authentication errors differ?

Keep the complete original message, then troubleshoot the right layer:

What you seeCheck firstDo not assume
Timeout, connection reset, TLS / certificate errorProxy URL, port, corporate CA, variable visibilityThe region is unsupported
User location is not supported for the API use.IPv4 / IPv6 exits and the API region listThe API key is invalid
API keys are not supported by this API...Authentication choice, organization policy, Cloud projectThe proxy failed
A three-step Gemini CLI triageCheck the Gemini CLI version and proxy variables, verify IPv4 and IPv6 exits from the same terminal, then branch on the exact error. Connection errors point to the proxy path or certificates, User location is not supported points to the Gemini API region list, and authentication or project errors point to the selected sign-in method and Google Cloud project. Three-step Gemini CLI triage 1 Check version and proxy variablesgemini --version · print presence only 2 Check exits in the same terminalcurl ipjudge.org · curl -6 ipjudge.org 3 Branch on the exact error Timeout / TLSProxy, port, certificate User location…API region list Auth / projectSign-in and Cloud project Outside the list: use Google’s documented path Do not diagnose a transport error as a region error, or vice versa
Keep the exact error text: transport, region, and authentication/project failures have different causes and fixes.

How can I verify Gemini CLI can see the variables?

Check the version and only print whether variables exist, so credential-bearing URLs do not land in logs:

gemini --version
test -n "$HTTPS_PROXY" && echo HTTPS_PROXY=set || echo HTTPS_PROXY=unset
test -n "$HTTP_PROXY" && echo HTTP_PROXY=set || echo HTTP_PROXY=unset

Then run the exit checks and launch gemini from that same shell. If a browser check and terminal check disagree, the terminal result is the relevant path for Gemini CLI. IP Judge can compare the exit with Google’s public list; it cannot read Google’s internal geolocation or account decision.

FAQ

Why does Gemini work in my browser while Gemini CLI reports a region error?

The browser and terminal may use different exits. Check IPv4 and IPv6 in the same terminal that launches Gemini CLI.

Is HTTP_PROXY alone enough?

The source reads it, but only after HTTPS_PROXY and https_proxy. Setting HTTPS_PROXY and HTTP_PROXY to the same approved HTTP proxy avoids disagreements between tools.

Why did .gemini/.env work in one project but not another?

Gemini CLI loads the first environment file it finds and does not merge multiple files. Look for an earlier project or parent-directory file.

The exit is on Google’s list, but I still see the same error. What next?

Confirm that both IPv4 and IPv6 are in listed regions, then report the version, full error and non-secret exit evidence to the official Gemini CLI repository. Different IP databases may disagree; this site cannot confirm Google’s own classification.

Does changing the proxy guarantee recovery?

No. Proxy variables only select the terminal path. Google still evaluates the account, authentication method, organization policy and service eligibility.

Related checks and guides: Gemini region check · CLI exit check · Gemini API region errors · Gemini in mainland China and Hong Kong · Which IP does the terminal use?

Which kind of IP do you have?

Check my IP for free