Title card: OpenCode vs Codex, which fits which job, with Codex and OpenCode labels
All articles

OpenCode vs Codex: which to use in November 2026

OpenCode vs Codex in 2026: Codex fits a ChatGPT plan and a real sandbox, OpenCode fits model choice and free models. Table, prices and commands.

As of November 2026, pick Codex if you have a ChatGPT plan and want OpenAI's own agent with an operating-system sandbox and one login. Pick OpenCode if you want an open source (MIT) agent where you choose the provider and model, including local models and a list of free ones. Both read the same AGENTS.md, so many developers install both and run them on different tasks.

One workspace for all your coding agents.Download VibeiDE

Everything below was checked on 19 November 2026 against the official OpenCode docs, which now document OpenCode 2, and OpenAI's Codex CLI docs. If you are also weighing Anthropic's agent, see OpenCode vs Claude Code and Codex vs Claude Code.

OpenCode vs Codex at a glance

OpenCodeCodex
MakerThe OpenCode team (anomalyco/opencode on GitHub)OpenAI (openai/codex)
LicenceOpen source, MITCLI is open source, Apache-2.0
ModelsAny connected provider from the models.dev catalog, local servers, OpenCode Console modelsOpenAI models, such as GPT-6.2 Astra and GPT-6.2 Sol; --oss for a local provider
How you payProvider API keys, ChatGPT Plus or Pro, GitHub Copilot, pay-as-you-go Console credits, Go subscription, some free modelsChatGPT plan (Codex is included), or an API key at API pricing
Platforms and installmacOS, Linux, Windows (standalone zip); curl script, npm, HomebrewmacOS, Linux, Windows; install script, npm, Homebrew
InterfacesTerminal UI, desktop app, web UI, mobile appCLI, IDE extension, ChatGPT desktop app, Codex web
Approvals and sandboxOrdered permissions rules (allow, ask, deny); no sandbox describedSandbox modes plus approval policies
Instructions fileAGENTS.mdAGENTS.md, created with /init
Session resume/sessions, opencode run --continuecodex resume
MCPYes, opencode mcp addYes, codex mcp
Headless modeopencode run, opencode servecodex exec
Configopencode.jsonconfig.toml

Where does the model come from?

Codex runs OpenAI models on your ChatGPT or API account, and OpenCode runs whichever provider you connect.

In Codex you start codex in a project folder, choose "Sign in with ChatGPT" or another sign-in method, and pick a model and reasoning effort with /model. As of November 2026 the Codex models page lists GPT-6.2 Astra for demanding work and GPT-6.2 Sol for everyday coding, which we cover in GPT-6.2 Astra and Sol. You can also pass a model directly, for example codex -m gpt-6.2-sol. The --oss flag points Codex at a local open source model provider. Our guides to installing the Codex CLI and Codex models cover setup and defaults.

OpenCode ships a provider and model catalog from models.dev. You run /connect (or opencode auth login outside the interface), pick a provider and add credentials, then choose with /models. opencode models lists everything available. The providers page says Ollama, LM Studio and vLLM servers are discovered locally. Our OpenCode models guide shows defaults and variants.

Codex connects to OpenAI models; OpenCode fans out to several providers: OpenAI, Anthropic, GitHub Copilot and local Ollama
Codex is built around OpenAI models; OpenCode connects many providers through /connect.

Is OpenCode free? Is Codex?

Both agents cost nothing to install, and both have a way to run at no model cost, with limits.

For OpenCode, as of November 2026, the Console models page (the former Zen page) lists free models such as Big Pickle and DeepSeek V4.1 Flash Free, each described as free for a limited time and some with data retention caveats. Paid Console models are pay as you go, with a processing fee of 4.6% plus $0.31 on each credit purchase. OpenCode Go is an optional subscription at $10 a month. Our list of OpenCode free models tracks what is free now.

For Codex, OpenAI's pricing page says, as of November 2026, that Codex is included in ChatGPT Free, Go, Plus, Pro, Business, Edu and Enterprise plans. It lists Go at $8 a month, Plus at $20 and Pro from $100. Each plan has its own usage allowance. With an API key, usage is billed at API pricing, separate from your plan.

Can I use my ChatGPT subscription in OpenCode?

Yes, according to OpenCode's own docs.

The OpenCode providers page says you can use a ChatGPT Plus or Pro plan in place of an OpenAI API key: connect OpenAI, choose "Sign in with ChatGPT", and usage counts against your plan. GitHub Copilot connects through device sign-in. The OpenAI pages we checked describe signing in to Codex itself and do not mention OpenCode, so treat the OpenCode docs as the source for this and recheck after upgrades.

That means one ChatGPT plan can drive both tools. What you get from Codex in return is OpenAI's sandbox, its IDE extension, the ChatGPT desktop app and Codex web.

How do sandboxing and approvals differ?

Codex sandboxes commands at the operating-system level, while OpenCode decides per action with permission rules and describes no sandbox.

Codex separates two ideas. The sandbox mode sets what the agent can technically do: read-only, workspace-write or danger-full-access. The approval policy sets when it must ask: on-request, never or a granular table. The approvals and security docs say the older untrusted policy is retired. In a version-controlled folder Codex defaults to Auto, which is workspace-write with on-request approvals, and network access is off by default. Folders that are not under version control start read-only. The sandbox uses Seatbelt on macOS and bwrap with seccomp on Linux. Set these with --sandbox and --ask-for-approval, or with sandbox_mode and approval_policy in config.toml. Our Codex sandbox guide has examples.

