Practical guide
RAG Cost Estimate for Ingestion and Answer Generation
Calculate RAG token spend for corpus embedding, retrieved context, and generated answers using the calculator’s Gemini rates.
By StackCalcs · Updated · Sources checked
Separate ingestion from query traffic
A RAG budget has at least two token flows. Ingestion embeds documents when they enter or change in the corpus. Queries send retrieved passages and instructions to the generation model, which then emits an answer. The RAG Cost Calculator shows the one-time ingest separately, then adds monthly re-embedding, query embeddings, retrieved-chunk input, system-prompt input, and output for the generation model you choose.
Consider a 12-million-token knowledge base with 5% of its text updated each month. The initial load uses 12 million embedding tokens; a steady month uses about 600,000 if only changed content is re-embedded. For 30,000 monthly questions with a 400-token system prompt, a 100-token question, four 500-token chunks, and 300 output tokens, enter those values with 1,000 queries per day for 30 days. The calculator shows the one-time ingest separately so the initial load is not hidden inside an average month.
Estimate tokens before launch
Count cleaned text after removing boilerplate, because headers, navigation, duplicated footers, and overlapping chunks can enlarge the embedded corpus. For query traffic, include system instructions, chat history, and retrieved passages in generation input. The user’s question alone is rarely the whole prompt.
Test at least two retrieval sizes. If increasing from four passages to eight doubles retrieved context without improving answer quality, the extra generation input is avoidable spend.
This calculator does not include a vector database, reranking, cache storage, retrieval compute, grounding services, networking, taxes, or discounts. It models embedding and generation token charges only, so use infrastructure quotes separately.
FAQ
Do I embed the entire corpus every month?
Only if your pipeline rebuilds it. Incremental indexing should count new and changed chunks; verify the actual behavior of your ingestion job.
Does chunk count equal embedding token count?
No. Pricing uses input tokens. Chunk overlap can cause the same source text to be embedded more than once.