Skip to main content
Comparison9 min read·Updated September 14, 2026
🤖

Codex CLI vs Claude Code vs OpenCode: Which to Use (2026)

B

A. Frans

Published September 14, 2026

AI CodingCodex CLIClaude CodeOpenCodeTerminal Agents

Codex CLI is free to try with a ChatGPT account and runs in an OS-level sandbox, including on native Windows. Claude Code needs a paid Claude plan (from $20 a month) or API credits, is the only one of the three that isn't open source, and has the most thorough permission system. OpenCode is MIT-licensed, has more GitHub stars than either, and works with over 75 model providers, but it starts with nearly every permission set to "allow".

Those are the three facts most likely to decide this for you. The rest of the comparison below is checked against each project's official docs, pricing pages, and GitHub repos as of September 14, 2026. Pricing and model lineups in this category change monthly, so check the linked pages before you commit to a plan.

Codex CLI vs Claude Code vs OpenCode at a glance

Codex CLIClaude CodeOpenCode
MakerOpenAIAnthropicanomalyco (formerly sst) on GitHub
LicenseApache-2.0ProprietaryMIT
GitHub stars~124K~145K~207K
Cheapest way inChatGPT Free ($0)Claude Pro ($20/mo, $17 annual)Free models via OpenCode Zen, or your own API key
ModelsOpenAI onlyAnthropic only75+ providers, plus local models
SandboxOS-level, on by defaultOS-level on macOS, Linux, WSL2Permission rules, permissive defaults
Native Windows sandboxYesNo (needs WSL2)Docs recommend WSL
Headless modecodex execclaude -popencode run
Instruction fileAGENTS.mdCLAUDE.mdAGENTS.md, falls back to CLAUDE.md
Skills folder.agents/skills/.claude/skills/Reads both, plus .opencode/skills/
Star counts come from the GitHub API on the day of writing: openai/codex, anthropics/claude-code, and anomalyco/opencode. The old sst/opencode address redirects to the new one.

Pricing: what you pay to use each one

Codex CLI

OpenAI's Codex pricing page says Codex is included in ChatGPT Free, Go, Plus, Pro, Business, Edu, and Enterprise. The individual tiers are Free at $0, Go at $8 a month, Plus at $20, and Pro from $100. Business costs $20 per user per month billed annually, or $25 monthly.

That free entry point is the biggest difference in this comparison. You can find out whether you like working with a terminal agent before paying anything. You can also sign in with an API key and pay per token, which OpenAI recommends for CI. The trade-off is that API-key sessions don't get Codex's cloud features, such as GitHub code review.

Claude Code

Claude Code isn't included in Anthropic's free plan. Claude's pricing page lists Pro at $20 a month ($17 a month billed annually) and Max from $100 a month for 5x or 20x Pro's usage. Team Standard seats are $25 a month, or $20 billed annually. You can also run it on API credits, Amazon Bedrock, or Google Cloud.

Subscription usage is shared with regular Claude chat. If you use Claude heavily in the browser during the day, that eats into the same limits your coding sessions draw from. The model you get by default also depends on the plan: Anthropic's model configuration docs show Opus 5 and Sonnet 5 as the defaults across different account types.

OpenCode

OpenCode itself is free. You pay whoever supplies the model. The providers page lists over 75, and you can sign in with an existing ChatGPT Plus or Pro subscription or a GitHub Copilot subscription instead of pasting an API key.

OpenCode also sells two optional model plans of its own. OpenCode Zen is pay-as-you-go per million tokens and includes some free models. OpenCode Go is $10 a month for access to open models from providers like GLM, Kimi, Qwen, and DeepSeek, with usage caps.

One thing not to plan around: a Claude Pro or Max subscription. OpenCode's own docs say Anthropic explicitly prohibits third-party plugins that use Claude subscriptions, and those plugins were removed from the bundle. You can still use Claude models in OpenCode with an Anthropic API key.

Cheapest serious setup: if you already pay for ChatGPT Plus, both Codex and OpenCode cost you nothing extra. If you already pay for Claude Pro, Claude Code is the only one of the three that uses that subscription.

Safety: sandboxing and permissions

This is where the three differ most, and where a wrong default can cost you a directory.

Codex CLI

Codex enforces its sandbox at the operating-system level. According to its security docs, the defaults are no network access and write access limited to your current workspace. Codex asks before editing files outside the workspace or running commands that need the network. It also ships a native Windows sandbox, which neither competitor matches.

If you set approval_policy = "untrusted" in an older config, remove it. OpenAI has retired that value, and its security docs warn the leftover setting can stop Codex from starting.

Claude Code

Claude Code has six permission modes, from the default (ask before edits and commands) through acceptEdits, plan, and auto up to bypassPermissions. You can write allow and deny rules per tool and per command pattern, which makes it the most configurable of the three.

Its Bash sandbox runs on macOS, Linux, and WSL2. The docs say plainly that native Windows isn't supported. Claude Code itself runs on native Windows, but if you want OS-level isolation on a Windows machine, you need WSL2.

