OpenCode vs Claude Code
OpenCode is an MIT-licensed agent that runs almost any model you connect. Claude Code runs Claude models and ships stricter defaults for what the agent may do.
OpenCode and Claude Code are terminal coding agents. Both read your code, edit files and run commands until a task is done. OpenCode is open source and model-agnostic. Claude Code is Anthropic's agent for Claude. This page covers OpenCode V2, the current release. Facts were checked against each tool's own docs, pricing page and repository in November 2026.
At a Glance
| OpenCode | Claude Code | |
|---|---|---|
| License | MIT | Proprietary |
| Pricing | Free. You pay your model provider. Optional OpenCode Go subscription from $10 per month | Claude Pro, Max, Ultra, Team or Enterprise plan, or pay per token through the Claude Console |
| Models | Providers from the models.dev catalog, including Anthropic, OpenAI, Google, Amazon Bedrock, Azure, OpenRouter and xAI. ChatGPT Plus or Pro and GitHub Copilot sign-in. Local models through Ollama, LM Studio or vLLM. Any OpenAI-compatible endpoint. | Claude models, through Anthropic, Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry |
| Default permissions | Allows every action except reading .env files, which asks | Asks before file edits and non-read-only shell commands |
| Permission rules | Ordered allow, ask and deny rules per action and path, per agent | Allow, ask and deny rules, plus modes such as plan, acceptEdits and auto |
| OS sandbox | None. Shell commands run with your user's full access | Optional. Seatbelt on macOS, bubblewrap on Linux and WSL2 |
| MCP | Local stdio and remote HTTP servers, with OAuth | Yes |
| Project instructions | AGENTS.md, falling back to CLAUDE.md | CLAUDE.md, or AGENTS.md |
| Skills and extensions | Agent Skills, plugins, custom agents, custom commands | Agent Skills, plugins, hooks, subagents |
| Headless and CI | opencode run | claude -p, GitHub Actions, GitLab CI/CD |
| Surfaces | Terminal UI, desktop app in beta, web app | Terminal, VS Code, JetBrains, desktop app, web |
| Platforms | macOS, Windows, Linux | macOS, Windows, Linux |
Models and Cost
Model choice is the biggest difference. OpenCode reads its provider and model list from models.dev and connects to almost any provider with /connect. You can sign in with a ChatGPT Plus or Pro plan, use a GitHub Copilot account, or point it at a model running on your own machine. OpenCode itself is free.
OpenCode Go is an optional subscription for open coding models that the OpenCode team tests. It costs $10 per month, with Go Plus at $40 per month and Go Teams at $20 per member per month.
Claude Code runs only Claude models. Anthropic lists Pro at $20 per month billed monthly, Max at $100 and Ultra at $200. You can also pay per token with an API key, or bill usage through Amazon Bedrock, Google Cloud or Microsoft Foundry.
If you want to switch models per task or use local models, OpenCode fits. If you only use Claude, Claude Code comes from Anthropic, which also trains the models.
Permissions and Sandboxing
The defaults point in opposite directions. OpenCode starts every agent with a policy that allows everything, then asks only before reading .env files. You tighten it with ordered allow, ask and deny rules. The last matching rule wins, and a configured deny beats a saved approval.
OpenCode has no OS sandbox. Its docs warn that shell commands run with your user's filesystem, process and network access. Rules match command text, which the docs call best effort, so they recommend a narrow shell allowlist.
Claude Code asks before it edits a file or runs a shell command that is not read-only. It also has an optional OS sandbox. When it is on, shell commands can write only inside the working directory and reach only the network domains you allow.
If you let OpenCode run unattended, run it in a container or a cloud sandbox, or write deny rules first.
Agents, Skills and MCP
OpenCode ships a build agent with full access and a plan agent that cannot edit your code. Press Tab to switch between them. You can define your own agents with their own prompts, models, tools and permissions.
Claude Code covers the same split with permission modes, including a read-only plan mode. You can also define custom subagents for specific tasks.
Both load skills from SKILL.md folders. OpenCode also reads skills from .claude/skills and ~/.claude/skills, so skills you wrote for Claude Code work there. Both support local and remote MCP servers.
Project instructions carry over in both directions. OpenCode reads AGENTS.md, and reads CLAUDE.md in any directory without one, per its instructions docs as of December 4, 2026. Claude Code reads CLAUDE.md, or AGENTS.md when that is what a repository has. A single AGENTS.md works for both.
Headless Use
opencode run "prompt" submits a prompt without the interface, for scripts and CI jobs. OpenCode runs a shared background server that every local client connects to, and --server points a client at another one. claude -p "prompt" is Claude Code's equivalent, and Anthropic ships GitHub Actions and GitLab CI/CD integrations for it.
When to Pick Which
Which model do you need to run, and where do you want to run the agent?
| If you need | Pick | Why |
|---|---|---|
| Models from several providers, or local models | OpenCode | It connects to any provider in the models.dev catalog and to OpenAI-compatible endpoints |
| Source code you can read, fork and patch | OpenCode | It is MIT licensed |
| To reuse a ChatGPT or GitHub Copilot subscription | OpenCode | It signs in with both |
| Only Claude models, from the vendor that trains them | Claude Code | Anthropic builds the agent and the models together |
| Prompts before edits and an OS sandbox | Claude Code | It asks by default and can confine shell commands |
| An agent inside VS Code or JetBrains | Claude Code | It ships extensions for both |
| A fixed monthly bill | Either | Claude plans start at $20 per month, OpenCode Go at $10 |
Many teams use both. A shared AGENTS.md and SKILL.md folders let one repository serve either agent.
OpenCode Alternatives
Aider and Goose also support multiple model providers. Both clients use the Apache 2.0 license. Cline is an Apache 2.0 agent for many providers that runs inside VS Code and JetBrains. See Claude Code vs Cline and OpenCode vs Cline. If you connect a paid model API, your provider bills you for usage. Compare coding agent CLIs, or see OpenCode Alternatives for each option's safety defaults.
If you want an editor instead of a terminal, Cursor vs Claude Code covers an editor with many models built in, and OpenCode vs Cursor sets it against OpenCode. For a vendor agent with an open source client, Claude Code vs Codex CLI covers Codex CLI, which is Apache 2.0. Claude Code vs Gemini CLI covers Google's agents.
If you pick OpenCode for local models, Best Open-Weight Coding Models lists the models to run and their licenses.
Running Several Agents at Once
To compare models, give each agent the same task in a separate working copy. Set up Git worktrees manually, then review the resulting changes. In Treq, run each agent in its own workspace. You can stack changes when one depends on another.
Next Steps
- Best Coding Agent CLIs: every current terminal agent in one table
- Claude Code vs Codex CLI: two vendor agents side by side
- Sandbox Providers for Coding Agents: run agents on machines they can break
- How to Run Multiple Claude Code Sessions: parallel sessions without collisions