TokenPad
RAG

RAG Retrieval Budget Calculator

See what your k value costs, and what changing it would.

Settings
Retrieval BudgetExact
0Token change
Token change0no change
Input tokens0what you pasted
Output tokens0what you would send
Token cost of this result
Output tokens0
As input$0.00
× 100K requests$0.00

Everything on this page runs in your browser. Nothing you paste is transmitted, because there is no server here to transmit it to.

Result
 

Retrieved context usually dominates

Eight chunks of three hundred tokens is 2,400 tokens on every single request, billed every time. In most RAG systems that is more than half the prompt, and it is the part nobody examines because it was chosen once as a default.

The comparison table exists to make the alternative concrete. Going from k=8 to k=4 halves the largest line of the bill.

Fewer chunks is often better, not just cheaper

This is the unusual case where the cheap option and the good option coincide. Irrelevant context degrades answers: a model shown four relevant passages and eight irrelevant ones performs worse than one shown four relevant passages.

Reranking a wide candidate set down to a few is the standard way to get both. Whether the reranker pays for itself is a separate calculation.

Frequently asked questions

What k should I use?
Start at three to five with a reranker in front, or five to eight without one. Then measure: if the right passage is retrieved but the answer is wrong, you are sending too much, not too little.
Does prompt caching help here?
For the system prompt, yes. Not for the retrieved chunks, which differ on every query by design — that portion always bills at the full input rate.

More rag tools