Strategy & GuidesFIELD NOTE · 16 MIN

OpenCode vs Claude Code, Stop Choosing

OpenCode vs Claude Code, measured not argued: what the free alternative really costs since Anthropic closed subscription OAuth, and why we run both instead of choosing.

AITerm 16 min read

OpenCode is an MIT licensed, model agnostic coding agent running 75+ providers, while Claude Code is Anthropic's own harness, tied to Claude. Since Anthropic restricted subscription OAuth to its own clients in 2026, the honest answer to the comparison is not one or the other. It is both, on different tasks, in one window.

Updated August 31, 2026 · by the AITerm team

410 MB

six OpenCode sessions on our M2 Air, because one server carries all six and the clients are thin

2.3 GB

six Claude Code sessions on the same machine, same repo, before a single MCP child process

0.4 s

to re-attach an OpenCode session against 2.8 s to rehydrate a long Claude Code one

Key takeaways

  • The whole "free alternative" framing died on April 4, 2026. Your Claude subscription no longer authenticates third party tools, so OpenCode plus Claude means an API key and metered billing.
  • OpenCode runs one persistent server with thin clients. Claude Code runs one process per session. At six sessions that is 410 MB against 2.3 GB on the same laptop.
  • Claude Code wins the cold start, OpenCode wins the re-attach. Nobody publishes either number, so we measured both.
  • Claude Code's real moat is the ecosystem: checkpoints, plugins, hooks. OpenCode's real moat is a documented HTTP API and 75+ providers.
  • Every article on this query treats it as a binary. The developers we watch run both, and the switching cost is a pane, not a migration.
  OpenCode Claude Code
LicenceMIT, source availableProprietary, Anthropic
Models75+ providers, local models includedClaude only
ArchitectureOne HTTP server, many thin clientsOne process per session
RAM, six sessions~410 MB measured~2.3 GB measured
Session survives a dropped SSHYes, the server owns itNo, resume from disk instead
Undo a bad editGit, like everyone elseAutomatic checkpoints, double Escape
Extend itPlugins, documented HTTP API, SDKsPlugins bundling skills, subagents, hooks
Use a Claude subscriptionNot permitted since April 2026Yes, that is the point of it
Entry cost$0 for the agent, tokens metered$20 / mo Pro, $100 or $200 Max

So, that table settles the specifications and none of the questions you actually have. In practice, the three rows that decide it are architecture, subscription access and cost, and no feature comparison on this query prices any of them.

Is OpenCode as good as Claude Code?

For the core job, driving a frontier model through your repository, close enough that the harness stops being the deciding variable. Both read files, run commands, and iterate on what comes back. The measurable gap is ecosystem, not capability: Claude Code was authoring roughly 4 percent of all public GitHub commits by February 2026, peaking near 326,000 in a single day that March.

Look, capability parity is not a compliment to either side. It means the model is doing the work and both harnesses are competent plumbing. Once you accept that, the interesting questions change.

Claude Code's advantage is the stuff around the agent. Checkpoints snapshot state before every change, so a double Escape rewinds a bad run. Plugins bundle skills, subagents, slash commands and hooks into one installable unit, and hooks fire around session start, tool calls and stop events.

OpenCode's advantage is that nothing is closed. MIT licence, 75+ providers, local models, and a documented HTTP API with generated SDKs. In practice that matters most to two groups: teams with a compliance rule that forbids sending code to a vendor, and people building their own tooling on top of an agent.

You're probably thinking that a feature table settles this. It does not, because the two lists barely overlap. Ask which list you will actually touch this quarter, and the answer usually arrives in about four seconds.

Is there a free alternative to Claude Code?

Yes, and OpenCode is the one people mean. It is genuinely free software: MIT licensed, zero install cost, no seat, no account.

The agent is free. The inference is not, and that is where every article on this query goes quiet.

Here's the thing. Unless you are running a local model on hardware you already own, "free agent" just relocates the bill from a subscription line to a token meter. So the real comparison is a flat monthly fee against metered usage, and metered only wins in two cases.

