01Chapter 1: What a token is and why counts differ by modelThis chapter assumes you can read basic Python and have used an AI coding assistant. It also assumes you know a large language model (LLM) is a program that reads text and predicts more text. You don't need any other background.3 min read
02Chapter 2: The context window as a shared budgetThis chapter assumes you can read basic Python and know that a model reads and writes tokens. It also assumes you have used a coding agent. It builds on the earlier chapter on what a token is.3 min read
03Chapter 3: How input and output tokens are pricedThis chapter assumes you can read basic Python, know what a token is, and have seen JSON usage data from an LLM API. It covers how one request is billed. Later chapters build on this to cost whole agent loops.2 min read
04Chapter 4: Why an agent loop costs more than one requestThis chapter assumes you can read basic Python and know that models bill per token, with output tokens usually priced higher than input tokens. You also need to know what a context window is. It explains why a coding agent's bill grows faster than its number of turns.3 min read
05Chapter 5: Where the context grows: tool output, file reads and historyThis chapter assumes you know what tokens and a context window are, and that you have read the earlier chapters on token pricing and the cost of an agent loop. You should be able to read short Python and JSON.2 min read
06Chapter 6: Prompt caching and keeping prefixes stableThis chapter assumes you can read basic Python, know that an agent loop resends its whole context on every turn, and know that input tokens are billed per million. If the cost of a loop without caching is unfamiliar, review the earlier chapter on agent loop cost first.3 min read
07Chapter 7: Keeping context small: scoped reads, truncation and compactionThis chapter assumes you know that an agent loop resends its whole context on every turn, and that input tokens are billed each time. You should also be able to read short Python functions. Here you will look at three ways to keep that context small.2 min read
08Chapter 8: Choosing between model tiersThis chapter assumes you know how input and output tokens are priced and how an agent loop resends its context on every turn. It covers what separates model tiers and how to pick one for a given kind of work.2 min read
09Chapter 9: Reasoning tokens and when extra thinking pays offThis chapter assumes you know how input and output tokens are priced, that output tokens usually cost more per token than input tokens, and that you can read short Python functions.3 min read
10Chapter 10: Subagents as a way to isolate contextThis chapter assumes you have read the earlier chapters on context growth and prompt caching. You should also be comfortable reading short Python programs and JSON.3 min read
11Chapter 11: Routing steps to the right modelThis chapter assumes you can read basic Python and know the idea of model tiers (small, mid, large) from the earlier chapter on choosing between them. It also assumes you know that an agent loop makes many separate model calls.3 min read
12Chapter 12: Reading usage data and attributing spendThis chapter assumes you can read basic Python and JSON, and that you know how input, output and cached tokens are priced. It shows how to turn raw usage data into a spend report you can act on.2 min read
13Chapter 13: Judging models by cost per resolved taskThis chapter assumes you can read basic Python and know how input and output tokens are billed. It also assumes you know that an agent loop resends its context on every turn.3 min read
14Chapter 14: Budgets, step limits and guardrailsThis chapter assumes you have read the earlier chapters on token pricing, agent loop cost and measuring usage. You should be comfortable with the per-request cost formula and with reading usage data from API responses. Measuring spend shows you what a run cost after it finishes. Budgets and guardrai2 min read