Yashveer Singh
Connect
<- All posts

The Cost of Running LLMs in Production: A Realistic Budget

LLM API costs in production look different from development costs. Here is how to build a realistic budget before your AI features go live.

Written by Yashveer Singh, founder of Yashveer Labs.

# The Cost of Running LLMs in Production: A Realistic Budget

LLM API costs in development are trivial. LLM API costs in production scale with usage in ways that most founders do not anticipate until the first monthly invoice arrives. The gap between "this seems cheap in testing" and "this is expensive at real user volume" is one of the most common AI product budget surprises. This post provides the framework for estimating production LLM costs before you ship, not after.

What you need to know

  • LLM pricing is based on tokens (roughly 0.75 words per token), and both input and output tokens are billed separately at different rates
  • Production costs are typically five to twenty times higher than development costs because of prompt overhead that was not visible during testing
  • Context window size has a direct cost implication: longer system prompts, chat history, and retrieved documents all add to the input token cost per request
  • Caching LLM responses for repeated queries can reduce costs by 40 to 80 percent depending on query repetition rates
  • The real production cost of an AI feature includes the LLM API cost plus the infrastructure to handle retries, timeouts, fallbacks, and monitoring

The core argument

The most common AI budget mistake is testing with short prompts and minimal context in development, then discovering in production that the real system prompts are much longer, the chat history that needs to be included for context grows with each conversation turn, and the retrieved documents from the RAG layer add thousands of tokens per request. The development test case cost was $0.001 per request. The production request cost is $0.02 per request. At 100,000 requests per month, that is $2,000 per month instead of $100.

Token cost varies significantly by model. At the time of writing, frontier models from OpenAI and Anthropic range from a few cents per million tokens for smaller models to several dollars per million tokens for the largest. Choosing the right model for each use case is the single highest-leverage cost optimization decision available. A customer support triage feature that classifies intent and routes requests does not need a frontier model. A feature that generates complex technical documentation may need one. Routing different features to appropriately sized models is standard practice at cost-conscious AI product teams.

The system prompt is where most teams leave money on the table. A system prompt that is 2,000 tokens long adds 2,000 tokens of cost to every single request, regardless of the user's input length. For a conversational feature with 10,000 daily conversations, that system prompt overhead alone costs (using approximate mid-range pricing) around $2 to $4 per day. Over a month, that is $60 to $120 just from the prompt overhead. Optimizing the system prompt to remove redundant instructions, compress examples, and eliminate filler text is one of the cheapest and most effective cost reductions available. I apply this discipline to every AI feature I build, including the AI assistance features in Nyxera.

Common mistakes

  1. Not accounting for prompt overhead when estimating costs. The system prompt, conversation history, and retrieved context all add to the input token count on every request. Estimate the average total input length in production, not the average user message length.
  2. Using a frontier model for every feature. The largest, most capable model is not necessary for every use case. Classification tasks, simple formatting, and templated generation often work equally well with smaller, cheaper models. Use the smallest model that produces acceptable quality for each specific feature.
  3. Not implementing LLM response caching. Many AI features generate the same or similar outputs for similar inputs. Semantic caching (storing responses for inputs that are semantically similar) or exact caching (storing responses for identical inputs) can reduce costs significantly for use cases like FAQ answering, documentation lookup, and template generation.
  4. Not setting usage limits per user or per day. An unrestricted AI feature can be abused or used at a volume you did not anticipate. Implement rate limits and per-user usage caps from launch. A user who discovers they can generate unlimited content will sometimes use it at a volume that makes that user unprofitable.
  5. Not monitoring cost per user or per feature. Aggregate LLM cost is a lagging indicator. Cost per user and cost per feature tell you which features or usage patterns are expensive and allow proactive optimization before the cost compounds.

Where to start

Step 1: Build a cost model for each AI feature before shipping it. For each feature: estimate average input tokens (system prompt + context + user message), average output tokens, estimated requests per day, and the model's per-token pricing. This gives you the daily cost estimate for that feature at launch-day usage.

Step 2: Implement prompt optimization as part of every AI feature's development cycle. Before shipping, take the system prompt and apply the token budget discipline: remove examples that are not necessary, compress instructions that are verbose, and cut any content that does not directly improve output quality. Every token you remove from the system prompt reduces cost on every request, permanently.

Step 3: Set up cost monitoring per feature, per user tier, and per day. Most LLM providers provide usage APIs. Build a lightweight dashboard or use a tool like LangSmith or Helicone to monitor cost attribution. Review it weekly when a feature launches, monthly as it matures.

Related reading

FAQ

Frequently asked

Author

Closing note from the author

I keep these closing notes short on purpose. Most engineers writing about this topic are not the engineer you want to hire. I might be. Yashveer Singh, founder of Yashveer Labs. The contact channel is Instagram. The proof is the portfolio. The standard is in the work. If we are aligned, you will know within five minutes of the first message.

Related reading