OpenAI RAG Calculator

The OpenAI RAG Calculator estimates the recurring cost of a retrieval-augmented generation workload. It combines query embeddings, retrieved context, model input and output tokens, and optional per-query retrieval fees.

This is useful for knowledge assistants, search experiences, and document question-answering systems. It highlights how retrieval depth and chunk size affect both context usage and spend, while keeping one-time indexing and vector-storage costs separate from query-time expenses.

Calculation inputs

queries
chunks
tokens
tokens
tokens
tokens
USD
USD
USD
USD
Result
Estimated result
Retrieved tokens/query
Generation model cost
Embedding + retrieval cost
Cost per query
  1. Set the workload

    Enter queries per month and any other volume assumptions that define the period or batch.

  2. Add usage assumptions

    Complete the remaining usage fields, keeping token, duration, or size units consistent with their labels.

  3. Enter current rates

    Use the current prices for the exact model, endpoint, quality, and processing tier you plan to use.

  4. Review the estimate

    Read the main result and the supporting breakdown to see the largest cost or capacity driver.

  5. Test another scenario

    Change one assumption at a time or select Reset to restore the default example values.

Retrieved context tokens = Chunks per query × Tokens per chunk. Total monthly cost = Queries × {[(Base input + retrieved context) × input rate + Output tokens × output rate + Query embedding tokens × embedding rate] ÷ 1,000,000 + retrieval fee}.

The calculator applies the entered values directly and displays rounded results for planning.

What the result means

The result estimates recurring query-time RAG cost across retrieval, query embeddings, and answer generation.

Initial document embedding, re-indexing, vector storage, reranking, and database infrastructure are separate costs unless entered as a retrieval fee.

Given: Example assumptions

Calculation: For 100,000 monthly queries retrieving five 300-token chunks, context adds 1,500 tokens. With 700 base input and 300 output tokens, rates of $2.50 input and $15 output per million, model cost is $1,000. Query embeddings of 25 tokens at $0.02 per million add $0.05, so total is $1,000.05 before any retrieval fee.

Result: The displayed result follows the same formula and rounding logic.

Should reranked chunks or initially retrieved chunks be counted?

Count the chunks actually inserted into the model prompt for token cost. Add reranker charges separately if applicable.

Does this include document indexing?

No. Use the Embedding Calculator for initial and recurring corpus embedding costs.

How does chunk size affect cost?

Larger or more numerous chunks increase model input tokens. Better retrieval can sometimes reduce context while preserving answer quality.

What belongs in base input tokens?

Include system instructions, user question, conversation history, formatting, and other non-retrieved text sent to the model.

Can a RAG system use cached input pricing?

Potentially, but retrieved context often changes per query. Model stable prefixes and cache-eligible text separately when the platform supports it.