The Cartographer · 11 min mission

Gemini CLI vs Claude Code vs Codex CLI

Pick the right terminal coding agent — an honest, current three-way comparison.

gemini-cliclaude-codecodex-clicomparisonsandboxingpricingmcpFact-checked 2026-06-15
On this page

Gemini CLI, Claude Code, and OpenAI's Codex CLI are terminal coding agents: each reads your repo, edits files, runs commands, and loops until the task is done. They differ on three axes that decide the choice — context window, cost (including whether a free path exists), and sandbox/trust model. This guide gives the exact model IDs, flags, config keys, file paths, and defaults for each, plus a decision procedure.

ToolLatest stableCanonical installLaunch
Gemini CLIv0.46.0 (2026-06-10)npm install -g @google/gemini-cligemini
Claude CodeAuto-updating native install (no pinned version)curl -fsSL https://claude.ai/install.sh | bashclaude
Codex CLI0.139.0 (~2026-06-11)npm install -g @openai/codexcodex
Latest stable release and canonical install command, as of 2026-06-15.

Context window and model selection

All three flagships reach a 1,000,000-token input window. Pick or override the model per run; the strings below are the verified current IDs.

ToolFlagship model IDContext (in / out)How to selectNotes
Gemini CLIgemini-3.1-pro-preview1,048,576 / 65,536gemini -m <id>Knowledge cutoff Jan 2025. Stable: gemini-3.5-flash, gemini-3.1-flash-lite. gemini-3-pro-preview is retired — do not use.
Claude Codeclaude-opus-4-81M / 128k/model or configclaude-sonnet-4-6 (1M/64k), claude-fable-5 (1M/128k, GA 2026-06-09), claude-haiku-4-5 (200k/64k). IDs are pinned dated snapshots, not evergreen aliases.
Codex CLIgpt-5.5 (recommended)-m <id> or /modelNo hard-pinned default string; inherited from ~/.codex/config.toml. Reference example: -m gpt-5.4.
Flagship and selectable models. Limits verified against each vendor model page (2026-06-15).

Cost and free tier

Two of the three have no $0 plan, and the third loses its free individual tier on 2026-06-18. The cheapest paid CLI entry for Claude Code and Codex CLI is $20/mo.

ToolFree for individuals?Cheapest paid entryPay-as-you-go
Gemini CLIYes until 2026-06-18 — 60 req/min, 1,000 req/day, no cardGemini Code Assist Standard/Enterprise (after cutover)Paid Gemini API key (~1,000 req/day on Gemini 3)
Claude CodeNo free tierPro $20/mo (Max 5× $100, Max 20× $200)Anthropic API, metered per token
Codex CLINo $0 plan (Codex Mobile ≠ Codex CLI)ChatGPT Plus $20/mo (Pro/Business/Edu/Enterprise too)OpenAI API key, standard rates
Money, as of 2026-06-15. No honest "$0" column exists for Claude Code or the Codex CLI; Gemini CLI free individual access ends 2026-06-18.

MCP and extensibility

All three speak the Model Context Protocol (MCP) and read a project-memory file before you type. The config locations and memory files differ.

ToolProject memory fileMCP / config locationExtensibility surface
Gemini CLIGEMINI.mdMCP servers in ~/.gemini/settings.jsonExtensions, custom commands; Apache-2.0 open source.
Claude CodeCLAUDE.md (+ auto-memory)MCP via /mcp; tool definitions deferred by default (only names enter context until used)Skills, hooks (PreToolUse/PostToolUse), subagents, agent teams (CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1), plugins, Agent SDK; terminal, VS Code, JetBrains, desktop, web, Slack, GitHub Actions.
Codex CLIAGENTS.md (cross-tool standard)Config in ~/.codex/config.tomlexec for scripting; /model and slash-commands in the TUI.
Project memory, MCP config, and config file paths. Verified against vendor docs (2026-06-15).

Sandboxing

This is the widest gap. Default postures: Codex sandboxes by default, Claude is opt-in, Gemini is opt-in. macOS uses Seatbelt on all three; Linux/WSL2 uses bubblewrap for the two that ship OS sandboxing.

Enable and control each sandbox

  1. Codex CLI — on by default

    Already sandboxed at workspace-write. Set mode with sandbox_mode in config, or --sandbox/-s: read-onlyworkspace-write (default) → danger-full-access. Set approvals with approval_policy, or --ask-for-approval/-a: untrustedon-request (default) → never.

  2. Claude Code — opt in

    Run /sandbox, or set sandbox.enabled: true in settings.json. By default the agent writes only to the working directory and a session temp dir, reads most of the disk, and reaches the network through a deny-by-default out-of-sandbox proxy that allowlists by hostname. Choose auto-allow (no prompts) or regular permissions.

  3. Gemini CLI — opt in

    Pass --sandbox/-s, or set the GEMINI_SANDBOX env var to a method: true (OS default), docker, podman, sandbox-exec, runsc (gVisor), or lxc. On macOS, SEATBELT_PROFILE selects the Seatbelt profile (permissive-open default).

