The real cost
Cap, attribute, explain, and never mistake a public figure for a measurement
- Module
- Module 05
- Deliverable
- cout-semaine.csv (one line per session, tied to its task) and analyse-cout.md (the aggregated table, the before / after comparison, and what the measurement does not prove); for the duel, duel.md (the two passes and their cost per successful task)
- Access
- preview
Before you read
- What you will be able to do
By the end of the exercise, you know what your agents cost over five days, task by task, and roughly what a cheaper model changes on mechanical work, in cost and in quality.
- What you will do
- Action 1: Note your spend for the last month
- Action 2: Name the task of your next session
- Action 3: Set the model of a subagent
- Action 4: Check which model answered your subagents
- Action 5: Find where your tool sets the model and the effort of a subagent
- Action 6: Fill in the first line of your reading
Then the exercises:
- Une semaine de relevé : trois jours de ligne de base, deux jours d'étagement (in French)
- Le duel : la même tâche, avec et sans délégation à un modèle léger (in French)
- Time
83 min reading, exercise 1: 160 min, exercise 2: 90 min
- Updated on
- Before you start
- Words used in this module
- toolThe software that runs your coding agents, Claude Code or Cursor for example.
- responseEach call to the model: an agent makes one at every step of its work, not only when it writes to you.
- contextEverything the model rereads each time it answers an agent: the instructions, the files read, what was said earlier in that agent's conversation.
- subagentA secondary agent, launched by another agent for part of the work, with its own context; it returns its result to the one that launched it.
- main sessionThe working conversation you open yourself in the tool, and that launches the subagents; its subagents are not part of it.
- sessionWhen this module says "session" with nothing else: a main session with the subagents it launches.
- fleetAll the agents working for you at the same moment, main sessions and subagents together.
- tokenThe unit of text the model reads and writes, and on which the provider counts what it bills.
- taskA piece of work you name before starting, a ticket or a feature for example; it can take several sessions.
- readingThe file that records, for each main session, the task it served and what it cost, subagents included.
- regimeThe way a fleet is organised: how many agents work at the same time, which ones modify files, and in what order; the reading keeps only the number of agents.
- attribution unitWhat you tie each cost of the reading to; in this module, the task, never the session.
- goal fileThe file that tells an agent, before a long piece of work, what it must produce, what it is forbidden to do and when it has finished (module 6).
- quotaWhat your subscription gives you to consume over a given period, across all open sessions.
- usage creditsWhat you pay on top of a subscription when its quota is used up.
- capA limit written in advance, in the tool or in your account: a number of responses, a budget in dollars, or an agent's model; unless set otherwise, the session that launches an agent can ask for another model for it.
- mechanical workWork that calls for no decision: extracting, formatting, renaming, reading a file tree.
- orchestratorThe main session that splits a task, hands its execution to subagents on a cheaper model, and keeps the decisions and the verification.
- routerA service that gives access to the models of several providers with a single key and a single bill.
- tieringKeeping the most expensive model for the work where judgement counts, and running mechanical work on a cheaper model.
- reasoning effortThe setting, when the tool has one, that tells the model how much to think before answering; it is set by levels, from the lowest to the highest.
- baselineThe days when you keep the reading without adding anything to your current habits, to have a point of comparison.
- quality indicatorA count of defects recorded at the same time as the cost, for example the pieces of work redone: the higher it is, the less good the work was.
- transcriptThe file where the tool records everything that happens in a session, with the token count of each response from the model.
- cacheThe memory where the provider keeps, for a few minutes or an hour, the start of a context it has already received.
- fresh inputThe tokens the model receives outside the cache, billed at the full rate.
- cache readThe tokens the model rereads from the cache, billed much less than a fresh input.
- cache writeThe tokens put in the cache the first time they arrive, or again after the cache expires; they cost more than a fresh input.
- outputThe tokens the model writes in its responses; they are the most expensive per token.
- list-price equivalentWhat tokens would have cost at the provider's list price, the one it bills token by token outside a subscription; it is not what was paid.
The known rule I was not applying
I am the author of this manual; "I" always refers to my own practice in it. "The most expensive model, only where judgement counts": this cost rule is public, and this manual teaches it. Yet when I reread, after the fact, a whole week of my work with agents, I saw that almost all the cost had gone through the most expensive model. None of my subagents had a model set in writing: almost all of them took the model of the main session that launched them. Nobody had decided it; it was the default choice.
Cap first, then tie each cost to its task, and explain the cost of a task only once that cost is tied to it.
A total says neither where the money went, nor whether a cap held. A spend tied to a task can be discussed line by line.
The module's terms are defined at the top of the page; here are the ones the rest needs right away. Your tool runs your coding agents: Claude Code or Cursor, for example. The main session is the conversation you open in it yourself. It launches subagents, secondary agents that each do part of the work with their own context. A session with nothing else is the main session with its subagents; one line of the reading covers one session.
The context is everything the model rereads when it answers an agent: the instructions, the files read, what was said earlier in that agent's conversation. A response is each call to the model: an agent makes one at every step of its work, and each response rereads the whole context. The fleet is all the agents working for you at the same moment. The providers, which sell access to the models, bill in tokens: the units of text the model reads and writes.
The figures in this module that come from my own work come out of that reread, and from a second week read the same way. They are observed weeks, mine alone, reconstructed after the fact from the files that my tool, Claude Code, writes. Nothing in them was compared before and after a change, and the quality of the work was not measured at the same time. These figures give a minimum of what a week would have cost at list price, because those files do not see every call (the detail comes further on). They also say how that spend is distributed. They do not say what you save with a cheaper model without losing quality: the exercise measures that on your side, and I have not done it on mine.
When this module is useless
This module teaches you to keep a reading: the file that records, for each main session, the task it served and what it cost, subagents included.
The way you pay changes what follows. By usage, you pay for what you consume. On a flat rate, you pay a fixed-price subscription: here, "flat rate" and "subscription" mean the same thing. The subscription gives you a quota to consume: a quantity fixed over a given period, across all open sessions. Beyond it, you wait for the next period, or you buy usage credits, credits paid on top of the subscription.
This module is useless to you if two conditions hold: your total bill, subscription and usage credits included, stays under about €200 a month, and the quota never cuts off your agents. Below this threshold, an automatic export (tracking that fills itself in, described further on) and a table would cost you more, in time, than they can save you. This threshold is my estimate: nothing has put a number on it. Note each month's amount, set a monthly spending limit on your account if your provider offers one, and come back the day the amount surprises you.
If the quota cuts off your agents, this module is useful to you, whatever the amount of the bill. On a subscription, the cost that counts is the work cut off, and the usage credits if you buy any. That is my case: the quota cut me off several times a week, as the rest shows. I did not note my bill for the month, so I cannot say which side of the €200 threshold it falls on.
On a subscription, do not count what you pay: count the usage. Count in list-price equivalent, meaning in dollars calculated from the tokens at the provider's list price, as I did for my week (the method is further down). It is the unit where a cheaper model shows best. Failing that, count in time spent or in number of exchanges (the messages you send to the agent). The share of quota consumed is not enough: it holds for all the sessions together, and cannot be tied to a task when several sessions run at the same time.
Action 1: Note your spend for the last month
Open the billing or usage page of your account, at your tool's provider. Note in a file today's date and your way of paying, by usage or on a flat rate. Then note the total amount for the last full month, subscription and usage credits included, then, separately, the amount of the usage credits, zero included. If the amount is in dollars, convert it to euros to compare it with the threshold. Finally, note whether the quota cut off your agents this month.
Expected result: A dated line in a file: your way of paying, the total for the last full month in euros, the usage credits separately, and whether the quota cut you off. Under about €200 and with no cut-off, only a spending limit on your account is useful to you.
Three questions, in this order
Ask yourself three cost questions, in this order: cap, attribute, explain. Do not answer the third before you have answered the second.
Capping is writing a limit in advance, in the tool or in your account at the provider. The limit applies to a number of responses, to a budget in dollars, or to the model of an agent, set so that it does not take a more expensive one. A cap needs no data to be set. It is the only one of the three questions that acts from the first day. Check all the same that the cap holds: the main session that launches a subagent can ask for a different model for it than the one set for that subagent. The settings and the check come further down.
Attributing is tying each cost to the task that caused it.
Explaining is understanding why a task cost what it cost, and what can be removed from that spend without losing quality.
The temptation is to start with the third, the most interesting one. You then explain a distribution that nobody recorded, and you go after the most visible spend, like the length of what the model writes, which is not necessarily the heaviest. In my week, according to my transcripts, what the model writes made up 14% of the cost, and the context it loads and rereads at each response, 86%.
Do the opposite, which costs little: a cap set on the first day, a reading kept every day, and the explanation only when you have a week of lines to read.
The task, never the session
Tie each cost to a task, a piece of work you name before starting (a ticket or a feature, for example), never to a session. The task is your attribution unit: what you tie each cost of the reading to. Decide the list of tasks before the first measurement.
A session, in this module, is a main session with the subagents it launches. A task can take several sessions: that is the normal case as soon as a piece of work lasts. Never have one session serve two tasks: its line would be tied to nothing precise and would end up under "misc". A cost table that carries a "misc" line no longer says where the money went.
That is why module 6 is among the prerequisites of this one. It teaches you to write a goal file: the file that tells an agent, before a long piece of work, what it must produce, what it is forbidden to do and when it has finished. A goal file has a name, a start, an end and a deliverable: it is a task ready-made for the reading.
Action 2: Name the task of your next session
Before opening your next session, write in one line the name of the task it will serve, as you will write it in the reading. Keep that name until the end of the task: a name changed along the way cuts its costs into two lines that no longer meet.
Expected result: A task name written before opening the session, and only one. If it takes two, they are two sessions.
Public figures, and their expiry date
Use a public figure to place an order of magnitude before measuring, never to say what your fleet costs. Read its date: a pricing figure ages, because each price change by a provider can make it false. Treat a pricing figure more than six months old as an assumption to check again.
A public figure says nothing about the size of your repositories, the length of your contexts, or your way of splitting tasks. These factors make the result vary, and the figure does not say by how much. Nor does it say how the users it counts organise their fleet: how many agents work at the same time, which ones modify files, and in what order. This module calls that organisation the regime. When you quote a cost, give with it the regime, the size of the repository and the date.
The rule you apply without measuring anything
Keep the most expensive model for the work where judgement counts: arbitrating, deciding on an architecture, checking before delivery. Run on a cheaper model the mechanical work, the work that calls for no decision: extracting, formatting, renaming, reading a file tree. This split is called tiering here. It is set like a cap, by setting models before any measurement, as the first of the three questions requires.
Providers sell several model tiers: a top tier, the most expensive; a mid tier; a light tier, the cheapest. "One step down" is the next tier towards the cheapest. The exercise moves mechanical work down a single step from your habits; the table of tiers, further on, goes down to the light tier for the simplest work.
According to the five-agent row of the table above, going from $81 to $39 saves 52%: that is the gap the source publishes. This percentage does not say whether the quality of the code suffers from it, and I did not check it on my side: I had not applied the rule during my reconstructed week.
What the exercise asks for, and the fallback route
Plan for the exercise five working days in a row, on a repository you use every day. You also need the detail of your consumption, day by day: your provider's bill, the usage page of your account, or the files your tool writes. It is the exercise in the manual that asks for the most time and access. These five days cannot be caught up in a weekend. Without them, you cannot do the exercise on your own work, even if you understood everything on reading. The fallback route, a provided data set (further down), is planned for that case. At the end, the exercise has you write your analysis: a file that carries the table of costs by task, the before / after comparison, and what the measurement does not prove.
The exercise does what my week did not do. First three days of baseline: the days when you keep the reading without adding anything to your current habits, to have a point of comparison. Then two days of tiering, with a cap that sets the model of the subagents. For each session, you record the cost and a quality indicator: a count of defects recorded at the same time as the cost. The higher it is, the less good the work was. For example the number of pieces of work redone because the first result was wrong. Or the number of findings confirmed in review, the defects that a review, yours or an agent's, reported and that you checked (module 3).
The exercise puts your tasks in two groups: the mechanical tasks, in which all the work is mechanical, and the judgement tasks. A task that mixes the two is split into two tasks. Classifying each task, with its reason, is a step of the exercise. Code written from a specification already drafted is a borderline case. The table of tiers, further on, puts it at the mid tier, and the exercise leaves it to you to place it, with its reason.
"Cap first" holds for your everyday practice. The exercise, for its part, is a measurement. Its three baseline days measure your habits at the start of the exercise. "Without adding anything" means: without adding anything to what you already do on the first day. So keep the practices from this module that you adopted while reading (naming the tasks, setting a cap), and add no other change during these three days.
On the fourth and fifth days, the mechanical tasks move down one step. Their main session runs one step below its usual model, and a cap sets their subagents on that same model. The judgement tasks do not change, subagents included.
Preferably, set this cap through definitions. A definition is the file that describes a type of
subagent and can set its model; its format comes further on. Stored in .claude/agents/, it holds
for the whole project: a judgement task can launch that type too. So create types of subagent kept
for mechanical tasks, and ask for them only in mechanical tasks: it is the main session that
chooses which type it launches, from what you ask of it.
The other route is an environment variable that sets the model of the subagents, set in a terminal kept for mechanical tasks. On its own, it is not enough: it gives way to the definition and to the session's request. A second setting imposes the model of this variable on all the subagents launched from that terminal. But it also moves up to that model a subagent that was running on a lighter model: if you have one, stay with definitions. These two settings, and the command that checks whether a subagent moved back up to the expensive model, come further on.
If you did the actions of this module, your baseline is already partly tiered. The gap measured between the baseline and the two days of tiering will then be smaller than if you started from zero, and your analysis says so. The comparison then covers the one step down that the exercise adds. If your mechanical work already runs on the cheapest model, there is no step left to go down. Days 4 and 5 then go like the baseline, and your analysis covers only the cost per task. The tasks of the two periods will not be the same: the comparison gives an order of magnitude, and your analysis says what it does not prove.
Still in this module:
- A week reconstructed on my side
- Reading the cost by kind of token
- Capping: set the model, then check who answered
- Delegating: a strong model that splits, light models that execute
- Attributing: the reading, by hand then by export
- The list-price equivalent is not a bill
- Comparing with a public figure, at an equal number of agents
- Pay only for what produces
- In practice
That is about 11,870 words, and the exercise with its deliverable template.