Building Module 6 · CLI Tools Setup

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

Terminal window
npm install -g @anthropic-ai/claude-code

Wait — that’s Claude. Here’s the right one:

Terminal window
npm install -g @google/gemini-cli

Verify:

Terminal window
gemini --version

Step 2: Authenticate

Run Gemini CLI:

Terminal window
gemini

It will open your browser to authenticate with your Google account. Sign in, and you’re done. Authenticates with your Google account.

💡Authenticating over SSH or on a remote server

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.

💡The daily allowance is generous

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

Terminal window
mkdir hello-gemini && cd hello-gemini

Step 2: Start Gemini CLI

Terminal window
gemini

Step 3: Give it a task

Create a simple HTML page with a counter. It should have a dark
background, a large number in the center, and + / - buttons to
increment and decrement. Use vanilla JavaScript — no frameworks.

Watch as Gemini:

  1. Plans the approach
  2. Creates the file(s)
  3. Writes the HTML, CSS, and JavaScript
  4. Reports what it did

Step 4: Check the result

Terminal window
ls
cat index.html
Terminal window
open index.html

From WSL:

Terminal window
explorer.exe index.html

Or right-click the file in VS Code’s Explorer panel.

Terminal window
xdg-open index.html

On 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:

AspectGemini CLIClaude Code
AccessGoogle account (1K req/day)API key or subscription
Context window1M tokens200K tokens
Open sourceYesNo
Best forLarge codebases, budget-conscious workComplex reasoning, nuanced instructions
SetupGoogle accountAPI 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

CommandWhat it does
/helpShow available commands
/modelSwitch between Gemini models
/clearClear conversation history
Ctrl+CExit Gemini CLI

Tips

  1. 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.

  2. Experiment without hesitation. Gemini CLI’s daily allowance is generous — don’t worry about “wasting” requests while learning.

  3. Try different models. Use /model to switch between Gemini 2.5 Pro (most capable) and Flash (faster, good for simpler tasks).