Account

What new tool do you want?

Developer Tools

AI API Cost Calculator (LLM Token Pricing)

Estimate what an LLM-powered feature will cost — tokens per request, requests per month, input/output prices per million tokens, prompt caching and batch discounts. Works for any model: enter your provider's current prices.

Results are estimates for planning; real-world values vary.

How to use

  1. 1Enter the average input (prompt) and output (response) size of one request — in tokens, or words if you don't know the token count.
  2. 2Enter how many requests you expect per month.
  3. 3Copy the model's input and output prices per million tokens from your provider's pricing page.
  4. 4Add the share of input served from the prompt cache and any batch discount if you use them.

How it's calculated

Cost per request = (uncached input × input price + cached input × cache price + output × output price) ÷ 1,000,000, then × (1 − batch discount). Words are converted at about 1.33 tokens per English word.

Frequently asked questions

How many tokens is a word?

For English text, roughly 3/4 of a word per token — 100 words ≈ 133 tokens. Code, non-English text and numbers use more tokens per word. Your provider's tokenizer gives the exact count.

Why is output more expensive than input?

Output tokens are generated one at a time, which takes much more compute than reading the prompt. Output prices are typically 3–5× the input price.

What is prompt caching?

If many requests share a long identical prefix (system prompt, documents, examples), providers can cache it and bill those tokens at a steep discount — often 90% off the normal input price.

Where do I find current prices?

On your AI provider's pricing page. Prices change often and differ per model, so this calculator lets you enter them rather than relying on a built-in list that could go stale.

Why input and output are priced — and billed — separately

This calculator keeps input and output as two separate fields with two separate prices because that's how every provider actually bills: generating a token takes far more compute than reading one, so output is typically 3–5× the input price. A feature that summarizes a long document (large input, short output) has a very different cost profile from a chatbot that writes long replies (smaller input, large output) even at identical token counts — the 'Share of cost from output' figure in the results exists specifically to show you which side of that trade your feature sits on.

What the cache and batch fields are actually modeling

The cached-input percentage and cache price aren't decorative — the compute function splits your input tokens into a cached share (billed at cachePrice) and an uncached share (billed at the normal input price), then applies the batch/off-peak discount multiplicatively on top of both input and output. This mirrors real provider billing: prompt caching is worth modeling whenever requests share a long fixed prefix — a system prompt, a retrieved document, a tool schema — because providers often discount cached tokens by 90%. If you're not using caching or batch APIs, leave those at 0; the fields are additive, not required.

Worked example: AI API Cost Calculator

Take a support chatbot sending 1,500 input tokens and 400 output tokens per request, at 50,000 requests a month, with input priced at $3 and output at $15 per million tokens and no caching or batch discount. Input cost per request is 1,500 × $3 ÷ 1,000,000 = $0.0045; output cost is 400 × $15 ÷ 1,000,000 = $0.006 — total $0.0105 per request. At 50,000 requests that's $525/month ($6,300/year), with 95,000,000 total tokens processed. Notice output ($0.006) is already more than half the per-request cost despite being under a fifth of the token count — that's the input/output price gap at work.

The one thing this number always underestimates

The 'Input per request' field is meant to capture the full prompt — system prompt, user message and any injected context — but it's easy to size it from a single isolated request and forget that multi-turn conversations resend the entire prior transcript as input on every turn, and that tool calls and retries each count as a full additional request. A chat feature with an average 5-turn conversation effectively has a growing input size, not a flat one; model that with the average input size across a conversation's turns, not the size of turn one, or the monthly estimate will run low once the feature ships.

Related tools

More: Developer Tools