Blog

OpenCode vs Codex: Which Coding Agent Fits You?

AI CodingTool Comparisons

OpenCode vs Codex is closer than it used to be. Both command-line tools are open source. Both can run on a ChatGPT plan. Both can run a local model. The real question is: do you want an agent that works with any provider, or one that comes with OpenAI's sandbox and cloud?

OpenCode is an MIT-licensed agent that lets you connect many providers and runs on your own machine or server. Codex is OpenAI's agent, with an OS-enforced sandbox on by default and a hosted cloud behind it.

The short version:

  • Pick OpenCode if you switch between providers, want local models to show up in a menu, or want an MIT-licensed agent you can host yourself
  • Pick Codex if you want safer defaults for unattended work, tasks that run in OpenAI's cloud, and built-in GitHub code review
  • Already pay for ChatGPT? That alone doesn't decide it. ChatGPT Plus and Pro work in both
  • Two claims to ignore: "Codex can't run local models" (it can) and "OpenCode asks before it runs commands" (by default, it doesn't)

Quick Comparison

OpenCode (V2)Codex
MakerAnomalyOpenAI
LicenseMITApache-2.0 for the CLI; IDE extension and cloud are closed
Models200+ providers, per its homepageOpenAI by default; other providers through config
Local modelsOllama, LM Studio and vLLM found automatically--oss with Ollama or LM Studio
ChatGPT plan sign-inYes, Plus or ProYes
Default safety modelPermission rules, mostly set to allowOS sandbox plus approvals
Network for commandsSame access as your user accountOff by default
SurfacesTerminal, desktop, web UI, mobile, SDK, editors through ACPCLI, IDE extension, ChatGPT desktop app, web, mobile, SDK
Vendor-hosted cloud tasksNot described in its docs; you run the serverCodex Cloud
Scripts and CIopencode runcodex exec and an official GitHub Action
Project instructionsAGENTS.md, with CLAUDE.md as fallbackAGENTS.md, with fallback names you configure

Open Source: Both, but Not to the Same Depth

Calling this "open source vs closed source" is wrong. The OpenCode repository carries the MIT license. The Codex CLI repository carries Apache-2.0.

The difference is what sits around the CLI. OpenAI's open source page lists the CLI, SDK and app server as open, and the IDE extension and Codex Cloud as "not open source."

Contribution rules differ too. The same OpenAI page says the Codex repository takes issues and bug reports but "doesn't accept external code contributions or pull requests." OpenCode does take pull requests, with design review first for UI and core features. If you plan to send a fix upstream, that may settle it.

One more thing to check before you read any older review: OpenCode is now on version 2. Its migration guide lists breaking changes to plugins, the server API and terminal settings, and says most other V1 configuration should carry over. Many guides still describe V1.

Models: Any Provider or OpenAI First

OpenCode treats the model as a setting. Its providers page has you run /connect, choose a provider, then pick a model with /models. The catalog comes from models.dev, and you can add any provider that isn't listed. Each agent can also have its own model, so you can plan with one vendor and review with another.

Codex starts with OpenAI's models and lets you change that in config. The advanced config page covers custom providers, Azure and Amazon Bedrock. There's one hard limit: the models page says a custom provider needs a compatible Responses API endpoint, and that current releases don't support a Chat Completions-only endpoint. If your server or gateway calls itself "OpenAI-compatible," check that it has a Responses endpoint first.

Can Codex run local models?

Yes. Codex can run against Ollama or LM Studio when you pass --oss. You pick the server per run with --local-provider, or set oss_provider as your default.

OpenCode takes less setup. It probes Ollama, LM Studio and vLLM at their usual local addresses and adds what it finds to /models, no account needed. One catch: vLLM models start with tools disabled, because OpenCode can't detect tool support there.

Whichever agent you choose, test your local model on a short task before you hand it a long one. Our LM Studio vs Ollama comparison covers the server side of that setup.

Using Your ChatGPT Plan in Both

You can use the same ChatGPT subscription in either tool. OpenCode documents how, and OpenAI names the integration.

OpenCode's docs say you can use a ChatGPT Plus or Pro plan instead of an API key: connect OpenAI, then choose Sign in with ChatGPT. Usage counts against your plan. OpenAI's own Sign in with ChatGPT page lists OpenCode under open source integrations.

So switching to OpenCode on the same plan won't get you a bigger allowance. OpenCode even caps context for these sign-ins by default. It says the caps match Codex's defaults, so you use up your plan at a similar rate.

What you get in Codex depends on how you sign in. At the time of writing (November 2026):

  • Plus and above get Codex on the web, in the CLI, in the IDE extension and on iOS, plus cloud features such as automatic code review.
  • Free and Go are narrower. OpenAI lists GPT-6 Luna in the desktop app, subject to rollout.
  • An API key works in the CLI, SDK and IDE extension, but leaves out cloud-based features like GitHub code review.

If limits are why you're comparing the two, read Codex usage limits before you switch.

Billing: Console and Go vs ChatGPT Plans

Neither tool has one price, so compare what you'd be buying.

OpenCode is free software. You pay for models in one of four ways:

  1. Your own provider key, billed by that provider
  2. A subscription you already have. OpenCode's homepage names ChatGPT Plus/Pro and GitHub Copilot
  3. Console models, pay-as-you-go from credits you add. Older guides call this OpenCode Zen, and the old Zen docs address now redirects here
  4. OpenCode Go, a monthly subscription to open coding models. At the time of writing (November 2026) it has three tiers (Go, Go Plus and Go Teams), with 5-hour, weekly and monthly limits

There are also free models you can use without an account. Read the data terms on the Console page first, because some free models log or train on what you send.

Codex is included in ChatGPT plans with a usage allowance, and eligible plans can add credits. With an API key you pay API rates instead. The details are on OpenAI's Codex pricing page.

The two even mix. OpenCode publishes a Codex setup guide for using Console or Go models inside the Codex CLI. If you like Codex's sandbox but want a different model, that's one route.

OpenCode vs Codex CLI: Sandbox and Permissions

This is the biggest difference, and the section to read before you let either agent touch a real repository.

Codex limits what commands can do. OpenAI's approvals and security page describes two layers: an OS-enforced sandbox and an approval policy. By default, writes are limited to the active workspace and network access is off. Codex asks before it edits files elsewhere or runs a command that needs the network. Non-interactive codex exec runs are stricter still and start read-only.

OpenCode decides what gets approved. Its permissions page describes rules that resolve to allow, ask or deny. The V2 base policy allows everything, then asks before reading .env files. Reads and edits outside your project go ahead without a prompt. Shell commands run with your own account's file, process and network access. The page doesn't describe an OS sandbox.

Action with default settingsOpenCode V2Codex CLI (Auto preset)
Edit a file in the projectAllowedAllowed
Edit a file outside the projectAllowedAsks first
Run a shell command in the projectAllowed, as your userAllowed, inside the sandbox
Run a command that needs the networkAllowedAsks first
Read a .env fileAsks firstNot singled out on the approvals page

You can tighten OpenCode a lot. Set shell to ask, allow only the Git commands you trust, and set external_directory to ask. Its docs warn that working out which directories a shell command touches is "best effort," so a short allowlist beats a long blocklist. For unattended runs, put it in a container. OpenCode publishes a Docker image.

You can also loosen Codex. Full access mode removes the filesystem and network limits, so at that point its advantage here is gone.

Surfaces: Terminal, Editor, Phone and Cloud

Both tools have moved well beyond the terminal.

OpenCode. The product page lists a desktop app for macOS, Windows and Linux, a terminal UI, iPhone and Android apps, and an SDK. There's also a web UI served from your own machine, which you open by running opencode pair. For editors, ACP support runs it inside clients such as Zed. The VS Code extension is documented in the V1 docs, so test it before you rely on it with V2.

Codex. You get the CLI, an IDE extension for VS Code-style editors, integrations in Xcode and JetBrains IDEs, and the ChatGPT desktop app. Codex on mobile works through the ChatGPT app with a cloud environment or a connected Mac or Windows PC.

The gap is where work runs when your laptop closes. Codex Cloud gives each task its own workspace on OpenAI's side and keeps going while your computer sleeps. OpenCode's answer is to host it yourself: run opencode serve on an always-on machine and connect your clients to it. That gives you more control, and more to maintain.

Agents, Skills, MCP and CI

Day to day, the building blocks match almost one for one.

  • Instructions. Both read AGENTS.md at global and project level. OpenCode falls back to CLAUDE.md in any directory without one. Codex tries other filenames only if you list them in its config.
  • Skills. Both use SKILL.md folders, and both read .agents/skills. Put shared skills there and you won't need two copies.
  • MCP. Both connect to MCP servers. OpenCode's MCP page reminds you that MCP tools take up model context, so add only what you need.
  • Subagents. OpenCode ships Build and Plan as main agents, with General and Explore as subagents. Codex ships default, worker and explorer. Both let you define your own.
  • Scripts. opencode run "..." and codex exec "..." do the same job.
  • GitHub. OpenCode's command docs show opencode run as an Actions step. Its /oc comment bot is in the V1 docs. Codex has an official GitHub Action and hosted code review that you trigger by commenting @codex review.

Because AGENTS.md and skills carry over, you can try both on one repository without a migration.

Which Should You Choose?

Your situationStart withWhy
You switch between model vendorsOpenCodeProvider choice is a menu, not a config project
Your server only speaks Chat CompletionsOpenCodeCodex needs a Responses API endpoint
You want tasks to run while your laptop sleeps, with no server to runCodexCodex Cloud is hosted for you
You run agents unattended on your own machineCodexThe sandbox is on and network is off by default
You want PR review without building a workflowCodexHosted GitHub review
You want to self-host or contribute codeOpenCodeMIT, self-hosted server, takes pull requests
You work in JetBrains or XcodeCodexOpenAI documents both integrations

Still split? Use Codex for unattended and cloud work, and OpenCode when you want a different model's opinion. They can share a repository and a ChatGPT plan.

Comparing with Anthropic's agent too? OpenCode vs Claude Code covers the first pairing and Claude Code vs Codex covers the second.

Where Taku Fits

OpenCode and Codex both assume you have a codebase and want an agent to change it. Plenty of people have neither. They just want to use an AI tool someone else already built.

If that's you, that's where Taku comes in. Taku Apps and Sites, built by the best AI minds. Find one, run it, and keep it in your Mac Dock. Taku is in Beta, and the Mac app is available now.

Key Points

  • Both CLIs are open source: OpenCode under MIT, Codex under Apache-2.0. Codex's IDE extension and cloud are not
  • Models: OpenCode connects to almost any provider. Codex defaults to OpenAI and accepts custom providers that offer a Responses API
  • Local models work in both. OpenCode discovers them, and Codex uses --oss
  • ChatGPT Plus and Pro work in both, against the same plan usage
  • Safety defaults differ most. Codex sandboxes commands and turns network off. OpenCode V2 allows nearly everything until you add rules
  • Cloud: Codex hosts tasks for you. With OpenCode you host the server

FAQ

Is OpenCode better than Codex?

Not across the board. OpenCode is better for provider choice, local models and self-hosting. Codex is better for sandboxed defaults, hosted cloud tasks and GitHub review. If you only use OpenAI models and want little setup, Codex is the simpler pick.

Is OpenCode the same as OpenAI Codex?

No. OpenCode is made by Anomaly and isn't tied to one model vendor. Codex is OpenAI's own agent. OpenAI does list OpenCode as an open source integration on its Sign in with ChatGPT page, but they're separate projects.

Can I use Codex models in OpenCode?

You can use OpenAI models in OpenCode with a ChatGPT Plus or Pro sign-in, an OpenAI API key or Console credits. Which models you see depends on how you connect, so check /models.

What is the difference between OpenCode and Codex CLI?

OpenCode vs Codex CLI comes down to defaults. Both are terminal agents with AGENTS.md, skills, MCP and subagents. OpenCode opens to any provider and allows most actions. Codex CLI opens to OpenAI models and keeps commands inside a sandbox.

Does Codex CLI work offline?

With --oss and a local server such as Ollama, the model itself runs on your machine. Other features, such as Codex Cloud, still need a connection and a ChatGPT sign-in.

What happened to OpenCode Zen?

OpenCode's current docs describe the pay-as-you-go service as Console models, and the old Zen docs page redirects there. OpenCode Go is the separate monthly subscription. You don't need either one to use OpenCode.