How to use Gemini CLI cheaper without a subscription
Gemini CLI is a great way to bring a model into your terminal, but the default path nudges you toward a Google account, usage tiers, and eventually a paid plan. If you'd rather pay only for what you actually use — and keep the option to test other models from the same setup — you can point Gemini CLI at an OpenAI-compatible gateway instead. No subscription, no minimums.
Why a subscription is rarely the cheapest option
Subscriptions are predictable, but predictability cuts both ways. If you write code in bursts — heavy on a Tuesday, nothing for a week — a flat monthly fee charges you for idle time. Per-token billing flips that: a quiet week costs almost nothing, and a busy one only costs what the work was worth.
The other hidden cost is lock-in. A subscription ties you to one model family. Some tasks are better served by a cheaper, faster model (quick edits, commit messages) while others want a stronger reasoning model. Paying per token lets you match the model to the job.
The setup: one endpoint, any model
AnyModel exposes a single OpenAI-compatible endpoint. Gemini CLI can talk to any OpenAI-compatible backend, so you give it one base URL and one key — and that same key also reaches GPT, Claude, DeepSeek, GLM, Kimi, Qwen, and Grok. Switching models means changing the model id, nothing else.
- Base URL:
https://anymodel.org/v1 - API key: one key for every model
- Billing: pay-per-token, no subscription, no card to start
You get 1,000,000 free tokens on signup, and a total of 6,000,000 if you link Telegram — enough to run real sessions before you spend a cent.
Configure Gemini CLI manually
Gemini CLI isn't one of our one-line installer tools, so you wire it up with the standard OpenAI-compatible environment variables. Most builds of the CLI (and its OpenAI-compatible mode) read these:
export OPENAI_BASE_URL="https://anymodel.org/v1"
export OPENAI_API_KEY="<YOUR_API_KEY>"
export OPENAI_MODEL="gemini-2.5-pro"
Add those to your shell profile (~/.zshrc or ~/.bashrc), open a new terminal, and run the CLI as usual. To try a different model, change the last line — for example to a cheaper Gemini Flash tier for routine edits, or to a different provider entirely when you want a second opinion.
Tip: keep two shell aliases, one exporting a fast/cheap model and one exporting a stronger model. You'll switch in a single command instead of editing config.
Picking the right model for the job
Because every model sits behind the same key, it's worth being deliberate. A rough rule of thumb:
| Task | Lean toward |
|---|---|
| Quick edits, refactors, commit messages | A fast, low-cost tier |
| Large-context reasoning, architecture | A stronger flagship model |
| Cross-checking a tricky bug | A different provider for a second opinion |
If you're unsure what each model costs or how they stack up, the compare page lays out pricing and capabilities side by side so you can make a real decision instead of guessing.
What about privacy?
If you're sending proprietary code through any gateway, retention matters. AnyModel offers Ghost Mode: opt-in, zero-retention API keys where your prompts and responses aren't stored on our side — only a token counter for billing. Be clear-eyed about the limit: the model provider still receives your prompt to generate a response, so this isn't "total privacy," but it does remove our copy from the equation.
Other CLIs, same key
The manual setup above works for any OpenAI-compatible client — Cursor, Windsurf, Zed, Cline, Aider, Continue, and Gemini CLI all just need the base URL and key. And if you also use Codex or Claude Code, those have a one-line installer:
bash <(curl -fsSL "https://anymodel.org/i?tool=codex") <YOUR_API_KEY>
One account, one key, every terminal tool you already use. More walkthroughs live on the blog.
Start free
You don't need a subscription to use Gemini CLI well — you need a flexible endpoint and honest per-token pricing. Create a free account, grab your key, and you'll have a million tokens to spend before any decision about money.
AnyModel