Kipt

OpenCode vs Codex: open source terminal agents compared

OpenCode vs Codex compared from official docs: models and providers, plans, permissions and sandboxing, AGENTS.md, skills, MCP, scripting, and which to pick.

By the Kipt team · Updated 24 October 2026

What is the difference between OpenCode and Codex?

OpenCode and Codex are both open source coding agents for the terminal; OpenCode works with almost any model provider, while Codex is built around OpenAI's models and your ChatGPT plan. The other big difference is safety defaults: Codex runs inside a sandbox with network off by default, while OpenCode's base permission policy allows most actions unless you add rules.

Both read AGENTS.md, load Agent Skills, connect to MCP servers and have a one-shot mode for scripts. Everything below comes from the official docs as of 24 October 2026.

How does OpenCode work?

The OpenCode docs say "OpenCode is an open source AI coding agent. It's available as a terminal-based interface, desktop app, or web app." The code lives at anomalyco/opencode under the MIT license. Version 2 is current:

curl -fsSL https://opencode.ai/v2/install | bash
# or
npm install -g @opencode/cli
brew install anomalyco/tap/opencode-v2

cd your-project
opencode

Inside the TUI, run /connect, pick a provider and enter its credentials, then /models to choose a model. The providers docs cover a catalog from models.dev, and three options stand out:

  • ChatGPT: connect OpenAI and choose Sign in with ChatGPT to use a Plus or Pro plan instead of an API key.
  • GitHub Copilot: sign in with device OAuth; the account needs Copilot Chat access.
  • Local models: OpenCode detects a running Ollama server and lists its models "without an account connection," and also discovers LM Studio and vLLM.

OpenCode ships two primary agents. build is the "Default coding agent," and plan "Explores and plans without editing normal project files." Subagents named general and explore handle research in child sessions. The OpenCode guide covers setup in more depth.

How does Codex work?

The Codex repository calls it a "Lightweight coding agent that runs in your terminal," licensed under Apache 2.0:

curl -fsSL https://chatgpt.com/codex/install.sh | sh
# or
npm install -g @openai/codex
brew install --cask codex

cd your-project
codex

You sign in with your ChatGPT account or an API key. The pricing page says Codex is "included in your ChatGPT Free, Go, Plus, Pro, Business, Edu, or Enterprise plan," and API key use is billed at standard API rates.

Codex uses OpenAI models. Its models page recommends gpt-6-astra for the hardest work, gpt-6.1-sol for long-running coding at lower cost and gpt-6-luna for fast, focused tasks. Beyond the CLI, Codex has an IDE extension, a desktop app and Codex cloud, and codex cloud sends tasks to cloud environments from your terminal. See the Codex CLI guide.

How do OpenCode and Codex compare side by side?

OpenCode Codex
Maintainer anomalyco on GitHub OpenAI
License MIT Apache 2.0
Command opencode codex
Surfaces Terminal UI, desktop app, web app CLI, IDE extension, desktop app, cloud
Models Many providers, plus local models via Ollama, LM Studio, vLLM OpenAI models; custom providers need a Responses API endpoint
Sign-in options Provider API keys, ChatGPT Plus or Pro, GitHub Copilot, OpenCode Go ChatGPT plan (Free to Enterprise) or API key
Optional subscription (Oct 2026) OpenCode Go $10 a month, Go Plus $40 a month ChatGPT plans, from Free to Pro
Default safety Base policy allows actions; .env reads ask Sandbox on: workspace-write with on-request approvals in Git folders, network off
Project instructions AGENTS.md only AGENTS.md, AGENTS.override.md
Agent Skills .opencode/skills/, plus .claude/skills/ and .agents/skills/ .agents/skills/, ~/.agents/skills/
Config opencode.json or opencode.jsonc ~/.codex/config.toml
MCP opencode mcp add, under mcp.servers codex mcp add, [mcp_servers.<name>]
Scripting opencode run "<prompt>" codex exec, with --json

How do permissions and sandboxing differ?

This is the difference to understand before you let either agent loose on a real repo.

Codex enforces a sandbox. The approvals and security docs define three modes, read-only, workspace-write and danger-full-access, and approval policies such as on-request and never. A Git folder starts on the Auto preset (workspace-write plus on-request), and other folders start read-only. "By default, the agent runs with network access turned off." codex exec is read-only unless you pass --sandbox workspace-write. The Codex approvals and sandbox guide covers every setting.

OpenCode uses permission rules instead of a sandbox. Each rule's effect is allow, deny or ask. The permissions docs say the base policy for every agent is a catch-all allow, with reads of *.env files set to ask. The docs also warn that shell runs with your user's authority and recommend narrow allowlists. If you want OpenCode to ask before edits or commands, add rules in opencode.json, or work in the plan agent, which denies edits outside its plan files.

