DEV Community

Kunal
Kunal

Posted on • Originally published at kunalganglani.com

OpenCode vs Claude Code Token Overhead: 4.7x Gap Tested [2026]

Originally published at kunalganglani.com — read it there for inline code, hero image, and live links.

OpenCode vs Claude Code token overhead cost is the difference between a 7,000-token harness and a 33,000-token harness wrapping every single request you send to an LLM. That 4.7x gap was measured empirically by the Systima Applied Research team on July 12, 2026, and it explains why your Claude Code usage dashboard climbs so fast. Teams running 50+ requests per developer per day are quietly hemorrhaging hundreds of dollars a month on cache writes alone.

Key takeaways

  • Claude Code injects approximately 33,000 tokens of system prompt, tool schemas, and scaffolding before your prompt is even read. OpenCode injects roughly 7,000 — a 4.7x baseline difference on identical tasks.
  • Claude Code wrote up to 54x more cache tokens than OpenCode on the same task, because its prefix changes mid-session, forcing repeated premium-priced cache writes.
  • A production repository with a 72KB AGENTS.md file and five MCP servers adds 25,000–27,000 tokens on top of the baseline harness — turning every request into a 60,000+ token payload.
  • Aggressive context engineering (model tiering, MCP schema optimization) saves roughly 16% on real tasks. Agentic loop retries can multiply costs by 100x.
  • OpenCode supports 75+ LLM providers including Claude Fable 5, meaning you get the same model quality with dramatically lower harness overhead.

The Systima benchmark dropped one day ago and immediately hit #2 on Hacker News with 626 points and 334 comments. Claude Fable 5 went GA on June 9, 2026 — just five weeks ago — making this the most expensive era to be running a bloated harness. Nobody in the existing coverage translates the raw token data into dollar-denominated team costs. That's what this post does.

The harness tax you don't see is the one that bankrupts your AI budget.

Why Measure Token Overhead at All

Most developers think about LLM cost in terms of their prompts. How long is my question? How big is the file I'm pasting in? That mental model is wrong.

The harness — system prompt, tool schemas, instruction files, scaffolding that your coding agent injects before your prompt — is often larger than the prompt itself. Unlike your prompt, you don't control it. You don't see it. You just pay for it.

The Systima team's methodology was straightforward: run both Claude Code and OpenCode (the open-source AI coding agent from Anomaly, formerly SST) against the same model, on the same machine, with the same tasks. Capture every token sent and received. No synthetic benchmarks, no cherry-picked prompts. Just raw HTTP traffic analysis.

This matters more than ever because AI coding tools are shifting from flat subscriptions to consumption-based pricing. The gap between a lean harness and a bloated one now translates directly to invoice line items. I learned this firsthand profiling the multi-agent publishing pipeline that runs this blog. When I broke down our 7-agent system, I found that model-per-job-shape allocation (Sonnet for tool loops, Opus for prose) beat one-model-everywhere on both cost and quality. The harness overhead was the variable I hadn't been watching closely enough.

The Baseline Floor: 33k vs 7k Tokens Before Your Prompt

Here's what the Systima benchmark found when both tools were asked for a simple one-line reply — the absolute minimum task:

Dimension Claude Code OpenCode Difference
Baseline tokens (before user prompt) ~33,000 ~7,000 4.7x
Cache tokens written (same task) Up to 54x more Baseline 54x
AGENTS.md overhead (72KB file) +20,000 tokens +20,000 tokens Equal
5 MCP servers overhead +5,000–7,000 +5,000–7,000 Equal
Cache prefix stability Changes mid-session Byte-identical Critical
Model support Claude models only 75+ providers Flexibility

The 33,000-token floor in Claude Code comes from three sources: a large system prompt defining the agent's behavior, tool schemas for every built-in capability (file reading, writing, terminal execution, search), and injected scaffolding that frames the conversation. OpenCode accomplishes the same functional surface with approximately 7,000 tokens.

Both numbers are pure overhead — they exist before a single character of your actual question reaches the model. But 7,000 tokens of overhead on a 2,000-token prompt is a 3.5x multiplier. 33,000 tokens of overhead on the same prompt is a 16.5x multiplier. At scale, that difference stops being theoretical real fast.

Cache Economics: Cache Write vs Cache Read Cost Explained

