aiAI Calculator Pro

RAG vs Long Context Calculator

Compare retrieving top-k chunks vs stuffing the whole corpus.

Results update automatically as you type.

Result
RAG (retrieve top-k) is cheaper
$0.00762 vs $0.1290 per query
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

This calculator uses the rag formulas described in our methodology. All figures are estimates for planning; verify current pricing with each provider before relying on them.

Worked example (defaults)

With the default inputs above, here is the result:

Result
RAG (retrieve top-k) is cheaper
$0.00762 vs $0.1290 per query
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

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.

Related calculators