Gemini CLI is Google's open-source coding agent for the terminal, but since June 18, 2026 it no longer serves free users or Google AI Pro and Ultra subscribers, who were moved to Antigravity CLI. This guide explains who can still use Gemini CLI, how to install and configure it, how GEMINI.md and MCP work, and when to switch.
- Gemini CLI still works with paid Gemini API keys, Google Cloud keys and Gemini Code Assist Standard or Enterprise licenses.
- Free tier and Google AI Pro or Ultra users now use Antigravity CLI (
agy), which reads the same GEMINI.md and AGENTS.md files. - Install with
npm install -g @google/gemini-cli(Node.js 20 or newer) and start it withgeminiin your project. - Put project instructions in GEMINI.md; run
/initto generate one and/memory showto see what the model receives. - Use
--approval-modeand--sandboxto control what the agent can do, and avoid--yolooutside a container.
What is Gemini CLI, and can you still use it?
Gemini CLI is an open-source AI agent that runs Google's Gemini models in your terminal: it reads your codebase, edits files, runs shell commands and connects to MCP servers. It is published under the Apache 2.0 license in the google-gemini/gemini-cli repository.
The big change in 2026 is who can use it. Google's announcement says that on June 18, 2026, Gemini CLI and the Gemini Code Assist IDE extensions stopped serving requests for Google AI Pro and Ultra, and free use through Gemini Code Assist for individuals ended. The README now says unpaid tier and Google One users were moved to Antigravity CLI, and that Gemini CLI has not been optimized for the newest Gemini models.
So there are two kinds of readers for this guide:
- You have a paid Gemini API key, a Google Cloud setup, or a Gemini Code Assist Standard or Enterprise license. Gemini CLI still works for you, and everything below applies.
- You used Gemini CLI for free or through a Google AI Pro or Ultra subscription. You now need Antigravity CLI. Your GEMINI.md files carry over, and the migration section below shows what changes.
Parts of the Gemini CLI documentation, such as the quota page, still describe the old free tiers. Treat the README and Google's announcement as current.
Who can use Gemini CLI after June 2026?
Gemini CLI is now for paid API and enterprise users; everyone else is pointed to Antigravity CLI. This table summarizes the announcement at the time of writing (October 2026).
| Your account | Gemini CLI | What to use |
|---|---|---|
| Free Google account (Code Assist for individuals) | No longer served | Antigravity CLI |
| Google AI Pro or Ultra (Google One) | No longer served | Antigravity CLI |
| Paid Gemini API key (AI Studio) | Works | Gemini CLI or Antigravity CLI |
| Gemini Enterprise Agent Platform (Google Cloud) API key | Works | Gemini CLI |
| Gemini Code Assist Standard or Enterprise | Works, still supported | Gemini CLI |
Google says Antigravity CLI "is available to everyone," and Antigravity's plans page describes baseline rate limits for users without a Google AI plan, with higher limits and the option of purchased AI credits for Pro and Ultra subscribers.
How do I install Gemini CLI?
Install the npm package globally, then run gemini inside a project folder. Gemini CLI needs Node.js 20 or newer.
Check your Node version with
node --version. Install Node 20+ if needed.Install Gemini CLI globally with npm. On macOS or Linux,
brew install gemini-clialso works, andnpx @google/gemini-cliruns it without installing:terminal npm install -g @google/gemini-cliMove into a project and start it:
terminal cd ~/code/my-appgeminiPick an authentication method when prompted (next section).
Gemini CLI ships on three release channels: latest (stable, weekly on Tuesdays), preview (weekly, less vetted) and nightly. Stick with latest unless you need a specific fix: npm install -g @google/gemini-cli@latest.
How do I sign in to Gemini CLI?
Use a Gemini API key from Google AI Studio, a Google Cloud setup, or sign in with a Google account that holds a Code Assist license. The authentication docs cover each path.
Gemini API key
Create a key in Google AI Studio, export it, start the CLI and choose Use Gemini API key:
export GEMINI_API_KEY="your-key-here"geminiWith a paid key you are billed per token at Gemini API rates, so check the current prices on Google's pricing page before running long tasks.
Google Cloud (Vertex AI or Agent Platform)
For enterprise projects on Google Cloud:
export GOOGLE_API_KEY="your-cloud-key"export GOOGLE_GENAI_USE_VERTEXAI=truegeminiSign in with Google and a Code Assist license
If your organization gives you a Gemini Code Assist Standard or Enterprise license, select Sign in with Google. Company, school and Workspace accounts also need a Google Cloud project:
export GOOGLE_CLOUD_PROJECT="your-project-id"geminiTreat API keys as passwords. Keep them in your shell profile or a secrets manager, never in a committed .env file or in GEMINI.md.
How do you use GEMINI.md files?
GEMINI.md is the instruction file Gemini CLI loads into every prompt: build commands, code style, architecture notes and rules. It plays the same role as CLAUDE.md for Claude Code and AGENTS.md for Codex.
According to the GEMINI.md docs, the CLI combines files from three places:
- Global:
~/.gemini/GEMINI.md, for preferences that apply to every project. - Workspace:
GEMINI.mdfiles in your workspace directories and their parents. - Just in time: when a tool touches a file or folder, the CLI looks for
GEMINI.mdin that folder and its ancestors, so component-specific rules load only when needed.
The footer shows how many context files are loaded. Useful commands:
| Command | What it does |
|---|---|
/init | Analyzes the current directory and generates a starter GEMINI.md |
/memory show | Displays the full combined context the model receives |
/memory reload | Re-scans and reloads all GEMINI.md files |
A short, useful GEMINI.md:
## Commands- Install: npm ci- Test: npm test (run before saying a task is done)- Lint: npm run lint## Conventions- TypeScript strict mode, no `any`- API handlers live in src/api/, one file per route- Never edit files in dist/ or generated/You can split a long file with imports (@./docs/style-guide.md), and you can change the file name. If your team already keeps instructions in AGENTS.md, add this to settings.json so Gemini CLI reads it too:
{ "context": { "fileName": ["AGENTS.md", "GEMINI.md"] }}The same principles that make a good CLAUDE.md apply here; our guide to CLAUDE.md best practices covers what to include and what to leave out.
How do I add MCP servers to Gemini CLI?
Declare servers under mcpServers in settings.json, or add them with gemini mcp add. MCP servers give the agent tools such as GitHub, databases or browsers.
The MCP docs show the format. A GitHub server in your user settings:
{ "mcpServers": { "github": { "command": "npx", "args": ["-y", "@github/github-mcp-server"], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_PERSONAL_ACCESS_TOKEN" } } }}Or from the command line, for a local or remote server:
gemini mcp add -e API_KEY=123 my-server /path/to/servergemini mcp add --transport http my-http-server https://api.example.com/mcp/gemini mcp add writes to project settings by default; pass -s user to add it for all projects. Inside a session, /mcp lists servers and their tools, and you can address a server's tools in a prompt with @github List my open pull requests. Each server config also has a trust property; leave it false so the CLI asks before running that server's tools. New to MCP? Start with what MCP is and how it works.
How do you keep Gemini CLI safe?
Pick an approval mode that matches the task, turn on the sandbox for anything unattended, and only trust folders you know. Gemini CLI runs real shell commands on your machine.
- Approval modes:
defaultasks before actions,auto_editauto-approves file edits, andplanis read-only. You can set these in settings or with--approval-mode. YOLO mode, which approves everything, can only be turned on from the command line (--yoloor--approval-mode=yolo), and admins can block it withsecurity.disableYoloMode. - Plan mode:
/planswitches to a read-only mode and shows the current plan, so you can review the approach before any edit. - Sandbox: the sandboxing docs list three ways to enable it: the
-sor--sandboxflag, theGEMINI_SANDBOXenvironment variable (true,docker,podman,sandbox-execand others), or"sandbox": trueundertoolsin settings. - Trusted folders:
/permissions trustmanages which directories the CLI treats as trusted.
For scripts and CI, headless mode prints a single answer, optionally as JSON:
gemini -p "Summarize what changed in the last 10 commits" --output-format jsonHeadless runs pair well with a machine that stays on. If you want coding agents to keep working after you close your laptop, a hosted box such as Orkio runs Claude Code and Codex 24/7 on an isolated server you steer from your phone.
Should you switch to Antigravity CLI?
If you lost Gemini CLI access in June, yes: Antigravity CLI is Google's replacement, and most of your setup carries over. If you are on a paid key or Code Assist license, you can stay on Gemini CLI, but new Gemini models are optimized for Antigravity.
Install the agy binary with Google's installer, per the Antigravity getting started docs:
curl -fsSL https://antigravity.google/cli/install.sh | bashagyOn first launch in an environment with Gemini CLI config, agy detects it and offers a checklist of what to migrate. The migration guide lists what changes:
| Item | Gemini CLI | Antigravity CLI |
|---|---|---|
| Project instructions | GEMINI.md, AGENTS.md | Same files, no changes needed |
| Global instructions | ~/.gemini/GEMINI.md | Same file |
| Extensions | Extensions | Plugins (agy plugin import gemini) |
| Workspace skills | .gemini/skills/ | .agents/skills/ |
| MCP servers | Inside ~/.gemini/settings.json | ~/.gemini/config/mcp_config.json or .agents/mcp_config.json |
| Remote MCP URL key | url or httpUrl | serverUrl |
Google's announcement says skills, hooks, subagents and extensions carry over, but warns there will not be one-to-one feature parity at first.
How does Gemini CLI compare with Claude Code and Codex?
All three are terminal agents with an instruction file, MCP support and approval modes; they differ mostly in model family, account model and ecosystem.
| Gemini CLI | Claude Code | Codex CLI | |
|---|---|---|---|
| Maker | Anthropic | OpenAI | |
| Open source | Yes (Apache 2.0) | No | Yes |
| Instruction file | GEMINI.md (configurable) | CLAUDE.md, can read AGENTS.md | AGENTS.md |
| Access after June 2026 | Paid API keys, Code Assist licenses | Claude Pro, Max, Team or API | ChatGPT plan or API key |
| Successor or sibling | Antigravity CLI for free and Google AI users | Desktop, web and mobile surfaces | Codex cloud and IDE extension |
If you are choosing a primary agent today, the guides for Claude Code and Codex CLI walk through the same setup steps for those tools, and our roundup of AI in the terminal compares the wider field.
Your Gemini CLI setup checklist
Use this list to get from zero to a safe, useful setup in under an hour.
- Confirm your account type: paid API key or Code Assist license means Gemini CLI; free or Google AI Pro or Ultra means Antigravity CLI.
- Install Node.js 20+ and
@google/gemini-cli@latest, or installagy. - Authenticate and keep the key out of your repository.
- Run
/init, then trim the generated GEMINI.md to commands, conventions and no-go zones. - Add one MCP server you will actually use, with
trustleft off. - Start with
defaultapproval mode and/planfor anything bigger than a small fix. - Turn on the sandbox before running unattended or headless jobs.
Frequently asked questions
Is Gemini CLI still free?
Not for most people. Google's announcement says Gemini CLI stopped serving free Gemini Code Assist for individuals and Google AI Pro and Ultra on June 18, 2026. Gemini CLI remains available with paid API keys and Code Assist Standard or Enterprise, and Google points everyone else to Antigravity CLI.
What replaced Gemini CLI?
Antigravity CLI, a terminal agent that is part of Google Antigravity. Its command is agy, it is built in Go, and it shares its agent core with the Antigravity desktop app. Skills, hooks, subagents and extensions carry over, with extensions renamed to plugins.
Does Antigravity CLI read GEMINI.md?
Yes. Google's migration guide says Antigravity CLI uses the same workspace context rules, reading GEMINI.md and AGENTS.md in your project and the global file at ~/.gemini/GEMINI.md, so you do not need to change them.
Can Gemini CLI use AGENTS.md instead of GEMINI.md?
Yes. Set the context.fileName property in settings.json to a list that includes AGENTS.md. That lets Gemini CLI share one instruction file with Codex, Cursor and other agents that read AGENTS.md.
Is Gemini CLI open source?
Yes. The google-gemini/gemini-cli repository is published under the Apache License 2.0, and you can install it from npm, Homebrew or MacPorts. Access to the models still depends on your account type.

