Claude Code sends 33k tokens before reading the prompt; OpenCode sends 7k
6 hours ago
- #token efficiency
- #performance benchmarking
- #AI agents
- Claude Code uses significantly more tokens than OpenCode for the same tasks, with baseline overhead around 33,000 tokens vs 7,000 for a simple reply.
- Cache inefficiency is a major factor; Claude Code rewrites tens of thousands of prompt-cache tokens mid-session, leading to up to 54x more cache writes than OpenCode.
- Configuration elements like instruction files and MCP servers add substantial token overhead, with a real setup reaching 75,000–85,000 tokens before user input.
- Subagents dramatically increase token usage; a task costing 121,000 tokens directly rose to 513,000 tokens when fanned out to two subagents.
- On multi-step tasks, Claude Code's batching can reduce total tokens compared to OpenCode's serial approach, though baseline costs remain higher.
- The token gap varies by model; Claude Code's system prompt is smaller for newer models like Fable 5, narrowing the overhead ratio.
- Prompt caching reduces costs but doesn't eliminate them; cache writes, reads, and context-window consumption still incur expenses.
- Claude Code exhibits cache prefix instability, leading to more frequent and costly cache rewrites compared to OpenCode's stable prefixes.
- Measurement was conducted via a logging proxy capturing exact JSON payloads and API usage, with results logged in an audit trail for integrity.
- The findings highlight the importance of monitoring token usage in production, especially under regulations like the EU AI Act.