Codex vs Gemini CLI comes down to which account you already pay for and how much isolation you want. Codex is OpenAI’s terminal agent: it signs in with ChatGPT, runs GPT models and sandboxes every command at the OS level. Gemini CLI is Google’s: it signs in with a Google account, a Gemini API key or Vertex AI, runs Gemini models and gives you four approval modes plus an optional sandbox. Both are open source under Apache 2.0, both read a project instructions file, and both connect to MCP servers.
The biggest difference at the time of writing (October 2026) is access. Codex is included in every ChatGPT plan, the free one too. Gemini CLI stopped serving unpaid tier and Google One users on June 18, 2026; those users were moved to Antigravity CLI. This post walks through sign-in and pricing, models, reasoning effort, sandbox and approvals, session resume, MCP and install, then shows how to run both together. No benchmark scores; they change with every model release.
Codex and Gemini CLI at a glance
| Codex | Gemini CLI | |
|---|---|---|
| Maker | OpenAI | |
| License | Apache 2.0 | Apache 2.0 |
| Sign in | ChatGPT account or API key | Google account, GEMINI_API_KEY or Vertex AI |
| Free use | Included in ChatGPT Free | Not for unpaid tier since June 18, 2026 |
| Models | OpenAI GPT models | Gemini models (auto, pro, flash, flash-lite) |
| Reasoning effort | Per model, set in /model or config.toml | No effort flag |
| Sandbox | On by default, OS level | Off by default, --sandbox to enable |
| Approvals | --ask-for-approval, /permissions | --approval-mode default, auto_edit, plan, yolo |
| Instructions file | AGENTS.md | GEMINI.md (configurable) |
| Resume | codex resume, /resume, codex fork | --resume latest, --list-sessions |
| MCP | codex mcp, ~/.codex/config.toml | gemini mcp add, ~/.gemini/settings.json |
Sign-in and pricing
Codex
Codex asks you to sign in on first run. Sign in with ChatGPT is the recommended path, and usage then counts against your ChatGPT plan. You can also use an OpenAI API key; that bills at standard API rates and leaves out the cloud features.
At the time of writing (October 2026), OpenAI lists Codex in ChatGPT Free ($0), Go ($8/month), Plus ($20/month), Pro (from $100/month), Business ($20 per user per month billed annually, $25 monthly), Edu and Enterprise. Higher plans give higher usage limits. Check the current numbers on OpenAI’s Codex pricing page.
Gemini CLI
Gemini CLI offers three ways in: Sign in with Google, a Gemini API key in GEMINI_API_KEY, or Vertex AI for Google Cloud projects. Paid Gemini Code Assist licenses also need GOOGLE_CLOUD_PROJECT set.
The catch is the June 2026 change. Google’s notice in the repository says unpaid tier and Google One users were moved to Antigravity CLI on June 18, 2026, and that Gemini CLI is not optimized for Google’s newest models. So at the time of writing, Gemini CLI is a tool for paid API keys, Vertex AI and Code Assist Standard or Enterprise. API usage is billed per token; see Google’s Gemini API pricing for current rates. If you were on the free tier, read Gemini CLI vs Claude Code for the details of the move.
Models and reasoning effort
Codex runs OpenAI’s GPT models. Pick one with --model (or -m) at launch or /model inside a session; /model also sets the reasoning effort when the model supports it. To make it stick, set model and model_reasoning_effort in ~/.codex/config.toml, or in a project’s .codex/config.toml.
Gemini CLI’s --model (-m) defaults to auto and takes the aliases pro, flash and flash-lite as well as full model names. It has no reasoning-effort flag; you choose a faster or a stronger model instead.
Sandbox and approval modes
Codex
Codex separates two things: what a command can touch (the sandbox) and when it asks you (approvals).
--sandbox read-only: it can read, but not write or reach the network.--sandbox workspace-write: it can edit inside the workspace.--sandbox danger-full-access: no sandbox.--ask-for-approval on-requestornevercontrols the prompts, and/permissionsswitches between presets such as Auto and Read Only in a running session.
The sandbox is enforced by the OS: Seatbelt on macOS, bubblewrap and seccomp on Linux, a native sandbox on Windows. --add-dir gives write access to one more folder. --dangerously-bypass-approvals-and-sandbox turns everything off and is meant only for a dedicated, isolated machine.
Gemini CLI
Gemini CLI’s --approval-mode has four values:
default: asks before edits and commands.auto_edit: applies file edits without asking, still asks for other tools.plan: read-only planning.yolo: approves everything. The old--yoloflag still exists but is deprecated in favor of--approval-mode=yolo.
The sandbox is off by default. --sandbox (-s) turns it on, and you can choose a backend such as Seatbelt on macOS or a Docker or Podman container. Gemini CLI also has checkpointing, so you can roll back file changes an agent made. For a wider view of these risks, see AI coding agent security.
Session resume
- Codex:
codex resumeopens a picker,codex resume --lastcontinues the latest session, and/resumedoes it from inside a session.codex forkstarts a new branch from a past session, so you can try two directions from the same point. - Gemini CLI:
gemini --resume latestcontinues the last session,--resume 5picks one by index, and--list-sessionslists the sessions of the current project.
Instruction files and MCP
Codex reads AGENTS.md in your repo, and /init writes a starter one. Gemini CLI reads GEMINI.md, but context.fileName in settings.json can be set to ["AGENTS.md", "GEMINI.md"]. Keep shared rules in AGENTS.md and both agents follow them.
Both speak the Model Context Protocol. In Codex, codex mcp add, list, remove and authenticate manage servers, stored in ~/.codex/config.toml. In Gemini CLI, gemini mcp add <name> <command> adds a stdio server, stored under mcpServers in ~/.gemini/settings.json. Same servers, two config files.
Install
# Codex
npm install -g @openai/codex
brew install --cask codex
curl -fsSL https://chatgpt.com/codex/install.sh | sh
# Gemini CLI
npm install -g @google/gemini-cli
brew install gemini-cli
npx @google/gemini-cli # try without installing
On Windows, Codex also has a PowerShell installer: irm https://chatgpt.com/codex/install.ps1 | iex.
Strengths, honestly
Codex is strongest when you already pay for ChatGPT: no extra bill, limits that scale with your plan, a sandbox that is on by default, and codex exec for scripts and CI. Its read-only and workspace-write modes make it a safe agent to leave running.
Gemini CLI is strongest for teams already on Google Cloud: Vertex AI and Code Assist licenses fit straight in, the sandbox can run in a container, and auto_edit is a handy middle ground between asking for everything and asking for nothing. Its weak spot right now is access: personal accounts have moved to Antigravity CLI.
Codex and Gemini CLI in AgentVera
AgentVera is a desktop app for macOS, Windows and Linux that runs 18 terminal coding agent CLIs side by side in real terminals, in a grid per project, with your existing logins. Codex and Gemini CLI are both in the New agent dialog; Gemini CLI stays dimmed until you install it.
| Need | In AgentVera |
|---|---|
| Sign in | Codex uses your existing login; each added account gets its own CODEX_HOME. Gemini CLI uses its own Google login or GEMINI_API_KEY |
| Pick a model | Codex models are read live with codex debug models; for Gemini CLI, leave it empty for the default or pick one, passed with --model |
| Reasoning effort | Codex: a slider with the levels the model offers. Gemini CLI: none |
| Permissions | Ask, Auto or Full access per agent, limited to the levels each CLI supports |
| Keep sessions | Codex continues from its local history and can fork with codex fork; Gemini CLI starts with its own --session-id and reopens with --resume |
| Shared tools | AgentVera’s MCP servers and its browser attach to both on every launch |
| Separate folders | Each agent in its own git worktree |
| Check the work | Automatic code review: at turn end, the Claude model you choose reviews the turn’s commits or all changes |
| Chain agents | Flows: both can be a source or a target (Pro and Team) |
A flow is where the pair pays off. Say Codex writes and Gemini CLI reviews: when Codex finishes its turn, its last reply goes into your template ({{output}}, {{source}}, {{target}}) and is sent to Gemini CLI. If Gemini CLI is busy, the flow waits; a turn limit stops the loop. You can add Condition, Wait, Transform, Notify or Human approval nodes in between, and approve from Telegram when you are away.
Codex also gets the extras that only some CLIs support: account switching with account chains that move to the next account when the 5-hour or weekly limit runs out (Pro and Team), the remaining limits of each account, a Lean context profile, and running in Docker. Gemini CLI has no extra-instructions flag, so AgentVera’s Role field doesn’t reach it; put the rules in AGENTS.md or GEMINI.md.
A simple setup
- Put shared rules in
AGENTS.mdand add it to Gemini CLI’scontext.fileName. - Open a Codex agent and a Gemini CLI agent in the same project, each in its own worktree.
- Register your MCP servers once in AgentVera so both get them.
- Turn on automatic code review in project settings.
- On Pro or Team, add a flow from Codex to Gemini CLI with a review prompt and a turn limit.
The grid, worktrees, code review and the MCP manager are on the free plan. Download AgentVera and compare both on your own repo. For more pairs, see Claude Code vs Codex and the best AI coding CLI tools.
Which to choose
Pick Codex if you have a ChatGPT plan, want a sandbox that is on by default and like strict read-only or workspace-write modes. Pick Gemini CLI if your team pays for Gemini through Google Cloud or a Code Assist license and you want container sandboxes. If you are on a free Google account, look at Antigravity CLI instead. And if you have access to both, run them side by side and let one check the other.