AI & LLMs · Guide · AI & Prompt Tools
How to Use Gemini CLI
Installing the gemini CLI, free tier access, Gemini 2.5 Pro, 1M context, tool use, and comparing to other CLIs.
Gemini CLI is Google’s open-source terminal agent that puts Gemini’s 1M-token context window behind a single `gemini` command.
Advertisement
Gemini CLI is Google’s answer to terminal-first AI tools like Claude Code and Codex CLI. You install it once, sign in with a personal Google account, and get access to Gemini 2.5 Pro with a generous free tier of requests per day and minute. It reads files, runs shell commands, edits code, and can pull in web search and the full 1M-token context window for questions that span a whole repo or long documents.
What it is
Gemini CLI is an Apache-2.0 project from Google on GitHub. It ships as an npm package (gemini-cli) and runs on Node. Authentication is either a personal Google sign-in for the free tier, or an API key via Google AI Studio / Vertex AI for higher limits and team usage. It follows the Model Context Protocol, so MCP servers plug in as tools.
Install
# Node 20+ npm install -g @google/gemini-cli # first run triggers login gemini
First session
Run `gemini` in any project directory. The REPL opens, reads a GEMINI.md file if present, and waits for a task.
$ cd my-repo && gemini > Summarize how auth is wired in this repo → grep, read files, cite paths, answer
Everyday workflows
- Codebase questions — point it at a large repo and ask architectural questions; 1M context shines here.
- Scripted refactors — let it edit files in place, review the diff, commit.
- Research — built-in Google Search grounds answers in live links instead of stale training data.
Gotchas and tips
Free-tier rate limits are per-minute and per-day, so long tool-heavy tasks can stall. If you hit the ceiling, switch to an API key or drop to Gemini 2.5 Flash for the cheap iterations. The CLI respects a .gitignore-style pattern file to keep sensitive paths out of context.
Context compaction runs automatically on long sessions, but you can force it with /compress. Drop a GEMINI.md at the project root with conventions, test commands, and taboo files — it is loaded on every session and is the easiest way to get consistent output.
Who it’s for
Developers who want a free, open-source terminal agent with a very large context window, and who are fine living inside Google’s model family. Start on a read-only task to get a feel for the tool-use loop before letting it edit files.
Advertisement