Retrieving relevant documents and adding them to the prompt.
RAG searches a knowledge base, inserts the most relevant chunks into the prompt, and asks the model to answer using that context. Retrieval quality and chunk size strongly affect token cost.
RAG is input-heavy. Sending fewer, better chunks and caching stable prefixes can cut cost more than switching models.