RAG vs Long Context Calculator
Compare retrieving top-k chunks vs stuffing the whole corpus.
With the default inputs, RAG (retrieve top-k) is cheaper — $0.00762 vs $0.1290 per query. Enter your own numbers below to recompute instantly; the full step-by-step math is shown under the worked example.
Results update automatically as you type.
- RAG input tokens
- 2,900 tokens
- Long-context input tokens
- 100,000 tokens
- RAG / query
- $0.00762
- Long-context / query
- $0.1290
- RAG / month
- $457.50
- Long-context / month
- $7,743.00
Should you retrieve a few relevant chunks (RAG) or just paste the whole document into a long-context model each call? Compare the per-query and monthly cost of both approaches.
How this is calculated
RAG per-query cost prices only the retrieved top-k × chunk size tokens (plus system + answer) as input; long-context prices the entire corpus/document as input on every call. We compute both per query and per month so you can see the crossover for your corpus size and query volume.
Is this a good result? What to do next
Long context is only cheaper when the corpus is small or query volume is very low; stuffing a big corpus into every call gets expensive fast because you pay for all of it every time. RAG adds embedding/storage/retrieval overhead but usually wins on per-query generation at scale.
Typical planning ranges
- Long context
- pays for the whole corpus every query
- RAG
- pays only for retrieved chunks per query
- Crossover
- small corpus / low volume favours long context
Ranges are typical planning figures to sanity-check your result, not authoritative benchmarks. Your numbers will vary with use case, volume, and vendor.
How to improve this number
- Use RAG for large corpora and high query volume.
- Use long context for small docs or rare queries.
- Trim retrieved chunks to widen RAG's advantage.
Common mistakes
- Stuffing a big corpus into every call at high volume.
- Ignoring RAG's embedding, storage and infra overhead.
When to use a different approach
For full RAG economics, use the RAG cost calculator. To check whether a document fits long context, use the 'will it fit' checker.
Worked example (defaults)
With the default inputs above, here is the result:
- RAG input tokens
- 2,900 tokens
- Long-context input tokens
- 100,000 tokens
- RAG / query
- $0.00762
- Long-context / query
- $0.1290
- RAG / month
- $457.50
- Long-context / month
- $7,743.00
- Stuffing the whole corpus every call pays for all 100,000 tokens each query.
Sources & references
Frequently asked questions
When is long context cheaper?+
Only when the corpus is small or query volume is very low. Stuffing a big corpus into every call gets expensive fast.
Does RAG have hidden costs?+
Yes — embedding, storage and retrieval infrastructure. But per-query generation is usually far cheaper than long context.