Gemini CLI is Apache 2.0 and free with a personal Google account at 60 requests per minute and 1,000 per day, with a 1M token context window. Codex needs a paid ChatGPT plan from $20/mo and adds an OS-enforced sandbox with three capability modes and four approval policies. Pick Gemini CLI for cost and context, Codex for unattended runs you are not watching.
- Gemini CLI is free: 60 requests/min, 1,000/day on a personal Google account.
- Codex requires a paid ChatGPT plan. There is no free tier.
- Only Codex has an OS-enforced sandbox that a prompt cannot talk past.
- Gemini CLI ships a 1M token context window on the free tier.
- Both do MCP, both run headless, both read a repo context file. The names differ.
Side by side
Checked against vendor documentation, August 2026.
| Gemini CLI | Codex CLI | |
|---|---|---|
| Cost to start | Free, personal Google account | Paid ChatGPT plan, from $20/mo |
| Licence | Apache 2.0 | Open source, vendor-run models |
| Free tier | 60 req/min, 1,000 req/day | None |
| Context window | 1M tokens | Large, model-dependent |
| Sandbox | Opt-in: Docker image or Seatbelt profile | On by default, OS-enforced |
| Approval control | 3 modes | 4 policies, independent of the sandbox |
| Repo context file | GEMINI.md | AGENTS.md |
| Config file | ~/.gemini/settings.json | ~/.codex/config.toml |
| MCP servers | Yes | Yes |
| Headless | gemini -p, JSON output | codex exec |
| Written in | TypeScript, on Node | Rust |
| Windows | Native | Windows 11 via WSL2 |
The free tier, in numbers
Gemini CLI is the only serious terminal agent with a free tier that is a product rather than a trial. Signing in with a personal Google account gives you 60 requests per minute and 1,000 requests per day, with Gemini 3 models and a 1M token context window, as of August 2026.
What each authentication route gives you, August 2026.
| Route | Limit | When to use it |
|---|---|---|
| Google account sign-in | 60/min, 1,000/day | Almost everyone. No key to manage. |
| Gemini API key | 1,000/day on Gemini 3, then billed | You want to pin a specific model |
| Vertex AI | Scalable, enterprise controls | Compliance, data residency, org billing |
A thousand requests a day is not a marketing number that collapses under real use. A request is one turn, so a busy day of interactive agent work on a large repository is a few hundred. You have to be running long unattended loops before that ceiling is the thing that stops you.
# Gemini CLI
npm install -g @google/gemini-cli
# or: brew install gemini-cli
# or run it once: npx @google/gemini-cli
# Codex CLI
npm install -g @openai/codex
# or: brew install codex
gemini --version
codex --version
Containment is where Codex is alone
Codex separates two things most tools conflate: what the agent is capable of, and when it stops to ask. The first is enforced by the operating system, using Seatbelt on macOS and Landlock plus seccomp on Linux. A model cannot be persuaded past it, because the model is not the thing enforcing it.
Codex: two independent dials.
| Setting | Values | Enforced by |
|---|---|---|
sandbox_mode | read-only, workspace-write, danger-full-access | The kernel |
approval_policy | untrusted, on-failure, on-request, never | Your attention |
Gemini CLI: approval modes, with the sandbox opt-in.
| Setting | Values | Notes |
|---|---|---|
--approval-mode | default, auto_edit, yolo | --yolo is the legacy spelling of the third |
| Sandbox | Docker image, or a macOS Seatbelt profile | Enabled automatically with yolo |
Gemini CLI does have containment, and it is real: a prebuilt gemini-cli-sandbox container, a project-level .gemini/sandbox.Dockerfile when you need your own toolchain inside it, and named macOS Seatbelt profiles selected with SEATBELT_PROFILE (permissive-open is the default, through to strict-proxied). The difference is posture. Codex is confined unless you opt out; Gemini CLI is unconfined unless you opt in or turn on yolo, which enables the sandbox for you precisely because that mode stops asking.
Context files and config
Both read a markdown file from the repository so you are not re-explaining your conventions every session. The mechanism is the same idea with different names, and if you run both you will end up maintaining both.
| Gemini CLI | Codex CLI | |
|---|---|---|
| Repo instructions | GEMINI.md | AGENTS.md |
| User settings | ~/.gemini/settings.json | ~/.codex/config.toml |
| Project settings | .gemini/settings.json, overrides user | Per-project config plus CLI overrides |
| One-off override | Flags | codex -c key=value |
| Custom commands | Yes, plus extensions | Yes |
Headless and CI
Both run without a TUI, which is what a pipeline needs. The shapes differ slightly and the licensing differs a lot.
# Gemini CLI: prompt in, structured output back
gemini -p "summarise the failing tests in this repo"
gemini -p "list every TODO with its file" --output-format json
# Codex: exec subcommand, read-only for an analysis job
codex exec --sandbox read-only "explain the auth flow"
Which for which job
| If you are | Pick | Why |
|---|---|---|
| Trying agentic coding at all | Gemini CLI | It costs nothing and it is a real agent |
| A student or on a side project | Gemini CLI | The free tier is the whole answer |
| Asking whole-repo comprehension questions | Gemini CLI | 1M tokens in one pass |
| Already paying for ChatGPT | Codex | You already own it |
| Letting an agent run while you do something else | Codex | The sandbox is enforced, not requested |
| Exploring a repository you do not trust | Codex | read-only plus never: free rein, zero write capability |
| On Windows without WSL | Gemini CLI | Codex wants WSL2 on Windows 11 |
| Running several agents in parallel worktrees | Either | Both are one process per checkout |
Running both
There is very little argument against having Gemini CLI installed even if Codex is what you pay for. It covers two cases the paid agent cannot: a second opinion when the first one is going in circles, and continuing to work after you have exhausted a subscription window.
- Write
AGENTS.mdfirst and pointGEMINI.mdat it, so both agents read the same conventions. - Give each agent its own git worktree. Two agents in one checkout will overwrite each other, and the failure is silent.
- Keep Codex on
workspace-writepluson-request, which is the default and is correct. - Send whole-repo questions to Gemini and edit-and-verify loops to Codex. That split plays to each one directly.
Questions people ask
Yes. Signing in with a personal Google account gives 60 requests per minute and 1,000 per day with Gemini 3 models and a 1M token context window, as of August 2026. The tool itself is Apache 2.0.
No. Codex requires a paid ChatGPT plan, starting at Plus at $20 a month, or an OpenAI API key billed per token. There is no free Codex tier.
For cost and for whole-repository questions, Gemini CLI. For work you leave running unattended, Codex, because its sandbox is enforced by the operating system rather than by a prompt.
It has one, but it is opt-in rather than the default. Gemini CLI can run inside a prebuilt Docker image or under a named macOS Seatbelt profile, and it enables the sandbox automatically in yolo mode. Codex sandboxes every session unless you choose danger-full-access.
Not by default. Codex reads AGENTS.md and Gemini CLI reads GEMINI.md. Writing AGENTS.md and symlinking GEMINI.md to it keeps one source of truth.
Gemini CLI, at 1M tokens on the free tier as of August 2026. That is what makes single-pass questions about an entire repository practical rather than a series of summaries.
Gemini CLI installs natively through npm or Homebrew. Codex documents Windows 11 support through WSL2, so on Windows the Codex path involves a Linux environment.
Both run headless, with codex exec and gemini -p. Licensing is the constraint rather than capability: a ChatGPT subscription covers one person working interactively, so automation belongs on an API key. Check the Gemini free tier terms before automating against it.
Sources
Every figure above was read from these pages on August 2026. Vendors reprice without notice; if you find a stale number, tell us.