Gemini CLI
Install Google's open-source AI CLI tool and try it out
What is Gemini CLI?
Gemini CLI is Google’s open-source command-line AI tool. With 95,000+ stars on GitHub, it’s one of the most popular developer tools ever released. It uses Google’s Gemini models and offers a generous usage allowance.
Key features:
- 1,000 requests per day with a Google account
- Massive context: Up to 1 million tokens — it can read enormous codebases
- Open source: You can see exactly how it works, and the community contributes improvements
- MCP extensible: Can connect to external tools and services
- Multiple models: Access to Gemini 2.5 Pro, Flash, and more
Installation
Step 1: Install Gemini CLI
npm install -g @anthropic-ai/claude-codeWait — that’s Claude. Here’s the right one:
npm install -g @google/gemini-cliVerify:
gemini --versionStep 2: Authenticate
Run Gemini CLI:
geminiIt will open your browser to authenticate with your Google account. Sign in, and you’re done. Authenticates with your Google account.
If you’re on a remote server without a browser, Gemini CLI supports device flow authentication — it shows a URL and a code. Open the URL on your local machine’s browser, enter the code, and the remote tool authenticates. Alternatively, you can set a Gemini API key as an environment variable: export GEMINI_API_KEY="your-key". Get one from aistudio.google.com.
1,000 requests per day is more than enough for learning and even for real projects. This makes Gemini CLI an excellent tool to start with.
Your first interaction
Step 1: Create a project folder
mkdir hello-gemini && cd hello-geminiStep 2: Start Gemini CLI
geminiStep 3: Give it a task
Create a simple HTML page with a counter. It should have a darkbackground, a large number in the center, and + / - buttons toincrement and decrement. Use vanilla JavaScript — no frameworks.Watch as Gemini:
- Plans the approach
- Creates the file(s)
- Writes the HTML, CSS, and JavaScript
- Reports what it did
Step 4: Check the result
lscat index.htmlopen index.htmlFrom WSL:
explorer.exe index.htmlOr right-click the file in VS Code’s Explorer panel.
xdg-open index.htmlOn a remote server, use VS Code’s file explorer or download the file.
Gemini CLI vs Claude Code
Both are excellent tools. Here’s how they compare:
| Aspect | Gemini CLI | Claude Code |
|---|---|---|
| Access | Google account (1K req/day) | API key or subscription |
| Context window | 1M tokens | 200K tokens |
| Open source | Yes | No |
| Best for | Large codebases, budget-conscious work | Complex reasoning, nuanced instructions |
| Setup | Google account | API key or subscription |
Many orchestrators use both — Gemini CLI for everyday tasks and Claude Code for complex, multi-step projects where reasoning quality matters most.
Useful commands
| Command | What it does |
|---|---|
/help | Show available commands |
/model | Switch between Gemini models |
/clear | Clear conversation history |
Ctrl+C | Exit Gemini CLI |
Tips
-
Take advantage of the massive context. Gemini CLI can process up to 1 million tokens. This means it can understand very large codebases — don’t hesitate to point it at big projects.
-
Experiment without hesitation. Gemini CLI’s daily allowance is generous — don’t worry about “wasting” requests while learning.
-
Try different models. Use
/modelto switch between Gemini 2.5 Pro (most capable) and Flash (faster, good for simpler tasks).