AI Token Cost Calculator — LLM API Pricing per Request & Month

Estimate what your AI app will cost: enter input/output tokens and requests to see per-call and monthly spend. Prices are editable to match any model. ✓ Editable rates

🤖

AI Token Cost

LLM API spend

$
$
🤖
Enter tokens to estimate your AI cost

How the AI Token Cost Calculator Works

  1. Pick a model tier or enter your own per-million-token prices.
  2. Enter input & output tokens per request and your monthly volume.
  3. See the cost per request, per 1,000 calls, and per month.

Estimating LLM API Costs

Large language models charge by the token (~¾ of a word), with separate prices for input (your prompt) and output (the model's reply) — usually quoted per million tokens. Output is typically 3–5× more expensive than input, so long replies dominate cost. The formula: cost = (input tokens ÷ 1M × input price) + (output tokens ÷ 1M × output price), times your request volume.

Because prices change often and vary by provider, this calculator keeps the rates editable — drop in the exact numbers from your provider's pricing page. To cut spend: trim prompts, cap output length, cache repeated context, and use a smaller model for simple tasks. Estimate only.

Formula & Logic

Large language model APIs bill per token, and input and output tokens are priced differently — output typically costs several times more than input, because generating tokens is more computationally expensive than reading them. A token is roughly four characters of English, so about 750 words per thousand tokens, though code and non-Latin scripts tokenise less efficiently. The cost driver most people miss is conversation history: in a multi-turn chat the entire prior exchange is resent as input on every request, so input cost grows quadratically with conversation length unless caching is used.

Cost = (input tokens ÷ 1M × input price) + (output tokens ÷ 1M × output price)Tokens ≈ characters ÷ 4, or words × 1.33Multi-turn: cumulative input = Σ of all prior turns resent each timeCached input is typically priced far below fresh input

where:

input token
text sent to the model, including the entire conversation history
output token
text generated, usually several times the input price
caching
reuses a prefix at reduced cost — the main lever on long conversations

Assumptions: Prices vary by model and change frequently; check current provider pricing rather than relying on a cached figure. Token counts differ between tokenisers, so estimates from one provider do not transfer exactly to another.

Step-by-Step Example: 2.4M Input and 800K Output Tokens

Cost a month of API usage, then show what prompt caching saves.

  • Input tokens2,400,000
  • Output tokens800,000
  • Input price$3.00 per million
  • Output price$15.00 per million
  • Cached input price$0.30 per million
  1. Input cost: 2.4 × $3.00 = $7.20.
  2. Output cost: 0.8 × $15.00 = $12.00.
  3. Total: $7.20 + $12.00 = $19.20.
  4. Note the split: output is 25% of the tokens but 63% of the cost.
  5. Now assume the input is fully cacheable: 2.4 × $0.30 = $0.72.
  6. Cached total: $0.72 + $12.00 = $12.72, a saving of $6.48 or 34%.

Result$19.20 — falling to $12.72 with prompt caching

The output-heavy cost profile is why asking for concise responses reduces spend more than shortening prompts. Caching helps most in long agentic conversations where a large stable context is resent on every turn — exactly the workload where naive costs escalate fastest.

AI Token Cost FAQ

A token is a chunk of text — roughly ¾ of a word, or about 4 characters. "Hello world" is about 2–3 tokens. Models bill by tokens in and tokens out.
Generating text is more compute-intensive than reading it, so providers charge more per output token — often 3–5× the input price. Limiting reply length is a fast way to cut costs.
Shorten prompts, cap max output tokens, cache or reuse context, batch requests, and route simple tasks to a cheaper/smaller model. Even small per-request savings multiply at scale.

Related Calculators

✔ Written & reviewed by Dr Sam — 20+ yrs in management & research leadership📅 Last updated June 2026🔬 Research behind this calculator📑 How we build & check these