OpenCode

OpenCode uses permission rules (allow, ask, or deny per tool and pattern) rather than an OS-level sandbox; the permissions docs don't describe one. More important is the starting point. The docs say OpenCode "starts from permissive defaults": most permissions are allow, reading .env files is denied, and only a couple of actions, such as touching directories outside the project, default to ask.

In practice, a fresh OpenCode install can edit files and run shell commands without asking. Fix that before your first real session:

{
  "$schema": "https://opencode.ai/config.json",
  "permission": {
    "edit": "ask",
    "bash": {
      "*": "ask",
      "git status": "allow",
      "git diff*": "allow"
    }
  }
}

Put that in opencode.json and OpenCode behaves closer to the other two.

Day-to-day workflow

All three cover the same core loop: read the repo, plan, edit files, run commands, and check the result. They converged on most features over the past year, so the differences sit in the details.

Project instructions. Codex and OpenCode read AGENTS.md. Claude Code reads CLAUDE.md and, per its memory docs, does not read AGENTS.md. If your repo already has one, create a CLAUDE.md containing the line @AGENTS.md so all three tools read the same instructions. OpenCode falls back to CLAUDE.md when no AGENTS.md exists.

Subagents. All three can hand work to subagents. Codex's docs say current releases enable subagent workflows by default. OpenCode ships built-in Build and Plan agents plus General, Explore, and Scout subagents.

Skills and MCP. All three support MCP servers and SKILL.md skills, but they look in different folders. Our guide on whether Claude skills work in Codex, Cursor, and Gemini CLI has the full path table and a one-line symlink that shares one skills folder across all of them.

Automation. For scripts and CI, codex exec, claude -p, and opencode run each run a single prompt non-interactively. Codex's API-key mode is aimed squarely at this.

Editors. Codex has an extension for VS Code, Cursor, and Windsurf, plus JetBrains and Xcode integrations. Claude Code has a VS Code extension and a JetBrains plugin. OpenCode has an IDE extension and a desktop app.

Model choice. This is OpenCode's reason to exist. Codex runs OpenAI's models (the GPT-5.6 family, with GPT-6 Astra also listed in its model docs). Claude Code runs Anthropic's. OpenCode lets you switch between them, or to a local model, from the same terminal, and keeps working if one provider has an outage or raises prices.

Which one should you use?

Pick Codex CLI if you want to try a terminal coding agent without paying, you already have ChatGPT Plus, or you work on native Windows and want real sandboxing. Its restrictive defaults also make it the safest of the three to hand to someone new to agents.

Pick Claude Code if you already pay for Claude, you want fine-grained permission rules, or you rely on the skills and plugin tooling built around it. The biggest collection of agent skills is still written for Claude Code first, and our skills directory tracks nearly 2,000 of them. It's the priciest entry point and the least portable, since it only runs Anthropic models.

Pick OpenCode if you don't want to be tied to one model vendor, you want open-source code you can audit or fork, or you want to use cheaper open models for routine work. Budget ten minutes to tighten its permissions first.

Running two is a reasonable setup: Claude Code or Codex as the daily driver, OpenCode for trying other models on the same repo. It works once your instructions live in AGENTS.md and your skills live in a shared folder.

If you're also weighing editor-based tools, see our Claude Code vs Cursor comparison and Cursor vs Claude Code vs Aider. Tool profiles: Codex CLI, Claude Code, OpenCode. For the wider picture, our full list for developers covers the rest of the stack.

FAQ

Is Codex CLI free?

The CLI is open source under Apache-2.0, and OpenAI's pricing page lists Codex as included in the ChatGPT Free plan, with more usage on Go ($8/month), Plus ($20/month), and higher tiers. You can also use it with an API key and pay per token.

Is Claude Code open source?

No. The anthropics/claude-code GitHub repository is used for issues and the changelog, but the license is proprietary (all rights reserved). Codex CLI (Apache-2.0) and OpenCode (MIT) are both open source.

Can I use my Claude Pro subscription with OpenCode?

Don't count on it. OpenCode's providers documentation says Anthropic explicitly prohibits plugins that use Claude Pro/Max subscriptions in OpenCode, and those plugins are no longer bundled. You can use Claude models in OpenCode with an Anthropic API key instead.

Does Claude Code read AGENTS.md?

No. Claude Code reads CLAUDE.md. Anthropic's docs suggest creating a CLAUDE.md that imports AGENTS.md with an @AGENTS.md line, so Claude Code, Codex, and OpenCode share one set of instructions.

Which terminal coding agent is safest by default?

Codex CLI, based on documented defaults: an OS-level sandbox with no network access and writes limited to the workspace, including on native Windows. Claude Code asks before edits and commands by default. OpenCode allows most actions unless you change its permission settings.

Share this article

📬

Get More AI Tool Guides

New comparisons and guides every week. Join thousands of professionals staying ahead of the AI curve.