Both are open-source terminal coding agents with frequent releases, but they answer different questions. Codex CLI is OpenAI's agent, tuned for its own models, sandboxed by the operating system and paid for by a ChatGPT plan. OpenCode is model-agnostic, reaching more than 75 providers, and its permissions allow edits and shell commands by default unless you tighten them.
The choice between these two agents is mostly a choice about who supplies your models. Codex CLI is built and tuned by OpenAI, and a ChatGPT plan pays for it: Plus at $20 a month, or Business at $20 per user per month on annual billing ($25 monthly). OpenCode is free under the MIT licence and talks to more than 75 providers through Models.dev, including local models, and its homepage says it can sign in with a ChatGPT Plus or Pro subscription too. Both ship quickly: OpenCode released v1.19.4 on 22 October 2026, Codex rust-v0.164.0 the next day.
Their safety defaults differ more than their feature lists. In a version-controlled folder Codex suggests Auto mode, which edits and runs commands only inside the workspace, keeps network access off and asks before going further; an operating-system sandbox (Seatbelt on macOS, bubblewrap with seccomp on Linux, MXC on Windows) enforces it. OpenCode's permissions docs say most tools, including edit and bash, default to allow, with prompts only for paths outside the project, repeated identical tool calls and .env files. Its plan agent blocks edits but, per the agents docs, does not restrict shell commands unless you configure it to. OpenCode's local HTTP server has also needed three security fixes in 2026, against one public sandbox bypass for Codex.
Cost predictability cuts the other way. OpenAI gives Plus users an estimated 15 to 160 local GPT-6.1 Sol messages per five hours and 350 to 3,000 on GPT-6 Luna, with weekly limits it does not specify; Pro at $100, $200 or $500 a month removes the five-hour cap. OpenCode's bill is whatever your provider charges, or a fixed $10 or $40 a month for OpenCode Go, which covers 29 models with caps of 20% of the monthly allowance per five hours and 50% per week. Two Go models train on prompts, so the model list needs reading before proprietary code goes near it.
For a company standardised on ChatGPT Business, Codex costs nothing extra and starts from tighter defaults, which outweighs OpenCode's flexibility. The calculation flips for a bank with its own LLM gateway or a team comparing models: OpenCode Enterprise can lock every install to one gateway and disable other providers, and the same agents, commands and MCP servers carry over when the model changes, which Codex, tuned for OpenAI's lineup, does not aim to offer.