AI & MCP
Long context: what a 1M-token window really costs
A 1M-token window changes the price tier, the number of steps and the value of cache. Here is the arithmetic with the 1 November 2026 list pages.
Key points
- Above the declared threshold the input price can double: on gpt-6.1-sol $4 against $2 per million.
- A ten-step agent pays for the context ten times, so cost grows faster than the number of steps when the context grows.
- Cache is paid once and makes input fifty times cheaper on deepseek-flash off-peak.
A 1M-token context is not a free window: it changes the price tier, multiplies the cost of every step and makes cache the most important line in the bill. The arithmetic below uses the list pages read on 1 November 2026.
The price changes above the threshold
| Scenario | Input tokens | Input price | Cost of the call |
|---|---|---|---|
| gpt-6.1-sol, short context | 272,000 | $2/1M | $0.544 |
| gpt-6.1-sol, long context | 300,000 | $4/1M | $1.20 |
| deepseek-flash, cache miss | 300,000 | $0.15/1M | $0.045 |
| deepseek-flash, cache hit | 300,000 | $0.003/1M | $0.0009 |
The first row and the second are not the same prompt with 28,000 extra tokens: they are two price tiers. Going from 272K to 300K tokens costs 2.2 times as much, and the jump arrives in one piece at the point where the list page changes label.
Arithmetic, not impressions
node -e "const t=300000,p=4;console.log((t/1e6*p).toFixed(4),'USD')"
The command prints 1.2000 USD: 300,000 tokens at $4 per million. Set p to 2 and you get the cost in the short tier; change t and you see what every extra 10,000 tokens of prompt really adds.
Ten steps do not cost ten times
An agent working in ten steps resends the context on every step. With a fixed 300,000 tokens, ten calls are 3M input tokens, or $12 in the long tier on gpt-6.1-sol. The same work with the context held at 40,000 tokens costs 400,000 tokens in the short tier, or $0.80: fifteen times less, same model, same result.
Cache is the real discount
An identical prefix is paid once and then read at cache price: on deepseek-flash $0.003 against $0.15 per million, fifty times less. Cache rewards stability, though: if the system prompt carries today's date or a randomly ordered file list, the prefix changes on every call and the discount never arrives.
What to cut first
- Tool schemas: 3,655 bytes for nine tools is about 900 tokens on every call; with fifty tools they become the main line.
- Old tool outputs: keep the latest result and a summary of the earlier ones, not every intermediate JSON.
- Re-read files: a diff is cheaper than the whole file once the change is known.
- Logs: ten thousand log lines rarely change the next action.
The limitation
Comparing list pages by window size misleads. The tokenizer changes the count on the same text, cache rules differ in duration and prefix, and peak hours double the price without touching the window. Our four-characters-per-token figure is a rough estimate: for the real budget read the usage field of every response.
Where to continue
The order of steps is in orchestrating multi-step agents, model choice in evaluating a model for code and the system prompt in prompts for agents. To see why a second interface costs less than one giant prompt read MCP vs REST. The catalogue behind the examples is 111,985 components and 1,556 blocks; a citable MIT record is Magic UI rainbow button.
Frequently asked questions
Does a 1M-token window mean I can paste a whole repository?
Technically yes, economically no. deepseek-flash declares a 1M-token context and 384K output on 1 November 2026, but every step pays for the whole prompt again and the bill grows with the number of steps.
Why does the price double above 272K tokens?
Some list pages have two tiers. OpenAI writes short context up to 272K and long context above it, with gpt-6.1-sol at $2 against $4 input per million. The threshold is a line in the list page, not a property of the model.
How much does cache save?
On deepseek-flash, fifty times: $0.003 against $0.15 per million input tokens off-peak, list page read on 1 November 2026. Cache pays only for the identical prefix, so one changed line at the top invalidates it.
Is a byte count a token count?
No. Four characters per token is an estimate: tools/list answers 3,655 bytes, about 900 tokens, but the real tokenizer changes with the content. For the budget use the usage field in the response.
Should I trim the context or switch model?
Trim first. A 40K prompt costs an order of magnitude less than a 300K one on the same model, and the trimming still pays after a model swap. Switching model makes sense once the context is clean.