What RAG Actually Costs Per Query: Real Numbers From a Production System
Inference is not what makes retrieval-augmented generation expensive. A worked cost breakdown from a running RAG system — per query, per ingest, and the fixed line item that dwarfs both.
The Short Answer
A RAG query on a production system costs about $0.0023 in inference — under a quarter of a cent. Fixed infrastructure runs about $57/month, and roughly 92% of that is one line item: the managed vector database's plan minimum.
At 1,000 queries a month those two numbers combine to about $59, of which inference is $2.30. Inference is 4% of the bill. Almost every RAG cost discussion optimises the 4%.
The numbers below come from a system we run, at the settings it actually runs at, not from a spreadsheet built on defaults. Where a figure is derived rather than measured, it says so.
What Goes Into One Query
A single query does four things: embed the question, retrieve candidate passages, rerank them, and generate an answer from the ones that survive.
The configuration those numbers assume:
| Parameter | Value |
|---|---|
| Generation model | Claude Haiku 4.5 |
| Embedding model | Amazon Titan Text Embeddings V2 |
| Chunk size | 100 tokens, 20 overlap |
| Retrieved chunks (topK) | 5 |
| Max output tokens | 1,000 |
| Reranker | Lexical overlap, in-process |
And the cost of each step:
| Step | Tokens | Cost |
|---|---|---|
| Embed the question | ~30 | $0.0000006 |
| Keyword search, rank fusion, rerank | — | $0 (in-process) |
| Vector query | — | ~$0 marginal (see fixed costs) |
| Generation — input | ~830 | $0.00083 |
| Generation — output | ~300 | $0.00150 |
| Total | ≈ $0.0023 |
Two design choices hold that number down, and both are worth naming because they are the ones people get wrong.
The reranker runs in-process. It is lexical-overlap scoring, not a hosted cross-encoder. A managed reranking API charges per document reranked, and at five documents per query it would add roughly an order of magnitude to the marginal cost — turning the cheapest step in the pipeline into one of the most expensive.
The context budget is bounded. Five chunks at 100 tokens each puts a hard ceiling on prompt size. Cost per query cannot drift upward as the document corpus grows, which is the failure mode that makes RAG bills unpredictable. Whether your corpus is 10 pages or 10,000, the model sees the same amount of text.
A note on rates: these are list prices — $1.00/$5.00 per million tokens for Haiku 4.5, $0.02 per million for Titan V2. Partner-hosted inference is priced separately. The conclusion survives any plausible variance, because the gap between inference and fixed cost is more than an order of magnitude.
What Ingestion Costs
Almost nothing. Chunking and keyword indexing are local; only embedding costs money.
| Corpus | Approx. tokens | Cost to embed |
|---|---|---|
| A mid-sized Confluence space | ~11,000 | $0.0002 |
| A 500-page handbook | ~250,000 | $0.005 |
| A 10,000-page corpus | ~5,000,000 | $0.10 |
Indexing an entire enterprise document set costs about the same as a cup of coffee, once.
The real ingestion constraint is wall-clock time, not money. Our first live ingest ran 109 chunks in about 61 seconds. The cause was not embedding throughput — it was that the pipeline awaited four network round-trips per chunk in sequence, and called the single-document embedding API instead of the batch one, so the client's built-in batching never engaged. That model reproduces the measurement exactly: 109 chunks × 4 round-trips × 140ms ≈ 61s.
Restructuring it into phases — bulk existence checks at bounded concurrency, then one batched embedding call, then one bulk upsert — removes most of that. We are deliberately not publishing an "after" figure yet, because the improvement we can currently quote is derived from that same 140ms round-trip rather than measured against a live ingest under real throttling. It will be lower in practice than arithmetic suggests, and a number nobody has measured is not a number worth quoting.
The lesson generalises past our system: if your ingestion is slow, measure round-trips before you blame the embedding model. Latency-bound pipelines look exactly like throughput-bound ones from the outside.
The Line Item That Actually Matters
| Item | Monthly |
|---|---|
| Managed vector database (plan minimum) | ~$50.00 |
| Compute (small ARM instance, 24/7) | ~$3.07 |
| Public IPv4 address | ~$3.60 |
| Block storage, 8 GB | ~$0.64 |
| Container registry | ~$0.10 |
| State storage and parameters | ~$0.05 |
| Total | ≈ $57 |
The vector database is 92% of fixed cost and it is a floor, not a usage charge. You pay it on the first day with an empty index.
That reframes the whole economics question. Serving 1,000 queries a month costs about $59 in total, of which $2.30 is inference. Serving 10,000 costs about $80. The marginal cost of a query is real but small; the cost of existing is what you are actually buying.
What This Means for Design Decisions
Three things follow, and they are the opposite of the usual advice.
Stop optimising the model choice for cost. Moving generation from a small model to a frontier model takes a query from roughly $0.0023 to roughly $0.0117. Across 1,000 queries that is a difference of about $9 a month. If answer quality is what makes the system worth running, that is the cheapest quality improvement available anywhere in the stack. Nobody churns over $9; plenty of people churn over a bad answer.
Treat context budget as a quality dial, not a cost one. Our 100-token chunks with topK=5 give the model roughly 500 tokens of context — often too little to contain a complete answer, which shows up as unnecessary refusals and thin responses long before it shows up on a bill. Raising chunk size to 400 and topK to 8 takes a query to about $0.005. That is still around 5% of a $99/month plan. Under-retrieval costs more in churn than over-retrieval costs in tokens.
Look hard at the vector store, because that is where the money is. A managed serverless vector database with a $50 floor makes sense at scale and makes very little sense at one small index. Postgres with pgvector, on a database you are already running, removes that floor almost entirely. At corpus sizes below a few million chunks the retrieval quality difference is negligible, and the cost difference is the entire fixed bill.
Why These Numbers Are Hard to Find
Published RAG cost analyses tend to model token consumption in isolation, because tokens are the part with a public price list. The result is guidance that is directionally wrong: it optimises the smallest line item and ignores the one that dominates.
If you are building a RAG system and want a single number to carry away, use this one: at low query volumes, your vector database costs more than your language model. Design accordingly.
Frequently asked questions
How much does one RAG query cost?
About $0.0023 — a fifth of a cent — on a production system using Claude Haiku 4.5 for generation and Titan Text Embeddings V2 for retrieval, with five retrieved chunks of 100 tokens each. Generation is essentially all of it: roughly $0.0008 of input and $0.0015 of output. Embedding the question costs well under a thousandth of a cent, and keyword search, rank fusion and lexical reranking run in-process at no marginal cost.
What is the biggest cost in a RAG system?
Fixed infrastructure, and specifically the vector database. A managed serverless vector store with a $50/month plan minimum accounts for about 92% of a ~$57/month fixed bill, and you pay it whether you serve one query or ten thousand. At 1,000 queries a month, inference is roughly 4% of the total.
Does using a more expensive model meaningfully change RAG costs?
Less than most teams assume. Moving generation from a small model to a frontier model takes a query from about $0.0023 to about $0.0117 — around $9 a month more across 1,000 queries. Against fixed infrastructure of roughly $57/month, model quality is one of the cheapest levers available, so it should be chosen on answer quality rather than token price.
How much does it cost to index documents for RAG?
Effectively nothing. Embedding is the only paid step — chunking and keyword indexing are local — so a mid-sized Confluence space costs a fraction of a cent, a 500-page handbook about half a cent, and a 10,000-page corpus around ten cents. The binding constraint on ingestion is wall-clock time, not money, and it is usually caused by sequential network round-trips per chunk rather than by the embedding model itself.
Should I use pgvector instead of a managed vector database?
At small to moderate corpus sizes, usually yes on cost grounds. A managed serverless vector store's plan minimum can be the single largest line item in the whole system, while pgvector on a Postgres instance you already run adds close to nothing. Below a few million chunks the retrieval quality difference is negligible. Managed services earn their floor at larger scale or when you need their operational guarantees.
WeaveAI Anchor
Answers your documents can actually back up.
Anchor is retrieval-augmented generation over your own documents — every answer cited to the passage behind it, and refused when the documents don't cover the question. Free plan, no card.
Explore Anchor