Skip to content

Stage 02 · 11 articles

Context & Caching

What goes into the context window, what it costs, and how to stop paying for the same tokens twice.

About this stage

The context window is the token limit that one model call shares between its input and its output, and every token in it is billed. This stage covers what to put in the window, how to keep it small, and how caching stops you paying for the same tokens twice.

Start with tokens and the window itself, then context engineering and context rot, which explain why a longer prompt can make answers worse. The caching articles separate prompt caching, which the provider applies to a repeated prefix, from semantic caching, which you run yourself and which can return a wrong answer. Retrieval belongs here as well: chunking, embedding models, and whether RAG or fine-tuning fixes the problem in front of you.

Start here

  1. 01What is a token in AI? How models count and bill themWhy counts differ by model and language, and how to count first.
  2. 02Context window: what fits, what it costs, when bigger hurtsWindow sizes today, and what a long input costs.
  3. 03Context engineering: what to put in the window and whereHow to budget the window and order it for caching.
  4. 04Prompt caching: how it works and what it savesRepeated prefixes billed at a fraction of the price, if they never change.