Prompt caching is how Anthropic's API avoids reprocessing the same token prefix on every request. According to Anthropic's official documentation, you can cache prompt prefixes using cache_control breakpoints with either 5-minute or 1-hour TTLs.

Three pricing tiers to know:

  • Cache writes are billed at a premium over standard input token prices. You pay this every time a new prefix is cached.
  • Cache reads are significantly cheaper than fresh input tokens. You pay this when a subsequent request matches a previously cached prefix byte-for-byte.
  • Standard input tokens are the baseline price when no caching is involved.

The entire economic argument for prompt caching rests on one assumption: your prefix is stable. Same bytes hit the cache on every request, you pay the write premium once and amortize it across dozens or hundreds of cheap reads. If your prefix changes between requests, you pay the write premium over and over.

This is where the OpenCode vs Claude Code comparison gets ugly.

Per the LLM pricing data I maintain at kunalganglani.com/llm-prices, cache write premiums across frontier models typically run 1.25x the standard input rate, while cache reads drop to 0.1x. A single unnecessary cache write costs roughly 12.5x what a cache read would have cost. Multiply that by 33,000 tokens. Now you know why Claude Code's usage dashboard climbs so aggressively.

Cache Stability: The Decisive Difference Between OpenCode and Claude Code

Here's the finding from the Systima benchmark that should make every Claude Code user stop scrolling. It's not just that Claude Code sends more tokens. Claude Code's prefix is unstable.

OpenCode's request prefix was byte-identical in every captured run. It pays the cache write cost exactly once per session, then every subsequent request hits the cache read path — the cheap path. The harness overhead, already smaller to begin with, amortizes almost to zero after the first request.

Claude Code, by contrast, rewrites tens of thousands of prompt-cache tokens mid-session, run after run. The Systima team measured Claude Code writing up to 54x more cache tokens than OpenCode on the same task. Every one of those rewrites triggers a fresh cache write at premium pricing.

Why? The harness appears to inject dynamic state — conversation metadata, updated tool availability, context flags — into the prefix between turns. Each injection invalidates the cached prefix and forces a full rewrite. It's a design choice that prioritizes flexibility over cost efficiency.

For a solo developer running 10 requests in a quick session, the difference might be $0.50 vs $0.08. Annoying but survivable. For a team of 20 engineers each running 50+ agentic requests per day, the compound effect is brutal.

The Multipliers: AGENTS.md, MCP Servers, Subagents, and Extended Thinking

The 33,000-token baseline is just the floor. Real-world Claude Code setups stack five additional multipliers on top.

Multiplier 1: The instruction file

Most production repos include an AGENTS.md or CLAUDE.md file — instructions telling the coding agent how to behave in that specific codebase. According to the Systima benchmark, a typical 72KB instruction file adds approximately 20,000 tokens to every single request.

Not a one-time cost. Every turn of every conversation. On a 50-request session, that's 1 million tokens of instruction file alone.

The fix is straightforward: trim your AGENTS.md. Remove duplicated rules. Move task-specific instructions into per-task context rather than the global file. Strip examples the model doesn't need on every turn. Teams routinely cut their instruction files from 72KB to under 20KB without measurable quality loss — but almost nobody bothers, because they never see the token count.

Multiplier 2: MCP servers

The Model Context Protocol (MCP) lets coding agents connect to external tools — databases, documentation systems, deployment pipelines. Each MCP server adds its tool schema to the system prompt. The Systima benchmark found that five modest MCP servers add 5,000 to 7,000 tokens per request.

Maxim Saplin tested mcp2cli, a tool that claims to save 96–99% of tokens wasted on MCP tool schemas. His finding was sobering: the savings are largely irrelevant if the schemas are already cached, because cached tokens cost far less than fresh writes. The real question isn't whether MCP schemas are big. It's whether they destabilize your cache prefix.

Multiplier 3: Subagent spawning

This is the largest single cost multiplier, and it's the one that caught the Hacker News crowd off guard. A commenter named mcv reported that Claude Code immediately launched 7 subagents on a complex task, burning through their entire budget before a single subagent finished. Running the same task sequentially cost a fraction.

Each subagent inherits the full harness overhead. Seven subagents means 7× the 33,000-token baseline, plus 7× the AGENTS.md overhead, plus 7× the MCP schema overhead. Simple math. Terrifying math.

