Special Topic · Token Cost Engineering: Make the Numbers Work

Input-Length Tiering: the 32k Red Line

One extra chunk can move the whole request into a higher input tier; use budget-aware truncation and stop paying double for RAG junk

THE QUESTION THIS PAGE ANSWERS

ANSWER FIRST

What is the key idea behind “Input-Length Tiering: the 32k Red Line”?

One extra chunk can move the whole request into a higher input tier; use budget-aware truncation and stop paying double for RAG junk

DECISION RULE

Read cost as a shape, not a single number. Break a request into input, output, retries, tools, and waiting time. The shape of usage usually tells you which design choice is expensive and where a smaller change can help.

TRY NEXT

Measure one real request before you optimize an imagined average.

WATCH FOR

A cheaper call that quietly creates more retries, latency, or review work.

The pattern: 1k more Tokens, whole bill doubles
Input length (illustrative model)Unit price ($/M, illustrative)vs baseline
0 – 32k$1.601x
32k – 128k$3.202x
128k – 252k$4.803x

Say your input is 33,000 Tokens—only 1,000 over 32k. All 33k Tokens on the request bill at $3.20/M—not the first 32k at $1.60 and the last 1k at $3.20. That extra 1k doubles the whole request in this illustrative rate card.

Interactive Demo · The bill on the ladder

Drag input length and watch what happens near the 32k and 128k red lines.

28k Tokens
32k128k200k
Applicable unit price
Input cost per call
Monthly bill @ 100k calls/day
RAG: paying double for junk

This gets especially sharp in RAG. Suppose retrieval returns 5 chunks that stitch to exactly 33k. Ask yourself: how much does the 5th chunk actually help the final answer?

If it's a core legal clause or a critical tech parameter, maybe it's worth it. But if it's a page footer, copyright notice, a duplicated paragraph, or even leftover newlines from formatting? Sloppy RAG strategies are paying double for junk.

Input-length billing: the threshold sets the multiplier and creates full-request risk
Just 1k extra Tokens, and all 33k bill at 2×. Is RAG's 5th chunk really worth doubling the price? (Figure: from the author's internal share deck)
Strategy: budget-aware truncation

The fix: turn “32k” from a bill shock you discover after the fact into a budget constraint written into code. Prompt assembly can't be mindless concat:

✗ Wrong: mindless concat
prompt = system_prompt + context + user_query
✓ Right: budget-aware
def build_prompt_within_budget(system_prompt, context_chunks, user_query, budget=32000): prompt = system_prompt + user_query current_tokens = count_tokens(prompt) selected_chunks = [] for chunk in sort_by_relevance(context_chunks): # sort by relevance chunk_tokens = count_tokens(chunk) if current_tokens + chunk_tokens > budget: break # stop at the budget cap selected_chunks.append(chunk) current_tokens += chunk_tokens return system_prompt + ''.join(selected_chunks) + user_query
ScenarioStrategyNotes
RAG retrievalDynamic Top-KDon't always take 5 chunks—take until you're “about to hit 32k”
Multi-turn chatHistory compressionTrigger Summarization when history nears 30k
Long-doc processingSegmented processingDon't stuff it all at once—use Map-Reduce
Draw a red line in the product: 32k is the budget cap—unless the business case is extremely strong, never step into the expensive band.
Three pricing strategies side by side
VendorTier-jump typeKey thresholdCounter-strategy
Output-tiered providerOutput-length tier jump200 TokensTask splitting, or switch to a non-output-tiered model
Input-tiered providerInput-length tier jump32k / 128kBudget-aware truncation; dynamically trim context
Reasoning-enabled providerHidden reasoning buildupMulti-turn inflationContext scrubbing; discard when done
Key Takeaways

Full-request billing changes the economics: in this pattern, a 33k request prices all 33k at 2×. One extra 1k can double the bill.

Ask “is the 5th chunk worth it?”: sloppy RAG pays double for footers, disclaimers, and newlines.

