Cost guide
Context Window Pricing Guide: How Input Token Costs Scale with Context Length
Published 2026-07-25 · Updated 2026-07-25 · Estimated read: 8 min
Longer contexts mean more input tokens — and higher costs. But the relationship between context length and cost is not always linear. Some providers charge the same per-token rate regardless of context size, while others apply premium tiers for inputs above certain thresholds. This guide explains how context length affects pricing, when to truncate vs. use long-context models, and how to manage costs effectively.
1. How Context Length Affects Cost
LLM API pricing is based on token count, not character or word count. Every token in your input context — system prompt, conversation history, retrieved documents, few-shot examples — is multiplied by the model's per-token input price. Doubling your context length doubles your input cost per request.
The formula is straightforward:
request cost = (input tokens × input price/1M) + (output tokens × output price/1M) For a 10,000-token input on GPT-5 ($1.25/1M input tokens), the input cost per request is $0.0125. For a 100,000-token input on the same model, it rises to $0.125 — a 10x increase that scales linearly.
Output tokens are typically 3-6x more expensive than input tokens, so the output cost often dominates. But for workloads with very long inputs and short outputs (classification, extraction, long-context summarization), input costs can become the primary expense.
2. Context-Based Pricing Tiers
Some providers charge different rates depending on how many input tokens you send. When your input crosses a threshold, the per-token price increases — sometimes significantly. This is separate from the model's base price.
| Provider / Model | Standard input | Long-context input | Threshold | Price increase |
|---|---|---|---|---|
| Claude Sonnet 4.5 | $3.00/1M | $6.00/1M | Above 200k tokens | 2x |
| Gemini 2.5 Pro | $1.25/1M | $2.50/1M | Above 200k tokens | 2x |
| Grok 4.5 | $2.00/1M | $4.00/1M | Above 200k tokens | 2x |
| Grok 4.3 | $1.25/1M | $2.50/1M | Above 200k tokens | 2x |
| GPT-5 / GPT-5.1 | $1.25/1M | $1.25/1M | No tier | None |
| Gemini 2.5 Flash | $0.30/1M | $0.30/1M | No tier | None |
| DeepSeek V3.2 | $0.28/1M | $0.28/1M | No tier | None |
| Anthropic output (above 200k) | $15.00/1M | $22.50/1M | Above 200k tokens | 1.5x |
Key insight
OpenAI, Google Gemini Flash, DeepSeek, and Mistral do not charge more for long-context inputs. If you need to send 100k+ tokens regularly, these providers avoid the tier premium that Anthropic and Google Pro models charge above 200k tokens.
3. Short-Context vs Long-Context Cost Comparison
The table below compares per-request input costs at different context lengths across popular models. Output is fixed at 1,000 tokens for comparison.
| Model | Input $/1M | Context | 5k tokens | 20k tokens | 50k tokens | 100k tokens | 200k tokens |
|---|---|---|---|---|---|---|---|
| GPT-4.1 Nano | $0.10 | 32k | $0.0009 | $0.0024 | $0.0054 | $0.01 | — |
| GPT-4.1 Mini | $0.40 | 32k | $0.0036 | $0.0096 | $0.02 | $0.04 | — |
| GPT-5 Mini | $0.25 | 128k | $0.0032 | $0.0070 | $0.01 | $0.03 | $0.05 |
| GPT-5 | $1.25 | 128k | $0.02 | $0.04 | $0.07 | $0.14 | $0.26 |
| Claude Haiku 4.5 | $1.00 | 64k | $0.01 | $0.03 | $0.06 | $0.10 | $0.20 |
| Claude Sonnet 4.5 | $3.00 | 64k | $0.03 | $0.07 | $0.17 | $0.32 | $0.61 |
| Gemini 2.5 Flash | $0.30 | 65k | $0.0040 | $0.0085 | $0.02 | $0.03 | $0.06 |
| Gemini 2.5 Pro | $1.25 | 65k | $0.02 | $0.04 | $0.07 | $0.14 | $0.26 |
| DeepSeek Chat | $0.28 | 8k | $0.0018 | $0.0060 | $0.01 | $0.03 | — |
| DeepSeek V3.2 | $0.28 | 164k | $0.0018 | $0.0060 | $0.01 | $0.03 | $0.06 |
| Grok 3 Mini | $0.30 | 131k | $0.0020 | $0.0065 | $0.02 | $0.03 | $0.06 |
| Grok 3 | $3.00 | 131k | $0.03 | $0.07 | $0.17 | $0.32 | $0.61 |
At 100k input tokens, the cheapest options are:
- DeepSeek V3.2 — $0.03 per request (164k context, no tier premium)
- Gemini 2.5 Flash — $0.03 per request (65k context, no tier premium)
- GPT-5 Mini — $0.03 per request (128k context, no tier premium)
- Grok 3 Mini — $0.03 per request (131k context, no tier premium)
Monthly cost at scale: 50k input tokens, 1k output, 10k requests/month
| Model | Monthly cost | vs cheapest |
|---|---|---|
| DeepSeek V3.2 | $144.00 | baseline |
| Gemini 2.5 Flash | $175.00 | 22% |
| GPT-5 Mini | $145.00 | 1% |
| Grok 3 Mini | $155.00 | 8% |
| GPT-4.1 Nano | $54.00 | -63% |
| GPT-5 | $725.00 | 403% |
| Claude Sonnet 4.5 | $1650.00 | 1046% |
At 50k input tokens, Claude Sonnet 4.5 costs 1046% more than DeepSeek V3.2 per month. The gap widens further at higher context lengths if tier-based pricing kicks in.
4. When to Truncate vs Use Long-Context Models
Truncate when:
- The full context isn't needed. If you're summarizing a 200-page document but only need the first and last chapters, send only those sections.
- Tier premiums apply. Sending 210k tokens to Claude Sonnet 4.5 triggers the 2x input premium. Truncating to 190k tokens avoids the tier entirely.
- Quality doesn't degrade. Many tasks (classification, extraction, simple Q&A) work well with focused, shorter contexts rather than noisy full documents.
- Cost matters more than completeness. For high-volume workloads, even small per-request savings compound. Truncating 20% of context across 100k requests can save thousands per month.
Use long-context models when:
- Full context is necessary. Legal document review, codebase analysis, multi-document reasoning, and RAG with large retrieval sets require the full context to avoid missing critical information.
- No tier premium. Gemini 2.5 Flash, DeepSeek V3.2, GPT-5 Mini, and Grok 3 Mini handle long contexts without pricing tiers — sending more tokens costs proportionally more, not exponentially more.
- Quality depends on breadth. Tasks like comparing multiple documents, detecting contradictions, or answering questions that span a large corpus benefit from seeing everything at once.
- Latency is acceptable. Long contexts increase processing time. If latency isn't critical, using the full context on a cheap long-context model is often cheaper than preprocessing or chunking.
Decision rule
If your input is under 128k tokens, most models handle it without tier premiums. Above 128k, check whether the model charges a context-based premium before deciding to send the full context. Above 200k, compare the tier premium cost against the value of including the full context.
5. Best Practices for Managing Context Costs
Measure before optimizing
Log your actual context sizes per request. Many workloads send 2-3x more tokens than necessary because of verbose system prompts, redundant conversation history, or over-included retrieved documents. Start by measuring, then target the biggest offenders.
Structure prompts for efficient context use
Put the most important information at the beginning and end of your context. Use clear section markers so models can focus on relevant parts. Avoid redundant instructions that waste tokens without improving output quality.
Prune conversation history aggressively
For multi-turn conversations, keep only the last N turns plus the system prompt. Older turns rarely contribute meaningfully to the current response. A sliding window of 5-10 turns is often sufficient.
Chunk retrieved documents
In RAG systems, retrieve only the most relevant chunks rather than entire documents. Use reranking to score retrieved chunks before sending them to the LLM. Sending 5 high-quality chunks (2k tokens) is cheaper and often more effective than sending 20 chunks (8k tokens).
Use prompt caching for stable prefixes
If your system prompt, few-shot examples, or reference documents stay consistent across requests, enable prompt caching. Cached tokens cost 75-90% less, which offsets the cost of sending long contexts.
Choose the right context window for your workload
Don't pay for a 1M context window if you always send 10k tokens. A smaller, cheaper model like GPT-4.1 Nano or Gemini 2.0 Flash is more cost-efficient for short-context workloads. Reserve long-context models for tasks that genuinely need them.
Consider a two-stage pipeline
For very long documents, use a cheap model to extract or summarize relevant sections first, then send the condensed output to a premium model for final reasoning. This reduces the input tokens sent to the expensive model.
6. Frequently Asked Questions
Does a longer context window always cost more?
Not necessarily. Context window size and per-token price are independent. A model with a 128k context window may have the same per-token price as a model with a 16k window. However, some providers charge a premium when your input exceeds certain thresholds (e.g., 200k tokens), so the effective cost per request can increase with very long contexts.
When should I truncate context instead of using a long-context model?
Truncate when the removed tokens contribute little to output quality. For example, if you're summarizing a document and the middle section is less relevant, truncating to the most salient parts saves tokens without quality loss. Truncation is also preferred when your context exceeds a model's tier-based pricing threshold and the premium is significant.
How do I estimate the cost of sending long contexts?
Multiply your input tokens by the model's per-1M-token input price. For example, 50,000 input tokens on GPT-5 ($1.25/1M input) costs $0.0625 per request. If the context exceeds a tier threshold (e.g., above 200k), check whether the model charges a higher rate for long-context tokens.
Which providers have tiered pricing based on context length?
Anthropic charges 2x for input above 200k tokens on Claude Sonnet 4.5. Google Gemini 2.5 Pro doubles input pricing above 200k tokens. xAI Grok 4.5 doubles input pricing above 200k tokens. OpenAI does not use context-based pricing tiers — all input tokens are priced the same regardless of context length.
Can prompt caching offset long-context costs?
Yes, significantly. If your long context has a stable prefix (system prompt, few-shot examples, reference documents), caching those tokens reduces the input cost by 75-90% for cached tokens. This makes it viable to keep large contexts without paying full price on every request.
What is the cheapest way to process a 100k-token document?
Use a low-cost model with a large context window, such as Gemini 2.5 Flash ($0.30/1M input) or DeepSeek V3.2 ($0.28/1M input). If you only need a summary, truncate the document to the most relevant sections first. For repeated processing, enable prompt caching to reduce costs further.
Estimate your context costs
Use the calculator to model your exact context size, request volume, and compare pricing across models.
Pricing data sourced from our catalog. Check data sources for provenance and freshness.