opencode or Claude Code: two terminal agents and how they differ

Both read your project, edit files and run commands in the terminal. We compare how they connect to models, where settings live, how agents and MCP work, and what it costs.

5 min · · агенты · сравнение

If you are choosing between opencode and Claude Code, at first glance both do the same thing: read the project, edit files, run commands, all in the terminal. The differences start in the details: which models you can plug in, where settings live, how agents and MCP are set up, and how many tokens get spent. Below is the opencode vs Claude Code comparison on those points, with configurations for working through the Zukko gateway. Information about the tools comes from their official documentation; it changes, so check the current version before setting up.

A short note on each

Claude Code is a terminal agent from Anthropic. It is built for Claude models and speaks the Anthropic format. Anthropic's documentation states that pointing Claude Code at models from other families through gateways is not supported, so use Claude models inside it.

opencode is an open-source terminal agent built on the AI SDK: according to its documentation it supports more than 75 providers, including any OpenAI-compatible API. You can change the model and provider within one program.

Table of differences

Claude Codeopencode
ModelsClaudeAny via providers, including OpenAI-compatible ones
Connecting to a gatewayenvironment variablesthe opencode.json file and the /connect command
Project instructions fileCLAUDE.mdAGENTS.md (also reads CLAUDE.md if there is no AGENTS.md)
Creating the instructions fileby hand or with the /init commandthe /init command
Agentssubagents in .claude/agents/primary agents Build and Plan (switch with Tab) plus subagents
MCPclaude mcp add or .mcp.jsonmcp section in opencode.json, local and remote servers
Hooksyes (PreToolUse and other events)a different mechanism: plugins

Connecting to the gateway

Claude Code

Claude Code reads the address and key from environment variables:

bash
export ANTHROPIC_BASE_URL=https://api.zukko.pro
export ANTHROPIC_AUTH_TOKEN=fetch_your_key
export ANTHROPIC_MODEL=claude-sonnet-5-5
claude

The address here is without /v1: Claude Code adds the path itself. The variable is specifically ANTHROPIC_AUTH_TOKEN. Full instructions are in the Claude Code documentation.

opencode

In opencode, setup goes through opencode.json in the project root (or the global ~/.config/opencode/opencode.json). For Claude models you can override the address of the built-in anthropic provider and take the key from an environment variable:

bash
{
  "$schema": "https://opencode.ai/config.json",
  "model": "anthropic/claude-sonnet-5-5",
  "provider": {
    "anthropic": {
      "options": {
        "baseURL": "https://api.zukko.pro/v1",
        "apiKey": "{env:ZUKKO_API_KEY}"
      },
      "models": {
        "claude-sonnet-5-5": {}
      }
    }
  }
}

Here the address is with /v1: opencode's anthropic provider works through the AI SDK, and without /v1 requests go to the wrong path and return 404. For GPT, DeepSeek or GLM you add a separate provider on @ai-sdk/openai-compatible with baseURL https://api.zukko.pro/v1 and a list of models; the format example is in the opencode docs, Custom provider section. More in the opencode guide and in the article on connecting opencode.

Project instructions and agents

Both have a rules file for the project that enters the context: CLAUDE.md in Claude Code, AGENTS.md in opencode. If a project has only CLAUDE.md, opencode will read it too according to its documentation, so moving between tools does not require rewriting rules. Keep it short: build and test commands, structure, team conventions.

Agents are organized differently. opencode has two built-in primary agents: Build with the full toolset and Plan, where file edits and shell commands require confirmation by default; you switch between them with Tab. Subagents are defined separately and can be invoked with @, and you can define your own agents in opencode.json or markdown files. In Claude Code, subagents are described by files in .claude/agents/ and are invoked by the model itself based on the description. A practical takeaway: if you want different models for different roles (a cheap one for survey, a strong one for edits), in opencode this is set in the agent config through the model field.

MCP

Both connect MCP servers, but differently. In Claude Code it is a command like claude mcp add --transport http <name> <url> for a remote server or an entry in .mcp.json. In opencode a server is described in the mcp section with "type": "local" and a launch command, or "type": "remote" and an address. Keep in mind that every connected server adds tool descriptions to the context, so enable only the ones you need.

What it costs through the gateway

Per-token billing does not depend on the tool, but it does depend on cache. For Claude, the cache discount comes from the Anthropic format (/v1/messages): the gateway sees how much input came from cache. In Claude Code this works by default. In opencode with the anthropic provider, requests also go in the Anthropic format; if you call Claude through an OpenAI-compatible provider, all input is billed at the input price. After the first session check under "Usage" in the dashboard whether tokens landed in cache reads.

An illustration with hypothetical numbers (not a measurement): a session on claude-sonnet-5-5 with 0.5M fresh input, 5M cache reads, 0.4M cache writes and 0.2M output. claude-sonnet-5-5 prices as of October 18, 2026, $ per 1M tokens: input 0.4, cache read 0.05, cache write 0.5, output 2.

  • With cache: 0.5 x 0.4 + 5 x 0.05 + 0.4 x 0.5 + 0.2 x 2 = 0.20 + 0.25 + 0.20 + 0.40 = $1.05
  • If all input is billed at the input price: (0.5 + 5 + 0.4) x 0.4 + 0.2 x 2 = 2.36 + 0.40 = $2.76

Real numbers depend on project size and step count. For estimating a session step by step see the agent session cost calculation.

What to choose

  • Claude only and minimal setup: Claude Code. Three environment variables and it works.
  • Different models for different roles, including GPT, DeepSeek, GLM: opencode.
  • Your team already writes CLAUDE.md: either fits, since opencode reads it when there is no AGENTS.md.
  • You need hooks on tool events: look at Claude Code, but check opencode's plugins.

The best way to decide is a day of work with each on a real task. You can create a key in the dashboard: one key works in both tools.

FAQ

Can I use one Zukko key in both tools?

Yes. Only the setup method changes: environment variables for Claude Code and opencode.json for opencode. The balance is shared.

Does opencode read Claude Code files?

According to opencode's documentation, if a project has no AGENTS.md it uses CLAUDE.md, and it also supports the .claude directory for skills. It can be turned off with an environment variable; check the details in opencode's docs.

Which one is cheaper?

The tool itself costs you nothing; you spend tokens. Spend depends on the model, context size and whether input hits the cache. Compare in the "Usage" section on the same task.

Why does opencode give a 404?

Most often because of the address. For opencode's anthropic provider you need https://api.zukko.pro/v1, while for Claude Code it is https://api.zukko.pro without /v1.

zukko

Pay 25×
less

for Claude Code & ChatGPT

One fetch_* key and base URL api.zukko.pro — for Cursor, Claude Code, Codex, and any SDK.

Get API keyDocumentation

api.zukko.pro · fetch_*

opencode vs Claude Code: terminal agents compared · Zukko