OpenCode vs Claude Code

We make AI Bridge, a Mac app that runs these command-line agents side by side. We do not sell any of them, are not affiliated with their makers, and none of them paid for or reviewed this guide. We use them every day.

Which should you choose?

It depends less on which model is ahead this month than on how you pay for models and how much you want the agent to ask first.

Choose Claude Code if

  • you already pay for Claude Pro, Max or Team: Claude Code is included, with Opus 5.5 as the default model, and OpenCode cannot use that plan;
  • you want stricter defaults: it starts in auto mode, where a classifier reviews each action, and has an operating-system sandbox you can turn on;
  • you want the products around it: the desktop app, Claude on the web, IDE extensions, Slack and Chrome.

Choose OpenCode if

  • you want open source: OpenCode is MIT-licensed, while Claude Code is proprietary;
  • you want to pick the model per task, from 75+ providers or a local model through Ollama, LM Studio or llama.cpp;
  • you pay for ChatGPT Plus or Pro, GitHub Copilot or GitLab Duo and want to use it in a terminal agent;
  • you want open models on a flat monthly fee, through an OpenCode Go subscription.

You do not have to pick only one: since both read AGENTS.md, one set of project instructions works in each.

What is OpenCode?

OpenCode is an open-source AI coding agent for the terminal, also available as a desktop app (in beta) and an IDE extension. It is MIT-licensed, works with models from 75+ providers through the models.dev catalogue, and had about 213,000 stars on GitHub on 12 October 2026. The code lives at github.com/anomalyco/opencode; the old sst/opencode address redirects there. People also search for it as “OpenCode AI”: the site is opencode.ai and the npm package is opencode-ai.

On a Mac, install it with any one of these:

curl -fsSL https://opencode.ai/install | bash
brew install anomalyco/tap/opencode
npm i -g opencode-ai

In our testing, the Homebrew tap above is the one to use: the core brew install opencode formula lagged behind releases.

Two versions at once

OpenCode is shipping two lines in parallel. Version 1, the opencode-ai package, reached 1.19.0 on 11 October 2026. OpenCode 2, a separate @opencode/cli package with its own installer, reached 2.0.27 on 12 October, a month after 2.0.0, and changes how plugins, the server and terminal settings are configured, so 1.x plugins and configs may need work. Both use the opencode command, and OpenCode’s docs say they cannot be installed side by side under it.

The sources we checked disagree on whether OpenCode 2 is now the default or still a beta: the docs announce it as “now available”, while the standard install command and npm package still give you 1.x. Check which one you have before following any guide, this one included. Everything below describes 1.x unless it says otherwise.

OpenCode vs Claude Code at a glance

As of 12 October 2026, from each project’s own documentation:

OpenCode and Claude Code, October 2026
Claude CodeOpenCode
LicenceProprietaryMIT
ModelsClaude only, from Anthropic, Amazon Bedrock, Google Cloud or Microsoft Foundry75+ providers, plus local models
Default modelOpus 5.5None fixed: your config, else the last one you used
Cheapest way inClaude Pro, $20/month (not on Free)Free with your own keys or a local model; or an OpenCode Go subscription
Claude Pro or Max subscriptionYesNo: an Anthropic API key only
Starting permissionsAuto mode: a classifier reviews each actionMost tools allowed; asks for paths outside the project and repeated identical calls
OS sandboxOff by default; /sandbox, shell commands onlyNone documented
Instruction fileCLAUDE.md (reads AGENTS.md too)AGENTS.md (falls back to CLAUDE.md)
Resume a sessionclaude -c, claude -ropencode -c, opencode -s <id>
UndoCheckpoints: /rewind/undo and /redo, through git
Headlessclaude -popencode run
GitHub@claude through its GitHub Action/opencode or /oc in a comment

Claude in OpenCode means an API key, not your subscription

Claude models in OpenCode need an Anthropic API key, paid per token; a Claude Pro or Max subscription cannot be used there. Anthropic’s terms for Claude Code say sign-in with a Claude account is meant for its subscription plans and “native Anthropic applications”, and that Anthropic does not permit third-party developers “to route requests through Free, Pro, or Max plan credentials on behalf of their users”.