Another HN commenter, btown, made a sharp point: subagents should "step down" to less curious, cheaper models for well-planned parallel subtasks. Using Claude Fable 5 for every subagent is like dispatching a senior architect to move boxes.

Multiplier 4: Extended thinking

Claude's extended thinking feature lets the model reason through complex problems before responding. Better results on hard tasks, but it generates additional tokens that count toward your bill. On production agentic runs, extended thinking can add thousands of tokens per turn.

The everything number

Nobody has added up all the multipliers for a fully-configured production repository. Here's what the stack looks like:

  • Baseline harness: 33,000 tokens (Claude Code) vs 7,000 (OpenCode)
  • Instruction file (72KB): +20,000 tokens
  • Five MCP servers: +6,000 tokens (midpoint estimate)
  • Extended thinking: +3,000–10,000 tokens per complex turn
  • Subagent multiplier: ×N (where N is the number of spawned subagents)

For Claude Code with a single agent (no subagents), the per-request token payload lands at approximately 59,000–69,000 tokens. For OpenCode, approximately 33,000–43,000 tokens. That's still a meaningful gap — roughly 1.6x — but the real divergence is in cache behavior, where Claude Code's instability means you're paying write prices repeatedly on that larger payload.

With 3 subagents, Claude Code's total jumps to roughly 177,000–207,000 tokens of harness overhead per compound request. OpenCode's equivalent: 99,000–129,000 tokens. And OpenCode amortizes most of that through stable caching.

[YOUTUBE:OSaq_WHFUGk|OpenCode vs Claude Code: The Truth About Cost vs Quality]

Does Claude Code's Extra Token Spend Buy Better Code?

This is the question the Systima benchmark deliberately sidesteps. And it's the right question.

Claude Code isn't a dumb wrapper around the Claude API. Its harness includes sophisticated context engineering — the system prompt encodes patterns for how to explore codebases, when to read files before editing, how to validate changes. The "curiosity" behavior that Maxim Saplin and HN commenters describe — where Claude Code traces program logic exhaustively before writing code instead of just winging it — is a feature, not a bug.

But here's the thing nobody's saying about those extra tokens: they're buying behavior, not intelligence. Both Claude Code and OpenCode can use the exact same underlying model — Claude Fable 5, Claude Opus 4.8, whatever large language model you want. The difference is what surrounds the model, not what powers it.

OpenCode with its Zen tier — a curated, benchmarked set of models specifically optimized for agentic coding tasks — can deliver comparable output quality with a fraction of the harness overhead. The Zen tier isn't just "any model"; it's validated combinations tested against real coding benchmarks.

Michael Truell, CEO of Cursor, called Claude Fable 5 "state of the art on CursorBench" and noted it "opened up a class of long-horizon problems." That capability isn't exclusive to Claude Code's harness. Any tool that calls the Fable 5 API gets the same model. The question is how much scaffolding you wrap around it.

Break-Even Model: When Does Switching to OpenCode Pay Off?

None of the existing coverage translates the 4.7x token gap into dollar-denominated team costs. Let me fix that.

Assumptions for this model:

  • Claude Fable 5 as the underlying model for both tools
  • Standard Anthropic API pricing tiers for input/cache write/cache read tokens
  • 50 agentic requests per developer per day (moderate usage for active coding)
  • Production setup: 72KB AGENTS.md + 3 MCP servers
  • Claude Code cache hit rate: ~40% (due to prefix instability, per Systima data)
  • OpenCode cache hit rate: ~90% (due to byte-identical prefixes)
Scenario Claude Code (est. daily cost/dev) OpenCode (est. daily cost/dev) Monthly savings/dev
Solo dev, 20 requests/day ~$4.80 ~$1.60 ~$64
Active dev, 50 requests/day ~$12.00 ~$4.00 ~$160
Heavy agentic, 100 requests/day ~$28.00 ~$8.50 ~$390
Heavy + subagents (3 avg) ~$78.00 ~$22.00 ~$1,120

For a 20-person engineering team at moderate usage (50 requests/day), the monthly difference is approximately $3,200. For a team running heavy agentic workflows with subagent spawning, the gap widens past $22,000 per month.

These numbers are conservative. They don't account for retries, failed agentic loops, or the 100x loop multiplier that Maxim Saplin documented — where aggressive context engineering saves 20% but agentic retries multiply the entire bill by orders of magnitude.

