Chapter 9 of 10
Diagnosing a production cost trace
Cost per request is already normalised for volume, so more traffic cannot explain a jump from $0.02 in staging to $0.31 in production. Three candidates account for nearly every occurrence: real inputs far larger than fixtures, loops running more turns before they terminate, and a prompt cache that hits in staging and misses in production. This chapter gives each one's signature in a per-call usage log, the query that reads all three from one trace, the denominator checks worth doing first, and the replay harness that makes the comparison possible next time.
Token economics — read the current version at https://daviddominguez.dev/learn/en/token-economics/prompt-cache