Skip to content

RAG Cost Calculator

Embedding the corpus, storing the vectors, embedding each query and generating each answer, added up into one fully loaded cost per query.

The corpus — a one-time cost you pay again on every re-index

Storage

Per query

Fully loaded cost per query
$0.01

$1,427 a month in total, of which 100.0% of each query is the generation call. Indexing and storage together are 0.1% of the bill.

Chunks in the index
160,000
Corpus tokens
64,000,000
One full index pass
$6.40
Re-indexing, amortised per month
$1.07
Vector storage
1.28 GB
Storage per month
$0.32
Query embedding, per query
$0.0000060
Prompt tokens sent per query
3,000
Generation input, per query
$0.0090
Generation output, per query
$0.0053
Marginal cost per query
$0.01
Queries per month, total
$1,426
Everything, per month
$1,427
What this assumes: every chunk is the same size and every query retrieves exactly top-k of them, which makes the retrieved-token count a clean multiplication and slightly understates reality — chunks vary and rerankers often fetch more candidates than they keep. Re-indexing is amortised evenly across the year rather than landing in the month it happens. Storage is charged on the raw vector bytes plus the overhead percentage you set; it does not include the memory a hosted index keeps resident, which is usually the more expensive resource and is priced per node rather than per gigabyte. The retrieval query itself — the vector search — is assumed to be included in your storage or node cost rather than metered separately. No reranker call, no query rewriting call, no caching.

Almost every RAG cost discussion is about the vector database, and almost every RAG bill is about the generation call. The breakdown above usually makes that plain within a few seconds of arriving: storing a few hundred thousand vectors costs less per month than a single engineer's lunch, while sending several thousand retrieved tokens into a model on every one of a hundred thousand queries costs real money. If your fully loaded cost per query is dominated by generation — and it generally will be — then tuning your index is optimising the wrong term.

The lever that matters is top-k multiplied by tokens per chunk. That product is your prompt, and it scales linearly with the bill. Halving the number of retrieved chunks halves the retrieval half of the input cost, and if a reranker lets you go from ten mediocre chunks to three good ones you have cut cost and improved the answer at the same time. The second lever is chunk size, which is a retrieval-quality decision long before it is a cost decision, but it has a cost consequence people forget to price.

What is missing here is the part that ages worst: re-embedding. The one-time index cost looks trivial until you change embedding model, change chunking strategy, or add a field, at which point you pay it again in full. Two re-indexes a year is a modest assumption for a system under active development. If yours is closer to monthly, raise that field and watch the amortised figure stop being a rounding error.

RAG Cost Calculator · Multigrid