Developer & Tech

LLM API Cost Calculator

What this does

Project monthly LLM API spend from per-call token usage, input/output pricing and call volume across your traffic mix.

Enter your details

Runs in your browser

Calculator inputs

Using the llm api cost calculator

  1. 01

    Measure a representative call

    Use the token counter on a typical prompt and response pair.

  2. 02

    Enter both prices

    Output tokens usually cost 3–5× input; leaving defaults skews nothing structurally.

  3. 03

    Scale by traffic

    Calls/day × days/month converts unit economics into a budget line.

Inputs dominate at scale

Because output tokens cost multiples of input ones, teams obsess over reply length while shipping enormous system prompts and full conversation histories every call. Trimming context, caching prefixes and summarizing history routinely halve bills without touching model quality settings.

Model choice moves the decimal point

Flagship models often cost 10–30× their smaller siblings. Routing easy tasks to mini-class models and reserving flagships for hard steps frequently cuts blended spend by an order of magnitude at negligible quality loss; model this by running the calculator once per tier.

The math behind this calculator

perCall = in/1M × $in + out/1M × $out monthly = perCall × calls/day × days

Token counts convert to dollars through each side’s per-million rate, summing input and output because providers price them differently. Multiplying per-call cost by daily volume and active days yields the monthly projection, with a daily figure for sprint-level sanity checks.

Assumptions & limitations

  • List prices entered per million tokens, no volume discounts.
  • Uniform call shape; mixed workloads need weighted averages.
  • Retries and failed calls billed by providers still count.

Worked example

A chat feature averaging 2,000-token prompts and 500-token replies at $3/$15 per million, called 100 times daily, spends about $40.50 per 30-day month.

Frequently asked questions

Are cached input tokens cheaper?
Many providers discount cache hits 50–90%. Model that by lowering the effective input price for the cached fraction.
Do I enter prices per 1K or 1M tokens?
Per 1M here; matching how major providers quote. Divide legacy per-1K quotes by one thousand... i.e. multiply by 1000 to convert per-1K to per-1M.
Batch APIs?
Off-peak batch endpoints typically halve prices; enter half-price values to model them directly.

Related calculators