RetrievalMath
RAG Cost per Answer Calculator
Indexing is the cost people budget for. Retrieved context on every query is the one that actually adds up.
RAG cost per answer by corpus and query volume
Retrieval-augmented generation costs almost nothing to index and a great deal to query. Rows use 800 tokens per document, one re-index a month, 4,000 retrieved tokens and 400 output tokens per query.
| Documents | Queries/month | Quality | Indexing | Query cost | Total | Per query | Per good answer |
|---|---|---|---|---|---|---|---|
| 10,000 | 50,000 | 80% | $1.04 | $900 | $901 | $0.0180 | $0.0225 |
| 100,000 | 50,000 | 80% | $10.40 | $900 | $910 | $0.0180 | $0.0228 |
| 50,000 | 200,000 | 75% | $5.20 | $3,600 | $3,605 | $0.0180 | $0.0240 |
| 10,000 | 500,000 | 80% | $1.04 | $9,000 | $9,001 | $0.0180 | $0.0225 |
Indexing is a rounding error next to query cost, so a ten-fold larger corpus barely moves the bill while a ten-fold increase in queries multiplies it. The last column divides by answer quality: at 80% usable, you pay for five answers to get four.
A RAG cost calculator prices a retrieval-augmented generation pipeline across both of its cost centres — building the index and serving queries — and then divides by the answers that are actually good enough to use. That last step is what separates a real unit-economics figure from a token estimate, because an answer the system produces but a human rejects still consumed full cost.
Ingestion cost comes first and is the one teams instinctively budget for. Embedding a corpus means processing every document once: documents multiplied by tokens per document gives the corpus size, priced at the embedding rate per million tokens. Crucially this is not a one-off if your content changes, so the calculator multiplies by how many full re-index passes you run per month. Query cost is the other half and is usually far larger at any meaningful volume. Each query sends retrieved context as input — typically several thousand tokens of chunks pulled from the vector store — and generates an answer as output, priced at the separate input and output rates. Multiplied by monthly query volume, this is where the money goes. Dividing the combined monthly total by the number of answers that clear your quality bar produces cost per good answer.
The structural insight is that retrieved context is the dominant lever, and it is charged on every single query. Retrieving ten chunks instead of five doubles the input tokens on every request forever, while typically improving answer quality only marginally — and sometimes making it worse, since irrelevant context distracts the model. This is why better retrieval beats more retrieval: a well-tuned reranker that surfaces three excellent chunks outperforms naive top-k retrieval of twenty mediocre ones on both quality and cost simultaneously. Embedding cost, by contrast, is usually modest unless you re-index constantly, so aggressive re-embedding schedules deserve scrutiny; incremental indexing of changed documents only is almost always the right pattern. The answer-quality input matters because it converts spend into value: a pipeline at 50% acceptable answers costs twice as much per usable result as one at 100%, even with identical token consumption. The source research recommends including parsing, OCR, chunking, embeddings, storage, reranking, generation, refresh, and answer-quality yield — this models the dominant terms; add vector-database hosting, reranker calls, and document parsing separately if they are material to you.
Better retrieval beats more retrieval
Every chunk you retrieve is billed as input tokens on every query, forever. Doubling top-k doubles that line permanently while often improving answers only slightly — and irrelevant context can actively degrade quality by distracting the model. A reranker that surfaces three excellent chunks usually beats twenty mediocre ones on quality and cost at the same time.
Re-indexing schedules deserve scrutiny
Embedding a corpus is comparatively cheap once, but re-embedding everything nightly multiplies that cost by thirty. Incremental indexing — re-embedding only documents that changed — captures nearly all the freshness benefit at a small fraction of the cost. Full re-index passes should be reserved for chunking or model changes.
Frequently asked questions
50,000 docs at 800 tokens, embedded monthly, with 100,000 queries at 4,000 context + 350 output tokens — what's my cost per answer?
The 40M-token corpus costs about $5.20/month to embed. Each query costs roughly $0.0173 (4,000 input at $3/M plus 350 output at $15/M), so 100,000 queries ≈ $1,725. Total ≈ $1,730/month; at 75% acceptable answers that's about $0.023 per good answer — and note queries are 99.7% of the bill.
Why is my query cost so much higher than my embedding cost?
Because embedding happens once per document but retrieval happens on every query, and retrieved context is large. A 4,000-token context on 100,000 queries is 400M input tokens a month — ten times the size of a 40M-token corpus embedded once. Unless you re-index constantly, queries dominate.
Should I retrieve more chunks to improve answers?
Usually no. More chunks means more input tokens on every query permanently, and beyond a point extra context dilutes rather than helps — the model has to find the signal among more noise. Invest in better chunking, hybrid search, and reranking so fewer chunks carry more relevance.
How is this different from the LLM workload cost calculator?
The workload calculator prices generic request traffic and models caching and routing savings. This one models the RAG-specific shape: a corpus you embed and re-index, retrieved context that inflates every query's input, and an answer-quality rate that converts raw spend into cost per usable answer.
Related Developer calculators
Cloud Egress Cost Calculator
Monthly data transfer cost across internet egress, CDN, cross-region, and cross-AZ.
OpenServerless vs Container Cost Calculator
Compare serverless and always-on container cost, and find the break-even volume.
OpenLLM Workload Cost Calculator
Monthly LLM cost plus the savings from prompt caching and model routing.
OpenAI Video Cost per Approved Minute
True cost per usable minute of AI video, including rejected generations and editing.
OpenYou might also like
Last updated: August 6, 2026