The break-even point for migration effort is surprisingly low. If your team spends even one engineering day switching from Claude Code to OpenCode and configuring models, the token savings pay for it within the first week at 50 requests/day per developer.

How to Audit Your Claude Code Token Spend Right Now

If you're running Claude Code and not ready to switch, here's what you can do today to reduce your token overhead without changing tools:

  1. Measure your AGENTS.md file size. Run wc -c AGENTS.md or CLAUDE.md. Over 20KB? You're paying for bloat. Strip duplicate rules, remove verbose examples, move task-specific instructions into per-task context files.

  2. Count your MCP servers. Each one adds 1,000–1,400 tokens of schema to every request. Disable the ones you don't use on every task. Load them selectively.

  3. Disable subagent auto-spawning for well-defined tasks. If you know the task is sequential, force sequential execution. Subagents are powerful for genuinely parallel problems. Not for everything.

  4. Monitor cache hit rates. Check your Anthropic usage dashboard for the ratio of cache reads to cache writes. A healthy ratio is 5:1 or better. Close to 1:1? Your prefix is unstable and you're paying write premiums on every turn.

  5. Use model tiering. Not every subtask needs Claude Fable 5. Use Opus 4.8 or Sonnet for well-scoped subtasks. When I built this site's multi-agent publishing pipeline, the lesson was clear: deterministic gates before LLM review catch more issues than doubling the review model's size. The same principle applies to coding agents. Route simple tasks to cheaper, faster models.

  6. Set a daily budget cap. Both Claude Code and your API dashboard support spending limits. Set one per developer. The constraint forces discipline.

What Is OpenCode and How Does It Compare to Claude Code?

OpenCode is an open-source AI coding agent built by Anomaly (formerly SST). As of July 2026, it has 185,000 GitHub stars, 900+ contributors, 14,926+ commits, and serves 7.5 million developers monthly. It ships as a terminal interface, a desktop app (recently launched in beta for macOS, Windows, and Linux), and an IDE extension.

The key architectural differences from Claude Code:

  • Model agnostic. OpenCode supports 75+ LLM providers through Models.dev, including Claude, GPT, Gemini, and local models. Claude Code is locked to Anthropic's API.
  • Privacy-first. OpenCode stores no code or context data. For teams in regulated industries — healthcare, finance, government — this is a real compliance differentiator.
  • Lean harness. The 7,000-token baseline versus Claude Code's 33,000 is structural, not an optimization that could vanish in an update.
  • Stable cache prefix. Byte-identical prefixes across requests mean cache economics actually work as designed.
  • Zen model tier. A curated set of models tested and benchmarked specifically for coding agents, removing the guesswork of model selection.
  • Multi-session parallelism. OpenCode supports running multiple agents in parallel on the same project — a different architectural approach to Claude Code's subagent spawning, with potentially better cache sharing between sessions.

OpenCode is free to use. You bring your own API keys (or use existing GitHub Copilot or ChatGPT Plus/Pro subscriptions). The Zen tier adds a curated model layer on top.

Can you use OpenCode with Claude Fable 5? Yes. Same frontier model capabilities, without Claude Code's 33,000-token harness overhead. That's the core economic argument.

Caveats and How to Reproduce the Benchmark

The Systima benchmark is the most rigorous public measurement of harness overhead I've found, but it has important limits:

  • The quality comparison is incomplete. Systima deliberately measured token overhead, not output quality. Claude Code's larger harness may produce better results on complex, multi-step tasks where the extra system prompt provides useful behavioral guidance. That needs separate benchmarking, and nobody's done it yet.
  • Cache behavior could change. Anthropic could optimize Claude Code's prefix stability in a future update. If they made the prefix byte-identical like OpenCode's, the cache economics gap would narrow significantly. The 4.7x baseline token difference would remain.
  • The benchmark used specific model versions. Results may differ with different Claude model tiers. The Systima team tested across models and found the gap persisted, but your specific configuration matters.
  • Real-world usage patterns vary wildly. A developer who sends 5 long, complex prompts per day has a very different cost profile than one who sends 100 short iterative requests. The overhead ratio matters more for high-frequency, short-prompt workflows.

To reproduce: the Systima team published their methodology, including the HTTP capture approach and the exact task prompts used. Their benchmark dataset doubles as an audit log — a clever approach where the benchmark data itself validates the tooling.

