01Chapter 1: What a token is and why counts differ by modelA language model does not read characters or words. It reads tokens, and every price, limit, and usage figure for a coding agent is stated in tokens. This chapter explains what a token is, why two models count different numbers for the same text, and how to get counts you can trust.7 min read
02Chapter 2: The context window as a shared budgetYou can read short Python programs, you have used an AI coding agent, and you know that a large language model reads and writes tokens. The previous chapter covered what a token is and why counts differ between models. This chapter covers the limit on how many tokens a model can handle at once, and 6 min read
03Chapter 3: How input and output tokens are pricedThis chapter explains how a provider turns token counts into a bill. It assumes you can read basic Python and JSON, and that you know what a token and a context window are from the earlier chapters. By the end you should be able to compute the cost of one request from its usage data, and to see why 6 min read
04Chapter 4: Why an agent loop costs more than one requestThis chapter assumes you can read basic Python and know how input and output tokens are priced. It also assumes you have used a coding agent that calls tools such as file reads and shell commands. Earlier chapters covered tokens, the context window, and per-token prices. Here you will see how those 6 min read
05Chapter 5: Where the context grows: tool output, file reads and historyThis chapter assumes you have read the earlier chapters on tokens, the context window, input and output pricing, and the cost structure of an agent loop. You should be comfortable reading short Python programs and JSON. Here we look at what actually fills the context of a coding agent, so you can pr7 min read
06Chapter 6: Prompt caching and keeping prefixes stableThis chapter assumes you have read the earlier chapters on token pricing and agent loop cost. You should be comfortable reading short Python functions and JSON usage records. Prices in the examples are placeholders. Take real rates and cache rules from your provider's documentation.6 min read
07Chapter 7: Keeping context small: scoped reads, truncation and compactionEvery token in the context is billed again on each turn of an agent loop. This chapter covers three ways to keep the context small: scoped reads, truncation and compaction. It assumes you have read the chapters on input and output pricing, agent loop cost and context growth. It also assumes you can 5 min read
08Chapter 8: Choosing between model tiersThis chapter assumes you can read basic Python and know what an agent loop is. You should also know how input and output tokens are priced, which an earlier chapter covered. Here you will learn how model tiers differ, how to compare them on a given task, and where people most often go wrong.6 min read
09Chapter 9: Reasoning tokens and when extra thinking pays offThis chapter assumes you have read the earlier chapters on token pricing and agent loop cost. You should know that output tokens usually cost more than input tokens, and that each turn of an agent loop resends the growing context. You should also be able to read short Python functions.7 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 know that an agent loop resends its whole context on every turn, and that tool output is the main thing that makes that context grow. It also assumes you can read short Python programs.5 min read
11Chapter 11: Routing steps to the right modelThis chapter assumes you have read the earlier chapters on token pricing, agent loop cost, model tiers and subagents. You should be able to read short Python programs and know that a coding agent runs a loop of model calls and tool calls.6 min read
12Chapter 12: Reading usage data and attributing spendThis chapter assumes you know how input, output and cached tokens are priced, and why an agent loop resends its context on every turn. It also assumes you can read short Python and JSON. It covers how to turn the usage numbers an API returns into a spend report that says where the money went.6 min read
13Chapter 13: Judging models by cost per resolved taskThis chapter assumes you have read the earlier chapters on token pricing, agent loop cost and model tiers. It also assumes you can read short Python functions and JSON usage records. Here you stop comparing models by their price list and start comparing them by what a finished piece of work costs.6 min read
14Chapter 14: Budgets, step limits and guardrailsThis chapter assumes you have read the earlier chapters on how tokens are billed, how an agent loop resends a growing context, and how to read usage data. You should be comfortable reading Python and JSON. Here we turn those measurements into limits that stop an agent from spending more than you int7 min read