Claude Code vs OpenCode Token Overhead Analysis

Claude Code exhibits significantly higher token overhead than OpenCode

Claude Code consumes approximately 33,000 tokens of system prompts, tool schemas, and scaffolding before processing a user prompt, compared to roughly 7,000 tokens for OpenCode. This baseline overhead increases latency, raises costs, and consumes a significant portion of the model's context window before any actual code is processed.

Baseline Token Consumption

In a controlled test where both harnesses were pinned to the claude-sonnet-4-5 model, the fixed overhead for a simple one-line reply was measured as follows:

Component Claude Code OpenCode
System prompt ~6.5k tokens ~2.0k tokens
Tool schemas ~24k tokens ~4.8k tokens
Scaffolding Included in baseline None
Total First-Turn Payload ~32,800 tokens ~6,900 tokens

Claude Code's overhead is driven by a larger set of 27 tools—including background-agent and orchestration suites—and extensive behavioral doctrine regarding tone and safety. OpenCode uses a minimal set of 10 classic coding tools and a concise system block.

Impact of Configuration Multipliers

Real-world production environments introduce additional token multipliers that stack on top of the baseline:

Instruction Files

Adding a 72KB instruction file (such as CLAUDE.md or AGENTS.md) adds approximately 20,000 tokens to every request for both harnesses.

MCP Servers

Model Context Protocol (MCP) servers add roughly 1,000 to 1,400 tokens per small server per request. In a configuration with five servers, this adds between 4,900 and 6,967 tokens to the baseline.

Subagents

Delegation to subagents is the largest token multiplier. A task costing 121,000 tokens when performed directly cost 513,000 tokens when fanned out to two subagents. This 4.2x increase occurs because each subagent requires its own bootstrap cost, and the parent agent subsequently consumes the subagent's transcript.

Prompt Caching and Stability

While prompt caching reduces the cost of repeated prefixes, it does not eliminate the overhead or the context window consumption.

Cache Write Inefficiency

OpenCode maintains byte-identical prefixes across requests, allowing it to pay for cache writes once per session. In contrast, Claude Code frequently rewrites tens of thousands of prompt-cache tokens mid-session. In one test, Claude Code's cache-write volume ranged from 5.9x to 54x that of OpenCode for the same task.

Context Window Pressure

A large bootstrap (e.g., 85,000 tokens in a fully configured setup) occupies over 40% of a 200k context window on every request. This reduces the space available for actual code and triggers earlier context compaction, which itself consumes more tokens for summarization.

Performance Trade-offs: Batching vs. Serialization

Despite the higher baseline, Claude Code can be more token-efficient in multi-step tasks due to its tool-calling strategy. Claude Code batches multiple tool calls into a single parallel round trip, whereas OpenCode typically performs one tool call per turn.

In a write-run-test-fix loop, Claude Code required only 3 requests compared to OpenCode's 9. Because the baseline is re-sent (or re-read) on every request, Claude Code's aggressive batching converged the total input tokens to roughly 121,000, while OpenCode's serialized approach reached 132,000.

Community Insights and Counterpoints

Discussion among developers highlights a tension between token efficiency and agentic capability:

  • Orchestration Quality: Some users argue that Claude Code's heavier harness is a reflection of superior orchestration for bulk parallel work and subagent management.
  • Conflict of Interest: Several contributors noted a potential conflict of interest when the model provider (Anthropic) also provides the harness, suggesting there is little incentive to minimize token usage.
  • Alternative Harnesses: Users mentioned other lean alternatives such as Pi, which reportedly sends significantly fewer tokens (1k or less) for its system prompt.

"Claude Code sending 33k tokens before reading the prompt is the AI equivalent of a consultant who bills you for the time spent reading your email before they even open it."

Methodology Summary

Measurements were taken using a logging proxy spliced between the harness and the model endpoint to capture exact JSON payloads and API usage blocks. The tests used Claude Code 2.1.207 and OpenCode 1.17.18 pinned to claude-sonnet-4-5 in July 2026. To ensure data integrity, all 150 captured request/response records were stored in a SHA-256 hash-chained audit trail.

Sources

Related