OpenCode 2 uses an ordered permissions array of action, resource and effect rules, where the last matching rule wins. Its permissions page says the base policy allows every action and only asks before reading .env files, and that shell commands run with your user's filesystem, process and network authority. The Plan agent cannot edit normal project files. Press Shift+Tab to cycle agents. To be asked before each shell command:

{
  "permissions": [
    { "action": "shell", "resource": "*", "effect": "ask" }
  ]
}
Two panels: Codex sandbox modes (read-only, workspace-write, danger-full-access) and OpenCode permissions (edit, bash and agents that can require approval), fading in turn
Codex draws a sandbox boundary around the working folder; OpenCode asks for approval per tool and per agent.

OpenCode 1 named the shell action bash. Version 2 still reads old configs. Neither approach replaces review: a sandbox limits damage, it does not tell you whether the change is correct.

Which is better for large refactors and long tasks?

Neither wins on a measurement we can cite, so compare the process. We publish no benchmark here.

  • Start read-only. Use OpenCode's Plan agent or Codex's read-only sandbox, read the proposal, then let it edit.
  • Isolation. Codex has a --worktree flag that starts a session in a new managed Git worktree (see Codex worktree). With OpenCode you create the worktree yourself with git worktree add.
  • Undo. OpenCode has /undo and /redo. In Codex, the workspace sandbox and Git are your safety net.
  • Away from the keyboard. Codex web runs tasks in the cloud, and opencode serve runs OpenCode as a server you can reconnect to.
  • Limits. Codex draws from your ChatGPT plan allowance or API billing. In OpenCode the limit is whatever the connected provider sets, and you can switch models with /models.

How do you script each one?

Use codex exec for Codex and opencode run for OpenCode.

codex exec (alias codex e) runs non-interactively. The command reference lists --json for newline-delimited events, --output-last-message (-o) to write the final message to a file, and --output-schema for a JSON Schema. Our codex exec guide goes further.

opencode run takes --model, --agent, --continue, --session and --format json, per the OpenCode command reference. opencode serve starts the API and web server.

# Codex: one scripted task, final message saved to a file
codex exec --sandbox workspace-write -o result.md "Add tests for the date parser"

# OpenCode: one scripted task with an explicit model
opencode run --model openai/gpt-6.1-sol "Add tests for the date parser"

Can you use both together?

Yes. They share AGENTS.md, keep separate sessions, and can work on the same repository if each task owns its files.

Keep build commands, layout and conventions in AGENTS.md, and tool-specific settings in config.toml and opencode.json. Our guide to AGENTS.md for Codex explains discovery and size limits. Two agents editing the same files will collide, whichever tools they are, so give each parallel task its own Git worktree.

A per-project task queue sending one task to a Codex slot in worktree A and another to an OpenCode slot in worktree B, both ending in Ready for review
Slots cap parallel processes per provider; separate worktrees keep the files apart.

You do not have to choose at all if you coordinate them. VibeiDE is a desktop app that coordinates the Codex, Claude Code and OpenCode CLIs you already installed, with your own provider accounts. Codex runs in an embedded terminal that shows the original CLI, while OpenCode runs headless with recorded activity. Each project has its own task queue, so a Codex task and an OpenCode task can run on the same project, and the "New worktree per task" mode gives each its own worktree and branch. Finished tasks wait in Ready for review. See the Codex page and the OpenCode page, or read about running agents in parallel and the plan council.

How do you switch between them?

Install the other tool and sign in. The AGENTS.md file carries over unchanged.

From Codex to OpenCode:

curl -fsSL https://opencode.ai/v2/install | bash
cd your-project
opencode

Then run /connect, choose OpenAI and "Sign in with ChatGPT" to keep the same plan, or pick another provider. Our OpenCode install guide covers Windows and the desktop app.

From OpenCode to Codex:

curl -fsSL https://chatgpt.com/codex/install.sh | sh
cd your-project
codex

Codex is also on npm (npm install -g @openai/codex) and Homebrew (brew install --cask codex). MCP servers are configured per tool, with opencode mcp add and codex mcp. Sessions do not transfer. If neither fits, see our list of OpenCode alternatives.

FAQ

Is OpenCode a replacement for Codex?

No. They overlap, but they are separate tools. OpenCode lets you choose providers, and Codex is OpenAI's agent. Many developers use each where it fits.

Does OpenCode work with ChatGPT Plus?

Yes. OpenCode's docs describe a "Sign in with ChatGPT" option for Plus and Pro plans, with usage counted against the plan.

Is Codex CLI open source?

Yes. The openai/codex repository is licensed under Apache-2.0. OpenCode's repository is MIT licensed.

Which is safer, OpenCode or Codex?

Codex's default in a version-controlled folder limits writes to the workspace and keeps network access off. OpenCode 2 allows actions by default unless you add permissions rules. Review the diff either way.

Takeaways

  • Codex is OpenAI's agent with sandbox modes and approval policies. OpenCode is MIT licensed, provider-agnostic and uses permissions rules.
  • As of November 2026, Codex is included in ChatGPT plans, and OpenCode documents a ChatGPT Plus or Pro sign-in.
  • Both read AGENTS.md, so one shared file works.
  • Use codex exec, or opencode run and opencode serve, for scripting.
  • Running both on one repository needs one task per session and a worktree per parallel task.

Share this article

Post on XShare on LinkedIn

Related articles

Necessary cookies support sign-in, security, your language and this choice. Optional categories stay off until accepted.

First-party page views and acquisition measurement, plus Google Analytics 4 (Google Ireland, data may reach the US). Advertising personalization stays off.

With Analytics enabled, retain Google, Microsoft and Reddit ad click identifiers and share download, signup, activation and purchase conversions with the relevant ad provider. No personalized advertising.

Privacy · Cookie inventory