ToolSandbox by default?How you control itIsolation mechanism
Codex CLIYes — workspace-writesandbox_mode + approval_policy (read-only → workspace-write → danger-full-access)macOS Seatbelt; Linux/WSL2 bubblewrap
Claude CodeOpt-in (/sandbox)Auto-allow vs regular permissions; deny-by-default network proxymacOS Seatbelt; Linux/WSL2 bubblewrap (+socat)
Gemini CLIOpt-in (--sandbox/-s)GEMINI_SANDBOX method: docker/podman/sandbox-exec/runsc/lxcmacOS Seatbelt; container or gVisor by choice
Sandboxing at a glance. Defaults and mechanisms verified against each vendor’s sandboxing docs (2026-06-15).
same task, three default postures
… scroll to run this session
Ask each CLI to delete a build artifact. Codex acts inside its workspace sandbox by default; Claude proposes and waits unless auto-allow is on; Gemini runs unsandboxed unless you pass -s.

Compare the three CLIs row by row

Claude Code vs Codex

The same agentic-coding ideas, two houses. Each column carries its own accent — coral for Claude, mint for Codex. Tap a header to isolate a tool, or replay the reveal.

Instruction fileThe repo file each tool reads to learn your project.

CLAUDE.md at the repo root (plus ~/.claude/CLAUDE.md and auto memory).

AGENTS.md in the repo, with config.toml for settings.

ExtensibilityHow you package and share repeatable workflows.

Plugins, skills and marketplaces — sharable across a team.

Custom prompts and config profiles.

SubagentsDelegating side-work to isolated helper agents.

Markdown agents in .claude/agents/ — each its own context, tools and model.

Supported for delegating focused subtasks.

HooksRun your own commands around the agent’s actions.

Shell hooks on lifecycle events, wired up in settings.json.

Hooks for workflow automation.

MCPConnecting external tools via Model Context Protocol.

MCP servers; tool definitions deferred until first used.

MCP servers for third-party tools and context.

Autonomy surfacesWhere each tool can run.

Terminal, VS Code + JetBrains, Desktop, Web, GitHub Actions, Agent SDK.

CLI, IDE extension, Cloud/Web, GitHub Action, Codex SDK, Chrome.

ModelsThe model families each tool drives.

Opus 4.8, Sonnet 4.6, Haiku 4.5, Fable 5.

GPT-5.5, GPT-5.4, GPT-5.4 mini.

Pricing modelHow you pay to use it.

Claude Pro / Max / Team / Enterprise, or Anthropic API tokens.

ChatGPT Plus / Pro / Business / Edu / Enterprise, or API tokens.

Best forWhere each one tends to shine.

Deep, multi-surface workflows tuned through CLAUDE.md, skills and hooks.

Teams already living in ChatGPT and the OpenAI stack.

Showing both

Verified against code.claude.com/docs and developers.openai.com/codex — current as of 2026. Both tools ship fast; check the docs for the latest.

Toggle through context window, free tier, default model, sandbox posture, MCP, and OS support to see which tool leads each row.

Pick X when — decision procedure (first match wins)

  1. Pick Gemini CLI

    You need Apache-2.0 source you can read and fork, you are an enterprise on Gemini Code Assist, or you want the most container-flexible sandbox (docker/podman/runsc/lxc). Individuals chasing the free tier must act before 2026-06-18 or plan for the paid API key that follows.

  2. Pick Claude Code

    You want the broadest surface (terminal, VS Code, JetBrains, desktop, web, Slack, GitHub Actions), the deepest extensibility (skills, hooks, subagents, deferred MCP), and a network-aware sandbox — and you accept a paid subscription and, on Windows, WSL2.

  3. Pick the Codex CLI

    You already pay for ChatGPT Plus or above, you want sandboxing on by default with the least setup, and AGENTS.md fits your team’s cross-tool standard.

  4. Still torn

    Optimize for what you already pay for: Google/Gemini enterprise → Gemini, Anthropic subscriber → Claude Code, ChatGPT subscriber → Codex.

Knowledge check

A teammate shows you a comparison chart with a "$0 / Free" column checked for all three CLIs. Which part of that chart is correct as of June 15, 2026?

Reach the end and this star joins your charted sky.