Context EngineeringLesson 40 of 87

Module 5 · Cost, caching and latency

The arithmetic of a request

In this lesson

  • 10 min read
  • 6 reading sections
  • Knowledge check
  • Lesson 1 of 9 in this chapter

This chapter’s goalCut the price and the time-to-first-token of a call without changing what it returns: order the prefix by stability so the cache actually hits, measure the hit rate rather than assuming it, move non-interactive work to a batch lane, route by context size, and cap the paths through which a single user can spend an unbounded amount.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available
Four rates on the same requestCached input10Batch input50Input100Cache write125Output400% of the base input rateExact prices change every few months and differ by an order of magnitude between the smallest modeland the largest, so look them up rather than memorising them. The ratios are stable, and they are whatthe arithmetic needs. Output is usually a few per cent of the tokens but, at several times the inputrate, a much larger share of the bill (more than a tenth uncached, and up to a third or more when mostinput is cached), which is why asking for a shorter answer is a real cost lever.
Exact prices change every few months and differ by an order of magnitude between the smallest model and the largest, so look them up rather than memorising them. The ratios are stable, and they are what the arithmetic needs. Output is usually a few per cent of the tokens but, at several times the input rate, a much larger share of the bill (more than a tenth uncached, and up to a third or more when most input is cached), which is why asking for a shorter answer is a real cost lever.

Figure 5.1

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 7Free · no account needed
Lesson steps

Four prices, not one

Every hosted model has at least four rates, and confusing them is how a cost model ends up wrong by a factor of five.

  • Input, per million tokens. The base rate.
  • Output, per million tokens. Typically four to eight times the input rate (five times on every current Anthropic model and on OpenAI’s newest; six to eight times on several OpenAI and Google models, checked October 2026), because generation is sequential and cannot be batched the same way.
  • Cached input, when a prefix is reused. Often around a tenth of the base input rate.
  • Cache write, a premium on the first call that stores the prefix: commonly around 1.25 times base input.

There is usually a batch rate as well, around half price for work that can wait hours.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Data, SQL and Getting to the Answer exam.

Stuck on something?Ask Sayali, your AI tutor

How to cite: Addaly (2026) ‘The arithmetic of a request’, in Context Engineering. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/context-engineering/what-a-token-costs (Accessed: 27 November 2026).