Gemini CLI Tutorial: How to Use Google's AI Coding Agent for Real Projects (2026)
Gemini CLI Tutorial: Use Google's AI Coding Agent for Real Projects
Google's Gemini CLI puts Gemini 2.5 Pro directly in your terminal. You describe what you want, it writes code, runs commands, and edits files — all from the command line. No browser, no GUI, no context switching.
If you've used Claude Code or OpenCode, the concept is similar: a terminal-based AI agent that reads your codebase and executes tasks. But Gemini CLI has a unique advantage — free access to Gemini 2.5 Pro with a generous context window.
This tutorial covers everything you need to start using Gemini CLI for real projects, including how to connect it to a multi-agent task board.
Related: OpenCode Tutorial · Claude Code Tutorial · Claude Code vs Cursor · AI Coding Assistant Complete Guide
What Is Gemini CLI?
Gemini CLI is Google's official command-line AI agent. Key features:
- Free Gemini 2.5 Pro access — no API key needed for basic usage
- 1M token context window — handles large codebases
- Terminal-native — edits files, runs commands, searches code
- Multi-modal — can analyze images and screenshots
- Open source — available on GitHub
The main limitation: it's a single agent in a single terminal. You can't coordinate it with other agents or assign tasks from a dashboard — unless you connect it to Ivern Squads.
Setup (3 Minutes)
Step 1: Install Gemini CLI
# Install via npm
npm install -g @anthropic-ai/gemini-cli
# Or download directly
curl -fsSL https://cli.gemini.google/install.sh | bash
Verify:
gemini --version
Step 2: Authenticate
gemini auth login
This opens a browser window to sign in with your Google account. No API key needed — Google provides free Gemini 2.5 Pro access through the CLI.
If you want to use your own API key for higher rate limits:
export GEMINI_API_KEY=your_key_here
gemini auth login --api-key
Step 3: Test It
Navigate to any project directory:
cd your-project
gemini "What does this codebase do? Give me a brief summary."
Gemini reads your project files and responds with a summary. That's it — you're running an AI coding agent.
Real-World Usage Examples
Example 1: Add a Feature
gemini "Add a /health endpoint to the Express server in src/server.ts. It should return { status: 'ok', uptime: <seconds>, version: <from package.json> }"
Gemini reads your server file, understands the structure, and adds the endpoint. It shows you the changes before applying them.
Example 2: Write Tests
gemini "Write integration tests for the /api/users endpoints. Cover: GET /users (list), POST /users (create), GET /users/:id (get one), PUT /users/:id (update), DELETE /users/:id (delete). Use the testing framework already in this project."
It detects your test framework (Jest, Vitest, Pytest, etc.) and writes matching tests.
Example 3: Debug an Error
gemini "The test suite is failing with 'TypeError: Cannot read property map of undefined' in the UserProfile component. Find the cause and fix it."
Gemini traces the error through your codebase, identifies the root cause, and suggests a fix.
Example 4: Code Review
gemini "Review all uncommitted changes in this git repo. Check for: security issues, performance problems, missing error handling, and test coverage gaps."
Example 5: Documentation
gemini "Generate JSDoc comments for all exported functions in src/utils/. Include @param and @returns tags with types."
Usage Limits and Pricing
| Tier | Rate Limit | Context | Cost |
|---|---|---|---|
| Free (Google auth) | 60 requests/min, 1000/day | 1M tokens | $0 |
| API Key (Pay-as-you-go) | Higher limits | 1M tokens | ~$0.10-0.50/task |
The free tier is generous enough for most individual developers. You only need an API key if you're running high-volume automated tasks.
Connecting Gemini CLI to a Multi-Agent Task Board
Gemini CLI works great on its own. But if you're also using Claude Code, Cursor, or OpenCode, you need a way to coordinate them. That's where Ivern Squads comes in.
Why Coordinate Multiple Agents?
| Use Case | Single Agent | Multi-Agent Squad |
|---|---|---|
| Simple edit | Fine | Overkill |
| Full feature (frontend + backend + tests) | Sequential, slow | Parallel, fast |
| Code review + implementation | Manual handoff | Automatic routing |
| Daily standup of tasks | Manual | Task board with auto-assignment |
How to Connect
-
Sign up at ivern.ai/signup (free)
-
Create a squad with multiple coding agents:
# Connect Gemini CLI
npx @ivern-ai/agent install --key YOUR_IVERN_KEY --provider gemini
# Connect Claude Code (in another terminal)
npx @ivern-ai/agent install --key YOUR_IVERN_KEY --provider claude
- Assign tasks from the Ivern dashboard. Tasks get routed to the right agent based on role:
- Gemini CLI Agent → research and documentation tasks (free, large context)
- Claude Code Agent → complex implementation tasks (strong reasoning)
- Cursor Agent → inline editing tasks (editor-native)
Each agent picks up tasks, executes them, and submits results to the shared task board. You watch everything stream in real time.
For detailed setup, see the Claude Code tutorial or OpenCode tutorial.
Gemini CLI vs Claude Code vs Cursor: Quick Comparison
| Feature | Gemini CLI | Claude Code | Cursor |
|---|---|---|---|
| Interface | Terminal | Terminal | VS Code editor |
| Model | Gemini 2.5 Pro | Claude Sonnet/Opus | Claude/GPT-4 |
| Context Window | 1M tokens | 200K tokens | 128K tokens |
| Free Tier | Yes (generous) | API costs only | 2000 completions/mo |
| Best For | Large codebases, free usage | Complex reasoning | Inline editing |
| Multi-file Edits | Yes | Yes | Yes |
The full breakdown is in our Claude Code vs Cursor comparison.
Tips for Getting the Most from Gemini CLI
1. Be Specific About File Paths
Instead of: "Fix the auth bug" Use: "Fix the JWT validation error in src/middleware/auth.ts line 47 where expired tokens are not being rejected"
2. Use the Context Window
Gemini's 1M token context means you can point it at your entire project:
gemini "Analyze the full codebase and identify: 1) Security vulnerabilities 2) Performance bottlenecks 3) Missing test coverage. Prioritize by severity."
3. Chain Commands
gemini "Find all TODO comments in the codebase. For each one, estimate the effort (S/M/L) and create a prioritized list."
4. Use for Non-Coding Tasks
gemini "Read all markdown files in the docs/ directory and generate a table of contents with summaries for each document."
Frequently Asked Questions
Is Gemini CLI free?
Yes. Google provides free access to Gemini 2.5 Pro through the CLI with generous rate limits (60 requests/min, 1000/day). No credit card needed. For higher limits, use your own API key.
How does Gemini CLI compare to GitHub Copilot?
Copilot suggests code inline in your editor. Gemini CLI is an agentic tool — it reads your entire project, plans changes across multiple files, and executes them. Copilot completes your next line. Gemini CLI builds your next feature.
Can I use Gemini CLI without internet?
No. Gemini CLI requires an internet connection to communicate with Google's Gemini API. The AI processing happens on Google's servers.
Does Gemini CLI work with all programming languages?
Yes. Gemini 2.5 Pro supports all major programming languages including Python, JavaScript, TypeScript, Go, Rust, Java, C++, Ruby, and more.
How do I connect Gemini CLI with other AI agents?
Use Ivern Squads to connect Gemini CLI with Claude Code, Cursor, and OpenCode in a shared workspace. Each agent gets a role and task queue. See the setup instructions above or the OpenCode tutorial for a similar walkthrough.
Is my code sent to Google?
Yes. When you use Gemini CLI, your code and prompts are sent to Google's servers for processing. If this is a concern for proprietary code, consider using a self-hosted model instead. Ivern Squads supports BYOK with any provider.
Get Started
- Install:
npm install -g @anthropic-ai/gemini-cli - Authenticate:
gemini auth login - Try it:
cd your-project && gemini "Explain this codebase"
For multi-agent coordination:
- Sign up at ivern.ai/signup
- Connect:
npx @ivern-ai/agent install --key YOUR_KEY --provider gemini - Assign tasks from the dashboard
Your first 15 tasks on Ivern are free. Gemini CLI usage is free with Google authentication.
Related Articles
OpenCode Tutorial: How to Connect OpenCode to a Task Board and Run Multi-Agent Tasks
Learn how to set up OpenCode as an AI coding agent, connect it to Ivern Squads for task management, and coordinate it with Claude Code and Cursor in a multi-agent team. Step-by-step guide with commands.
Claude Code Tutorial: How to Connect Claude Code to a Task Board (2026)
A complete tutorial for Claude Code users who want structured task management. Learn how to connect Claude Code to Ivern Squads, assign tasks from a web dashboard, and coordinate it with other AI agents — no manual context switching.
Cursor AI Tutorial: How to Use Cursor for Multi-Agent Development (2026)
A complete Cursor AI tutorial for developers. Learn how to set up Cursor, write effective prompts, coordinate it with Claude Code and other AI agents, and build a multi-agent development workflow. Includes real examples and cost breakdowns.
Set Up Your AI Team - Free
Join thousands building AI agent squads. Free tier with 3 squads.