Back to Home

Claude Code Burns 4.7x More Tokens Than OpenCode

Your AI coding agent might be burning tens of thousands of tokens before it reads a single word you type. That is the headline finding from a new measurement taken at the API boundary, and it is a bill you are paying whether you notice it or not.

Researchers put Claude Code and OpenCode on the same model, the same machine, and the same tasks, then spliced a logging proxy between each harness and the model endpoint. The proxy captured the exact JSON payloads each agent emitted — system blocks, tool schemas, and messages — plus the usage blocks the API returned. No estimates, no vendor dashboards: ground truth.

The result was stark. Asked for a one-line reply, Claude Code sent roughly 33,000 tokens of system prompt, tool schemas, and injected scaffolding before the user prompt even arrived. OpenCode sent about 7,000. That is a 4.7x gap on the very first request.

Where the Tokens Actually Go

Tool schemas are the biggest line item for both agents. Roughly 24,000 of Claude Code's ~33,000 tokens are tool definitions — a 27-tool platform bootstrap that includes background agents, cron tasks, monitoring, and push notifications. OpenCode ships ten classic coding tools, and its schemas cost about 4,800 of its ~6,900 tokens.

Strip the tools and the system prompts tell the same story. Claude Code's instruction set weighs in at 26,891 characters, around 6.5k tokens. OpenCode's is 8,811 characters, about 2.0k tokens. Even with tools disabled, Claude Code's instruction set is over three times the size — most of it behavioural doctrine: tone rules, safety guidance, task-management instructions, and environment descriptions.

The gap widens fast in real-world setups. A production repository's 72KB instruction file (AGENTS.md or CLAUDE.md) adds an average of 20,000 tokens to every single request. Five modest MCP servers add another 5,000 to 7,000. A normal working configuration is already 75,000 to 85,000 tokens deep before you type your first word.

Then there is caching. OpenCode's request prefix was byte-identical in every captured run, so it paid to cache its payload once per session and read it back for pennies. Claude Code rewrote tens of thousands of prompt-cache tokens mid-session, and on the same task wrote up to 54x more cache tokens than OpenCode. Cache writes are billed at a premium — that is why usage dashboards climb so fast with Claude Code.

What This Costs You in Practice

On a simple read-and-summarize task, Claude Code took 6 HTTP requests and roughly 199,000 cumulative input tokens. OpenCode took 4 requests and roughly 41,000, plus one small side call for session titling. A 33k-token baseline means every turn starts a sixth of the way into a 200k context window before any of your code enters the conversation.

Fan-out makes it worse. One small task that cost 121,000 tokens when done directly ballooned to 513,000 tokens when fanned out to two subagents, because each subagent re-reads its own system prompt and tools on every turn it takes.

Before you switch tools, one honest caveat: on a multi-step write-run-test-fix loop, Claude Code's whole-task total actually came out lower, because it batches tool calls into fewer requests while OpenCode re-pays its smaller baseline turn after turn. And on a newer model, the same task took twice the requests and cost roughly 298,000 tokens against OpenCode's 133,000. The meter starts higher; how the session unfolds decides who spends more.

How to Cut Your Own Token Waste

You do not need to wait for the next agent release to trim your bill. Run through this checklist:

  • Audit your instruction file: a 72KB AGENTS.md adds ~20,000 tokens per request. Keep only rules that change behaviour, and move reference material out of the prompt.
  • Count your MCP servers: five modest servers add 5,000 to 7,000 tokens a request. Disable any you do not use daily.
  • Watch cache writes, not just input tokens: a harness that rewrites its cache prefix every turn pays premium rates. Prefer agents with byte-stable prefixes.
  • Batch deliberately: if your agent serializes one tool call per turn, it re-pays its baseline every turn. Group operations where the harness supports it.
  • Measure, don't guess: put a logging proxy between your agent and the model endpoint, capture one request, and read the token breakdown.

If you operate agentic AI in production, this is not just a cost question. Under the EU AI Act's Article 12, you are expected to log and understand what your system actually sends. "What does my agent send?" is a question you should be able to answer with data.

The takeaway is simple: small-baseline agents like OpenCode are cheaper for quick, interactive work, while aggressive batching lets a larger-baseline agent like Claude Code win on long multi-step jobs. Measure your own workload, and pick the harness that matches it.

Comments

No comments yet. Be the first to share your thoughts!