For teams wanting to measure their own overhead: proxy your API traffic through a logging layer and count tokens per request. Compare the total tokens sent against the tokens in your actual prompt. The difference is your harness tax.

The Cache TTL Strategy Nobody's Discussing

Anthropic's prompt caching supports two TTL options: 5-minute and 1-hour. The right choice depends on your usage pattern, and nobody in the current conversation is talking about this.

For short interactive sessions (quick questions, code review, debugging): the 5-minute TTL works fine. You're firing bursts of requests within a few minutes, then moving on. The cache warms on the first request and serves subsequent ones cheaply.

For long autonomous agent runs (multi-step refactors, feature implementations, test generation): the 1-hour TTL is critical. These agentic AI sessions can span 30–60 minutes with pauses between model calls. A 5-minute TTL means your cache expires mid-run, forcing expensive rewrites.

But here's the catch: TTL strategy only matters if your prefix is stable. Claude Code's mid-session prefix rewrites make TTL selection almost irrelevant — you're paying write prices regardless of duration. OpenCode's stable prefix means TTL selection actually optimizes your costs as intended.

This is one of those things where the boring answer is actually the right one: cache stability matters more than cache duration.

What This Means for Your Team in 2026

The AI coding tool market is splitting in two. On one side, vertically integrated products like Claude Code that optimize for capability and developer experience at the cost of token efficiency. On the other, open and modular tools like OpenCode and Aider that prioritize lean operation and model flexibility.

As consumption-based pricing becomes the norm — and it will, because flat subscriptions at current usage levels are unsustainable for vendors — the harness tax will become the defining cost variable for engineering organizations. Not prompt length. Not model choice. The harness.

My prediction: within 12 months, every major AI coding tool will publish its harness token overhead as a competitive metric, the same way cloud providers publish cold start times and p99 latencies. The teams that audit their LLM cost now — measuring cache hit rates, trimming AGENTS.md files, evaluating alternatives like OpenCode — will be the ones whose AI budgets survive contact with the finance team.

The 4.7x gap is not a curiosity. It's a line item. Start measuring it.

Frequently Asked Questions

Why does Claude Code use so many tokens compared to other AI coding tools?

Claude Code injects approximately 33,000 tokens of system prompt, tool schemas, and behavioral scaffolding before your actual prompt reaches the model. This large harness defines how the agent explores codebases, validates changes, and orchestrates tool use. OpenCode accomplishes similar functionality with about 7,000 tokens by using a leaner system prompt architecture.

What is prompt caching and how does it affect Claude Code pricing?

Prompt caching lets the API reuse previously processed token prefixes instead of reprocessing them from scratch. Cache writes cost a premium (roughly 1.25x standard input rates), while cache reads are much cheaper (roughly 0.1x). Claude Code's prefix changes mid-session, forcing repeated expensive cache writes. OpenCode's prefix stays byte-identical, so it pays the write cost once and reads cheaply afterward.

What is AGENTS.md and how does it affect token usage in AI coding agents?

AGENTS.md (or CLAUDE.md) is an instruction file in your repository that tells the AI coding agent how to behave in your specific codebase — coding standards, architecture patterns, testing requirements. A typical production file is around 72KB and adds approximately 20,000 tokens to every single request the agent makes, not just the first one.

Is OpenCode free to use and does it support Claude models?

OpenCode is fully open source and free to use. You bring your own API keys from any of 75+ supported LLM providers, including Anthropic's Claude models (including Claude Fable 5), OpenAI GPT, Google Gemini, and local models. You can also log in with existing GitHub Copilot or ChatGPT Plus/Pro subscriptions.

What is the break-even point for switching from Claude Code to OpenCode for a team?

For a team of 20 engineers at moderate usage (50 agentic requests per developer per day), the estimated monthly savings from switching to OpenCode is approximately $3,200. If your team spends even one engineering day on migration, the token savings typically pay for the effort within the first week.

How do Claude Code subagents affect token consumption and cost?

Each subagent Claude Code spawns inherits the full harness overhead — the 33,000-token baseline plus your AGENTS.md, MCP schemas, and other multipliers. Spawning 7 subagents on a single task means paying 7× the full overhead stack. Running the same task sequentially costs a fraction of the parallel approach.


Originally published on kunalganglani.com

Top comments (0)