29.9 Token budgets, and quantifying a saving
- Approved by
- Panaversity ·
In everyday life. A mother sends her son to the market. His bag holds five kilos, and nothing more fits in it. Her list says "about three kilos of vegetables", which he may go a little over. She gives him a fixed sum of money, and the shopkeeper will not sell him more than that. When he comes home, she does not judge the trip by the money he spent. She judges it by how much of what he brought she can cook. In this section, the bag is max_tokens and the list is the task budget. The money is the session's dollar budget, and what she can cook is the accepted result.
What you will learn. You practice this in Lab 29, Tasks 2 to 4, each of which ends in one line of the report.
- Which three budgets can you set, and which are hard?
- Why set a budget per accepted result?
- How do you write a saving?
- Why are two savings never added together?
Why it matters. A budget caps what a run may spend. It does not say whether the spend bought anything. A saving that was not measured against the same baseline as the others is only a guess, even with a dollar figure on it.
At work. Tuesday, 2:30 p.m. You write to Dave: the headline, then one line for the cache change, and one for the tier. The batch line follows on Wednesday, after the first 1:00 a.m. run, with its measured delay. The tier line is provisional until next week's gate counts confirm it (29.3).
Which three budgets can you set, and which are hard?
max_tokens for each request and the dollar budget for each session are hard. The task budget is a hint. The task budget covers one agentic turn: everything after a user message that carries no tool results, across several requests.
| Budget | What it covers | Hard or soft |
|---|---|---|
max_tokens | The output of one request, thinking and text together | Hard: the response stops there1 |
| The task budget | One agentic turn, across all its requests | Soft: "a soft hint, not a hard cap"2 |
| The dollar budget (23.5) | One hosted session | Hard: the session pauses at the cap3 |
max_tokens is an upper limit that stops output from running too long. It is never a saving, and it limits one request, not a turn (29.2). Anthropic advises 64,000 for agentic work, or 128,000 when a cut-off attempt is costly. It also advises treating a stop at max_tokens as a failure.3 In the extraction, the stop-reason gate does exactly that.
The task budget is a beta setting, sent with the header task-budgets-2026-03-13 as output_config.task_budget. It counts what the model sees, its own output and new tool results. The smallest value is 20,000 tokens, and a smaller one is a 400 error. A budget that is too small can cause "refusal-like behavior". Changing its value in the middle of a conversation misses the cache. Sonnet 5.5 and Haiku 5.5 support it.2
The dollar budget is 23.5's cap on a hosted session: $0.50 for the morning triage, $1.00 for the month-end review. A workspace spending limit is the last safety limit.3
Why set a budget per accepted result?
Because a cap limits what a run spends, and only the check says whether the run bought anything. A triage session that stops at "budget reached" produces no report the check can accept. Its spend goes into the step's row, and nothing goes into the step's accepted results. So beside each cap, write the step's cost per accepted result from the week's report (29.6). A change that keeps every run under its cap, and sends more results to Ana, has raised that cost. A cap that is too low can raise it too, by stopping runs that would have passed.
How do you write a saving?
One line per change, each measured against the same baseline: the week before any change. Each line holds six things:
- The measured cost per invoice, before and after, from runs of the same invoices.
- Times the week's invoice count, from the usage log. This gives the expected saving in dollars a week.
- The token counts behind both costs.
- The prices used, and the date they were copied.
- The check the change passed: the cache share, the deadline, or the suite's lowest trial on each model.
- For a batch, its delay: when its last result came.
Here is the cache line, worked with example numbers, not from a recorded run, at Sonnet 5.5's prices.4 Suppose each invoice's two requests send 5,930 input tokens and receive 1,000 output tokens, thinking included. Of the input, 2,000 tokens are the tools and rules, 100 the task turn, 200 the model's call, 1,500 the invoice and 30 the date.
- Before: 5,930 × $2 + 1,000 × $10, per million tokens, is $0.01186 + $0.01000 = $0.02186 an invoice.
- After: request 1 reads 2,000 tokens and writes 100. Request 2 reads 2,100, and pays full price for 1,730. That is 4,100 × $0.10 + 100 × $2.50 + 1,730 × $2 + 1,000 × $10, per million tokens: $0.00041 + $0.00025 + $0.00346 + $0.01000 = $0.01412 an invoice.
Cache breakpoints on the extraction, single after the rules and rolling after request 1. Before $0.02186 an invoice, after $0.01412. At 300 invoices a week, $6.56 becomes $4.24: $2.32 a week saved. Tokens per invoice: before, 5,930 input and 1,000 output. After, 1,730 input, 100 written to the cache, 4,100 read from it, 1,000 output. Prices: Claude Sonnet 5.5, $2 input, $2.50 five-minute write, $0.10 read, $10 output per million tokens, copied November 30, 2026. Check: cache share from 0% to 69%. The output cannot change, so the suite was not run. Delay: none.
Note that the output, $0.01000, did not move. The breakpoints can only lower input. Note too that 69% is under Anthropic's 80% mark (29.6), and nothing is broken. For each invoice, 1,730 of the 5,930 input tokens are still paid at full price. The diagnostics decide that, not the mark.
A tier line adds the suite result: each model's lowest trial on the 16 extraction cases (29.3).
Why are two savings never added together?
Because two changes to the same requests overlap, so their sum claims more than both together can save. Take the same example invoice as a batch, without breakpoints, step by step:
- The batch line: half of $0.02186 is $0.01093, so the saving is $0.01093.
- The cache line: $0.02186 − $0.01412, so the saving is $0.00774.
- Added: $0.01093 + $0.00774 = $0.01867 saved, which would leave $0.02186 − $0.01867 = $0.00319 an invoice.
That is too low. The batch discount applies to the cached tokens too,4 so the best the two can do together is half of the cached cost. With the one-hour write that a batch needs (29.8), the 100 tokens written cost $4 per million, not $2.50, which adds $0.00015. So the cached cost is $0.01412 + $0.00015 = $0.01427, and half of it is about $0.0071. And inside a batch the cache hits are only "best-effort",5 so the real figure is higher still.
So each line stays against the same baseline, and the combined setup is measured as a run of its own, on its own line.
The operating rule: cap every request and every session, and judge each step by its cost per accepted result. Report each change as its own measured line against one baseline.
Check yourself
Question 1 / 5
0 answered
You set a task budget of 10,000 tokens on Sonnet 5.5. What happens?
Sources
- Owner
- Panaversity