01Chapter 1: What a token isThis chapter assumes you can read basic Python and have called an LLM through a chat or completion API. You should also be comfortable with simple arithmetic and unit conversion, such as dollars per million. You do not need to know how a model works internally.3 min read
02Chapter 2: How text is split into tokensThis chapter assumes you can read basic Python and know that an LLM receives tokens, not raw characters. It explains how a tokenizer turns text into those tokens and why the result is hard to guess by eye.2 min read
03Chapter 3: Counting tokensThis chapter assumes you can read basic Python and have called an LLM through a chat or completion API. It also assumes you know a token is the unit of text a model reads and writes. Here you will learn two ways to count tokens: before a call with a tokenizer library, and after a call with the usage3 min read
04Chapter 4: The context windowThis chapter assumes you can read basic Python, have called an LLM through a chat or completion API, and know what a token is from earlier chapters.3 min read
05Chapter 5: Output limits and the combined token budgetThis chapter assumes you can read basic Python, have called a chat or completion API before, and know that a context window is the maximum number of tokens a model can handle in one request. Here you will see how the window is shared between your prompt and the model's reply.3 min read
06Chapter 6: Why long conversations get expensiveThis chapter assumes you can read basic Python and know what a token and a context window are. It also assumes you know that providers charge per input and output token. Here you will see why the cost of a chat grows faster than its length.4 min read
07Chapter 7: How providers price tokensThis chapter assumes you can read basic Python, have called an LLM through a chat or completion API, and are comfortable with simple arithmetic and unit conversion. It covers how a provider turns token counts into a bill. Later chapters cover reading usage data and estimating whole conversations.3 min read
08Chapter 8: Reading usage from API responsesThis chapter assumes you can read basic Python and have called a chat API before. You should also know what input and output tokens are, and that providers bill for both.3 min read
09Chapter 9: Estimating what a call costsThis chapter assumes you can read basic Python, have called an LLM through a chat or completion API, and are comfortable with simple arithmetic. It builds on the earlier chapters about tokens, per-token pricing, and context windows.3 min read
10Chapter 10: Reasoning tokens and hidden outputThis chapter assumes you can read basic Python, have called an LLM through a chat or completion API, and know that providers bill input and output tokens at separate per-million-token prices. It builds on the output limit and the combined input-plus-output budget from earlier chapters.3 min read
11Chapter 11: Keeping context within budgetThis chapter assumes you can read basic Python and have called a chat API. It also assumes you know what a context window is and that a chat resends its history on every turn. Here you will learn three ways to keep that history within budget: trimming, summarizing, and retrieval.3 min read
12Chapter 12: Prompt cachingThis chapter assumes you can read basic Python, have called an LLM through a chat or completion API, and know how per-million-token pricing works from the earlier chapters on pricing and history growth.3 min read
13Chapter 13: Practical ways to lower costThis chapter assumes you can read basic Python, have called an LLM chat API, and know that cost is input tokens and output tokens multiplied by per-million-token prices. It also assumes you have seen history trimming and prompt caching introduced earlier. Here they are combined into a checklist you 3 min read