How Many Tokens Does an AI Coding Agent Use Per Task?
We ran the same bug fix through Claude Code, OpenCode, Hermes Agent and Aider and counted every token: requests per task, prompt size, cache share and output.
A coding agent does not send one prompt per task. It sends a request for every step, and every request carries the whole conversation so far. To put real numbers on that, we gave four popular agents the same small bug to fix, on the same model, and counted every token Ruvicode billed.
The short version:
- The tool-calling agents (Claude Code, OpenCode, Hermes Agent) needed 5 to 7 requests and 53,000 to 82,000 prompt tokens to fix one bug.
- Output was tiny next to that: under 1,000 tokens per task for each of those three. Their prompt tokens outnumbered output 106 to 381 times.
- Before reading a single line of code, each request already carried 8,000 to 13,000 tokens of system prompt and tool definitions.
- Aider used under 6,000 prompt tokens per task, a different design entirely, and applied its fix in one of two runs.
- The share of the prompt served from cache swung from 19% to 81% between runs.
The test
We wrote a small Python package: a shopping cart with line items, coupons and tax, five source files and six unit tests. One test fails, because Cart.total() charges tax on the subtotal instead of on the discounted amount. Every agent got the same instruction:
The test suite in this repository fails. Find the bug, fix it, and run the tests with
python -m unittest discover -s teststo confirm they all pass. Then reply with one sentence describing the fix.
The setup, kept identical for every tool:
- Model: GLM 5.3 Flash through the Ruvicode API, for every tool.
- Runs: two per tool, each from a fresh copy of the project, on 9 November 2026.
- Clean installs: each tool ran with an empty home directory, so no personal settings, skills or plugins were loaded.
- Counting: one Ruvicode API key per tool. The token counts below are the ones each response reported and Ruvicode billed, not estimates.
- Versions: Claude Code 2.1.312 (connected through 9router, since it speaks the Anthropic protocol), OpenCode 1.18.34, Hermes Agent 0.21.3 and Aider 0.86.2.
Results
Averages of the two runs per tool:
| Tool | Requests per task | Prompt tokens per task | Prompt per request | Output tokens per task | Served from cache | Fixed the bug |
|---|---|---|---|---|---|---|
| Claude Code | 6 | 82,376 | 13,729 | 779 | 20% and 47% | 2 of 2 |
| Hermes Agent | 5 | 71,145 | 14,229 | 186 | 19% and 42% | 2 of 2 |
| OpenCode | 6.5 | 53,210 | 8,186 | 431 | 35% and 81% | 2 of 2 |
| Aider | 2.5 | 3,934 | 1,574 | 1,077 | 0% and 57% | 1 of 2 |
The three tool-calling agents behaved alike: open the cart module, read the test, edit one line, run the tests, answer. That loop took 5 to 7 requests. OpenCode's count includes one small extra request it makes to title the session.
Where the tokens go
The first request of each task shows the fixed cost of the tool itself, before any code is read:
| Tool | First request (prompt tokens) |
|---|---|
| Hermes Agent | about 13,300 |
| Claude Code | about 12,600 |
| OpenCode | about 8,300 |
| Aider | about 1,150 |
That is the system prompt plus the definitions of every tool the agent can call. It is sent again on every request, and each request then adds what the previous steps returned: file contents, test output, the model's own replies. By the last step of a task, Claude Code's requests carried about 15,000 tokens.
So the bill of a coding agent is mostly input. In our runs the tool-calling agents sent 106 (Claude Code), 123 (OpenCode) and 381 (Hermes Agent) prompt tokens for every output token. Across all of Ruvicode's chat traffic in October the ratio was about 85 to 1, as our October usage report shows.
Aider works differently. It sends a map of the repository and the files it chose, with no tool definitions, and the model writes the edit straight into its reply. That keeps prompts small, but it also moves the work into output tokens, and with GLM 5.3 Flash and Aider's default whole-file edit format, one of our two runs described the right fix without applying it to the file.
Cache: same task, very different share
On paper an agent is the ideal cache workload: every request repeats the one before it plus a little more. In practice the share of prompt tokens served from cache moved a lot between two runs of the same tool on the same task, from 35% to 81% for OpenCode and from 20% to 47% for Claude Code.
A prompt cache only helps when a request reaches a server that still holds its prefix, and a short task of 5 or 6 requests leaves little room to warm one up. Longer sessions cache much better: across all Ruvicode chat requests in October 2026, 83.1% of prompt tokens were cache reads. On Ruvicode, cached prompt tokens are billed at the model's cheaper cached input rate automatically; our caching guide explains how to keep the prefix stable.
Installed extras are not free
Before we isolated the tools, one OpenCode run picked up 32 skills installed on the test machine. Its first request, for a one-line greeting, carried 13,251 prompt tokens. On a clean install, the first request of the real task carried about 8,300. The installed skills are described in the prompt, so they cost about 5,000 tokens on every request, whether a task uses them or not. MCP servers and extra tool definitions work the same way.
Estimating your own cost
Take Claude Code's average task from the table: about 82,000 prompt tokens, a third of them from cache, and under 800 output tokens. That is roughly 55,000 fresh input tokens, 27,000 cached input tokens and 800 output tokens. Multiply each by the model's live rate on its model page, then by the number of tasks you run.
Two cautions. This was a short task in a small project. Real sessions on a real codebase grow with every file read: the median Ruvicode chat request in October carried 37,633 prompt tokens. And the model matters as much as the tool, since rates differ widely across the catalog. The cost calculator takes requests per day and tokens per request, and its Coding agent profile starts from that median.
What to take from this
- Count requests, not prompts. One task is several requests, and each one resends the context.
- Mind the fixed overhead. A lean agent spends fewer tokens on every step. For many small tasks, 8,000 versus 13,000 tokens per request adds up.
- Switch off what you do not use. Skills, MCP servers and tools are part of every prompt.
- Do not worry about output. It was under 2% of the tokens in every tool-calling run.
- Let the cache work. Keep sessions going instead of restarting them, and keep the start of the prompt stable.
Setup guides for every tool in this test, with the exact settings we used, are on the integrations page: Claude Code, OpenCode, Hermes Agent and Aider.
Frequently asked questions
- How many tokens does Claude Code use for one task?
- In our test, fixing one bug in a small Python project took Claude Code 6 requests and about 82,000 prompt tokens, with under 1,000 output tokens. Each request carried 12,500 to 15,000 prompt tokens, because every step resends the system prompt, the tool definitions and the conversation so far.
- Which AI coding agent uses the fewest tokens?
- Aider, by a wide margin: 2 to 3 requests and under 6,000 prompt tokens per task, because it sends no tool definitions and writes its edits into the reply. It applied its fix in one of our two runs. Among the tool-calling agents, OpenCode used the fewest prompt tokens (about 53,000 per task), then Hermes Agent (about 71,000) and Claude Code (about 82,000).
- Why do coding agents use so many more input tokens than output tokens?
- An agent works in steps: read a file, edit it, run the tests. Each step is a new request that carries everything before it. In our test the tool-calling agents sent between 106 and 381 prompt tokens for every output token.
- How much of a coding agent's prompt is served from cache?
- It varied from 19% to 81% per run in our test, even for the same tool on the same task. Short tasks cache less than long sessions: across all Ruvicode chat requests in October 2026, 83.1% of prompt tokens came from cache.
- How do I estimate what my coding agent will cost?
- Multiply the fresh prompt tokens by the model's input rate, the cached ones by its cached input rate and the output by its output rate, then by the number of tasks you run. The model pages show live rates, and the Ruvicode cost calculator does the arithmetic for a month.