1. What Is OpenCode?
OpenCode is an open-source AI coding agent — a terminal-first, provider-agnostic tool that lets developers use any large language model to write, edit, and reason about code. Built in TypeScript (84% of the codebase), it was originally created by the team at SST (now rebranded to Anomaly) and lives at github.com/anomalyco/opencode.
The pitch is direct: OpenCode does what Claude Code does, minus Anthropic's lock-in, plus full community ownership. As of March 2026, it has accumulated over 112,000 GitHub stars — compared to Claude Code's approximately 71,500 — making it one of the fastest-growing developer tools in recent memory.[1]
OpenCode launched 80 releases in January and February 2026 alone — a velocity that reflects both community momentum and the intensity of the competitive moment. SemiAnalysis projects Claude Code at 20%+ of all public GitHub commits by end of 2026; OpenCode is clearly betting that enough developers will prefer tool freedom over model optimization to carve out a substantial portion of that market.[2]
2. Architecture Deep Dive
The most consequential architectural decision OpenCode made is its client/server split. OpenCode runs as a server process; the TUI (terminal UI) is just one client that connects to it. This has non-obvious implications:
- Remote control: OpenCode can run on your workstation while you drive it from a mobile app. The TUI is not the product — it's one interface.
- Session persistence: Because state lives server-side, closing the TUI doesn't kill the session. Return to a running task hours later. Claude Code loses context on close.
- Desktop app: A full Tauri-based desktop application is available for macOS (Apple Silicon and Intel), Windows, and Linux — with the same server backend.
The server architecture also enables the checkpoint/undo system — one of OpenCode's most practically useful features. Before any destructive operation (deleting files, overwriting code), OpenCode creates a checkpoint. If an edit goes wrong, you can roll back. Claude Code has no equivalent.[3]
Project Initialization
When you run /init in a project, OpenCode analyzes the codebase and creates an AGENTS.md file — analogous to Claude Code's CLAUDE.md. This file describes project structure and coding patterns to the model. Subsequent sessions load this context automatically, giving the agent project-aware behavior without re-explaining the codebase every time.
Configuration lives in opencode.json or opencode.jsonc in the project root. Agent definitions, model assignments, and MCP tool configurations all go here.
3. The Agent System
OpenCode ships with two built-in agents, switchable with the Tab key:
| Agent | Mode | File Access | Bash Commands | Best For |
|---|---|---|---|---|
build | Full access (default) | Read + Write | Executes freely | Active development |
plan | Read-only | Read only | Asks permission first | Exploring unfamiliar codebases, planning |
The plan agent is particularly useful when inheriting an unfamiliar codebase: it can explore, read, and reason about the code without making any changes — a safe reconnaissance mode. Once you're confident in the plan, switch to build to execute.
Beyond these two, OpenCode supports a @general subagent for complex multi-step searches. More significantly, users can define custom agents as YAML files in .opencode/agents/. Each agent can have its own model assignment, system prompt, and MCP tool configuration — giving teams the ability to build specialized agents for specific workflows (e.g., a "test writer" agent always on GPT-4o, a "security reviewer" on Claude).[4]
Agent Comparison: OpenCode vs Claude Code
| Feature | OpenCode | Claude Code |
|---|---|---|
| Interactive agent switching | ✅ Tab key | ❌ |
| Custom agent definitions | ✅ YAML files | Limited (Skills folder) |
| Checkpoint/Undo | ✅ Built-in | ❌ |
| Remote/mobile control | ✅ Client/server | ❌ |
| Session persistence | ✅ Server-side | ❌ In-session only |
| Native subagent polish | ❌ User-configured | ✅ Plan/Explore/Task built-in |
4. The Provider-Agnostic Model
OpenCode's core value proposition rests on provider independence. You can configure any of the following as your model backend:
- Anthropic — Claude models (via direct API key, not consumer OAuth)
- OpenAI — GPT-4o, o3, and subsequent releases
- Google — Gemini Pro and Flash models
- Local models — via Ollama (no API cost, full privacy)
- OpenCode Zen — OpenCode's own curated, pay-as-you-go model gateway
- OpenCode Black — enterprise gateway at $20/$100/$200/mo tiers
The implication: as model pricing drops and quality converges across providers (which it is, fast), OpenCode users can arbitrage. Run Claude Sonnet on Monday, switch to Gemini Flash for cost-sensitive tasks on Tuesday, use local Llama for private code. Claude Code users are locked to Anthropic's pricing and release cadence.[5]
5. The Anthropic Block: The Watershed Moment
On January 9, 2026, Anthropic silently blocked OpenCode from using Claude via consumer OAuth tokens. OpenCode removed Claude Pro/Max subscription support from its codebase, citing "Anthropic legal requests" in the commit message. The developer backlash on Hacker News was swift and fierce.[6]
OpenAI's response was equally swift — publicly welcoming third-party tools and positioning itself as the developer-friendly alternative. The message was unsubtle.
OpenCode's response was pragmatic: launch Black (an enterprise API gateway), accelerate Zen (pay-as-you-go model access), and lean into provider agnosticism as a feature rather than a workaround.
The community split along predictable lines. Developers who valued Anthropic model quality and tight integration stayed with Claude Code. Developers who valued tool freedom — and who resented the OAuth block as a competitive move dressed as a policy decision — rallied around OpenCode.
6. Benchmarks vs Claude Code
Formal benchmarks comparing agentic coding tools are rare and often contested. Here's what the available data shows:
| Task | OpenCode | Claude Code |
|---|---|---|
| Cross-file refactor | ✅ Correct — 4m 20s | ✅ Correct — 2m 15s |
| Bug fix from error trace | ✅ Correct — 3m 10s | ✅ Correct — 1m 45s |
| Test generation | 94 tests — 8m 50s | 73 tests — 5m 9s |
| Code reformatting bugs | ⚠️ Yes (all 3 models tested) | ❌ No |
The headline finding: Claude Code completes tasks approximately 45% faster, while OpenCode generates roughly 29% more tests. The reformatting bug — where OpenCode tries to reformat existing code it wasn't asked to change — appears to be a harness-level issue rather than a fundamental model quality gap.[7]
Claude Code's formal benchmarks are strong: 57.5% on SWE-bench Pro and 68.8% on ARC-AGI-2 (nearly 2× improvement from prior scores). Anthropic's 100K-line C compiler demo — using 16 parallel agents at $20K in API costs — demonstrated multi-agent orchestration at a scale nobody else has publicly replicated. These benchmarks reflect model quality and tight system-prompt optimization, not just tool architecture.
What the Benchmarks Don't Capture
Task completion time matters less than many developers assume. If you're thinking while the agent works, a 2-minute vs 4-minute task is irrelevant. What matters more: correctness rate, context handling on large codebases, and the cost of mistakes. OpenCode's checkpoint/undo system changes the calculus on that last point — if rollback is instant, a slightly higher error rate is more tolerable.
7. Pricing Reality
| Cost Dimension | OpenCode | Claude Code |
|---|---|---|
| Tool cost | Free (MIT) | Free |
| Model access (minimum) | $0 (local models via Ollama) | $20/mo (Claude Pro) |
| Model access (API) | BYOK — pay per token | Anthropic API pricing |
| Managed gateway | Zen (pay-as-you-go) or Black ($20–200/mo) | N/A |
| Local model support | ✅ Ollama | ❌ |
| Desktop app | ✅ Tauri (macOS/Win/Linux) | VS Code extension only |
For developers who already pay for Anthropic API access, switching to OpenCode doesn't necessarily cost more — and opens access to other providers at the same time. For developers who want zero model cost, Ollama integration means running capable open-source models (Llama 3, Qwen, DeepSeek) with no per-token charges at all.
8. MCP & LSP Integration
Model Context Protocol (MCP)
Both tools support MCP, but with fundamentally different loading strategies:
- Claude Code (old approach): Eager loading — all MCP tools loaded at startup. With many MCPs, this cost ~134K tokens per session. Anthropic's new MCP Tool Search reduces this to ~5K via "lazy loading."
- OpenCode: Declarative loading per agent. Tools only enter context when the agent is configured to use them. You can use glob patterns (
mymcp_*: true) to enable all tools from a specific server.
OpenCode's approach was more token-efficient by default before Claude Code's Tool Search fix. Now they're approximately comparable — but OpenCode's per-agent configuration gives finer-grained control over what each specialized agent can access.[8]
Language Server Protocol (LSP)
LSP integration is one of OpenCode's clearest technical advantages. Claude Code has limited LSP awareness; OpenCode built it in from the start. This means:
- Go-to-definition, find-references, and hover information are available to the agent as context
- The agent can ask the LSP server for type information before editing, reducing incorrect type assumptions
- Diagnostics (errors, warnings) from the language server are visible to the agent in real time
For statically typed languages (TypeScript, Go, Rust, Java), this is meaningful. The agent has access to the same semantic information that IDE users rely on — not just file text.
9. Who Should Use OpenCode?
OpenCode makes sense for you if:
- You already pay for Anthropic API access — you can use OpenCode with Claude without any additional cost, plus gain access to other providers
- You use multiple model providers — OpenCode is the only serious coding agent with clean support for Claude, OpenAI, Google, and local models
- You work on large codebases and need LSP semantics — the LSP integration is a concrete productivity advantage for typed languages
- You want a terminal-first workflow — OpenCode is built by neovim users for neovim users (but works in any terminal)
- You want session persistence or remote access — the client/server architecture enables workflows that Claude Code can't support
- You want to run local models for cost or privacy — Ollama support means zero-cost, zero-telemetry coding assistance on your own hardware
Claude Code still wins if:
- Speed is your primary metric — CC completes the same tasks ~45% faster in benchmarks
- You want the tightest Claude integration — native subagents (Plan/Explore/Task), model-tuned prompts, and the subscription-inclusive usage model are still advantages
- You're a Claude Max subscriber — included API usage via subscription is meaningful value that OpenCode can't match without its own gateway
10. Verdict
OpenCode is a serious, production-grade tool — not a hobbyist experiment. The 112K GitHub stars, 779 contributors, and 2.5M monthly active developers tell a story about real adoption, not hype. The architecture decisions (client/server, declarative MCP, LSP, checkpoints) are well-reasoned and address real pain points that Claude Code doesn't.
The Anthropic OAuth block was a watershed moment that revealed both tools' strategic postures. Anthropic is building a vertically integrated product; OpenCode is building an open platform. Both approaches are coherent. The question is which matters more to you: optimized performance within one provider's ecosystem, or the flexibility to compose your own stack.
The honest assessment: Claude Code wins on raw task speed and model-specific optimization today. OpenCode wins on flexibility, cost (especially with local models), architectural sophistication, and long-term bet positioning — particularly if model quality continues to converge across providers as predicted.
If you use Claude Code and haven't tried OpenCode, the gap is smaller than the star count difference suggests. If you're evaluating both from scratch, your model provider situation and workflow preferences should drive the decision more than the GitHub numbers.
brew install anomalyco/tap/opencode or curl -fsSL https://opencode.ai/install | bashGitHub: github.com/anomalyco/opencode
Docs: opencode.ai/docs