Home / Blog / Dev notes

Before building an AI feature, here's how to estimate LLM API costs

Dev notesSOL LABS AI3 min read

"If we add an AI feature, how much will it cost per month?" It's usually the first question asked at the planning stage. You won't know the exact number until you actually run it, but if you know the order of the calculation, you can make a solid estimate while still planning. Every number in this post is an example to show the method; please check actual prices on each company's official pricing page listed under "References" below.

What a token is, and why input and output are counted separately

LLM (large language model) APIs charge by tokens, not characters. A token is a small piece of text the model reads at a time. Anthropic's documentation says one token is roughly 4 characters in English. Other languages, such as Korean, produce different token counts for the same content, so measuring with your real sentences is the most accurate approach.

Pricing also counts input tokens (the questions, documents and instructions we send) and output tokens (the answer the model writes) separately. On most models, output costs more per token than input, so how long the answers are has a big effect on cost.

How to estimate monthly cost

Four steps are enough.

  1. Daily calls = daily users × average uses per person
  2. Estimate input and output tokens per call
  3. Cost per call = input tokens × input price + output tokens × output price
  4. Monthly cost = cost per call × daily calls × business days
ItemExample value (assumed)
Daily users · uses per person50 people × 6 = 300 calls per day
Tokens per call3,000 input · 500 output
Price (assumed)$2 per million input tokens · $10 per million output tokens
Cost per call$0.006 + $0.005 = $0.011
Monthly cost (22 days)0.011 × 300 × 22 ≈ $72.6
In the example, input is six times larger than output, yet the two costs come out about the same. That's because output is priced higher. Limiting answer length is the first lever for managing cost.

3 design choices that lower cost

① Split models by task — Send light work like classification and short summaries to a smaller model and reserve the larger model for long analysis. The same feature can end up with a very different cost structure.

② Cache the repeated beginning — Instructions and reference documents you send identically every time can be reduced with prompt caching (a feature that stores a prefix the model has already read and reuses it). Anthropic charges cache reads at 10% of the base input price, and OpenAI turns caching on by default for supported models. Both companies advise putting fixed instructions and reference material first and the changing content last.

③ Use batch for anything that isn't urgent — For bulk classification or summarization that can run overnight, the batch API gives a 50% discount on input and output at both Anthropic and OpenAI. OpenAI says it returns results within 24 hours.

Want to check this against your own data?AI Readiness Assessment · we review your material and map candidates and orderContact us

3 things to settle at the planning stage

  • Expected usage: daily users, uses per person, and the peak on your busiest days
  • Response length: how many lines or characters each feature should return
  • Fallback flow on failure: which screen to show when you hit a limit or the API fails

Once these three are settled, you and your development partner can look at "how much the AI will cost" on the same table when discussing a quote.

References

  • Anthropic, Pricing (tokens · prompt caching · batch): https://platform.claude.com/docs/en/about-claude/pricing
  • OpenAI, API Pricing: https://developers.openai.com/api/docs/pricing
  • OpenAI, Prompt caching: https://developers.openai.com/api/docs/guides/prompt-caching
  • OpenAI, Batch API: https://developers.openai.com/api/docs/guides/batch
Want to build something similar?

We review your current system and data, then outline the migration order and scope.

Talk to usStart with the 3-minute AI readiness check →
SOL LABS AI

We build web apps, mobile apps and business systems, then add and run the AI they need. We build and operate our own meeting notes, contract and company analysis AI.

See our projects
Get the next post by email?

Related posts