Before your prompt reaches the model, the harness has already spent thousands of tokens describing itself. On a cold request with no cache, Claude Code sends 28,407 input tokens, OpenCode sends 12,374, and Pi sends 2,768. Same trivial "hello", same work asked of the model, a 10x spread in what it costs to ask. If you are on a metered subscription with hard caps, that overhead is not a rounding error.
Then prompt caching enters and the ranking flips. This post is the numbers, not a recommendation.
The measurement
An independent test in May 2026 instrumented all three harnesses on the same minimal request and captured the first turn with a cold cache.
| Claude Code | OpenCode | Pi | |
|---|---|---|---|
| Input tokens, first turn | 28,407 | 12,374 | 2,768 |
| System prompt | ~6.6k | ~2.4k | ~0.9k |
| Tool catalog | ~18.9k | ~9.7k | ~1.1k |
| User context | ~1.0k | ~7 | ~7 |
| Tools shipped | 27 | 12 | 5 |
| First-turn cost | $0.0391 | $0.0170 | $0.0031 |
The tool catalog, not the system prompt, is the largest line item in every case. For Claude Code it is roughly two thirds of the total. A single bash tool description runs 10,637 characters in Claude Code against 248 in Pi, a 40x difference that buys embedded safety guardrails and usage examples.
Tool counts are consistent across sources: Pi exposes read, bash, edit, write, and mcp. OpenCode ships 12. Claude Code ships 27, including task management, worktrees, scheduling, and background monitoring.
The caching inversion
Here is the fact that undoes the obvious conclusion. With prompt caching enabled in steady state, OpenCode costs $0.00136 per turn while Pi costs $0.00310. OpenCode becomes cheaper than the harness that sends a fifth as many cold tokens.
Cached input is billed at a fraction of fresh input. A large static prefix that never changes is close to free after the first turn, so a harness with a big cacheable block and a small per-turn delta wins the long session. Pi's advantage is real but it is a cold-start advantage.
Which number matters depends on how you work. Many short sessions across the day, each starting cold, and the 10x gap is what you pay. One long session where you stay in the same context for an hour, and the steady-state number dominates. Neither is the "right" measurement.
What the tool surface buys and costs
The counts are a design choice, not a quality ranking.
Pi is deliberately minimal and self-extensible. Extensions run in-process as TypeScript, in the same runtime as the agent loop, so they can intercept, block, modify, and transform events in real time. Configuration is TypeScript extensions passed by CLI flag, YAML for rules, markdown for commands. What you give up is everything you did not build.
OpenCode is configurable rather than programmable. Plugins run out-of-process as JS or TS files in a config directory that subscribe to events and register tools, driven by JSON settings. It ships sub-agents, plan mode, LSP, web search, MCP, and a permissions layer. Both projects are MIT licensed.
Claude Code bundles the most and exposes the least. The 27 tools are why the catalog is 18.9k tokens, and they are also why it needs no assembly.
Where the model fits
Harness overhead and model capability are separate axes, and the second one has narrowed. On Terminal-Bench 2.1, Codex with GPT-5.6 Sol and Claude Code with Opus 5 land at 89.5% and 89.1%. When the frontier converges, the wrapper starts accounting for more of the difference in day-to-day cost. We compared the models themselves in GPT-5.6 Sol vs Claude Fable 5; this is the other axis.
The overhead matters most when your budget is fixed rather than metered per token. On a subscription like OpenCode Go, the caps are $12 per rolling 5-hour window, $30 per week, and $60 per month, and every request pays the harness tax before it does any work. If you are running Claude Code against a cheap endpoint, the permanent configuration setup is step one and knowing what each request costs you is step two.
Picking one
Take Claude Code if you want the tools to exist without building them and your usage is either unmetered or generous. The 28k cold overhead buys 27 tools and safety guardrails, and in long cached sessions it is not the disaster the cold number suggests.
Take OpenCode if you want provider independence with features already assembled, and especially if your sessions are long. It is the middle on cold tokens and the cheapest measured in cached steady state.
Take Pi if you want to build your own agent behavior and you value a small, readable surface. In-process TypeScript extensions give control the other two do not, and the cold-start cost is the lowest by a wide margin. You are trading bundled features for a runtime you can reason about end to end.
Two honest caveats. The measurements are from May 2026 and all three projects ship frequently, so treat the exact numbers as a snapshot rather than current truth. The Pi comparison repository states 4 tools and a roughly 200-token system prompt against the test's 5 tools and ~0.9k, which is either version drift or a different counting boundary. Re-measure on your own setup before making a decision that depends on precise figures.
FAQ
Which coding harness uses the fewest tokens?
Pi, on a cold request, at 2,768 input tokens against OpenCode's 12,374 and Claude Code's 28,407. The gap comes mostly from the tool catalog rather than the system prompt. With prompt caching in steady state the picture changes and OpenCode measures cheapest per turn.
Why does Claude Code send so many tokens before I type anything?
It ships 27 tools and each one carries a full description into every request. The tool catalog alone accounts for roughly 18.9k of the 28,407 tokens. A single bash tool description is 10,637 characters because it embeds safety guardrails and examples.
Is Pi a replacement for Claude Code?
It depends on whether you want to build your agent or use one. Pi exposes 5 tools and an in-process TypeScript extension system, so behavior that Claude Code bundles is behavior you write. Developers who want control and multi-provider work choose Pi; developers who want capability immediately choose Claude Code, and running both is common.
Does OpenCode work with any model provider?
Yes. OpenCode is model-agnostic and configured through JSON, using AI SDK packages per provider. This is the main practical difference from Claude Code, which speaks the Anthropic protocol and therefore only works with endpoints that implement it.
Do these token differences matter on a subscription plan?
They matter most when your plan caps spend rather than billing per token. Fixed windows like $12 per 5 hours mean harness overhead consumes budget on every request before any real work happens. On unmetered or high-ceiling plans the difference is mostly invisible.
