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.53.1npm install -g @google/gemini-cligemini
Claude CodeAuto-updating native install (no pinned version)curl -fsSL https://claude.ai/install.sh | bashclaude
Codex CLIRolling npm releasenpm install -g @openai/codexcodex
Canonical install commands; Gemini stable refreshed 2026-08-01.

Context window and model selection

Gemini and Claude both offer an approximately 1M-token input window for the models below: Gemini 3.1 Pro Preview publishes 1,048,576, while the Claude models use the rounded 1M figure. Codex context is model-dependent and the current Codex sources used in this run do not publish one fixed CLI-wide figure. 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-fable-51M / 128k/model or configclaude-opus-5 and claude-sonnet-5 (both 1M/128k), plus claude-haiku-4-5 (200k/64k). Dateless 4.6+ IDs are pinned model versions, not evergreen aliases.
Codex CLIgpt-5.6-sol (flagship)-m <id> or /modelUse gpt-5.6-terra for balanced daily work or gpt-5.6-luna for the fastest, lowest-cost lane.
Flagship and selectable models. Current model families and limits refreshed 2026-08-01.

Cost and free tier

Two of the three have no $0 plan. Gemini CLI has a Flash-only API-key free tier; individual Google AI accounts use Antigravity CLI. The cheapest paid CLI entry for Claude Code and Codex CLI is $20/mo.

ToolFree for individuals?Cheapest paid entryPay-as-you-go
Gemini CLIAPI-key free tier: 250 requests/day, Flash onlyGemini Code Assist Standard/Enterprise or Google CloudGemini API key or Vertex AI; limits depend on tier
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
No $0 plan exists for Claude Code or the Codex CLI. Gemini CLI availability refreshed 2026-08-01.

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, use a supported API-key or Google Cloud route, hold a Code Assist Standard/Enterprise license, or want the most container-flexible sandbox (docker/podman/runsc/lxc). Individual Google AI accounts use Antigravity CLI.

  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 is correct as of August 1, 2026?

Reach the end and this star joins your charted sky.