Skip to content

What a context window really costs article

'Fits 1M tokens' is a limit, not an allocation. A full window bills on every request, slows every answer, and can quietly make both worse.

Long read · 6 min
llmcontext-windowcost-engineeringrag

Every model launch season brings a bigger number. Two hundred thousand tokens. One million. Two. The number is real, and it is also the most expensive kind of true: it describes a limit, not an allocation. Nothing about a large window is free. A full window bills on every request, slows every response, and — past a point that arrives sooner than the marketing suggests — can make the answers themselves worse. This piece is about what filling the window actually costs, in dollars, seconds, and accuracy.

Cost #1: you pay for the window on every single request

The input bill is per token, per request. There is no “the model already read this” credit. If your workflow sends a 500K-token corpus with each of a hundred questions, you pay for 500K tokens a hundred times. Fifty million input tokens to ask a hundred questions of a document set is not an edge case; it is the default failure mode of “just put it all in context.”

The repetition compounds inside conversations, too. Turn n of a chat re-sends turns 1 through n−1. Without prefix caching, a twenty-turn session with 5K tokens of new material per turn bills roughly a million input tokens in total — most of it for tokens you already paid to process nineteen times. Caching cuts that dramatically (see the companion piece on prompt caching), but only for byte-identical prefixes, and usually only while the cache is warm. The window is rented, repeatedly; it is never owned.

Cost #2: time. Prefill grows with the window, and you wait for all of it

Generating the first output token requires processing all the input — the prefill. Prefill compute grows with input length, and superlinearly once attention kicks in. A 1K-token prompt answers in a blink; a 500K-token prompt can sit in prefill for tens of seconds before the first word arrives on standard tiers.

This changes product design. Every follow-up question over the same giant context pays prefill again unless a cache covers it. Interactive products that need sub-second first tokens learn to keep prompts short per request and fetch lazily, rather than carrying a warehouse of context on every call. Throughput drops as well: many providers meter their rate limits in tokens per minute, so a long prompt spends the quota of many short ones — your effective requests-per-minute falls exactly when your prompt grows.

Cost #3: some vendors charge extra for the long part

Read the pricing page’s fine print, not the headline. Several vendors tier their pricing by context length: the same model bills more per token above a threshold — commonly around the 128K–200K mark — than below it. So “gives 1M tokens” can simultaneously mean “bills 2× per token once you pass 200K.” Others discount short prompts instead, which is the same cliff wearing a friendlier hat. The window size and the price-per-token curve are separate decisions, and only one of them appears in the launch announcement. The companion token pricing article carries the per-vendor details.

Cost #4: quality. More context can make answers worse

The least advertised cost. Recall over a stuffed window is not uniform. The canonical finding — “lost in the middle” — is that models reliably use material at the beginning and end of the context and increasingly fumble information buried in the middle. Needle-in-a-haystack benchmarks look solved; choosing the right needle when forty needles look relevant is not, and that is closer to real work.

Irrelevant context is not neutral ballast. It is competition for attention. Every chunk of stale log, every redundant paragraph, every cached tool response you never trimmed is a distractor the model must actively discount. Practical symptoms: confident answers citing the wrong version of a document, numbers blended across sources, instructions obeyed at turn 3 and forgotten by turn 30. A disciplined 30K-token context routinely beats a lazy 300K one on both accuracy and cost.

The arithmetic, worked

Make the comparison concrete. Two designs answer questions over a 400K-token corpus, 500 questions total, with a small-output chat model:

Design A — stuff the window. Every request sends the full corpus plus the question. Total input ≈ 400K × 500 = 200M tokens, billed at full rate, with long-context surcharge possibly applying above the tier threshold, and prefill latency on every one of the 500 calls.

Design B — retrieve, then answer. Chunk the corpus once, embed the chunks once. Each request sends the question plus the top ~10 chunks, say 6K tokens total. Total input ≈ 6K × 500 = 3M tokens — plus one-time embedding costs that are typically an order of magnitude cheaper per token than input processing. Same questions, ~1.5% of the input bill, faster first tokens, and relevance chosen by retrieval quality instead of the model’s mid-window attention.

Retrieval is not free either — you now own a chunking strategy, an index, and a relevance problem — but note what changed: the cost driver moved from how big is the corpus to how good is the retrieval. The second is engineering you can improve; the first is a bill.

When the big window is the right tool

Long context is not a scam; it is a specialized instrument. It wins when:

  • One-shot analysis. A single pass over a long document — contract review, book-level Q&A in one conversation — where you will not re-send the corpus on many requests, so the repetition tax never triggers.
  • Noisy holistic tasks. Summarize-the-whole, find-cross-references, anything where you genuinely need simultaneous access to all of it.
  • Cache-friendly traversal. A stable corpus prefix, cached, with many short questions appended — the pattern that pairs big windows with prompt caching.

And it loses when the job is many small questions over a large corpus, or any recurring pipeline where the corpus is static and the queries are not. That is retrieval’s home turf.

Practices that pay rent

  1. Measure before stuffing. Count tokens for the real payload, not the estimate. token-estimator and context-window-planner exist for exactly this: know what fraction of the window — and of the bill — each component occupies.
  2. Chunk deliberately. Retrieval quality is decided at chunking time: size, overlap, structure-awareness. Compare strategies on your own text with rag-chunk-comparator and plan embedding batches with embedding-chunk-planner.
  3. Compress rolling history. In multi-turn apps, summarize old turns instead of dragging them verbatim — text-summarizer — and keep the live tail short.
  4. Trim tool debris. Agent frameworks cache tool outputs into the conversation forever. Cap them, collapse them, or drop them once consumed.
  5. Put the critical material at the edges. Instructions and key documents at the top; the current question at the bottom. The middle is where recall goes to nap.
  6. Price the whole workflow. Per-token rates × your real request shape, not the vendor’s. llm-cost-calculator turns “which design is cheaper” into arithmetic before you commit.

The number that matters

“Fits 1M tokens” answers can I send it? The productive question is what does sending it cost me per request, per second, per answer? — and the answer is usually “less than you think at 2K, more than you think at 200K, and worst exactly when quality starts sagging.” Respect the window as a budget — spend tokens where the task lives, retrieve instead of repeat, and keep the middle of the prompt for things you can afford to lose.