OpenCode vs Claude Code: Open-Source Agent or Anthropic’s Own
OpenCode is an MIT-licensed coding agent that runs any of 75-plus model providers from a terminal, desktop app, IDE or browser. Claude Code is Anthropic’s agent for Claude models. How they differ on models, config, agents, permissions, MCP and clients, what the docs say about using Claude in OpenCode, and who each suits.
7 min read
OpenCode is an open-source coding agent, MIT-licensed and maintained by Anomaly, that works with whichever model you connect: Anthropic, OpenAI, Google, dozens of other providers or a local model. Claude Code is Anthropic’s own agent for Claude models, distributed as a binary under Anthropic’s terms. They feel similar in a terminal, and OpenCode even reads CLAUDE.md when it finds no AGENTS.md. The real differences are model choice, default permissions, licence and how you can use Claude models: in OpenCode that means an API key or a cloud provider, not your Claude Pro or Max subscription.
What OpenCode is
The OpenCode docs (opens in a new tab) describe an open-source AI coding agent available as a terminal interface, a desktop app or an IDE extension, and the site is published by Anomaly. It installs with a script, npm i -g opencode-ai, Homebrew, Chocolatey, Scoop or Docker. Run /connect to add a provider, then /init in a project to have it write an AGENTS.md you commit.
curl -fsSL https://opencode.ai/install | bash cd my-project opencode # inside the TUI: /connect /init
Claude Code installs the same way, with a native installer, Homebrew or WinGet, and signs in with a Claude Pro, Max, Team, Enterprise or Console account, or through Amazon Bedrock, Google Cloud or Microsoft Foundry.
Models and providers
OpenCode uses the AI SDK and Models.dev to support more than 75 providers and local models, and /models switches between them mid-session. Its own OpenCode Zen is a curated list of models, and its providers page says ChatGPT Plus, GitHub Copilot and GitLab Duo subscriptions work without extra setup. Claude Code runs Claude models. It can be pointed at other endpoints, but Anthropic does not support that; see Claude Code with Ollama.
Using Claude models in OpenCode
This is where people get caught out. OpenCode’s providers page (opens in a new tab) says there are plugins that let you use Claude Pro or Max models in OpenCode, that “Anthropic explicitly prohibits this”, and that OpenCode stopped bundling those plugins as of version 1.3.0. The supported route is an Anthropic API key from the Claude Console, entered through /connect, or Claude models through Amazon Bedrock, Google Vertex AI or a gateway such as OpenRouter.
Anthropic’s side is on its legal and compliance page (opens in a new tab): subscription sign-in is designed for ordinary use of Claude Code and Anthropic’s own apps, developers building other products should use API keys, and third parties may not route requests through Free, Pro or Max credentials. If you want Claude on a subscription, Claude Code is the product for it. If you want Claude inside OpenCode, budget for API usage.
Config and agents
OpenCode reads opencode.json or opencode.jsonc: a global one in ~/.config/opencode/, one in the project root, and others from managed or remote sources, merged so later sources override earlier keys. Claude Code has the same idea with settings.json at user, project and local scope.
OpenCode’s agents documentation describes two primary agents you switch between with Tab: Build, with full tool access, and Plan, where edits and shell commands ask first. Subagents such as General, Explore and Scout are called automatically or with an @ mention, and your own agents are Markdown or JSON in .opencode/agents/ with their own model, prompt and permissions. Claude Code’s equivalents are plan mode and subagents in .claude/agents/.
Default permissions
The two start from opposite ends. OpenCode’s permissions page (opens in a new tab) says most permissions default to allow, including edits, shell commands and web fetches. It denies reading .env files, and asks when a tool reaches outside the project or repeats the same call three times. Each can be set to allow, ask or deny, with patterns, and the last matching rule wins, so put the catch-all first.
Claude Code now starts terminal and VS Code sessions in auto, where a classifier approves most actions and stops risky ones; in Manual it asks before most edits, commands and network access. If you move from Claude Code to OpenCode, set permissions before the first session; if you move the other way, check which mode you start in and add allow and deny rules for what you trust.
{
"$schema": "https://opencode.ai/config.json",
"permission": {
"edit": "ask",
"bash": { "*": "ask", "git status *": "allow", "npm test *": "allow" }
}
}Instruction files
OpenCode’s rules page (opens in a new tab) says it reads AGENTS.md walking up from the current directory, then ~/.config/opencode/AGENTS.md, and falls back to CLAUDE.md and ~/.claude/CLAUDE.md for Claude Code compatibility; OPENCODE_DISABLE_CLAUDE_CODE=1 turns that off. Extra files, even remote URLs, go in instructions. Claude Code reads CLAUDE.md and falls back to AGENTS.md. So a repository with an AGENTS.md and a short CLAUDE.md that imports it serves both; AI context files compared has the details.
MCP
OpenCode lists MCP servers under an mcp key in opencode.json: type: "local" with a command array, or type: "remote" with a url and optional headers. opencode mcp auth <name> signs in to OAuth servers. Claude Code uses claude mcp add and a project .mcp.json. The same remote server works in both.
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"fenbs": { "type": "remote", "url": "https://fenbs.ai/api/mcp", "enabled": true }
}
}The TUI and other clients
OpenCode is built as a client and a server. Running opencode starts both, and the terminal interface is a client of that server. opencode serve runs the server headless with an OpenAPI 3.1 spec, opencode web opens it in a browser, opencode attach connects a terminal to a running one, and opencode run takes a prompt non-interactively for scripts. That is what lets one session be driven from several places, or from your own code.
Claude Code runs in the terminal, VS Code and JetBrains, the Claude desktop app and the web, with claude -p for scripts; the surfaces are compared in Claude Code desktop vs CLI vs VS Code.
Licensing
The OpenCode repository (opens in a new tab) is MIT-licensed: you can read, fork and modify it, and Kilo Code’s CLI is one such fork. Claude Code’s public repository holds plugins, examples and issues, and its licence reserves all rights under Anthropic’s commercial terms. That matters if you need to audit the agent, run a patched build, or ship it inside your own product.
Who each suits
- You want to switch models freely, use local models, or use an existing ChatGPT or Copilot subscription: OpenCode.
- You want Claude on a Pro or Max subscription: Claude Code. OpenCode’s docs say that is not permitted there.
- You need the agent’s source, or a permissive licence to build on: OpenCode.
- You want an agent that asks first by default and a vendor that supports both model and tool: Claude Code.
- You want to drive the agent from your own programs over HTTP: OpenCode’s server; Claude Code’s answer is
claude -pand the Agent SDK.
Weighing OpenCode against Codex instead? Codex CLI is open source too, under Apache-2.0, but signs in with ChatGPT and sandboxes commands by default; the terminal agents are compared in Gemini CLI vs Claude Code vs Codex CLI.
The work stays on the board
Whichever you run, and whichever model sits behind it this week, the tasks do not have to move. With the mcp entry above, run opencode mcp auth fenbs to sign in; Claude Code takes claude mcp add --transport http fenbs https://fenbs.ai/api/mcp. Both then read and move tasks under your role, and fenbs records every change in History under the assistant’s name, on your behalf. A browser sign-in gets an hour-long access token that refreshes; a token issued by hand under Settings carries a name, scopes and an optional expiry. Revoking either stops that assistant and leaves your own sign-in alone.
Related
Connect Claude Code: the Claude Code integration. The tools the board exposes: the MCP docs. The Kilo Code side of the family: Cline, Roo Code and Kilo Code vs Claude Code. Running several agents on one repository: orchestrating coding agents.