All posts

Claude Code vs OpenCode: 33k tokens of overhead vs 7k

Huma ShaziaJuly 13, 2026 at 2:32 AM6 min read
Claude Code vs OpenCode: 33k tokens of overhead vs 7k

Key Takeaways

Opencode vs Claude Code vs Codex: Ultimate AI Coding Comparison for Developers

Claude Code vs OpenCode: 33k tokens of overhead vs 7k
Source: Hacker News: Best
  • Claude Code sends roughly 33,000 tokens of system prompt and tool schemas before your actual prompt reaches the model
  • OpenCode achieves the same baseline with about 7,000 tokens, making it nearly 5x more efficient on fixed overhead
  • Production setups with CLAUDE.md files and MCP servers can hit 75,000-85,000 tokens before typing a word

Claude Code sends approximately 33,000 tokens of system prompt, tool schemas, and scaffolding before your actual prompt reaches the model. OpenCode, an open-source alternative, sends about 7,000. That's nearly 5x the overhead for the same one-line task.

These numbers come from Systima.ai, which spliced a logging proxy between each harness and the model endpoint to capture exactly what gets sent. The findings matter because every token of overhead is context budget you can't spend on code, and that baseline gets re-sent on every single turn.

Advertisement

What's actually in those 33,000 tokens?

The researchers broke down the first-request payload for a trivial 22-character prompt asking each tool to reply with exactly "OK". Claude Code's payload contained a system prompt of 27,344 characters across three blocks, tool schemas for 27 tools totaling 99,778 characters, and an additional 7,997 characters of system-reminder scaffolding. The actual user prompt? 22 characters.

OpenCode's equivalent request carried a single system block of 9,324 characters, tool schemas for 10 tools at 20,856 characters, no additional scaffolding, and the same 22-character prompt. Total calibrated payload: about 6,900 tokens versus Claude Code's 32,800.

ComponentClaude CodeOpenCode
System prompt27,344 chars (3 blocks)9,324 chars (1 block)
Tool schemas27 tools, 99,778 chars10 tools, 20,856 chars
Scaffolding7,997 charsNone
First-turn payload~32,800 tokens~6,900 tokens

Why cache inefficiency hurts more than raw overhead

OpenCode's request prefix was byte-identical across every captured run. That means it paid to cache its payload once per session and read it back cheaply on subsequent turns. Claude Code rewrote tens of thousands of prompt-cache tokens mid-session, run after run.

The difference is severe. On the same task, Claude Code wrote up to 54x more cache tokens than OpenCode. Cache writes are billed at a premium, roughly $3.00 per million tokens for writes versus $0.30 for reads. When your harness keeps invalidating its own cache, your usage dashboard climbs even if you're doing the same work.

Production setups make it worse

The baseline tests used fresh config directories with no MCP servers, no user settings, and an empty workspace. Real production environments stack additional overhead on top.

A 72KB instruction file (AGENTS.md or CLAUDE.md) adds another 20,000 tokens on average to every request. Five modest MCP servers add 5,000 to 7,000 more. By the time a working setup sends its first request, it's 75,000 to 85,000 tokens deep before the user has typed anything.

Subagents compound the problem. A task that cost 121,000 tokens when done directly cost 513,000 tokens when fanned out to two subagents. Each subagent pays its own bootstrap cost, and the parent then consumes its transcript.

513,000 tokens
Cost of a small task fanned out to two subagents, versus 121,000 tokens done directly
Advertisement

When Claude Code actually wins

The analysis found one scenario where Claude Code came out ahead. On a multi-step task, Claude Code's whole-task total was lower than OpenCode's because it batches tool calls into fewer requests. OpenCode re-pays its smaller baseline turn after turn.

The takeaway: the meter starts higher with Claude Code, but how the session unfolds decides who spends more. Short, single-turn tasks favor OpenCode's lean baseline. Long, multi-step tasks with batched tool calls may favor Claude Code's approach.

How they measured this

The methodology matters because token counting is surprisingly hard to verify. Systima.ai spliced a logging proxy between each harness and the model endpoint. The proxy recorded two things per request: the exact JSON payload the harness emitted (system blocks, tool schemas, messages) and the usage block the API returned (input tokens, cache writes, cache reads, output tokens).

They tested Claude Code 2.1.207 and OpenCode 1.17.18, both pinned to claude-sonnet-4-5 in July 2025. Baseline isolation meant fresh config directories, no MCP servers, no user settings, no memory, an empty workspace, and permissions bypassed.

One disclosure: their traffic passes through a local LLM gateway that adds roughly 6,200 tokens of constant overhead, which they subtracted from every metered figure. Character-to-token conversion used each harness's measured ratio of 4.1 to 4.4 characters per token.

What this means for your API bill

If you're running agentic AI in production, "what does my agent actually send" is a question you should answer with data. The researchers note that under the EU AI Act, Article 12 expects operators to log and understand their system's behavior. But regulatory compliance aside, you're paying for every token.

A team running 1,000 requests per day with Claude Code's 33k baseline is paying for 33 million tokens of overhead daily, before any actual work happens. At Anthropic's current pricing, that adds up fast.

ℹ️

Logicity's Take

For startup founders running AI coding tools in production, this analysis suggests a clear action item: instrument your API calls. Most teams have no visibility into what their tooling actually sends. OpenCode's open-source nature makes it auditable by default; Claude Code's overhead is only visible if you proxy your traffic. If you're budget-sensitive and running short, discrete tasks, OpenCode's 5x leaner baseline matters. If you're running long multi-step workflows, Claude Code's batching may offset its heavier start. Either way, you should know which scenario you're in before your next invoice arrives.

Frequently Asked Questions

Why does Claude Code send so many tokens before my prompt?

Claude Code includes 27 tool schemas (99,778 characters), a multi-block system prompt, and additional scaffolding. This enables its broader feature set but creates significant fixed overhead on every request.

Is Claude Code always more expensive than OpenCode?

Not always. On multi-step tasks with batched tool calls, Claude Code's whole-task total can be lower because it makes fewer round-trips. The session pattern determines which tool costs more.

How do MCP servers affect token usage?

Five modest MCP servers add 5,000 to 7,000 tokens to every request. Combined with instruction files, a production setup can hit 75,000-85,000 tokens before the user types anything.

What is prompt caching and why does efficiency matter?

Prompt caching stores repeated content so subsequent requests read it cheaply instead of reprocessing it. Cache writes cost roughly 10x more than reads. Claude Code frequently invalidates its cache, forcing expensive rewrites.

How can I measure my own AI coding tool's token overhead?

Place a logging proxy between your tool and the model endpoint. Capture the JSON payloads sent and the usage blocks returned. This gives you ground truth on what you're actually paying for.

ℹ️

Need Help Implementing This?

If you're running AI coding assistants at scale and want help instrumenting your API calls or optimizing token usage, reach out to the Logicity team. We help startups build cost-efficient AI infrastructure.

Source: Hacker News: Best / Systima

Advertisement
H

Huma Shazia

Senior AI & Tech Writer

Produced with AI assistance and reviewed by the Logicity editorial team. Learn more in our Editorial Policy.