A recent Hacker News thread with 538 points and 303 comments highlighted token counts from two AI coding tools. Claude Code transmits 33k tokens before the user prompt reaches the model. OpenCode transmits 7k tokens in the same position.
Token Overhead Breakdown
The overhead consists of system instructions, tool schemas, and context formatting sent on every request. Claude Code includes extensive agent scaffolding and multi-step reasoning templates. OpenCode uses a stripped-down instruction set focused on direct code actions.
Measured Token Counts
| Tool | Pre-prompt Tokens | Primary Cause |
|---|---|---|
| Claude Code | 33,000 | Full agent loop + tool schemas |
| OpenCode | 7,000 | Minimal instruction set |
The 4.7× difference appears consistently across the reported test cases. No model parameters or generation quality numbers were included in the discussion.
How the Overhead Occurs
Both tools wrap the user prompt inside a larger system message. Claude Code adds repeated definitions for file operations, test execution, and iterative planning. OpenCode limits the wrapper to basic edit and run commands plus short safety rules.
Pros and Cons
- Claude Code delivers more structured multi-file edits but pays a fixed 33k-token cost per turn.
- OpenCode reduces context spend by 79% yet offers fewer built-in planning steps.
- Neither tool exposes user controls to trim the system prompt.
Alternatives and Comparisons
Cursor and Continue.dev also ship with agent-style prompts. Early reports place Cursor overhead near 18k tokens and Continue.dev near 12k tokens on similar tasks. No public benchmark yet compares all four on identical codebases.
Who Should Use Each Tool
Teams running long sessions on large repositories benefit from OpenCode's lower per-turn cost. Projects needing complex refactoring or test-driven loops may accept Claude Code's overhead for its planning depth. Users on token-limited APIs should measure their own average context length before committing.
Practical Next Steps
Clone the OpenCode repository and inspect its system prompt file. Replace sections with your own minimal instructions and re-measure token counts. For Claude Code users, test shorter sessions or split tasks to amortize the 33k baseline.
Bottom line: OpenCode cuts upfront token spend by more than half compared with Claude Code on the same workflow.
The gap shows that prompt engineering choices in coding agents directly affect operating cost at scale.
Top comments (0)