Path What you pay When it is the right call
OpenCode + local model$0 in tokens, your electricity and your GPUAir gapped work, or a machine that is already idle overnight
OpenCode + your own API keysProvider rates, no markup from the harnessLight or spiky usage, or you want to switch model weekly
OpenCode Go$10 / mo for curated open weight modelsYou want a cap and you do not need a frontier model
OpenCode ZenPre-paid balance, zero markupYou want curated coding models without picking providers
Claude Code$20 Pro, $100 or $200 MaxDaily heavy use where a predictable bill is worth more than choice

Opinion

For a developer using an agent every working day, OpenCode is usually the more expensive option, not the cheaper one. Metered frontier tokens beat a 20 dollar subscription only if you barely use them. "Free" describes the licence, and the licence is not the line item that hurts.

And yes, that cuts against most of what ranks on this query today. The pages promising a free replacement were largely written when a workaround existed, which brings us to the part that dated all of them at once.

Can you use Claude with OpenCode?

With an API key yes, with your Claude subscription no. Anthropic's terms restrict Claude Free, Pro and Max OAuth tokens to Claude Code and Claude.ai. Server side safeguards landed on January 9, 2026, returning 403s to third party clients, and full enforcement started on April 4, 2026.

Honestly, this single change rewrote the whole comparison and most of the internet has not caught up. A pile of community plugins existed for exactly this: bridge a Max seat into OpenCode, get frontier Claude models inside an open harness, pay nothing extra. That was the actual meaning of "free alternative" for a lot of people.

Anthropic offered a one time credit worth a month of subscription and some discounted usage bundles. Fine. It does not change the arithmetic going forward.

The trap

Any guide still telling you to log into OpenCode with your Claude account is describing a route that is both blocked and against the consumer terms. Plugins that scrape credentials out of a Claude Code install are the same route wearing a hat. If you want Claude inside OpenCode, use an Anthropic API key and accept that you now have two bills.

So, the practical shape of a two agent setup changed. You keep Claude Code for Claude, because that is the only supported way to spend a subscription on it, and you point OpenCode at everything else.

That is not a compromise. It is the configuration that survives contact with the terms of service.

One server against one process per session

This is the difference nobody quantifies, and it decides how many agents your laptop can actually hold. OpenCode runs a persistent local server, historically TypeScript on Bun with Hono, listening on port 4096, and every interface is a client of it over HTTP and server sent events. Claude Code runs a full process per session.

We measured both on the same MacBook Air M2 with 16 GB, same repository, sessions doing sustained work rather than sitting idle.

RESIDENT MEMORY BY CONCURRENT SESSIONS, M2 AIR 16 GB, SAME REPO Claude Code · 1 380 MB OpenCode · 1 330 MB Claude Code · 3 1.2 GB OpenCode · 3 370 MB Claude Code · 6 2.3 GB OpenCode · 6 410 MB CLAUDE CODE FIGURES EXCLUDE MCP CHILD PROCESSES. OPENCODE = ONE SERVER PLUS ~13 MB PER GO TUI CLIENT. SUSTAINED WORK IN EVERY SESSION, NOT IDLE. MEASURED ON OPENCODE V1.
One curve is flat because the server is shared. The other is linear because each session is a whole runtime.

Turns out the exclusion in that footnote is the important part. Claude Code spawns MCP servers per session, so N sessions with M configured MCP servers produce up to N times M node processes with no memory cap. The public issue tracker has a report of 15 concurrent sessions and 34 configured MCP servers triggering a hardware watchdog kernel panic twice in one evening on a 64 GB MacBook Pro.

Fair question: if OpenCode shares one server, why is 410 MB not closer to 330? Because each session still holds its own conversation state in that server, and each Go TUI client costs about 13 MB. The growth is real, it is just sublinear instead of linear.

So here is the admission. We instrumented the wrong half.

When we built per session memory readouts into AITerm, we counted the agent process and shipped it, and the numbers looked reassuring for weeks. The MCP children were where the memory actually went, and our own panel was hiding it from us. We rewrote the collector to walk the process tree.

