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.

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 adds Gemini Embedding input, Gemini 2.5 Pro generation input, and Gemini 2.5 Pro output charges.

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 2,500 generation-input tokens and 300 output tokens each, enter 75 million generation-input tokens and 9 million output tokens. Run the initial-load and steady-state cases separately rather than hiding a one-time ingestion spike 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 the three named Gemini token lines, 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.

Official sources

Related calculators

Continue reading