AI API Cost Calculator
Enter how often you call the API and how many tokens each call uses. We rank the monthly cost of 29 models from cheapest to priciest. Prices come from each provider’s official page, with the date we last checked.
How it’s calculated
Cost per request = (uncached input tokens × input price + cached input tokens × cache price + output tokens × output price) ÷ 1,000,000, then multiplied by requests per day and days per month.
- Cache share: System prompts or long documents you resend every time are much cheaper when read from cache (typically 5–25% of the input price). Cache write costs are not included.
- Batch: For work that doesn’t need an instant answer, Claude, Gemini and OpenAI take 50% off batch requests. This calculator applies no batch discount to xAI or Cloudflare.
- Long prompts: Above a length threshold (100K tokens for Claude Haiku 5.5, 200K for Gemini Pro and Grok, 272K for OpenAI) the higher long-context rate applies automatically.
- Cloudflare free allowance: Workers AI includes 10,000 neurons a day (about $0.11) free; tick the box to subtract it.
Price sources
| Provider | Official pricing page | Last checked |
|---|---|---|
| Anthropic (Claude) | docs.claude.com/…/pricing | 2026-10-11 |
| Google (Gemini) | ai.google.dev/gemini-api/docs/pricing | 2026-10-11 |
| OpenAI (GPT) | platform.openai.com/docs/pricing | 2026-10-11 |
| xAI (Grok) | docs.x.ai/docs/models | 2026-10-11 |
| Cloudflare Workers AI | developers.cloudflare.com/workers-ai/platform/pricing | 2026-10-11 |
Standard (real-time) rates for short prompts. Gemini 3.8 and 3.6 Flash are on promotional pricing through December 31, 2026 and double from 2027. Prices change often, so re-check the official page before you commit.
Watch out for
The same text produces different token counts on different models; Claude 4.7+ models count about 30% more tokens than earlier ones. Korean text usually takes more tokens than English, so measure a few real requests for the most accurate input. Free tiers, negotiated discounts and sales tax are not included. Nothing you type leaves your browser.