AI Token Cost Calculator
Estimate the token cost of a chatbot, coding agent, document workflow, or other AI application. Enter your own current per-million-token prices and expected usage. Compare workloads by changing token counts and prices without sending prompts or calling a model API.
How to use this calculator
Enter requests per day and the average total input and output tokens per request. Total input includes cache reads and cache writes; output should include billed reasoning tokens where applicable.
Copy applicable per-million-token prices from your provider for one model, processing mode, context tier, and currency. The initial zero prices are placeholders. If cache writes have their own price, enter their token count and full write price separately.
Choose the number of days and review the daily and period estimates alongside the four token-cost buckets. Use actual usage logs to refine your averages, then add non-token charges separately.
Formula
Uncached input = total input − cache reads − cache writes. Cost per request = (uncached input × input price + cache reads × read price + cache writes × write price + output × output price) ÷ 1,000,000. Daily cost = cost per request × requests per day. Period cost = daily cost × entered days.
Worked example
For 1,000 daily requests with 2,000 input tokens each, including 1,000 cache-read tokens, and 500 output tokens: input at 2, cache reads at 0.20, and output at 10 per million tokens cost 0.0072 per request, 7.20 per day, and 216 over 30 days in the entered currency. These are illustrative prices, not a model quote.
How much does prompt caching save on an API workload?
Compare the same workload with no cache, cache reads, and cache writes. All USD rates below are illustrative, not current provider prices. Replace them with the rates for your model, account, currency, and service tier.
1. Keep the requests and output fixed
Enter 1,000 requests per day, 30 days, 2,000 total input tokens per request, and 500 output tokens per request. Use these example prices per million tokens: uncached input $2.00, cache read $0.20, cache write $2.50, and output $10.00.
For the no-cache baseline, set cache reads and writes to zero. Input costs 2,000 × $2.00 ÷ 1,000,000 = $0.004 per request. Output costs 500 × $10.00 ÷ 1,000,000 = $0.005. The total is $0.009 per request, $9.00 per day, or $270.00 for 30 days.
2. Compare cache reads and writes as separate input buckets
For a cache-read scenario, keep total input at 2,000, enter 1,000 cache-read tokens and zero cache-write tokens. That leaves 1,000 uncached tokens. The request costs $0.002 uncached input + $0.0002 cache read + $0.005 output = $0.0072.
For a cache-write scenario, enter zero cache-read tokens and 1,000 cache-write tokens. With the same total input and output, the request costs $0.002 uncached input + $0.0025 cache write + $0.005 output = $0.0095. This row assumes that every request writes 1,000 tokens. A prefix written once and reused later has a different average read/write mix.
3. Read the saving as a share of the whole token bill
The read scenario saves $1.80 per day or $54.00 over 30 days: ($270 − $216) ÷ $270 = 20%. Output still costs $5.00 per day in every row. A large discount on cached input therefore does not mean the same percentage saving on the entire request.
Use representative usage totals to estimate an average request, including writes, reads, and uncached misses. Check the provider’s supported models, minimum cacheable prefix, prefix matching, cache lifetime, and tier rules. This calculator models the token mix you enter; it does not enable caching or verify that a request received a cache hit.
| Input tokens per request | Per request | Per day | 30 days |
|---|---|---|---|
| 2,000 uncached | $0.0090 | $9.00 | $270.00 |
| 1,000 uncached + 1,000 cache read | $0.0072 | $7.20 | $216.00 |
| 1,000 uncached + 1,000 cache write | $0.0095 | $9.50 | $285.00 |
Before applying the estimate
- Total input includes uncached, cache-read, and cache-write tokens. Do not add cached tokens again on top of total input, and do not count one token as both a read and a write.
- Enter the full effective cache-write rate per million tokens, not only a write surcharge. Include billed reasoning or thinking tokens in your actual output count when the provider bills them as output; this example fixes that total at 500. Enter applicable Batch discounts in the effective token rates. Add separately billed storage, tools, media, and other services only when they are not already included in those token charges.
- Keep every rate in one currency and use the same billing unit. Provider usage records and invoices remain the billing authority; these fixed examples are estimates, not a price quote.
- Estimate prompt size with the Token Counter
- Check input and output space with the Context Window Calculator
Provider references for cache behavior and pricing
Assumptions and limits
- All requests use the same average token counts and selected prices. Cache reads and cache writes are mutually exclusive portions of total input. The full write price replaces the normal input price for write tokens; it is not added again as a surcharge.
- This is a token-based estimate, without a live price feed or tokenizer. Prices can differ by model, region, context length, processing tier, and provider. Apply Batch or other discounts by entering their actual applicable prices; no universal discount is assumed.
- Tools, search, cache storage, image/audio/video charges, taxes, credits, minimum charges, and negotiated terms are excluded. Use one currency throughout. A period is exactly the entered number of days, and the provider usage statement is the authority for billed amounts.
Sources
- OpenAI: API pricingSeparate input, cached-input, output, processing-mode, and tool pricing; rates must match the workload being estimated. Reviewed 2026-10-26.
- Anthropic: Plans and pricingSeparate cache-read and cache-write prices and model-specific context tiers; cache writes are distinct from cache reads. Reviewed 2026-10-26.
Related calculators
Verification
How this calculator is checked
Trust comes from reproducible evidence, not model confidence. You can inspect the formula, assumptions, worked example, and cited sources on this page.
- Versioned calculationFormula logic is kept separate from the interface and covered by automated registry and behavior checks.
- Cited evidenceSources linked for independent checking: 2.
- Transparent AI useAI may assist drafting or adversarial review. Agreement between models is not proof, and no human expert review is claimed unless a named reviewer is shown.
Frequently asked questions
Does this calculator use current OpenAI, Claude, or other model prices?
You enter the applicable current prices yourself. The calculator does not supply model presets or fetch a live price list. This lets you use any provider while choosing the correct model, region, context tier, and processing mode.
How do I avoid counting cached tokens twice?
Enter all input tokens in total input, then identify the cache-read and cache-write portions. The calculator subtracts both from the uncached input bucket. Enter the full price for each bucket. Cache reads plus cache writes cannot exceed total input.
Why can my actual AI API bill differ from this estimate?
Requests vary in token counts, cache hits, reasoning tokens, and context tiers. Providers can also bill tools, cache storage, media, or other services separately. Use actual token usage and matching prices to refine the estimate; the result is not an invoice.
Last updated 2026-11-08 · disjoint-input-cache-read-write-output-cost-v1 · content-2026-11-08 · Published by YunFanLabs