Gemini CLI
Google's open-source terminal coding agent powered by Gemini 3
Gemini CLI is Google's open-source, terminal-native coding agent built on Gemini 3. It runs on your machine via npx or npm, reads and edits multiple files at once, executes shell commands, and handles agentic tasks through plan and act modes. The standout feature is its 1 million token context window, which lets it reason over entire codebases in a single pass. A genuinely useful free tier tied to a Google account makes it the most accessible entry point in the coding-agent space, and Apache 2.0 licensing means you can read, fork, and modify every part of the codebase. By mid-2026 it has over 104,000 GitHub stars and is a credible alternative to Claude Code and OpenAI Codex CLI.
Google shipped Gemini CLI in the summer of 2025 into a market that already had two credible terminal coding agents: Anthropic’s Claude Code and OpenAI’s Codex CLI. By most accounts it arrived as the underdog. A year out, the picture is more interesting. Gemini CLI has quietly accumulated over 104,000 GitHub stars, ships weekly updates, and runs on a genuinely free tier that neither of its direct competitors can match. It’s not the best terminal coding agent you can install today, but it’s the most accessible, and for a specific set of use cases centered on large codebases and zero-cost access, it’s the obvious first choice.
Quick verdict
Gemini CLI is the right starting point for any developer who wants a capable terminal agent without paying a monthly subscription. The 1 million token context window is a real edge on large-codebase tasks. The ecosystem isn’t as mature as Claude Code’s and the agent behavior on complex refactors is less reliable, but the free tier alone earns it a permanent place in the toolbox. If you’ve been curious about coding agents but not ready to commit to a subscription, start here.
What is Gemini CLI, exactly?
Gemini CLI is an open-source command-line agent that connects your terminal to Google’s Gemini 3 models. You install it with npx @google/gemini-cli or npm install -g @google/gemini-cli, sign in with your Google account, and start asking it to do things: read a module, refactor a function, write tests, execute a shell command, search the web for an API spec. It runs on your actual machine, in your actual project, against your actual files.
The architecture is similar to what Claude Code does. You start a session, the agent reads context from the project directory and any GEMINI.md context file you’ve set up, and then it works through tasks using a combination of built-in tools: file reads and writes, shell execution, web fetch, and Google Search grounding. When a task involves multiple files or multiple steps, it reasons through a plan before touching anything, and it asks for confirmation before writing.
The GEMINI.md file is the equivalent of Claude Code’s CLAUDE.md. You put project-specific instructions there: how the codebase is organized, which commands to run for tests, what conventions the team follows. The agent reads it at the start of each session and uses it to calibrate behavior. It’s a simple mechanism and it works well once you’ve invested fifteen minutes writing a useful one.
Under the hood, Gemini CLI is TypeScript, released under the Apache 2.0 license, and the codebase is clean enough that reading it is genuinely instructive. The project has a contributor community, ships nightly builds for people who want the bleeding edge, and pushes stable releases every Tuesday. For a CLI that only hit v0.41 by May 2026, the pace of development has been fast.
One thing that sets it apart immediately: the model it ships with by default supports a 1 million token context window. That’s not a rounding error. It means you can load a large monorepo, a full conversation history, and detailed documentation into a single session without hitting a wall.
The features that earn it the third-place mention
Open source from day one
Gemini CLI launched with full source access under Apache 2.0. That’s not a trivial distinction. You can audit exactly how the agent interacts with your filesystem, how credentials are handled, how context is assembled before each request. For teams with security requirements or for anyone who wants to know what’s actually happening when an agent reads their code, this matters.
The GitHub repo at google-gemini/gemini-cli has the expected things: issues, pull requests, a changelog, contribution guidelines. It also has 13,500 forks, which suggests real derivative work happening in the ecosystem. Companies are building on top of it, adapting it for internal tooling, extending it with proprietary tools. That kind of downstream activity is a good signal for long-term viability.
Claude Code is source-available, meaning you can read the code, but it’s not Apache-licensed for modification and redistribution in the same way. OpenAI’s Codex CLI is also open source but trails on community size. Google’s Apache 2.0 choice here is a genuine advantage for enterprise teams and independent developers who need more than just “it’s open source on paper.”
Massive context window
The 1 million token context window is the most technically distinctive thing Gemini CLI offers. To put that in concrete terms: a million tokens is roughly 750,000 words, which covers most medium-to-large codebases in their entirety plus extensive documentation. You can start a session, point it at a repository, and the model has the entire thing in view.
Why does this matter for a coding agent? Because many of the tasks where agents provide the most value involve understanding relationships across a large codebase: refactoring a data model that’s used in fifty places, understanding how an error propagates through several service layers, migrating an API while keeping all callers consistent. Agents with smaller windows have to make choices about what to include in context. Gemini CLI often doesn’t. It just reads everything.
In practice the quality of reasoning at extreme context lengths has improved considerably since the first Gemini releases. The agent doesn’t just hold more text; it uses it. The flip side is that loading a million tokens per request gets expensive quickly once you move off the free tier, and Gemini CLI does not currently have anything like Claude Code’s intelligent context compaction. You can burn through API quota fast on large projects if you’re not careful.
Free tier with Google AI account
Sign in with a personal Google account and you get 60 requests per minute and 1,000 requests per day. That’s the free tier. No credit card, no trial period, no expiry. For a solo developer or anyone doing occasional work with a coding agent, that’s enough for genuine productive use.
This is a significant differentiator. Claude Code requires a paid Anthropic subscription. OpenAI’s Codex CLI requires an OpenAI API key with usage-based billing. Gemini CLI is the only mainstream terminal coding agent you can pick up today and use seriously without entering a payment method. That makes it the natural entry point for developers who are evaluating whether AI coding agents are worth their time before committing to a subscription.
The free tier does come with constraints worth knowing. The rate limits apply across all Gemini API usage under your account, so if you’re already using Gemini through other tools, the quota is shared. And 1,000 requests per day sounds like a lot until you’re in the middle of a long planning session on a complex task where the agent is making fifteen tool calls per response. Heavy use will push you off the free tier.
Plan and act modes
Like Claude Code, Gemini CLI separates planning from execution. When you give it a non-trivial task, it produces a plan first: here’s what I intend to do, here are the files I’ll touch, here’s the sequence of steps. You review it, push back if something looks wrong, and then it executes. Files don’t change until you’ve signed off.
This matters for trust. One of the reasons developers were slow to adopt autonomous coding agents early on was the fear of an agent making sweeping changes they hadn’t reviewed. Plan mode directly addresses that fear. You’re not watching the agent; you’re directing it.
The implementation in Gemini CLI is functional rather than polished. The plans are readable and the confirmation flow is clear. What’s missing compared to Claude Code is the richer ability to edit the plan inline before execution, or to ask the agent to redo specific steps without scrapping the whole thing. Gemini CLI’s plan mode feels like the first iteration of a feature that will get significantly better.
MCP support and tool calling
Gemini CLI supports the Model Context Protocol, which means you can plug in external tools and services and have the agent call them as part of its reasoning loop. The built-in tools cover the core cases: file system operations, shell commands, web fetch, and Google Search. But MCP opens the door to databases, APIs, internal services, anything that speaks the protocol.
The MCP ecosystem has grown considerably since 2024. There are now servers for most common databases, for browser automation, for cloud provider CLIs, for documentation retrieval. Gemini CLI can use any of them. If you’ve already built MCP integrations for Claude Code, most will work with Gemini CLI with minimal reconfiguration.
The Google Search grounding integration is particularly useful for coding tasks. When the agent is reasoning about an unfamiliar API or a library it has limited training data for, it can search for current documentation and ground its answer in real results rather than potentially stale training data. This is something neither Claude Code nor Codex CLI offers natively.
Pricing
The free tier gives you access to Gemini 3 Flash at 60 requests per minute, 1,000 requests per day, authenticated with a personal Google account. No payment information required.
Beyond the free tier, pricing follows Google AI Studio’s usage-based model. You supply a Gemini API key and pay per token. As of mid-2026, Gemini 3 Flash is priced in the lower range of frontier models, keeping it cheaper per request than Claude’s Sonnet-tier models when used at volume. Gemini 3.1 Pro carries a higher price point in line with other frontier-tier models and is the better choice for tasks requiring deeper reasoning.
Google also offers Google AI Pro and Google AI Ultra subscription plans that bundle higher rate limits and priority access. If you’re using Gemini CLI as your daily driver and hitting the free tier ceiling regularly, a subscription plan typically works out cheaper than raw API usage at moderate volume. Specific pricing for these tiers evolves frequently; check the Google AI Studio pricing page before committing.
What makes the economics attractive for a team is the combination of the free tier and Apache 2.0 licensing. A small team can evaluate Gemini CLI seriously without any upfront cost, understand exactly what it’s doing with their code by reading the source, and make an informed decision about whether to move to paid access. Very few software tools of this capability offer that kind of low-friction evaluation path.
For heavy users who need the 1 million token context window regularly, expect costs to be meaningful. Frontier-tier context windows priced by token add up quickly in an agent loop. Budget accordingly if your use case involves loading large codebases per session.
Where Gemini CLI wins and where it doesn’t
Gemini CLI’s strengths cluster around accessibility and scale. The free tier, the open-source licensing, and the million-token context window are concrete advantages that no other mainstream terminal agent currently matches all at once.
On large-codebase tasks where the agent needs to hold an entire project in context and trace relationships across many files, Gemini CLI’s context advantage is real and tangible. It’s also the tool to reach for if you want to inspect, modify, or build on the agent itself. The Apache 2.0 license and clean codebase make it practical to fork for internal use.
Where it falls short is agent reliability on complex multi-step tasks. The gap between Gemini CLI and Claude Code narrows considerably on simple tasks, but on something like “refactor the authentication system across this service while preserving all existing test coverage,” Claude Code’s reasoning is currently more consistent and its error recovery is better. Gemini CLI sometimes loses track of the broader plan mid-execution in a way that Claude Code handles more gracefully.
The ecosystem is also less developed. The community of guides, templates, and GEMINI.md examples doesn’t yet match what’s available for Claude Code. Third-party MCP integrations that have been tested and documented for Claude Code may work with Gemini CLI but the documentation trail is thinner.
Who Gemini CLI is built for
Three types of developers get the most from Gemini CLI.
The first is the developer who’s never used a coding agent seriously and wants to try one without paying for a subscription. The free tier is real, the installation is fast, and it’s capable enough to make the case for itself within an afternoon. If you come away convinced, you can decide whether to pay for more capacity.
The second is the developer working on large codebases where context window size directly affects task quality. If you regularly need an agent to understand a 200,000-line monorepo or work across documentation and code simultaneously, the million-token window is not a spec sheet number; it changes what’s possible in a single session.
The third is the team that needs to inspect, audit, or modify the agent itself. Organizations with security requirements, compliance obligations, or just a preference for understanding what software does before deploying it can read and fork Gemini CLI in ways that aren’t possible with proprietary tools.
Gemini CLI vs the alternatives
vs Claude Code
Claude Code has a more polished agent loop, richer ecosystem documentation, and better performance on complex autonomous tasks. Its plan mode is more refined, the hook system gives power users fine-grained control, and Anthropic’s models currently produce more consistent multi-step reasoning. The trade-off is cost and context. Claude Code starts at $17 per month with no free tier, and its effective working context is smaller than Gemini 3’s million-token window. For developers who want the most capable agent and are willing to pay for it, Claude Code is still the benchmark. For developers who want to start free or need extreme context depth, Gemini CLI is a serious alternative.
vs OpenAI Codex
OpenAI Codex CLI is capable on straightforward code tasks, well-integrated with OpenAI’s model ecosystem, and has a familiar interface for developers already using ChatGPT or the OpenAI API. Gemini CLI beats it on context window size and free tier generosity. Codex CLI has historically been stronger on code generation quality for popular languages and frameworks, reflecting the depth of OpenAI’s code training data. Gemini CLI’s Google Search grounding is a meaningful practical advantage when working with fast-moving libraries or less-documented APIs. Both are Apache-licensed open-source projects; the main differentiator is which model ecosystem you’re more invested in.
vs Google Jules
This comparison gets interesting because both come from Google. Jules is Google’s cloud-based asynchronous coding agent, designed to pick up tasks from a GitHub issue and work on them independently in the background, reporting back when done. Gemini CLI is a synchronous, interactive terminal tool where you’re present in the loop. They’re not direct substitutes. If you want to hand off a task and come back to a completed pull request, Jules is the right tool. If you want to work with an agent interactively in your terminal while you direct the session, Gemini CLI is the right tool. Many developers will find themselves using both: Jules for async background work on well-defined issues, Gemini CLI for interactive exploration and refactoring sessions. Check out our best AI agent for coding comparison for the full picture on where each tool fits.
Getting started
Installation takes under a minute. Run npx @google/gemini-cli and it will prompt you to sign in with your Google account. No API key required for the free tier. Once authenticated, type your first task and it will read the current directory by default.
If you’re starting with an existing project, create a GEMINI.md file in the project root before your first session. Write down how the project is structured, what commands run the tests, any conventions the codebase follows. Ten minutes here saves a lot of back-and-forth later.
For regular use, a global install with npm install -g @google/gemini-cli avoids the npx overhead and lets you launch it with just gemini from any directory.
When you want to go beyond the free tier, generate an API key in Google AI Studio, set it as GEMINI_API_KEY in your environment, and the CLI will automatically use it instead of the free-tier authentication. You can then specify models directly with the -m flag to choose between speed and reasoning depth depending on the task.
The bottom line
Gemini CLI is the most accessible entry point into terminal-native coding agents. The free tier works, the million-token context window is a genuine technical advantage for large codebases, and the Apache 2.0 license means you can trust what it’s doing with your code because you can read the whole thing. It isn’t as polished as Claude Code for complex autonomous work, and the ecosystem is still catching up. But it’s a credible, actively maintained third option in a category that benefits from competition, and for many developers it’s the obvious first agent to install. The best AI agent for coding for you depends on your workflow, your budget, and how much you value context depth over agent sophistication. Gemini CLI wins on the first two counts more often than it gets credit for.
Key features
- 1 million token context window for deep codebase understanding
- Multi-file reads and edits from a single terminal session
- Shell command execution inside the agent loop
- Plan mode for reviewing tasks before any file is touched
- MCP support for custom tools and third-party integrations
- Built-in Google Search grounding for up-to-date answers
- Conversation checkpointing to save and resume long sessions
Pros and cons
Pros
- + Free tier is generous enough for daily driver use
- + 1 million token context window is the largest among mainstream CLI agents
- + Apache 2.0 license with full source access
- + MCP support connects it to any custom toolchain
- + Built-in Google Search grounding keeps answers current
- + Available via npx with zero global install required
Cons
- − Ecosystem and third-party integrations are less mature than Claude Code
- − Still on minor version releases (v0.x) as of mid-2026
- − Response quality on complex multi-step refactors trails Anthropic's models
- − Windows support works but the experience is rougher than on macOS or Linux
- − Conversation quality depends heavily on model choice and prompt style
Who is Gemini CLI for?
- Solo developers who want a capable coding agent without a monthly subscription
- Large-codebase refactors that benefit from a million-token context in one shot
- Teams that need an auditable, self-hostable open-source agent they can fork
- Engineers already in the Google Cloud ecosystem who want native AI tooling
Alternatives to Gemini CLI
If Gemini CLI isn't quite the right fit, the closest alternatives are claude-code , openai-codex , and google-jules . See our full Gemini CLI alternatives page for side-by-side comparisons.
Frequently Asked Questions
What is Gemini CLI?
Is Gemini CLI free?
How does Gemini CLI compare to Claude Code?
What is Gemini CLI's context window?
Can Gemini CLI use other models?
Is Gemini CLI open source?
Related agents
Aider
Git-aware AI pair programmer that runs in your terminal
Amazon Bedrock Agents
AWS-native AI agent platform built on Bedrock with Lambda actions and Guardrails
Amazon Q Developer
AWS-native AI coding assistant with deep cloud integration