RAG Cost
RAG Cost & Vector Storage Calculator
Estimate embedding cost, vector storage size, and monthly query cost for a retrieval-augmented generation corpus.
Storage & query settings
Raw vectors × this. HNSW indexes often add 1.5–2×.
44,643
22,857,216
$0.4571
392.37 MB
$0.2000
44,643
One-time embedding is the cost to index the corpus once. Storage is raw vectors × index overhead — the vector DB's actual footprint depends on its index type. Query cost covers embedding the queries only, not the LLM generation.
TL;DR
Indexing a 100,000-document corpus (~2k tokens each) in 512-token chunks with text-embedding-3-small costs about $4.57 one-time and needs roughly 3.83 GB of vector storage. Embedding is cheap; storage and per-query embedding are the ongoing costs. Set your corpus, chunking, and embedding model above; the cost-by-size table is below.
RAG cost & storage by corpus size
Updated Jul 5, 2026Indexing a corpus at 2,000 tokens per document, 512-token chunks with 64 overlap, embedded with text-embedding-3-small (1536 dims, float32, 1.5× index overhead):
| Documents | Chunks | Embedding cost | Vector storage |
|---|---|---|---|
| 1,000 | 4,465 | $0.0457 | 39.24 MB |
| 10,000 | 44,643 | $0.4571 | 392.37 MB |
| 100,000 | 446,429 | $4.57 | 3.83 GB |
| 1,000,000 | 4,464,286 | $45.71 | 38.32 GB |
Chunks = ⌈total tokens ÷ (chunk size − overlap)⌉. Storage ≈ chunks × dims × bytes × index overhead. Actual DB footprint varies by index type (flat, IVF, HNSW).
How it works
totalTokens = documents × tokens/doc; chunks = ⌈totalTokens ÷ (chunkSize − overlap)⌉. Because overlapping chunks re-embed shared tokens, embedding volume is chunks × chunkSize, and embeddingCost = (embeddedTokens ÷ 1e6) × embedPrice.
storage ≈ chunks × dims × bytesPerDim × indexOverhead, and monthly query cost = queries × queryTokens ÷ 1e6 × embedPrice (the query embedding only — not LLM generation). Storage is index-dependent; the overhead factor is an estimate. Embedding prices verified 2026-07-05.
FAQ
- How much does it cost to embed a document corpus?
- It's the number of tokens embedded × the embedding price per 1M. With overlap, chunks re-embed shared tokens, so the volume is chunks × chunk size, not just the raw corpus. Example: 100,000 docs at 2,000 tokens each, 512-token chunks with 64 overlap, embedded with text-embedding-3-small ($0.02/1M), costs about $4.57 one-time.
- How do I calculate vector storage size?
- Storage ≈ number of chunks × embedding dimensions × bytes per dimension × index overhead. A float32 vector uses 4 bytes per dimension, so a 1,536-dim vector is ~6 KB before indexing. The 100,000-doc example above needs roughly 3.83 GB with a 1.5× HNSW overhead.
- What chunk size and overlap should I use for RAG?
- Common defaults are 256–512 token chunks with 10–20% overlap (e.g. 64 tokens on a 512 chunk). Smaller chunks improve retrieval precision but create more vectors (higher storage and embedding cost); larger chunks reduce count but can dilute relevance. Tune to your content and retrieval quality.
- Can I reduce vector storage cost?
- Yes — use fewer dimensions (many models support shortening via Matryoshka embeddings, e.g. 3,072 → 1,536), quantize vectors to float16 or int8 (2× or 4× smaller), or increase chunk size to create fewer vectors. This tool lets you change dimensions and precision to see the impact.