Skip to main content

Google Gemini CLI

Set up Gemini CLI with KeepKite

Get Google Gemini CLI signing in and working — import your subscription, choose a supported region and configure HTTPS_PROXY.

Updated 2026-10-11

Gemini CLI talks to Google's sign-in service and the Gemini API, and both depend on the region your traffic exits from.

Install

npm install -g @google/gemini-cli
gemini --version

Step 1: Import your subscription and pick a node

Import your subscription as described in the Codex CLI guide. The Gemini API isn't available everywhere; choose US, Japan or Singapore nodes and avoid unsupported exits such as Hong Kong.

Step 2: Route Gemini CLI through the proxy

TUN mode (recommended): turn it on and run gemini. On first use choose "Login with Google"; the browser sign-in uses the proxy too.

Environment variables:

export HTTPS_PROXY=http://127.0.0.1:7897
export NO_PROXY=localhost,127.0.0.1,::1
gemini

Windows PowerShell:

$env:HTTPS_PROXY = "http://127.0.0.1:7897"
$env:NO_PROXY    = "localhost,127.0.0.1,::1"
gemini

Google sign-in calls back to a local port, so keep localhost in NO_PROXY.

Using an API key (optional)

If you created an API key in Google AI Studio, you can skip the browser sign-in:

export GEMINI_API_KEY="your key"
gemini

Verify and troubleshoot

curl -fsSL https://app.keepkite.com/check.sh | bash
gemini -p "hello"
  • User location is not supported: the exit region isn't supported — switch nodes.
  • Sign-in page won't load or the callback fails: check that TUN is on and NO_PROXY includes localhost.

More in Troubleshooting.

No subscription yet?

Sign up for KeepKite and get Codex connected in minutes.

Get started