OpenCode’s documentation says the same from its side. Plugins that let you use Claude Pro or Max in OpenCode exist, but “Anthropic explicitly prohibits this”, and OpenCode stopped bundling them as of version 1.3.0, released on 22 March 2026. Comparisons written before then may still describe signing in with a Claude plan.

To use Claude in OpenCode today, add a key from the Claude Console:

/connect     # choose Anthropic, then "Manually enter API Key"
/models      # pick a Claude model

That changes the arithmetic. In Claude Code, a plan from $20 a month covers your use up to its limits. Through an API key you pay for every token, at Anthropic’s API rates. So the real choice for Claude-heavy work is a flat monthly plan in Claude Code against metered billing in OpenCode.

Other vendors take a different line. OpenCode lets you sign in with ChatGPT Plus or Pro, GitHub Copilot and GitLab Duo through /connect.

Price and models

Claude Code is a subscription product for one family of models; OpenCode is free software that you point at whichever models you pay for.

Claude Code comes with every paid Claude plan, from Pro at $20 a month; it is not part of Claude’s free plan. Use is metered in a five-hour window plus weekly limits, shared with your Claude chats, and Anthropic publishes no numbers for either. It defaults to Opus 5.5 and takes --model with aliases such as opus, sonnet and fable. Current plans are on Anthropic’s pricing page.

OpenCode itself costs nothing. What you pay for is the models, in one of four ways:

  • Your own keys for any of 75+ providers, or a local model through Ollama, LM Studio or llama.cpp, which costs nothing beyond your hardware.
  • OpenCode Zen, a pay-as-you-go gateway to models the OpenCode team has tested, paid from account credit. Some of its free models say that, during their free period, your data may be used to improve the model.
  • OpenCode Go, a low-cost monthly subscription to a set of open coding models such as DeepSeek, Qwen, GLM and Kimi, with a higher-limit Go Plus tier.
  • A plan you already have: ChatGPT Plus or Pro, GitHub Copilot or GitLab Duo, through /connect.

OpenCode has no fixed default model: it uses the model in your config, otherwise the one you used last. List what your providers offer and pick one per run:

opencode models
opencode -m <provider>/<model>

Permissions and safety: OpenCode asks less

Out of the box, OpenCode lets the agent edit files and run commands without asking, and documents no sandbox. Claude Code reviews each action with a classifier and has a sandbox you can turn on.

In OpenCode every tool resolves to allow, ask or deny. Almost all default to allow, including edits and shell commands; the two that ask are external_directory (paths outside the project) and doom_loop (the same call repeated). Reading .env files is denied by default. Starting with --auto approves anything not explicitly denied. Its Plan agent is the cautious mode: edits and shell commands ask first. To make the default agent ask too, set it in opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "permission": {
    "edit": "ask",
    "bash": "ask"
  }
}

Claude Code has started new terminal and VS Code sessions in auto mode since late September 2026: a classifier reviews each action instead of asking you. Shift+Tab switches to the manual mode that asks first, to accept-edits mode or to plan mode, and deny rules apply in every mode. Its operating-system sandbox is off until you run /sandbox, and then covers shell commands only. Comparisons that say Claude Code asks before every shell command describe its older default. More in Claude Code permissions, explained.

Agents and instruction files

Both split work into a doing mode and a planning mode, and both now read the same instruction file. OpenCode starts in its Build agent, with every tool enabled; Tab switches to Plan, which asks before edits and shell commands. It also ships three subagents: General (full tools), Explore (read-only, for searching the codebase) and Scout (read-only, for researching dependencies and external docs). Claude Code’s equivalents are plan mode, subagents, and the experimental agent teams.

OpenCode’s instruction file is AGENTS.md, which /init writes for you. If a project has no AGENTS.md, it reads CLAUDE.md; if you have no global ~/.config/opencode/AGENTS.md, it reads ~/.claude/CLAUDE.md. It also loads Claude Code’s skills unless told not to. Set OPENCODE_DISABLE_CLAUDE_CODE=1 to turn all of that off.

