- Published on
Claude Code sends 33k tokens before reading the prompt; OpenCode sends 7k
- Authors

- Name
- DeepHorus
A new analysis reveals that Claude Code, Anthropic's agentic coding framework, consumes significantly more tokens in overhead compared to OpenCode, an open-source alternative. The study, published by the developers of OpenCode, measured exact token usage at the API boundary using a logging proxy between each harness and the model endpoint. Both frameworks were pinned to the same model, claude-sonnet-4-5 (July 2026), on identical hardware and tasks.
The researchers tested under controlled conditions with fresh config directories, no MCP servers or instruction files, then added variables such as AGENTS.md files and MCP servers. The logging proxy captured both the exact JSON payload of each request and the usage block returned by the API, providing ground truth for what was sent and metered. Three tasks were used: a trivial reply, a file summarization, and a write-run-test-fix loop.
For a simple 'OK' reply, Claude Code used roughly 33,000 tokens of system prompt, tool schemas, and injected scaffolding before the user's prompt arrived, while OpenCode used about 7,000. Claude Code was also far less cache-efficient, rewriting tens of thousands of prompt-cache tokens mid-session and writing up to 54 times more cache tokens than OpenCode on repeated tasks. Cache writes are billed at a premium, contributing to higher usage dashboard readings.
Adding a 72KB instruction file like AGENTS.md or CLAUDE.md introduced an average of 20,000 tokens per request. Five modest MCP servers added another 5,000 to 7,000 tokens. In a typical production setup, each request could be 75,000 to 85,000 tokens before the user types a single word.
Subagents amplified costs further: a small task costing 121,000 tokens directly ballooned to 513,000 tokens when distributed to two subagents, because every subagent incurs its own bootstrap cost and the parent consumes the transcript. This overhead reduces the available context for actual task execution, potentially impairing performance and inflating costs.
However, Claude Code showed one advantage: on a multi-step task, its ability to batch tool calls into fewer requests sometimes resulted in lower total token consumption than OpenCode, which re-pays its smaller baseline per turn. This advantage was model-dependent. When re-run on a newer model (claude-fable-5), the same task took Claude Code roughly 298,000 tokens against OpenCode's 133,000.
The findings were cross-checked on a second model family, and the pattern held with minor nuances. For organizations operating agentic AI in production, particularly under the EU AI Act's Article 12 requiring logging and understanding of system behavior, such data is crucial for compliance and cost management.
The study highlights the need for more efficient agent harnesses. Developers may need to weigh token overhead against task performance when choosing between Claude Code and OpenCode, and optimizations like improved prompt caching could narrow the gap in future iterations.