The practical ceiling on a 16 GB Mac, with a browser and a build running, is around four Claude Code sessions before the machine starts swapping. With OpenCode we stopped counting at ten, because RAM was no longer the thing that broke first. Our anonymous daily ping puts the median user at three simultaneous agent sessions, which fits comfortably either way, and that median is climbing.

The harness latency nobody measures

Every comparison on this query benchmarks models and prices, and none of them time the harness itself. That is a mistake, because you pay harness latency dozens of times a day and model latency only once per turn. We timed both from command to interactive prompt, averaged over ten launches on the same repository.

COMMAND TO INTERACTIVE PROMPT, MEAN OF 10 LAUNCHES opencode, attach 0.4 s claude, cold start 1.5 s opencode, cold start 2.3 s claude, long resume 2.8 s SAME REPO, SAME MACHINE, WARM DISK CACHE. THE SERVER MODEL WINS RE-ATTACH, THE PROCESS MODEL WINS COLD BOOT.
Neither harness is fast at everything. They are fast at opposite moments, which is a better reason to keep both than any feature table.

Read the two extremes together. Claude Code boots faster from nothing because there is nothing to boot but itself. OpenCode re-attaches almost instantly because the work never stopped: the server owns the session, so a dropped SSH connection, a closed lid or a killed terminal does not end it.

In practice that asymmetry maps onto how people actually work. Short throwaway questions favour a fast cold start. Long running refactors that you walk away from favour a session that survives you walking away.

And this is the point where we are supposed to tell you the terminal is the bottleneck. It usually is not. The harness numbers above dwarf anything the emulator contributes, and we would rather say that plainly than pretend otherwise.

Where the terminal does start costing you is at six panes streaming output at once, when a web stack renderer queues your keystrokes behind the paint. That is the specific problem AITerm exists to not have, and it is a narrower claim than the one we could make here.

Running both, the setup we actually use

Two agents, one project, four panes, and no tab hunting. The switching cost people imagine, two configs, two auth flows, two mental models, is real for about one afternoon and then disappears. What remains is one server you leave running and one process you start per question.

# pane 1, the OpenCode server. Start it once, leave it up all day.
opencode serve --port 4096

# pane 2, the long job. Detach, close the lid, come back, it is still there.
opencode

# pane 3, a second client on the same server. Costs ~13 MB, not another runtime.
opencode

# pane 4, Claude Code, where we want the model to argue back.
claude

In practice, the rule we settled on is boring and it holds. Anything where being wrong is expensive goes to Claude Code, because checkpoints mean a bad run costs a double Escape rather than a git surgery session. Anything long, mechanical and interruptible goes to OpenCode, because the session outlives the terminal.

Honestly, the hardest part was not technical. It was remembering which pane held which agent, which is a status problem rather than a tooling one.

Concretely: our last sweep across the seven localisation files in AITerm, adding and reconciling keys for a shipped feature, ran in an OpenCode session for most of an afternoon while we reviewed a migration in a Claude Code pane beside it. Neither agent waited on the other. That is the entire pitch for running both, and it is a scheduling argument rather than a quality one.

An AITerm window with several native macOS panes running OpenCode and Claude Code sessions on the same project, with per-session status colours in the sidebar and live quota gauges
The reason the two agent setup is cheap is that the panes are native and the status is visible. Hunting for which tab is waiting on you is what makes it expensive.

Which one for which task

Five splits, taken from how we actually route work rather than from a feature matrix. None of them is about which agent is smarter, because on the same model they are not meaningfully different.

01

Risky refactors go to Claude Code

Automatic checkpoints turn a wrong turn into two keystrokes. On a branch you have not committed in an hour, that is worth more than model choice.

02

Long unattended runs go to OpenCode

The server owns the session. Close the terminal, lose the SSH tunnel, sleep the machine, then re-attach in 0.4 seconds and read what happened.

03

Anything that cannot leave the building

OpenCode by default, because a local model is a supported configuration. Claude Code cannot do this at all, and no amount of preference changes that.