Claude Code has read AGENTS.md natively when a project has no CLAUDE.md since version 2.1.277 (18 September 2026). So a single AGENTS.md serves both. If a project has both files, each tool reads its own.

Sessions, undo and sharing

Both resume and fork sessions; they differ in how they undo and in how easily a session becomes public. opencode -c continues the last session, opencode -s <id> a given one, and --fork branches it; inside the app, /sessions lists them. opencode export writes a session as JSON. In Claude Code, claude -c continues the last session in the current folder, claude -r opens a picker, and --fork-session branches.

Seen first-hand

OpenCode keeps every session in one SQLite database (since 1.2) rather than a file per conversation, so opencode export is the way to get a copy of one. Resume it with an id that no longer exists and it exits within about two seconds with “Session not found”. And resuming with -s silently drops a --prompt you pass alongside it, so send the prompt once the session is open. Claude Code files each session under the folder it started in and exits on a stale id.

Undo

OpenCode’s /undo removes your last message, the replies and any file changes, and /redo puts them back; both use git, so the project must be a git repository. Claude Code takes a checkpoint before each prompt; /rewind, or Esc twice, restores the code, the conversation or both. It does not track files changed by shell commands, so a rm or mv the agent ran is not undone.

Sharing

OpenCode’s /share creates a link to the session and copies it to your clipboard. Shared conversations are “publicly accessible to anyone with the link”, so treat one like a public gist. Sharing is manual by default; /unshare takes a link down, and "share": "disabled" in your config turns the feature off.

Headless runs, GitHub and plugins

Both run without a person and both answer mentions on GitHub; OpenCode adds a server you can attach to. opencode run takes a prompt non-interactively, opencode serve starts a headless server, opencode web adds a web interface, and opencode attach connects a terminal to a running one. opencode github install sets up its GitHub agent, which answers /opencode or /oc in a comment and runs in your GitHub Actions runners, triaging issues or opening a pull request with a fix. Claude Code runs headless with claude -p and answers @claude through its GitHub Action.

What each tells a tool around it, first-hand

To show whether an agent is working or waiting on you, AI Bridge listens to both. What we saw:

  • OpenCode takes a plugin for one process through the OPENCODE_CONFIG_CONTENT environment variable, merged with your own config, so a tool can add behaviour without editing ~/.config/opencode. Claude Code’s equivalent is passing hooks with --settings for one launch.
  • OpenCode’s event bus reports the states that matter: permission.asked when it is waiting on you, and session.idle or session.error when it is done. But nothing fires for 8 to 10 seconds after it starts, and plugin hooks on tool calls are awaited, so a slow plugin holds up the tool call.
  • Claude Code reports more events, with gaps: permission and idle prompts and every tool call, but nothing for a turn you interrupt with Ctrl-C; a turn that ends on an API error fires StopFailure rather than Stop.

And Codex?

Against Codex, OpenCode’s case is model choice; Codex’s is safety. Both are open source (Codex under Apache-2.0). Codex is OpenAI’s own CLI, included from ChatGPT Plus at $20 a month, and runs in an operating-system sandbox with the network off from the first run, which OpenCode does not offer. OpenCode can sign in with the same ChatGPT Plus or Pro plan and run OpenAI’s models next to anyone else’s, but without that sandbox. How Codex compares with Claude Code, with sources: Codex vs Claude Code.

Where each falls short

Claude Code

  • Claude models only, and not open source.
  • Not on Claude’s free plan, and no published limit numbers on the paid ones.
  • The OS sandbox is off by default and covers shell commands only.
  • Sessions are deleted after 30 days unless you raise cleanupPeriodDays.

OpenCode

  • Claude only through a pay-per-token API key.
  • Permissive defaults and no documented sandbox: set edits and shell commands to ask if that matters to you.
  • Two major versions at once, with breaking changes between them and unclear status.
  • /share makes a session public to anyone with the link, and some free Zen models may use your data.
  • In our testing a resume silently drops a prompt passed with it.

