LLM costs depend heavily on how you design the application. A longer system prompt, an extra retrieved document, a more detailed response, or another agent step adds to the cost of each request. Those small additions can become a significant expense across millions of requests and affect the product's profitability.
In this chapter, we'll break down the main sources of cost in a GenAI system and look at practical ways to reduce them.