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.
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:
HTTPS_PROXYhttps_proxyHTTP_PROXYhttp_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 see | Check first | Do not assume |
|---|---|---|
| Timeout, connection reset, TLS / certificate error | Proxy URL, port, corporate CA, variable visibility | The region is unsupported |
User location is not supported for the API use. | IPv4 / IPv6 exits and the API region list | The API key is invalid |
API keys are not supported by this API... | Authentication choice, organization policy, Cloud project | The proxy failed |
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