Using both

Running both is straightforward: Claude Code on your Claude plan for Claude models, OpenCode for everything else. One AGENTS.md covers both, and OpenCode will read an existing CLAUDE.md. If they work on the same repository at the same time, give each its own git worktree so they never edit the same checkout; the steps are in how to run several Claude Code sessions at once.

What remains is keeping track of two agents that each stop to ask at different moments. That is what we built AI Bridge for; see how to run several AI coding agents at once.

Questions

What is OpenCode?

An open-source (MIT) AI coding agent that runs in your terminal, with a desktop app in beta and an IDE extension. It works with models from 75+ providers and with local models, and its code is at github.com/anomalyco/opencode.

Is OpenCode free?

The software is free. You pay for the models: your own API keys, pay-as-you-go credit on OpenCode Zen, or an OpenCode Go subscription. Local models cost nothing beyond your hardware.

Can I use my Claude Pro or Max subscription in OpenCode?

No. Anthropic does not permit third-party tools to route requests through Pro or Max credentials, and OpenCode stopped bundling the plugins that did it in version 1.3.0 (March 2026). Use an Anthropic API key, billed per token.

Is OpenCode better than Claude Code?

Neither is better at everything. Claude Code is the way to use a Claude subscription and has stricter defaults; OpenCode is open source and runs almost any model. Most published head-to-heads were run on older versions and models than ship today.

Does OpenCode read CLAUDE.md?

Yes, when a project has no AGENTS.md, and it falls back to ~/.claude/CLAUDE.md for global rules. Set OPENCODE_DISABLE_CLAUDE_CODE=1 to turn that off.

OpenCode vs Codex: which is safer?

Codex, by default: it runs in an operating-system sandbox with the network off. OpenCode allows most tools without asking and documents no sandbox, though you can set any tool to ask or deny.

Sources

Checked on 12 October 2026. These tools change often; where a source and this page disagree, the source is right, and we would like to hear about it at hello@aibridge.sh.

  1. OpenCode repository · github.com · checked 12 Oct 2026
  2. OpenCode docs · opencode.ai · checked 12 Oct 2026
  3. OpenCode providers · opencode.ai · checked 12 Oct 2026
  4. OpenCode permissions · opencode.ai · checked 12 Oct 2026
  5. OpenCode agents · opencode.ai · checked 12 Oct 2026
  6. OpenCode rules (AGENTS.md) · opencode.ai · checked 12 Oct 2026
  7. OpenCode CLI · opencode.ai · checked 12 Oct 2026
  8. OpenCode TUI commands · opencode.ai · checked 12 Oct 2026
  9. OpenCode share · opencode.ai · checked 12 Oct 2026
  10. OpenCode GitHub integration · opencode.ai · checked 12 Oct 2026
  11. OpenCode Zen · opencode.ai · checked 12 Oct 2026
  12. OpenCode Go · opencode.ai · checked 12 Oct 2026
  13. opencode-ai on npm · registry.npmjs.org · 1.19.0, 11 Oct 2026
  14. @opencode/cli on npm · registry.npmjs.org · 2.0.27, 12 Oct 2026
  15. Claude Code legal and compliance · code.claude.com · checked 12 Oct 2026
  16. Claude plans and pricing · claude.com · checked 12 Oct 2026
  17. Claude Code permission modes · code.claude.com · checked 12 Oct 2026
  18. Claude Code sandboxing · code.claude.com · checked 12 Oct 2026
  19. Claude Code checkpointing · code.claude.com · checked 12 Oct 2026
  20. Claude Code changelog · code.claude.com · to 2.1.296, 9 Oct 2026

Change log

  • : First published, against Claude Code 2.1.296, OpenCode 1.19.0 and OpenCode 2.0.27.

Keep reading

Every guide

Almost ready.

AI Bridge is in its last round of testing. Leave your email and we’ll send you the build the day it ships.