What is the difference between Codex and Gemini CLI?
Codex is OpenAI's coding agent for the terminal and Gemini CLI is Google's; both are open source, read your code, edit files and run commands, but they use different models, different sign-in plans and different safety defaults. The biggest practical difference in 2026 is access: Codex is included in every ChatGPT plan, while Gemini CLI now serves mainly enterprise licenses and paid API keys.
Both tools are Apache 2.0 licensed on GitHub, both support MCP servers and Agent Skills, and both have a non-interactive mode for scripts. Everything below comes from the official docs as of 24 October 2026.
How does Codex work?
The Codex repository describes it as a "Lightweight coding agent that runs in your terminal." You install it, run codex in a project and sign in:
# macOS and Linux
curl -fsSL https://chatgpt.com/codex/install.sh | sh
# or with npm or Homebrew
npm install -g @openai/codex
brew install --cask codex
cd your-project
codex
On first run you choose "Sign in with ChatGPT" or another method. The authentication docs describe the ChatGPT account as "subscription access" and the API key as "usage-based access" billed at standard API rates.
Inside a session, /model picks the model and reasoning effort, /permissions controls what runs without asking, /review reviews your changes, and /init writes an AGENTS.md. The Codex CLI docs also list codex cloud for sending work to cloud environments and codex resume for picking up old chats.
Codex runs on OpenAI models. The models page currently recommends gpt-6-astra for the hardest multi-step work, gpt-6.1-sol for long-running coding at lower cost, and gpt-6-luna for fast, high-volume tasks.
How does Gemini CLI work?
The Gemini CLI repository calls it "An open-source AI agent that brings the power of Gemini directly into your terminal." It needs Node.js 20.0.0 or later:
npm install -g @google/gemini-cli
# or
brew install gemini-cli
cd your-project
gemini
You sign in with a Google account, a Gemini API key (GEMINI_API_KEY) or Vertex AI. Gemini CLI loads GEMINI.md context files, supports custom slash commands written in TOML, and packages prompts, MCP servers, commands and skills as extensions you install with gemini extensions install.
Before you install it, check whether your account can still use it. The README and docs carry this notice for unpaid tier and Google One users: "Gemini CLI was replaced by Antigravity CLI on June 18th, 2026." Google's announcement adds that requests from Google AI Pro and Ultra subscribers also stopped, while "Gemini CLI will remain accessible via paid Gemini and Gemini Enterprise Agent Platform API keys." Organizations on Gemini Code Assist Standard or Enterprise keep their access unchanged.
How do Codex and Gemini CLI compare side by side?
| Codex | Gemini CLI | |
|---|---|---|
| Maker | OpenAI | |
| License | Apache 2.0 | Apache 2.0 |
| Command | codex |
gemini |
| Install | Script, npm, Homebrew, binaries | npm, Homebrew, MacPorts, npx |
| Who can sign in (Oct 2026) | Any ChatGPT plan, from Free to Enterprise, or an API key | Code Assist Standard or Enterprise, paid Gemini API keys, Vertex AI |
| Models | OpenAI models such as gpt-6-astra, gpt-6.1-sol, gpt-6-luna |
Gemini models |
| Default safety | Sandbox on: workspace-write with on-request approvals in Git folders, network off |
Asks before writes and commands; sandbox is opt-in with --sandbox |
| Approval controls | --sandbox and --ask-for-approval |
--approval-mode: default, auto_edit, yolo, plan |
| Project instructions | AGENTS.md (plus AGENTS.override.md) |
GEMINI.md, configurable to read AGENTS.md |
| Agent Skills | .agents/skills/, ~/.agents/skills/ |
.gemini/skills/ or .agents/skills/, and user equivalents |
| MCP config | ~/.codex/config.toml, codex mcp add |
settings.json under mcpServers, gemini mcp add |
| Scripting | codex exec, with --json |
gemini -p, with --output-format json or stream-json |
| Cloud tasks | codex cloud |
Not part of Gemini CLI |
How do they handle permissions and sandboxing?
This is the clearest design difference.
Codex has a sandbox built in. The approvals and security docs list three sandbox modes, read-only, workspace-write and danger-full-access, and approval policies such as on-request and never. In a version-controlled folder Codex starts with the Auto preset (workspace-write plus on-request), and in other folders it starts read-only. In the docs' words, "By default, the agent runs with network access turned off." The --yolo flag turns off both approvals and the sandbox, and the docs mark it as not recommended.
Gemini CLI asks before it writes files or runs commands, and you choose how much to trust it with --approval-mode. auto_edit approves file edits, yolo approves everything, and plan keeps it to planning. Sandboxing is a separate opt-in flag, -s or --sandbox, which defaults to off.
If you want isolation without configuring anything, Codex gives you more out of the box. If you prefer to decide per project, both tools let you tune it.
How do instructions, skills and MCP compare?
Instructions. Codex reads AGENTS.md, walking from the project root down to your current folder, with a global file in ~/.codex. The AGENTS.md docs cap the combined size at 32 KiB by default (project_doc_max_bytes). Gemini CLI reads GEMINI.md, and its context.fileName setting accepts a list, so you can add AGENTS.md and keep one file for both tools. The AGENTS.md guide and GEMINI.md guide cover the details.
{
"context": {
"fileName": ["AGENTS.md", "GEMINI.md"]
}
}
Skills. Both tools follow the Agent Skills format, a folder with a SKILL.md file. Codex scans .agents/skills from your working directory up to the repo root, plus ~/.agents/skills. Gemini CLI's skills docs list .gemini/skills/ with .agents/skills/ as an alias, and the alias wins if both exist. So one .agents/skills/ folder works in both. See Codex skills and Gemini CLI skills.
MCP. Codex stores servers as [mcp_servers.<name>] tables in config.toml and supports STDIO and Streamable HTTP servers. Gemini CLI stores them under mcpServers in settings.json. The formats differ, so you configure each tool separately.
How do you run them in scripts and CI?
Both have a one-shot mode:
# Codex: read-only by default in exec mode
codex exec "summarize the changes on this branch"
codex exec --sandbox workspace-write "fix the failing lint errors"
# Gemini CLI: -p forces non-interactive mode
gemini -p "summarize the changes on this branch" --output-format json
The non-interactive docs say "By default, codex exec runs in a read-only sandbox," and --json turns stdout into a JSON Lines event stream. Gemini CLI's -p appends piped input to the prompt, and --output-format takes text, json or stream-json.
Which should you pick?
Start with access, because it decides a lot.
Codex tends to fit when:
- You already pay for ChatGPT, or want to start on the Free plan.
- You want OpenAI's models and a sandbox with network off by default.
- You want to hand tasks to cloud environments with
codex cloudand pull results back locally. - You want
AGENTS.mdand.agents/skills/without extra configuration.
Gemini CLI tends to fit when:
- Your company has a Gemini Code Assist Standard or Enterprise license, or you pay for a Gemini API key or Vertex AI.
- You want an open source agent built around Gemini models.
- You want extensions that bundle MCP servers, commands and skills in one install.
- You want approval modes you switch with one flag.
If you are an individual on a free or Google AI Pro/Ultra plan, Gemini CLI is no longer an option. Google points you to Antigravity CLI instead, and the fairer comparison for you is Codex against that.
Whichever you choose, keep shared instructions in AGENTS.md and skills in .agents/skills/. Both tools read those paths, so trying the other one later costs little.
Keep your prompts and skills portable
Your review checklists and house rules outlast any single agent. Kipt keeps prompts and Agent Skills as Markdown in a private GitHub repo you own, and installs every skill into Claude Code or Codex with one npx skills add command. If you have a prompt you keep pasting into a terminal agent, the free SKILL.md generator turns it into a skill folder you can drop into .agents/skills/.