04

Team conventions go to Claude Code

The plugin format bundles skills, subagents, slash commands and hooks into one versioned thing you can hand a colleague. That distribution story has no equivalent yet.

05

Agents inside your own tooling

OpenCode publishes an HTTP API with generated SDKs, so your internal dashboard is another client. Building against a documented server beats scripting a TUI.

And yes, one caveat, because it is the kind of thing that quietly invalidates an article like this one. OpenCode 2.0 moves the server from Bun to Node, partly to fix memory behaviour, and the desktop client from Tauri to Electron for rendering consistency.

The one server architecture survives that move. The specific RAM figures above do not, and we will re-measure when V2 is the default.

The short version: stop treating this as a fork in the road. One of these agents is a subscription with excellent guardrails, the other is a server you can point anywhere, and they cost about one pane each to run side by side. Now go try it.

Going further

PILLAR

AI coding agents compared

The full field, benchmarked on our own repo instead of on leaderboards.

COMPARISON

Codex vs Claude Code

The same "run both" argument, applied to the other pairing we use daily.

PARALLELISM

Six worktrees, four paid off

What running several agent sessions costs in machine, merge time and attention.

TOOLS

Vibe coding tools that ship

Where terminal agents sit next to the browser based tools people try first.

PRODUCT

Piloting agents, not tabs

Live per session status for both agents, so you see which one is waiting on you.

SPEED

Why the panes stay fast

Native rendering, an 8 MB binary, and what that buys at six streaming sessions.

Sources

  1. Using Claude subscriptions with third party tools, Anthropic Support, 2026: the statement that Claude Free, Pro and Max OAuth authentication is intended for Claude Code and Claude.ai only, and that use in any other product or service violates the Consumer Terms.
  2. Anthropic clarifies ban on third-party tool access to Claude, The Register, 2026: independent coverage of the policy clarification and of the developer reaction to losing subscription backed access in open harnesses.
  3. Anthropic officially bans subscription authentication for third-party Claude use, AlternativeTo, 2026: the enforcement timeline used here, server side safeguards on January 9, 2026 and full enforcement on April 4, 2026, plus the one month credit offered as compensation.
  4. OpenCode Developer Guide, Developers Digest, 2026: the architecture facts cited here, TypeScript server on Bun with Hono, Bun.serve on port 4096, TUI and desktop and IDE and SDK all as HTTP plus SSE clients, MIT licence, 75+ providers and the 160K+ star count.
  5. How coding agents actually work, inside OpenCode, Moncef Abboud, 2026: the source level walkthrough confirming that launching OpenCode spawns two processes, a JavaScript backend server and a separate Go TUI, and that sessions survive terminal disconnects.
  6. Migrate from V1, OpenCode docs, 2026: the official V2 migration notes, including that supported V1 configuration keeps working.
  7. Moving OpenCode desktop to Electron, Brendan Allan, 2026: the first hand account of the Tauri to Electron switch and the rendering consistency reasoning behind it, alongside the Bun to Node server migration.
  8. Multiple concurrent sessions multiply MCP server processes without memory limits, anthropics/claude-code issue 45880, 2026: the N sessions times M MCP servers process multiplication, uncapped memory, and the 15 sessions with 34 MCP servers kernel panic report on a 64 GB MacBook Pro.
  9. Memory leak, claude process reaches 18GB private memory in a long session, anthropics/claude-code issue 33735, 2026: per session memory growth during extended use, and the stabilisation target the reports measure against.
  10. I built a zombie process killer because Claude Code ate 14GB of my RAM, The Stack, 2026: the child process tree behaviour, including MCP servers that outlive the session they belonged to.
  11. Zen and Go, OpenCode docs, 2026: the two first party paid paths used in the cost table, Zen as a zero markup pre-paid balance over curated coding models and Go at 10 dollars per month over curated open weight models.
  12. Best AI coding agent, ranked by Terminal-Bench, price and source, Morphllm, 2026: the benchmark positions referenced here, Claude Code leading SWE-bench Verified across the Opus 4.x line and Codex holding the Terminal-Bench record for shell heavy work.
  13. Claude Code statistics, Gradually, 2026: the adoption figures used in the opening section, roughly 4 percent of all public GitHub commits by February 2026 and a single day peak near 326,000 commits in March 2026.
  14. OpenCode vs Claude Code, after 100 hours of usage, Composio, 2026: the most cited hands on comparison on this query, and the reference point for the binary framing this article argues against.
  15. OpenCode vs Claude Code, which agentic tool should you use, DataCamp, 2026: the feature level comparison covering checkpoints, plugins and provider coverage on both sides.

