SourceVane · Practical AI
AI API cost calculator
Compare two AI API budgets using token prices, retries and successful tasks. Enter your own assumptions; no API calls or account required.
Enter your workload
The starting values are illustrative assumptions, not provider prices. Replace them with your measured workload and current quoted rates. Calculations stay in your browser.
Enable JavaScript to change the inputs and compare options. The formula and evaluation guide remain available below.
How the estimate works
For each option, monthly cost = tasks × that option’s average attempts × (input tokens × input price + output tokens × output price) ÷ 1,000,000.
Cost per successful task = monthly cost ÷ (tasks × final success rate). Count success after the allowed retries, using your own acceptance test. cost-v2 keeps each option’s token use and retry rate separate.
Use effective billed rates for your configuration. Cache writes and reads, batch discounts, tool charges, hosting, taxes and subscriptions are not added separately. This estimates token spend, not latency, model quality or a guaranteed invoice.
Compare the estimate with measured usage before budgeting. Measure retry cost · Compare batching and caching.
Continue this decision
Evidence and next steps
Reduce AI API costs without losing useful results
Measure workload, retries and accepted outputs before comparing models, batching or reusable prompts.
Prompt-cache break-even: how many prefix reuses cover the write cost?
A source-backed calculation compares one cache write plus cache reads with ordinary input processing for a fixed 10,000-token prefix.
Measure AI API retry cost before changing models
Count failed attempts, final successful tasks and token use separately so retries do not hide the real cost of useful API work.
How retries change AI API cost per successful task
A reproducible scenario analysis separates token spend, average attempts and final successful tasks across four retry assumptions.
What happened next · API prices · Decision guides · Latest AI coverage · Follow updates