OpenCode vs Claude Code: a practical comparison
October 16, 2026 · Oyren AI Team (AI-written)

OpenCode and Claude Code can both edit a repository and run its checks. The choice starts with the model account, the project instructions each tool loads and the permissions active for that run. Compare those settings on one small task before comparing the patches.
Choose or create a workspace, then select the agents and repositories for the workflow.
Configuration at a glance
| Setting | OpenCode V2 | Claude Code |
|---|---|---|
| SettingModel account | OpenCode V2A configured provider, local model or supported plan sign-in (providers) | Claude CodeAnthropic account, supported plan or API key (setup) |
| SettingModel selection | OpenCode V2/models (models) | Claude Code/model |
| SettingProject instructions | OpenCode V2AGENTS.md (instructions) | Claude CodeCLAUDE.md |
| SettingPermission config | OpenCode V2Ordered permissions rules in opencode.jsonc (permissions) | Claude Codepermissions in .claude/settings.json (permissions) |
| SettingStarting behavior | OpenCode V2Most actions allowed; .env reads ask; external paths are allowed unless a rule changes that | Claude CodeFile edits and shell commands beyond the read-only set ask |
The OpenCode column describes V2. Older V1 guides use a permission object, bash rules and a CLAUDE.md fallback. Those settings should not be copied into a new V2 policy without checking the migration guide.
Models and billing paths
OpenCode's /connect command links a provider or supported account, and /models selects a model available to that project. V2 also documents ChatGPT plan sign-in for supported OpenAI models. A local model, an API key and a plan sign-in can produce different bills even when the OpenCode interface looks the same. Record the provider, model and authentication path for each run.
Claude Code uses an Anthropic sign-in or API key. Its /model command changes the model available through that account. An installed CLI says little about the bill: usage follows the active account and its terms. The Claude cost guide explains the usage records.
Project instructions
OpenCode V2 loads AGENTS.md from applicable project directories. It does not fall back to CLAUDE.md. Claude Code uses CLAUDE.md. A repository used by both tools can keep equivalent guidance in both files, then confirm what each session actually loaded.
The instructions should name the build command, the test command and any excluded operations. A sentence such as "do not push" guides the model; a permission rule controls the tool call. Review generated instruction files before committing them, because a wrong test command can be repeated in every later run.
Permission rules
OpenCode V2 starts with permissive rules. It asks before reading .env files, while access outside the project is allowed by default. A team that wants approval for shell commands, edits and external paths can put ordered rules in opencode.jsonc:
{
"$schema": "https://opencode.ai/config.json",
"permissions": [
{ "action": "shell", "resource": "*", "effect": "ask" },
{ "action": "shell", "resource": "pnpm test *", "effect": "allow" },
{ "action": "shell", "resource": "git push *", "effect": "deny" },
{ "action": "edit", "resource": "*", "effect": "ask" },
{ "action": "external_directory", "resource": "*", "effect": "ask" }
]
}
The shell rules ask for commands by default, allow the test command and deny pushes. edit asks before file changes. external_directory asks before a tool accesses a path outside the project. OpenCode applies the last matching rule, so the narrower shell exceptions follow the broad rule. These permissions govern tool calls; shell commands still run with the host user's authority when allowed.
Claude Code keeps its tool rules in .claude/settings.json. Its default mode asks before file edits and shell commands outside a built-in read-only set. One project can allow its test command and block pushes:
{
"permissions": {
"allow": ["Bash(pnpm test *)"],
"deny": ["Bash(git push *)", "Read(./.env)"],
"defaultMode": "default"
}
}
allow and deny contain Claude tool patterns. defaultMode keeps the ordinary approval behavior for actions without a matching rule. Check the effective settings and sandbox on the execution host before an unattended trial.
One task, two worktrees
Start both agents at the same commit in separate directories. That keeps each patch inspectable and prevents one run from inheriting the other's edits.
BASE=$(git rev-parse HEAD)
git worktree add -b trial/opencode ../trial-opencode "$BASE"
git worktree add -b trial/claude ../trial-claude "$BASE"
git rev-parse HEAD records the starting commit. Each -b creates a trial branch, each ../trial-* names its directory, and "$BASE" puts both branches at that commit. Run the same acceptance command in both directories. Keep production credentials out of the trial and record any access exception.
The comparison record
For each run, save the tool version, model, account path, permission settings, patch, test output, failed attempts and billable usage. Count a task as accepted only after the same repository checks and review. A lower token rate does not establish a lower cost per accepted patch when failed attempts and reviewer time differ.
The AI code review guide covers patch review. The Claude Code, Codex and Gemini CLI comparison covers a wider set of agents. Oyren Codespaces provide a Linux terminal and browser VS Code where both tools can run; model access and Codespace runtime are billed through their respective accounts.
Choose or create a workspace, then select the agents and repositories for the workflow.
Open Codespace setup