Gemini CLI Proxy: HTTPS_PROXY Setup and Antigravity
Set the proxy with an environment variable, test the exit with curl first, then start the tool.
Which tool are you running: Gemini CLI or Antigravity?
Google's own notice says Gemini CLI stopped serving consumer plans (Google AI Pro, Ultra, Code Assist for individuals) on 18 June 2026, and that Antigravity CLI is the new terminal experience. Enterprise Code Assist licences keep their access, and Gemini CLI stays usable with paid Gemini API keys.
So first check which of the two you actually launch, and how you sign in. The proxy part is the same job in both cases: the process needs to send its traffic through your proxy.
Environment variable HTTPS_PROXY (a --proxy flag no longer exists)
A maintainer on GitHub: HTTPS_PROXY is the standard way; ~/.gemini/.env is picked up automatically.
Gemini CLI with an API key
Same variable; the key goes in GEMINI_API_KEY
Authentication page: API key from Google AI Studio, no Cloud project needed.
Antigravity CLI (agy), app, IDE extensions
Not documented on the pages I read: try the same environment variables and verify
Getting-started page: no proxy section.
Read on 19 November 2026 from the Gemini CLI repository discussions and documentation and from Antigravity's getting-started page; the rows for Antigravity are what is missing, not a claim that it cannot work.
Copy HOST, PORT, USERNAME and PASSWORD from My assets. Use the HTTP line (port 2222). Proxy302 accepts HTTP on 2222 and SOCKS5 on 3333 with the same credentials, but Gemini CLI's documentation does not mention SOCKS.
Step 2: test the exit before the tool
Run the curl check below. It must print an IP and country that are the ones you bought. If it fails, fix that first with the connection guide.
Expected result Expected: a JSON answer from ipinfo.io with your proxy's country.
Step 3: set HTTPS_PROXY
Either export it in the terminal for one session, or write it into ~/.gemini/.env so every run picks it up. Set HTTP_PROXY to the same value too if your version reads that one.
Step 4: start the tool and sign in
Run gemini (or agy) from the same terminal. Sign in with Google opens a browser, so the browser and the terminal must be on the same machine; for a headless server, set an API key instead.
Expected result Expected: the sign-in page opens and the CLI answers a short prompt.
Test the exit, then run Gemini CLI
# 1) the proxy works? (HTTP endpoint)
curl -x http://LOGIN:PASSWORD@HOST:PORT https://ipinfo.io/json
# 2) macOS, Linux, WSL: for this terminal only
export HTTPS_PROXY='http://LOGIN:PASSWORD@HOST:PORT'
gemini
# Windows PowerShell
$env:HTTPS_PROXY = "http://LOGIN:PASSWORD@HOST:PORT"
gemini
Example only: replace the placeholder values with your own.
Example only. A maintainer says this file is picked up automatically; the configuration page says only the first .env found is used, files are not merged.
Sign-in says: not currently available in your location
Check The exit IP is in a country Gemini CLI does not support, or the CLI is not going through the proxy at all.
Fix Run the curl check and read the country. Then pick an exit in a supported country from Google's available-locations list, linked in the troubleshooting page.
Stop when A proxy cannot change a country Google does not support or your account's own region; do not keep rotating exits.
unable to get local issuer certificate
Check A firewall or proxy that inspects TLS puts its own certificate in the chain.
Fix Set NODE_USE_SYSTEM_CA=1, or point NODE_EXTRA_CA_CERTS to the absolute path of your root certificate file (both from the official troubleshooting page).
Stop when Do not turn certificate checks off.
Sign-in page never opens or hangs
Check Sign in with Google needs a browser that can reach the terminal; a remote or headless machine cannot do that.
Fix Run the login on your local machine, or use GEMINI_API_KEY from Google AI Studio on the server.
The proxy works in curl but not in the tool
Check The process did not see the variable (set in another terminal, or the .env file is not the first one found).
Fix Print the variable in the same terminal, move it into ~/.gemini/.env, and run again.
Stop when If nothing changes, stop and test the proxy in a plain browser first.
Antigravity: what is and is not documented
Google's getting-started page lists four ways to use Antigravity: the app, the agy command line, IDE extensions and a Python SDK. It covers sign-in in the browser, but I found no proxy page and no list of supported countries there.
So there is no official instruction to quote. A reasonable test is to set the same variables in the terminal before launching agy and then confirm which country the account sees; if the tool still goes direct, a system-wide proxy setting on your computer is the other thing to try. Treat both as things to verify, not as promised to work.
For a paid Gemini plan you sign in, pay and use the account from the same place over weeks. A rotating exit changes country and network between sessions, which is the opposite of what an account tied to one place needs.
Proxy302 sells a Static ISP IP that does not rotate during the lease: US$7.99 for 30 days, HTTP and SOCKS5, and there is no free trial. Check on the order page that your country is in stock and that it is one Google supports. The Gemini-specific page below explains the subscription side.
No. It was removed on purpose; maintainers point to the HTTPS_PROXY environment variable, which can live in ~/.gemini/.env.
Does Gemini CLI work with a SOCKS5 proxy?
The official pages I read do not say it does, so use an HTTP proxy address. Proxy302 gives you an HTTP line on port 2222 with the same login.
Is Gemini CLI still the right tool?
For Google AI Pro, Ultra and Code Assist for individuals, Google moved terminal access to Antigravity CLI on 18 June 2026. Gemini CLI remains available with paid Gemini API keys and for enterprise Code Assist licences.
Will a proxy fix a location error?
Only if the exit is in a country Google supports for that product, and the CLI really goes through it. It does not change Google's rules or your account's region.
How to set up a proxy for the Gemini web app, Google AI Studio and the Gemini API, and how to diagnose common errors. A proxy does not change Google's terms.
The four official availability lists compared country by country — China, Hong Kong, Russia and more — plus hourly checks of the OpenAI and Anthropic APIs from 7 countries.
Check the exit IP, country and ISP your proxy really gives you in 30 seconds — and why IP databases disagree on the city. With our own test of three lookup services.
Further reading
Setup guides Proxy302 publishes on GitHub on the same topic:
Read on 19 November 2026: a maintainer answers that HTTPS_PROXY is the standard way and the home-grown proxy flag was taken out, and that the variable can be declared in ~/.gemini/.env, which is picked up automatically.
Read on 19 November 2026: a maintainer comment says the --proxy flag was removed intentionally and a proxy can be configured with an environment variable, and links the environment-variables section of the configuration docs.
Read on 19 November 2026: .env files are looked up in the working directory, then parent directories up to the project root or home, then ~/.env; settings.json lives at ~/.gemini/settings.json; command-line arguments override environment variables. The part of the page I read does not describe proxy variables.
The proxy variables themselves are documented only in the maintainer comments linked above.
Read on 19 November 2026: the options are Sign in with Google, Gemini API key (GEMINI_API_KEY) and Vertex AI; Sign in with Google opens a browser on a machine that can talk to the terminal; headless mode needs a cached credential or an API key or Vertex AI configured through environment variables.
Read on 19 November 2026: the location error text ("not currently available in your location") and its cause; the NODE_USE_SYSTEM_CA=1 and NODE_EXTRA_CA_CERTS fixes for "unable to get local issuer certificate" behind a firewall that inspects TLS; the line that Gemini CLI was replaced by Antigravity CLI on 18 June 2026 for unpaid-tier and Google One users.
Read on 19 November 2026: from 18 June 2026 Gemini CLI stops serving consumer plans (Google AI Pro, Ultra, Code Assist for individuals); enterprise Code Assist licences keep access; Gemini CLI stays usable with paid Gemini and Gemini Enterprise Agent Platform API keys; Antigravity CLI is the new terminal experience.
Read on 19 November 2026: Antigravity comes as an app, a CLI (agy), IDE extensions and a Python SDK; the app signs in through the browser; the SDK uses GEMINI_API_KEY. The page has no proxy or supported-country section.