gemini-cli
Google's open-source AI agent that brings Gemini models into your terminal for coding and other tasks.
- Stars
- 109,090 stars
- Forks
- 15k forks
- Last push
- today
- Activity
- Active
# Run without installing$ npx @google/gemini-cli# Install globally with npm$ npm install -g @google/gemini-cli# Or with Homebrew$ brew install gemini-cliCommands from the project's README. Run them after installing (see below).
Overview
Understand gemini-cli in 60 seconds
- What it does
- Gemini CLI is Google's open-source terminal agent for working with code using Gemini models. It is now maintained mainly for organisations using Gemini Code Assist Standard or Enterprise on Google Cloud.
- The problem it solves
- Developers want an AI agent in the terminal that can read a large codebase, edit it, debug problems and automate tasks. Gemini CLI does that with Gemini models, MCP servers and a non-interactive mode for scripts.
- Why choose it
- Choose it if your organisation has a Gemini Code Assist license. The README says free individual access and Google AI Pro / Ultra moved to Antigravity CLI on June 18, 2026, and Gemini CLI isn't tuned for Gemini 4 models.
- Who should use it
- Organisations with Gemini Code Assist Standard or Enterprise
- Teams using Code Assist for GitHub on Google Cloud
- Developers with paid Gemini API or Vertex AI keys
- People scripting codebase questions in CI
- Setup difficulty
You'll need:
- Node.js (or Homebrew, MacPorts or conda)
- A Gemini Code Assist license, a paid Gemini API key, or Vertex AI access
How gemini-cli works
Gemini CLI is a terminal agent that can query and edit large codebases, build apps from PDFs, images or sketches, debug with natural language, and automate tasks like querying pull requests or handling rebases. MCP servers add capabilities, such as media generation with Imagen, Veo or Lyria.
It can run interactively in your project directory or non-interactively with -p for scripts, with JSON or streaming JSON output. You can include extra directories and choose a model.
The README now points most individuals elsewhere: Antigravity CLI for free and Google AI Pro / Ultra accounts and Gemini 4, and the Gemini API CLI for stateless API commands. Gemini CLI remains for enterprise Code Assist workflows and legacy paid API or Vertex keys. Preview, stable and nightly release channels are published.
Features
Key features
Codebase understanding
Query and edit large codebases from the terminal.
Multimodal input
Generate apps from PDFs, images or sketches.
MCP servers
Connect tools such as media generation.
Scripting mode
Non-interactive -p with JSON output for automation.
Several auth options
Google sign-in, Gemini API key or Vertex AI.
Release channels
Preview, stable and nightly builds.
Strengths
- Open source from Google
- Good fit for Google Cloud enterprises
- Scriptable for CI
- Apache-2.0 license
Limitations
- No free tier or Google AI Pro / Ultra plans any more
- Not optimised for Gemini 4 and later
- Not meant for benchmarking Gemini models
Practical use cases
Explain a codebase
Run gemini -p "Explain the architecture of this codebase".
Automate PR chores
Query pull requests or handle complex rebases.
Enterprise coding agent
Use your organisation's Code Assist license in the terminal.
Installation
Install gemini-cli
Commands come from Gemini CLI's README. AIRepoHub hasn't run them yet. View source
Prerequisites
- Node.js
Supported systems
- macOS
- Linux
- Windows
- 1
Install globally
Shellnpm install -g @google/gemini-cli
- 1
Install
Shellbrew install gemini-cli
- 1
Run instantly
Shellnpx @google/gemini-cli
Configuration and API keys
| Setting | What it's for |
|---|---|
GOOGLE_CLOUD_PROJECTOptional | Your Google Cloud project when signing in with an organisation's Code Assist license. |
GEMINI_API_KEYOptional | A Gemini API key from Google AI Studio. |
GOOGLE_API_KEYOptional | API key for Vertex AI, used with GOOGLE_GENAI_USE_VERTEXAI=true. |
First run
- 1
Set your Google Cloud project and start
Shellexport GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"gemini
gemini-cli's documentation doesn't include sample output, so we don't show any. Expect the results in your terminal.
Your first project
Ask Gemini CLI to explain a codebase
Use Gemini CLI interactively and in a script to understand a project.
Before you start
- Gemini CLI installed
- A Code Assist license, Gemini API key or Vertex AI access
- 1
Sign in (Code Assist license)
Shellexport GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"gemini - 2
Or use an API key
Shellexport GEMINI_API_KEY="YOUR_API_KEY"gemini - 3
Ask from a script
Shellgemini -p "Explain the architecture of this codebase" --output-format json
What to expect
A structured explanation of the codebase, printed as JSON in script mode.
Next steps
- Add more folders with --include-directories
- Connect an MCP server
- Read the docs at geminicli.com
Costs and requirements
What it costs to run
- License
- Apache-2.0. Free to use, modify and use commercially.Free
- Software
- Free.Free
- Model access
- Needs a paid Code Assist license, paid Gemini API key or Vertex AI billing.Paid
Troubleshooting
Common setup issues
Free Google account or AI Pro / Ultra doesn't work
Those moved to Antigravity CLI on June 18, 2026.
Results with Gemini 4 models seem off
Gemini CLI isn't tuned for Gemini 4+; Google recommends Antigravity CLI.
Restricted environment without global npm
Install inside a conda environment with nodejs from conda-forge.
Alternatives
Similar AI repositories
deepseek-harness
deepseek-ai
Plugin-based harness from DeepSeek for running AI agents, where every feature is added as a plugin.
firecrawl
firecrawl
API that lets AI agents search, scrape and read web pages and other data sources through one service.
orca
stablyai
App for running and managing several AI coding agents like Claude Code and Codex on desktop, mobile or a remote machine.
TradingAgents
TauricResearch
Multi-agent framework where AI agents work together to research and analyze financial markets.