Both are terminal agents. Both let you choose who bills you. The difference is what a “provider” is to each one. For opencode a provider is a catalog entry, and the catalog is the whole registry — so one install runs models from several labs. For Claude Code a provider is a base URL that must speak the Anthropic Messages API. The comparisons on this query rank the two on feel and output; this is the fact that decides what you can still do a year from now.
Side by side
| Claude Code | opencode | |
|---|---|---|
| Where it runs | Terminal | Terminal |
| Who makes it | Anthropic | Open source |
| Default billing | Claude subscription, with a usage window | Per token, from the first request |
| Provider model | One base URL, Anthropic protocol | A catalog — providers are entries, protocol travels with them |
| Several labs at once | No | Yes |
| Changing provider | Two environment variables | A config block |
What configuring each actually looks like
# Claude Code — the endpoint is two environment variables, and whatever
# answers there must speak the Anthropic Messages API.
export ANTHROPIC_BASE_URL=https://api.kunavo.com
export ANTHROPIC_AUTH_TOKEN=sk-kn-...
# opencode — the provider is a catalog entry in opencode.json, and the
# protocol travels with it. OpenAI-compatible in this case:
{
"provider": {
"kunavo": {
"npm": "@ai-sdk/openai-compatible",
"options": { "baseURL": "https://api.kunavo.com/v1" },
"models": { "claude-sonnet-4-6": {}, "claude-haiku-4-5": {} }
}
}
}Both are a few lines, and that similarity is the point: the cost conversation around these tools is mostly about the defaults, not about anything inherent. Put both on the same endpoint and the price difference disappears — what is left is how much context each one re-sends per step, which depends on your repo far more than on the tool's name.
The one that is not a preference
If you want a Claude model for the main loop and something cheaper for background work, opencode does that inside one install and Claude Code does not — its cheap tier is a Claude model too (ANTHROPIC_DEFAULT_HAIKU_MODEL), because the socket is Anthropic-shaped. Neither behaviour is wrong; they are different designs. But it is the one difference between these two tools that configuration cannot erase, and no comparison on this query mentions it.
The cost arithmetic for either shape is on what Claude Code costs, and the tier question on Opus vs Sonnet vs Haiku.
Where this page stops
It does not say which writes better code. We have run no controlled comparison of the two on identical tasks, and the occupants of this query that do rank them are ranking impressions from their own use — a legitimate thing to publish, and not a measurement. The version of that experiment worth trusting is yours: put both on the same key, run the same real task, read the diffs and the charges.
Setup for each: opencode with a custom provider and an API key for Claude Code. If you are still surveying the field, Claude Code alternatives separates the tool question from the billing question first.
FAQ
What is the difference between opencode and Claude Code?
Both are agents you run in a terminal, and both can be pointed at a provider you choose. The structural difference is how each treats providers. opencode is provider-agnostic by design — its model catalog comes from the models.dev registry and a provider is a config entry, so one install can run models from several labs side by side. Claude Code is shaped around the Anthropic Messages API: it accepts a custom base URL, but whatever sits at that URL has to speak that protocol. One is a tool with a provider slot; the other is a tool with an Anthropic-shaped socket.
Is opencode cheaper than Claude Code?
Neither runs a model, so neither is cheaper as a tool — the bill comes from the provider each is pointed at, and both can be pointed at the same one. What differs is the default: Claude Code defaults to a Claude subscription with a usage window, while opencode has no subscription at all and is per-token from the first request. If you compare stock configurations that reads as a price difference; if you put both on the same endpoint it disappears, and what is left is how much context each re-sends per step.
Can opencode use Claude models?
Yes. Claude models are ordinary catalog entries for opencode, reachable either through Anthropic directly or through any gateway that serves them, and nothing about the tool prefers one lab. That is the point of its provider model — the same install can run a Claude model for the main loop and something cheaper for background steps, which Claude Code cannot do across labs.
Is opencode a drop-in replacement for Claude Code?
In shape, close: a terminal agent that reads your repo, proposes changes and runs commands, with no editor requirement. In habits, no — the commands, the config file and the approval flow are its own, so there is a day or so of relearning. Whether that is worth it depends on which of the two things you want: if you want the same workflow on a different bill, keeping Claude Code and changing its endpoint is the smaller change; if you want several labs under one tool, that is what opencode is for.
Which one should I pick?
Pick Claude Code if Claude models are what you want to run and you value the workflow and the approval flow it already gives you — and change its endpoint if the subscription's ceiling is the problem. Pick opencode if you want provider choice to be a first-class property of the tool: multiple labs, a catalog rather than a socket, and per-token billing with no plan underneath. Both are reversible in an afternoon, which is a good reason not to over-think it.
What do these tools cost on a custom endpoint?
Whatever the endpoint charges per token — there is no tool fee on either side. On Kunavo that is $1.20 input / $6.00 output per 1M tokens for Claude Sonnet 4.6, and $0.40 / $2.00 for Claude Haiku 4.5, each listed next to the vendor's own price so the comparison is visible rather than asserted. One key works for both tools.