Skip to main content

Codex vs OpenCode

Both are open source terminal agents. Codex runs OpenAI models inside a sandbox by default. OpenCode runs almost any model and trusts the agent unless you add rules.

Codex and OpenCode are terminal coding agents. Each reads your repository, edits files and runs commands until a task is done. OpenAI builds Codex and includes it in ChatGPT plans. OpenCode is an MIT-licensed agent from Anomaly that connects to almost any model provider, including your ChatGPT plan. Facts on this page were checked against each tool's own docs, pricing page and repository as of December 4, 2026.

Decision Table​

CodexOpenCode
LicenseApache 2.0 for the openai/codex CLIMIT
PriceIncluded in every ChatGPT plan, from Free. Or an API key at API pricesFree. You pay your provider, or OpenCode Go at $10 per month
ModelsOpenAI models, such as GPT-6.2 Astra and GPT-6.2 SolAny provider in the models.dev catalog, ChatGPT and GitHub Copilot sign-in, local models through Ollama
Default safetySandbox on. Writes limited to the workspaceNo OS sandbox. Every action allowed except reading .env files, which asks
SurfacesCLI, IDE extension, ChatGPT desktop and web, Codex CloudTerminal UI, desktop app, web app
Best forPeople who pay for ChatGPT and want safe defaultsPeople who switch models or run local ones

At a Glance​

CodexOpenCode
PricingChatGPT Free, Go $8, Plus $20, Pro from $100, Business $25 per user billed monthlyFree client. OpenCode Go $10 and Go Plus $40 per month for a curated model list
PermissionsSandbox modes read-only, workspace-write, danger-full-access. Approval policies on-request or neverOrdered allow, ask and deny rules per action and resource, per agent
SandboxSeatbelt on macOS, native sandbox on Windows, bubblewrap on Linux and WSL2None. Shell commands run with your user's filesystem, process and network access
Built-in agentsSubagentsbuild for full access, plan for read-only planning, general subagent
Project instructionsAGENTS.mdAGENTS.md, falling back to CLAUDE.md
SkillsSkills and pluginsSkills from .opencode/skills, .claude/skills and .agents/skills, plus plugins
MCPLocal and remote serversLocal and remote servers, with OAuth
Headless and CIcodex execopencode run

Models and Cost​

Codex runs OpenAI models. If you do not pick one, it uses a recommended model. OpenAI suggests GPT-6.2 Astra for demanding work and GPT-6.2 Sol for everyday coding. A custom provider works only if it exposes a Responses API endpoint.

OpenCode reads its provider list from models.dev and connects to almost any provider. You can sign in with a ChatGPT Plus or Pro plan, so one ChatGPT subscription can pay for either agent. OpenCode Go is an optional $10 subscription to a curated list of models tested for agentic coding, such as Kimi K3, GLM-5.4 and DeepSeek V4 Pro. Go Plus raises the limits for $40.

If you want a free plan with no API key, Codex works on ChatGPT Free. If you want Claude, Gemini or a local model in the same agent, pick OpenCode. Best LLM for Coding compares the models.

Sandboxing and Permissions​

The defaults point in opposite directions. Codex starts in a sandbox. In workspace-write mode it edits files in the workspace, runs routine commands and pauses when it needs to go further. On Linux and WSL2 you install bubblewrap first.

OpenCode's build agent allows every action by default, including access outside the workspace. Only reading .env files asks first. Its docs warn that shell commands run with your user's full authority. You narrow that with deny and ask rules, or run OpenCode in a container or a cloud sandbox.

If you run an agent unattended, Codex needs no setup to stay inside the workspace. OpenCode needs rules or isolation first.

Instructions and Skills​

Both agents read AGENTS.md, so one file serves both. OpenCode reads CLAUDE.md in any directory without an AGENTS.md. OpenCode also loads skills from .claude/skills and .agents/skills, so skills written for Claude Code or other agents work without copying.

When to Pick Which​

  • Pick Codex if you pay for ChatGPT, want a sandbox on from the start, use VS Code or JetBrains, or want to hand tasks to Codex Cloud.
  • Pick OpenCode if you switch providers per task, run local or open-weight models, or want an MIT-licensed agent you can fork.
  • Pick both if you have a ChatGPT plan. Use Codex for OpenAI models and OpenCode for everything else.

Alternatives​

Running Several Agents at Once​

To compare Codex and OpenCode on the same task, give each its own git worktree so their edits never collide. In Treq, each agent runs in its own workspace, and you review the results side by side.

Sources​

Checked December 4, 2026:

Next Steps​