Install Gemini CLI (npm or Homebrew) and Connect It to API Token Router
Gemini CLI is Google's open-source AI coding CLI, available through the gemini command.
Quick install on macOS (MacBook): run brew install gemini-cli, or npm install -g @google/gemini-cli if you use Node.js, then start it with gemini. To update later, run brew upgrade gemini-cli or npm install -g @google/gemini-cli@latest.
New accounts start with a $0 balance — top up before your first request. Top up from $5. If a request returns 402 with "wallet balance is insufficient", your balance is empty — your base URL and key are fine. Top up and retry.
1. Install Gemini CLI from scratch
Already have Gemini CLI? Skip to the next section.
macOS users can install with Homebrew:
brew install gemini-cli
Or install with npm:
npm install -g @google/gemini-cli
Windows users should install Node.js first, then install the CLI with npm.
| Task | Homebrew (macOS) | npm |
|---|---|---|
| Update | brew upgrade gemini-cli |
npm install -g @google/gemini-cli@latest |
| Uninstall | brew uninstall gemini-cli |
npm uninstall -g @google/gemini-cli |
If your shell says gemini: command not found after an npm install, npm's global folder is not on your PATH: run npm config get prefix, add the bin folder under it to PATH in ~/.zshrc, and open a new terminal.
2. Get your API Token Router API Key
Open the API Token Router dashboard, create an account, create an API key in the sk-atr-... format, and copy it. You can also view the complete model list in the dashboard.
3. Connect to API Token Router
Replace <your-API Token Router-key> with the key you copied, then paste the full block into your terminal:
mkdir -p ~/.gemini && cat > ~/.gemini/.env <<'EOF'
GOOGLE_GEMINI_BASE_URL=https://api.apitokenrouter.com
GEMINI_API_KEY=sk-atr-<your-API Token Router-key>
GEMINI_API_KEY_AUTH_MECHANISM=bearer
EOF
After saving, you do not need to restart the terminal or run source. The next gemini command will read the configuration.
When you run gemini, the "Get started" screen asks how you want to authenticate:
- Sign in with Google
- Use Gemini API Key
- Vertex AI
Highlight "Use Gemini API Key" and press Enter. Gemini will read the API Token Router API Key you configured. Press Enter again to continue.
If you already selected OAuth login before, reset it with:
rm ~/.gemini/settings.json
On the next launch, the authentication wizard will appear again. Choose Use Gemini API Key.
4. Use Gemini 4 models
API Token Router serves Google's Gemini 4 models: gemini-4-hydrogen, gemini-4-carbon and gemini-4-argon. Pick one for a session with --model:
gemini --model gemini-4-hydrogen
To make it the default, set model.name in ~/.gemini/settings.json:
{
"model": {
"name": "gemini-4-hydrogen"
}
}
Inside a session, run /model and choose Manual to switch. According to the Gemini CLI docs, /model and --model don't change the model sub-agents use, so your usage log may still show other models.
| Model | When to use it | Google list price, input / output per 1M |
|---|---|---|
gemini-4-hydrogen |
Everyday coding and agents; the fastest and cheapest Gemini 4 | $1.50 / $7.50 |
gemini-4-carbon |
The hardest problems | $2 / $10 through Nov 30, 2026; $4 / $20 from Dec 1 |
gemini-4-argon |
Long multi-step tasks | $2 / $10 through Nov 30, 2026; $4 / $20 from Dec 1 |
How the three compare: Gemini 4 Hydrogen vs Carbon vs Argon.
Pay with USDT or USDC
You don't need a credit card to use Gemini CLI with API Token Router. Top up your balance with USDT, USDC or ETH straight from an exchange app (Binance, OKX and others) or any wallet: click Pay with crypto in the top-up dialog, pick a coin and network, and send. The minimum is $5 (USDT on BEP20), and no browser extension is needed. Step by step: Pay for Claude and GPT APIs with crypto (USDT).