RAG vs long context: which is cheaper?
Need to compare long-context stuffing against RAG on cost? Tokens are the unit AI providers bill in, and getting the count wrong throws off every cost estimate. This page helps teams deciding how to supply context get an accurate count and the cost that follows from it.
Start here: Context Window Planner
Results update automatically as you type.
- System prompt
- 400 tokens
- Conversation history
- 2,000 tokens
- Retrieved / context
- 3,000 tokens
- User message
- 200 tokens
- Total input
- 5,600 tokens
- Context window
- 128,000 tokens
- Remaining
- 122,400 tokens
Then: RAG Query Cost Calculator
Results update automatically as you type.
- Query embedding
- $8.00e-7
- Retrieved context
- 2,560 tokens
- Generation cost
- $0.00762
- Per query
- $0.00763
- Per month
- $457.55
Why this isn't trivial
The part people underestimate: stuffing the whole window bills every token each call, while RAG retrieves only what's needed but adds retrieval cost. In practice the biggest savings come from using RAG when only a fraction of the context is relevant per query, so it is worth modelling before you commit.
How it's calculated
We estimate this by comparing the input cost of a full window against RAG's retrieval-plus-generation cost. Every figure uses the current provider prices baked into the site (reviewed daily), and you can override any input to match your own assumptions.
Frequently asked questions
When is long context worth it?+
When most of the context is genuinely needed every call — otherwise RAG is cheaper.
Does RAG add cost?+
Yes, retrieval and embeddings, but usually far less than a full window each time.
Are these prices up to date?+
Yes. The model prices behind this calculator are refreshed and reviewed daily, so your estimate reflects current provider rates rather than a stale snapshot.
Related
Estimates for planning. Pricing data last reviewed 28 July 2026.