RAG cost calculator

Estimate what a retrieval-augmented pipeline costs to run: one-time corpus embedding, per-query generation, and vector storage, broken down into a monthly total and a per-query price. Every number is editable, so it works for any embedding model, LLM, or vector database.

Corpus

Advanced

Queries

Vector storage

pgvector on a database you already run ≈ $0; managed vector databases typically land at $0–70/mo on entry tiers.

Cost itemBasisCost
Embedding the corpus (one-time)500,000 tokens × $0.02/1M$0.01
Re-embedding / monthone-time only — no refresh$0.00
Generation input / month2,300 tokens/query × 9,000 queries$62.10
Generation output / month400 tokens/query × 9,000 queries$54.00
Vector storage / monthflat monthly rate$0.00
Total / monthexcludes the one-time embedding row$116.10

$0.01 per query

Defaults reflect list prices as of July 2026 — every field is editable, so plug in any provider's pricing. Months are counted as 30 days.

Where RAG spend actually goes

A RAG pipeline has three cost buckets. First, embedding: every document is chunked and run through an embedding model once, billed per token. Second, generation: every query sends the user's question plus the retrieved context chunks to an LLM as input tokens and pays for the answer as output tokens. Third, storage: the vectors have to live somewhere, which is a flat monthly cost — near zero if you use pgvector on a database you already run, an entry-tier subscription if you use a managed vector database.

The counterintuitive part is which bucket dominates. Embedding looks scary because it scales with corpus size, but embedding models cost cents per million tokens — a thousand-page corpus embeds for under a dime. At any real query volume, the retrieved-context input tokens dwarf everything else: each query re-sends thousands of context tokens to a generation model priced a hundred times higher per token than the embedder. That makes chunk size and top-k your main cost levers — retrieving fewer, tighter chunks cuts input tokens directly, but starves the model of context and degrades answers, so tune them against answer quality, not just the bill. For a plain per-request comparison across generation models, see the LLM API cost calculator.

More free tools