So out of the box, Codex is more locked down and OpenCode is more hands-off. Both can be tuned in either direction.

How do instructions, skills and MCP compare?

Instructions. Both read AGENTS.md. Codex walks from the project root to your current folder, includes at most one file per folder, and stops at 32 KiB combined by default, per the AGENTS.md docs. OpenCode's instructions docs load ~/.config/opencode/AGENTS.md, every AGENTS.md from your workspace up toward home, and nested files when the agent reads that area. Note that "OpenCode V2 recognizes AGENTS.md only. It does not use CLAUDE.md as a fallback." One AGENTS.md serves both tools; the AGENTS.md guide explains the format.

Skills. Both use SKILL.md folders. Codex scans .agents/skills up to the repo root and ~/.agents/skills, and you call a skill with $ or /skills. OpenCode's skills docs read .opencode/skills and ~/.config/opencode/skills, plus .claude/skills and .agents/skills for compatibility. A skill in .agents/skills/ works in both. See Codex skills.

MCP. Both add servers from the command line:

# OpenCode (add --global for every project)
opencode mcp add context7 --url https://mcp.context7.com/mcp

# Codex (stored in ~/.codex/config.toml)
codex mcp add context7 -- npx -y @upstash/context7-mcp

OpenCode supports local stdio servers and remote Streamable HTTP servers with OAuth on by default. Codex supports STDIO and Streamable HTTP with bearer tokens or OAuth. The config formats differ, so set up each tool separately.

Which should you pick?

Pick on models first, then on how much guardrail you want by default.

OpenCode tends to fit when:

  • You want to switch between providers, or run local models through Ollama, LM Studio or vLLM.
  • You want to reuse a ChatGPT Plus or Pro plan or a GitHub Copilot account in one agent.
  • You want a terminal UI, desktop app and web app from the same open source project.
  • You are comfortable writing permission rules to match your risk tolerance.

Codex tends to fit when:

  • You want OpenAI's models and a ChatGPT plan, including the Free plan for quick tasks.
  • You want a sandbox with network off before you configure anything.
  • You want cloud tasks, an IDE extension and the CLI under one account.
  • You want codex exec with JSON Lines output for CI.

You can also run both. OpenCode can sign in with the same ChatGPT plan, and both read AGENTS.md and .agents/skills/, so your instructions and skills move with you. For OpenCode against Anthropic's agent, see OpenCode vs Claude Code.

Keep your prompts and skills portable

When you use more than one agent, your prompts and skills should live somewhere neutral. Kipt keeps them as Markdown in a private GitHub repo you own, and installs every skill into Claude Code or Codex with one npx skills add command. If you have a prompt you keep retyping, the free SKILL.md generator turns it into a skill folder for .agents/skills/.

Questions

Is OpenCode better than Codex?

Neither is better for everyone. OpenCode suits people who want one agent that works with many model providers, including local models. Codex suits people who want OpenAI's models, a ChatGPT plan and a sandbox that is on by default.

Can OpenCode use my ChatGPT subscription?

Yes. OpenCode's providers docs say you can connect OpenAI and choose Sign in with ChatGPT to use a ChatGPT Plus or Pro plan instead of an API key. Usage then counts against your plan.

Are OpenCode and Codex open source?

Yes. OpenCode is MIT licensed on GitHub at anomalyco/opencode, and Codex is Apache 2.0 licensed at openai/codex. The models you connect them to have their own terms and costs.

Can Codex use models other than OpenAI's?

Partly. Codex's models page says custom providers or gateways must offer a compatible Responses API endpoint, and current releases don't support Chat Completions-only endpoints. OpenCode supports a wider range out of the box, including Ollama, LM Studio and vLLM for local models.

Do OpenCode and Codex read the same AGENTS.md?

Yes. Both read AGENTS.md files in your project and a global AGENTS.md in their config folder. OpenCode V2 reads AGENTS.md only and does not fall back to CLAUDE.md.

What is OpenCode Go?

OpenCode Go is an optional subscription for lower-cost access to a list of models, at $10 a month, with Go Plus at $40 a month for higher limits, as of October 2026. You can also use OpenCode with your own provider accounts.

More in Compare

All guides

Keep your prompts and skills in one place, in your own GitHub. Install every skill with one command.

Get started

Kipt is an independent product, not affiliated with or endorsed by Anthropic, OpenAI, Cursor or GitHub. Claude, ChatGPT, Codex, Cursor and GitHub are trademarks of their owners.