Claude Code vs OpenCode: The 2026 Comparison
Anthropic's agentic CLI against the most-starred open-source coding agent -- release velocity, orchestration depth, provider freedom, permissions, pricing, and a verdict grounded in verified numbers, not vibes.
By Jose Nobile | Updated 2026-06-11 | 25 min read
Table of Contents
TL;DR Verdict
Claude Code wins overall for orchestration depth and long-horizon autonomy. Background agents, agent teams, worktree-isolated subagents, dynamic workflows that fan out tens to hundreds of subagents, and /goal are shipped, documented features. OpenCode's equivalents exist today only behind experimental environment flags.
OpenCode wins provider freedom and openness. It is MIT-licensed, supports 75+ providers including local Ollama and llama.cpp as documented first-class citizens, exposes a client/server architecture with an OpenAPI 3.1 spec, and is the most-starred coding agent on GitHub (173,168 stars vs 131,781 as of June 11, 2026).
And the most repeated myth is false: Claude Code is not locked to Anthropic's cloud. It officially runs on Amazon Bedrock, Google Vertex AI, and Microsoft Foundry, and through gateways via ANTHROPIC_BASE_URL. In my own stack it talks to local Qwen and Gemma models daily through an Anthropic-compatible proxy -- details in the misconceptions section.
What Each Tool Is
Claude Code is Anthropic's official agentic coding CLI: it reads your codebase, edits files, runs commands, and orchestrates multi-agent workflows from the terminal, with companion surfaces in VS Code and JetBrains, on the web, and on mobile. It is a proprietary product -- the GitHub repo hosts issues, docs, and the installer, not the product source. Current version: 2.1.173, published June 11, 2026. It runs Claude models: Opus 4.8, Sonnet 4.6, Haiku, and the new Claude Fable 5 with a 1M-token context window by default (model config docs).
OpenCode is "the open source coding agent" from Anomaly -- the team formerly known as SST; the repo moved from sst/opencode to anomalyco/opencode in the January 2026 rebrand. It is MIT-licensed and written in TypeScript on Bun (the original Go/Bubble Tea TUI is gone -- a common outdated claim). It ships as a TUI, an Electron desktop app, a VS Code/Cursor extension, and a headless HTTP server exposing an OpenAPI 3.1 spec. Latest release: v1.17.3, June 10, 2026.
Both implement the same fundamental loop -- gather context, act with tools, verify results -- and both support MCP, skills, hooks/plugins, and AGENTS.md-style project memory. The real differences are in orchestration depth, provider strategy, governance, and ecosystem maturity. That is what this guide measures.
Release Velocity: Both Ship Near-Daily
Velocity matters because whichever tool you pick, you are betting on its trajectory. Both teams ship at a pace that makes month-old reviews obsolete. The numbers below are counted from the npm registry and the GitHub Releases API, not estimated.
| Metric | Claude Code | OpenCode |
|---|---|---|
| Latest version | 2.1.173 (2026-06-11) | v1.17.3 (2026-06-10) |
| Releases, last ~2 months | 59 versions in 2 months (~6.8/week, per npm registry timestamps) | 61 releases in 61 days; 22 in the last 30 days; 4 on June 10 alone (GitHub Releases API) |
| Lifetime cadence | 315 version headings in the official changelog | 300+ releases in ~6.7 months (API page cap reached at v1.0.79, Nov 2025); public changelog |
Verdict: effectively a tie on raw speed. One community caveat worth knowing (anecdotal, from HN/Reddit roundups): OpenCode's velocity "adds, removes, fixes, and breaks features constantly," while Claude Code stages risky features as research previews behind flags before promoting them.
Provider Connectivity
This is OpenCode's signature strength. It uses the Vercel AI SDK and Models.dev to support 75+ LLM providers, with documented local setups for Ollama, llama.cpp's llama-server, and LM Studio. Claude Code is Claude-models-only by design, but its deployment surface is far wider than the "Anthropic-only" reputation suggests: Amazon Bedrock, Google Vertex AI, Microsoft Foundry, and LLM gateways are all officially supported.
| Capability | Claude Code | OpenCode |
|---|---|---|
| Model catalog | Claude models only, by design: Opus 4.8, Sonnet 4.6, Haiku 4.5, Fable 5; [1m] 1M-context variants; opusplan hybrid routing |
75+ providers via AI SDK + Models.dev: Anthropic, OpenAI, Google, open-weight models, and anything OpenAI-compatible |
| Cloud platforms | Anthropic API, Amazon Bedrock, Google Vertex AI, Microsoft Foundry (official) | Any provider you hold keys for; opencode auth login configures any Models.dev provider |
| Local models | Via ANTHROPIC_BASE_URL pointed at Anthropic-compatible endpoints (llama.cpp, Ollama, proxies) -- works, but unsupported for non-Claude models |
First-class and documented: Ollama (auto-configures itself for OpenCode), llama.cpp llama-server, LM Studio |
| Gateways | ANTHROPIC_BASE_URL / ANTHROPIC_BEDROCK_BASE_URL / ANTHROPIC_VERTEX_BASE_URL for LiteLLM-style gateways |
Optional OpenCode Zen: curated pay-as-you-go gateway with some free models |
| Claude subscription access | Native: Pro and Max plans include Claude Code usage | Blocked since January 2026: Anthropic prohibits consumer OAuth in third-party harnesses, so Claude in OpenCode means per-token API pricing |
Winner: OpenCode, clearly, on model freedom. If your workflow depends on GPT, Gemini, or open-weight models in one harness, Claude Code simply does not do that. If your models are Claude anyway, Claude Code's four official deployment channels cover most enterprise compliance needs.
Orchestration & Parallelism
This is where the two tools diverge most. Claude Code documents four distinct parallelism modes -- subagents, agent view, agent teams, and dynamic workflows -- on one comparison page. OpenCode has real primary agents and subagents running in child sessions, but its background/parallel orchestration is explicitly experimental: OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS, OPENCODE_EXPERIMENTAL_SCOUT, and OPENCODE_EXPERIMENTAL_PARALLEL are documented under "experimental features that may change or be removed".
| Capability | Claude Code | OpenCode |
|---|---|---|
| Subagents | Stable. Markdown+YAML in .claude/agents/ with per-agent model, tools, permissions, hooks, memory; can nest up to 5 levels deep since v2.1.172 (docs) |
Stable. Primary agents (Tab to cycle) + subagents in child sessions, auto-invoked by description or @-mentioned; per-agent model and permissions |
| Background agents | Shipped (research preview): claude --bg detached sessions keep running with no terminal attached; claude agents dashboard groups them by Needs input / Working / Completed (agent view) |
Experimental flag only (OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS); no fleet dashboard equivalent |
| Agent teams | Experimental (off by default): lead coordinates teammates with own context windows, shared task list, inter-agent messaging, tmux/iTerm2 split panes (docs) | No equivalent |
| Worktree isolation | Stable: claude -w launches in an isolated git worktree (even from a PR number), isolation: "worktree" per subagent, EnterWorktree mid-session, worktree hooks (docs) |
Not documented as stable; OPENCODE_EXPERIMENTAL_WORKSPACES flag exists, "managed workspaces" appeared in v1.16.0 notes |
| Workflow fan-out | Dynamic workflows (trigger keyword ultracode): Claude writes a rerunnable JavaScript orchestration script driving tens to hundreds of background subagents; bundled /deep-research (docs) |
No equivalent |
| Goal-driven autonomy | /goal: set a completion condition, a small fast model evaluates it after each turn, Claude keeps working until met (docs) |
No equivalent (the doom_loop permission key handles stuck-recovery prompts -- a different concern) |
| Interactive multi-agent UX | Shift+Down cycles teammates; ←← opens agents view |
Strong: Tab cycles primaries, Leader+Down enters child sessions, Left/Right cycles between them -- praised by power users |
Winner: Claude Code, and it is not close on fleet management and long-horizon autonomy. To be fair to OpenCode: its child-session navigation makes interactive multi-agent work pleasant, and power users on HN argue its parallel sub-sub-agents work well in practice -- but "behind an experimental env flag" is not the same as "shipped and documented."
Context Engineering
| Capability | Claude Code | OpenCode |
|---|---|---|
| Project memory | CLAUDE.md hierarchy (org / user / project / nested subdirectories) plus the AGENTS.md convention; auto-memory across sessions | AGENTS.md; community reports strong adherence to it (anecdotal, HN) |
| Skills | SKILL.md following the Agent Skills open standard (agentskills.io); dynamic context injection; custom slash commands merged into skills (docs) |
SKILL.md discovered from repo/home, loaded on demand via a native skill tool (docs); separate custom /commands |
| MCP context cost | MCP tool search lazy-loads tool schemas at scale instead of front-loading them (docs) | Full MCP tool schemas load every turn; no lazy loading -- third-party comparisons citing Anthropic measurements put heavy MCP setups at 55K-134K tokens of tool definitions (source) |
| Automation hooks | 20+ lifecycle events (PreToolUse, PermissionRequest, SubagentStop, TeammateIdle, WorktreeCreate...), command and HTTP hooks, conditional if: (docs) |
JS/TS plugins exporting hook functions, with the SDK client and Bun shell injected (docs) |
| Code intelligence | Agent-driven: runs your linters/typecheckers directly; LSP via IDE integrations and plugins | ~25 built-in LSP servers feeding diagnostics to the agent -- with the docs' own caveat that running lint/typecheck CLIs directly is often better (docs) |
Winner: narrow edge to Claude Code for the hook event surface and lazy MCP loading, which directly protects your context window in heavy-MCP setups. Both converged on the same SKILL.md standard, which is good news for portability: skills you write today largely travel between the two tools.
Permissions & Safety
| Capability | Claude Code | OpenCode |
|---|---|---|
| Model | Six permission modes: default, acceptEdits, plan, auto (autonomous with background safety checks), dontAsk (CI), bypassPermissions (containers/VMs only) |
Per-tool allow | ask | deny with glob patterns, e.g. bash: {"*":"ask","git *":"allow","git push *":"deny"} (docs) |
| Hard limits | Deny/ask rules apply even in bypassPermissions; protected paths are never auto-approved |
external_directory gates access outside the worktree; pattern matching extends to custom and MCP tools ("mymcp_*": "deny") |
| Per-agent scoping | permissionMode, tools, disallowedTools per subagent; background subagents auto-deny permission prompts |
Per-agent permission overrides merge over global config; Plan primary agent ships with edit/bash denied |
| Recovery | Checkpoints; worktree isolation keeps agent edits off your checkout | /undo and /redo revert messages and file changes via Git (requires a Git repo) |
Winner: tie, with different philosophies. OpenCode's glob-pattern permissions are elegant and very legible. Claude Code's mode system plus deny-rules-that-survive-bypass is more enterprise-shaped, and auto mode's background safety checks have no OpenCode equivalent.
TUI & UX
| Capability | Claude Code | OpenCode |
|---|---|---|
| Surfaces | Terminal TUI, VS Code/JetBrains extensions, web (Ultraplan cloud planning), mobile via Remote Control, messaging via MCP channels (research preview) | Terminal TUI, Electron desktop app, VS Code/Cursor extension, headless server + JS/TS SDK |
| Architecture | CLI-first; claude agents --json for scripting; -p headless mode |
Client/server: the TUI is just one client of an OpenAPI 3.1 server (opencode serve), which is genuinely great for building on top of it |
| Polish | Fast iteration; /fast mode up to 2.5x faster Opus output (docs); /effort levels |
Widely praised TUI (anecdotal but consistent): scrollable sections, no flicker, themeable, leader-key keybinds (docs) |
| Session sharing | Remote Control pairs terminal sessions with web/mobile; Ultraplan lets you comment on plans in the browser | /share creates a public link (off by default, /unshare deletes data); enterprises can disable or self-host sharing (docs) |
Winner: OpenCode for in-terminal feel and hackable architecture; Claude Code for breadth of surfaces (background fleet view, mobile, messaging channels). If you live exclusively in one terminal pane, you will probably prefer OpenCode's TUI. If you manage agents from your phone, only one of these does that.
Ecosystem & Extensibility
| Capability | Claude Code | OpenCode |
|---|---|---|
| Plugins | Plugins bundle skills + agents + hooks + MCP servers; marketplaces installable from git/GitHub/zip/URL; /plugin browser (docs) |
JS/TS plugin modules; npm plugins auto-installed via Bun at startup; local plugins in .opencode/plugins |
| MCP | Full client with OAuth, scopes, managed org allowlists, tool search, and channels pushing events into sessions | Local and remote servers; org-wide defaults via .well-known/opencode; MCP tools gated by the same permission syntax |
| GitHub automation | Official claude-code-action; PR-linked sessions; cloud execution |
Mention /oc in issues/PRs and OpenCode triages, fixes, and submits PRs inside your own GitHub Actions runners (docs) |
| Openness | Proprietary product; ~51 listed contributors on the public repo (issues/docs/installer) | MIT license, ~453 contributors, full source on GitHub -- you can read, fork, and patch the entire harness |
Winner: split. Claude Code's plugin/marketplace ecosystem is deeper today -- even pro-OpenCode roundups concede OpenCode's "doesn't quite match" it. OpenCode wins on inspectability: it is the only one of the two you can actually read and modify.
Pricing & Licensing
| Item | Claude Code | OpenCode |
|---|---|---|
| The tool itself | Free to install; proprietary | Free; MIT open source |
| Model billing | Anthropic API per-token, or subscriptions: Pro ($20/mo), Max 5x ($100/mo), Max 20x ($200/mo); Bedrock/Vertex/Foundry billing through your cloud | Bring your own keys to any provider; optional Zen gateway pay-as-you-go with free models; Go ($10/mo, open-weight models: GLM-5.1, Kimi K2.5, DeepSeek V4); Black ($200/mo) |
| Claude models | Included in subscriptions; /fast mode at $10/$50 per MTok in/out on Opus 4.8 for 2.5x speed |
API per-token only, since Anthropic blocked consumer OAuth tokens for third-party harnesses (Jan 2026); OpenCode removed its Claude Pro/Max plugins as of 1.3.0 |
| Cost predictability | Subscriptions absorb heavy usage -- HN users estimate Max $200 absorbs over $1,000 of API-equivalent tokens (anecdotal) | Full visibility per request; with local models, marginal cost approaches zero (your hardware and electricity) |
Winner: depends on your models. Heavy Claude users get the best economics from Claude Code subscriptions -- which is exactly the access OpenCode lost in January 2026. Local-model and open-weight users get unbeatable economics from OpenCode. Neither tool charges for itself.
Adoption & Benchmarks
Adoption is metric-dependent. GitHub stars favor OpenCode: 173,168 vs 131,781 (GitHub API, June 11, 2026). Usage favors Claude Code: npm downloads ran roughly 6:1 in the last month (35.5M vs 6.0M, api.npmjs.org) -- with the honest caveat that both ship native installers that npm does not count, and OpenCode's curl installer is its primary path, so it is undercounted more. A SemiAnalysis-attributed estimate (secondhand, via Morph) put Claude Code above 10% of all public GitHub commits in late Q1 2026.
The most rigorous head-to-head is Builder.io's controlled test: same model (Claude Sonnet 4.5) in both tools, fresh Docker environment, four tasks. Result: Claude Code finished in 9m09s vs OpenCode's 16m20s (~45% faster); OpenCode was more thorough on test-writing (94 tests, ran the full suite, vs 73 tests verifying only its own); bug fix and refactor were a tie; OpenCode showed unwanted reformatting of existing code with all three models tested -- a harness-level issue, not a model issue.
Leaderboard scores measure models, not harnesses. There is no official OpenCode SWE-bench entry, because OpenCode's score is whatever model you plug in. On Terminal-Bench 2.1 (as reported by Morph from the public leaderboard), Codex CLI + GPT-5.5 leads at 83.4% with Claude Code + Opus 4.8 second at 78.9%. Treat any single "SWE-bench score" for either tool with suspicion -- scaffolding differences alone move results by more than 20 points.
Common Misconceptions, Corrected
1. "Claude Code is locked to Anthropic's cloud" -- false
Claude Code officially supports Amazon Bedrock, Google Vertex AI, and Microsoft Foundry, plus LLM gateways via ANTHROPIC_BASE_URL, ANTHROPIC_BEDROCK_BASE_URL, and ANTHROPIC_VERTEX_BASE_URL. And because llama.cpp and Ollama now expose Anthropic-compatible endpoints, you can point the harness at local models too.
In my own stack, Claude Code runs daily against Opus and Sonnet on the Anthropic API for production work, and against local Qwen and Gemma models served from my own hardware through an Anthropic-compatible proxy for offline and experimental tasks. The harness does not care where the endpoint lives. What is true: Claude Code is Claude-models-only by design -- routing non-Claude models through a gateway works, but it is unsupported, and some features (like MCP tool search) are disabled by default on non-first-party base URLs. Comparison tables that say "Model support: Claude only" are about models, not deployment.
2. "OpenCode has Claude Code-level orchestration" -- contested, leaning no
OpenCode has real subagents in child sessions and an HTTP API. But background subagents, the Scout research agent, and parallel execution all sit behind experimental env flags that the docs say "may change or be removed," there is no agent-view fleet dashboard, no /goal equivalent, no agent teams, and no workflow fan-out. Power users argue OpenCode's interactive multi-agent switching is better -- that part is fair. Different philosophies: Claude Code is ahead on fleet management and long-horizon autonomy; OpenCode on interactive session juggling.
3. "OpenCode is more popular" -- depends entirely on the metric
Stars: yes, 173K vs 132K. Usage: no -- npm downloads ran ~6:1 in Claude Code's favor last month, and the (secondhand) commit-share estimates point the same direction. Both claims are true; quoting only one is marketing.
4. "Same model means same results in both tools" -- false
Builder.io's controlled same-model test produced a ~45% total-time difference and harness-specific behaviors (OpenCode's unwanted reformatting; Claude Code's narrower test verification). The harness -- system prompts, tool design, context management -- measurably changes outcomes.
5. Quoting the dead fork's stars
opencode-ai/opencode (12,915 stars, last pushed September 2025) is the abandoned original repo from the naming dispute. The active project is anomalyco/opencode (formerly sst/opencode). Comparisons that mix these up get both the stars and the architecture wrong.
6. "OpenCode scores X on SWE-bench"
A harness has no benchmark score of its own. SWE-bench results are scaffolding-dependent: standardized runs and vendor-reported runs of the same model differ by more than 20 points. Any comparison quoting a single SWE-bench number for either tool is measuring the model and the scaffold, not the product you install.
Who Should Pick Which
Pick Claude Code if...
You run Claude models anyway (subscription economics are unmatched); you want shipped multi-agent orchestration -- background fleets, agent teams, workflow fan-out, /goal autonomy, worktree isolation; you need enterprise controls (managed settings, Bedrock/Vertex/Foundry); or you manage long-running agents from web/mobile.
Pick OpenCode if...
You need multiple providers in one harness (GPT, Gemini, open-weight, local); you want MIT-licensed source you can read and patch; you build on top of a coding agent (OpenAPI server + SDK); you primarily run local models via Ollama/llama.cpp/LM Studio; or you simply prefer its TUI -- many do.
Or run both
They coexist fine in one repo: both read AGENTS.md-style memory and SKILL.md skills. A common pattern is Claude Code on a Max plan for heavy orchestration plus OpenCode for non-Claude model experiments. Switching costs are low and falling as the two converge on shared standards.
Final Verdict
- Orchestration & autonomy: Claude Code -- four shipped parallelism modes vs experimental flags.
- Provider freedom & local models: OpenCode -- 75+ providers and documented local setups vs one model family.
- Openness & hackability: OpenCode -- MIT source, OpenAPI server, 453 contributors.
- Speed & ecosystem: Claude Code -- 45% faster in the only controlled same-model test, deeper plugin marketplace, lazy MCP loading.
- TUI feel: OpenCode, per consistent (if anecdotal) community sentiment.
- Cost: tie -- Claude-heavy users win with Claude Code subscriptions; local/open-weight users win with OpenCode.
Overall: Claude Code, by a clear but not crushing margin. The evidence that decides it for me is orchestration depth: background agent fleets, agent teams, worktree-isolated subagents, hundred-agent workflow fan-out, and goal-driven autonomy are shipped and documented, while OpenCode's counterparts remain experimental. Add the only controlled same-model benchmark (45% faster) and the usage data (~6:1 npm downloads, commit-share estimates), and the orchestration story is not just marketing.
But this is not a fanboy call. OpenCode is the legitimate winner on provider freedom, open source, and local models -- and it is the most-starred coding agent on GitHub for real reasons. If Anthropic's January 2026 subscription lockout pushed you off Claude models, or your future is open-weight models on your own GPUs, OpenCode is the rational choice and a genuinely excellent tool. I say this as someone whose daily driver is Claude Code pointed at both Anthropic's cloud and my own local models: the gap is real today, OpenCode is closing parts of it monthly, and both are improving faster than any review can track. Re-evaluate quarterly.