Encode 32k as a budget constraint in code: sort by relevance, stop at budget. Dynamic Top-K beats fixed Top-K.

Source: Adapted from the author's internal team share “AI Token Cost Engineering Strategies,” section “Input-Length Tiering.” The rate card is an illustrative teaching example; verify live thresholds and full-request billing rules with the provider you deploy. RAG cost and optimization also appear from another angle in LLM Fundamentals · RAG Costs & Optimization Strategies—worth reading side by side.

The complete interaction cost of “The pattern: 1k more Tokens, whole bill doubles”

“Say your input is 33,000 Tokens—only 1,000 over 32k.” is a reminder that AI cost is not one price multiplied by one call. Input, output, retries, tools, waiting time, and human cleanup together decide what a task really costs.

Find what the bill repeats

The key variables behind “Drag input length and watch what happens near the 32k and 128k red lines” are usually repeated context, oversized output, retries after failure, and calls that do not produce useful progress. Removing wasted Tokens can reduce cost, latency, and concurrency pressure at the same time.

A cheaper call can make the whole workflow more expensive

Start with “Encode 32k as a budget constraint in code: sort by relevance, stop at budget.” and keep a small table for input, output, retries, tools, and human review. Compare quality before and after optimizing instead of looking at one price in isolation.

From “The pattern: 1k more Tokens, whole bill doubles” to “Interactive Demo · The bill on the ladder”

“The pattern: 1k more Tokens, whole bill doubles” grounds the problem in “Say your input is 33,000 Tokens—only 1,000 over 32k. All 33k Tokens on the request bill at $3.20/M —not the first 32k at $1.60 and the last 1k at $3.20. That extra 1k doubles the whole request in this illustrat…”. “Interactive Demo · The bill on the ladder” then moves it toward “Drag input length and watch what happens near the 32k and 128k red lines”. Together, they show that the lesson is not just a conclusion to remember, but a claim with conditions.

Carry the judgment into the next situation

When analyzing cost, map the complete interaction first, then find repeated input, wasted output, and retries. A cheap individual call does not make the whole task cheap.

  • “The pattern: 1k more Tokens, whole bill doubles”: Say your input is 33,000 Tokens—only 1,000 over 32k. All 33k Tokens on the request bill at $3.20/M —not the first 32k at $1.60 and the last 1k at $3.20. That extra 1k doubles the whole request in this illustrat…
  • “Interactive Demo · The bill on the ladder”: Drag input length and watch what happens near the 32k and 128k red lines
  • “The closing point”: Encode 32k as a budget constraint in code: sort by relevance, stop at budget. Dynamic Top-K beats fixed Top-K

The final “The closing point” brings the discussion to “Encode 32k as a budget constraint in code: sort by relevance, stop at budget. Dynamic Top-K beats fixed Top-K”. The useful thing to carry forward is knowing which judgments must be revisited when input, scale, or risk changes.

Mark as learned Your reading progress updates automatically
← PreviousNext →

Keep reading

The next useful article in the thread.

ARTICLE DISCUSSION

Leave one useful thought here.

Keep the idea that clicked, the question that stayed open, or a small note for the next learner.

Discussing Input-Length Tiering: the 32k Red Line Token Cost Engineering: Make the Numbers Work
3discussionsArticle discussion · synced with the Circle
View in the learning circle
AM
Asha MorganContent editor
INSIGHTField note

I turned one judgment from this article into a small experiment I could run today. Knowing what to observe next is more useful than simply remembering the conclusion.

ARTICLE DISCUSSION7 helpful
LH
Lin HarperIndie developer
INSIGHTInsight

After reading this, I first looked for the conditions behind the idea instead of copying the method into a project. That order made the later trade-offs much clearer.

ARTICLE DISCUSSION5 helpful
KM
Kiki MooreProduct operations
QUESTIONQuestion

When this judgment reaches real work, which constraint should be added first? I am curious which step matters most between reading and the first practical attempt.

ARTICLE DISCUSSION4 helpful