Before I launch a job from the queue in Reykjavik, I see a number: estimated tokens for this run. It is useful as a warning light, not as a price tag. By the time the change is merged locally and the tests are green, the real bill rarely looks like that first guess.
That gap is not dishonesty in the dashboard. The dashboard and I are measuring different things.
One message is not one task
A token estimate usually assumes one model call with a bounded prompt. A coding agent does not stop there. It reads files, runs tools, pastes errors back into the chat, tries a fix, runs tests again, and sometimes asks for another file because the first path was wrong. Each step sends the growing thread back through the model.
Providers document how input and output tokens are counted on each API request. That part is clear. What is not visible in the quote is how many requests your task will need before you accept the result.
Where the extra volume hides
These are the drains I watch on my own projects:
- Context at the door. Rules files, long memories, and wide repository snapshots load before the first line of code. I wrote about trimming my site memory file when it grew far past what a fresh chat needs; the same principle applies to any always-on context.
- Tool output. Search results, test logs, and linter output are plain text. They can be longer than the code they explain.
- Retries. A failed test or a mismatched type sends another full round through the model, often with the same background attached.
- Summaries. When the thread gets long, the product may compress history. Compression is not free: it is another pass that still moves tokens.
The list is tedious on purpose. None of these steps is exotic. Together they turn a modest feature into a long afternoon.
Budget the task, not the token line on the first message.
An illustrative loop
The following is a simplified story, not a log from a single job. Imagine I ask an agent to fix one failing test in a service I already know. It opens three files, proposes a patch, runs the suite, pastes a stack trace, adjusts imports, runs again, and only then passes. Each attempt resends the instructions, the files it chose, and the error text. The queue never showed that chain when I clicked start; it showed the opening prompt.
That is the mental model I keep: the estimate is the size of the front door. The task is the house.
What I do in practice
I stopped trying to optimise every token in real time. I plan per task instead:
- Name the task in one sentence and decide how much time and spend it deserves before the agent runs.
- Give context on purpose: what file matters, what test must pass, what is out of scope.
- Stop loops early. If two fix cycles do not move the failure, I narrow the question or take the keyboard.
- Record cost per finished task in my notes, not per message. That matches how I think about the work.
A small task brief in the repo beats a giant memory file for cost and for clarity. Here is the shape I use (fields are illustrative):
{
"task": "Fix pagination on /api/items when cursor is null",
"done_when": ["pytest tests/api/test_items.py passes", "no new deps"],
"context_files": ["src/api/items.py", "tests/api/test_items.py"],
"out_of_scope": ["admin UI", "migrations"]
}
Why this matters beyond my desk
When a team shares one pool of model access, a single underspecified task can burn through the afternoon for everyone waiting in line. Token counts are the meter. Tasks are what you buy. Teaching people to scope the task does more for the bill than arguing about whether a prompt could be ten words shorter.
I still like the queue estimate. It keeps me honest about monster prompts. I just do not treat it as a quote for the whole job.