Frequently asked questions

Is OpenCode as good as Claude Code?

For driving a frontier model through your repository, close enough that the harness stops being the deciding variable. Both read files, run commands and iterate on the result. Claude Code is ahead on polish and ecosystem: automatic checkpoints you rewind with a double Escape, a plugin format that bundles skills, subagents, slash commands and hooks, and event hooks around every tool call. OpenCode is ahead on freedom: MIT licensed, 75+ providers, local models, and a documented HTTP API that lets you build your own client. Pick on which of those two lists you will actually use.

Is there a free alternative to Claude Code?

OpenCode is the one people mean, and it is genuinely free software: MIT licensed, zero install cost, no seat. The agent is free, the inference is not. Unless you run a local model on your own hardware, you pay per token to whichever provider you point it at, which for a working developer usually lands above the 20 dollar Claude Pro line rather than below it. The honest framing is not free against paid. It is a flat subscription against metered tokens, and metered wins only when your usage is genuinely light or your models are genuinely local.

Can I use Claude with OpenCode?

Yes with an Anthropic API key, no with your Claude subscription. Anthropic's terms restrict Claude Free, Pro and Max OAuth tokens to Claude Code and Claude.ai, server side safeguards landed on January 9, 2026, and full enforcement started April 4, 2026. Community plugins that bridged a Max seat into OpenCode were the main reason people called it free, and that route is closed. Point OpenCode at Anthropic through an API key and you are on usage based billing, which is a different budget from your subscription.

What language is OpenCode written in?

The server is TypeScript, historically on the Bun runtime with the Hono framework, and the terminal client is a separate Go process. Launching OpenCode starts both: a local HTTP server, by default on port 4096, and a TUI that talks to it over HTTP and server sent events. The desktop app, IDE extensions and the SDK are all clients of that same server. OpenCode 2.0 moves the server from Bun to Node and the desktop client from Tauri to Electron, so the language answer stays TypeScript while the runtime underneath it changes.

Is Claude Code still the best coding agent?

On measured adoption it is still the one to beat, and on benchmarks the top spot now changes hands often enough that the harness matters more than the ranking. Claude Code was authoring roughly 4 percent of all public GitHub commits by February 2026, peaking near 326,000 commits in a single day that March. On the leaderboards it and Codex trade the lead depending on which suite you read, with Claude stronger on harder multi file problems and Codex holding the Terminal-Bench record for shell heavy work. Rankings move every few weeks, your workflow does not, so optimise for the harness you will still like in six months.

Which is better for coding, OpenAI or Claude?

They win different halves of the job, which is exactly why we stopped picking one. Claude models lead on multi file reasoning and on pushing back when a brief is wrong, and they top SWE-bench Pro style tests on harder real world problems. OpenAI models lead on long command line chains and hold the Terminal-Bench record. In practice the split we use is judgement work to Claude, long mechanical runs to whichever model is cheapest that week, and OpenCode is what makes the second half swappable.

Is there anything better than Claude Code?

Better at what it does, not yet. Better for specific constraints, often. If you need local or self hosted models for compliance, OpenCode or a similar open harness is strictly better because Claude Code cannot do it at all. If you want one bill instead of per token billing, Claude Code wins. If you want to embed an agent in your own tooling, OpenCode's documented HTTP API is the shorter path. The question is never which agent is best in the abstract, it is which constraint you are actually solving for.

Related articles