Analysis · API pricing · 4 min read
AI API pricing: calculate the cost of a finished task
A worked budget for 10,000 requests, with cache and retry arithmetic you can reuse.
API cost calculator
Compare up to three text models on the same workload. Rates come from the current catalogue; results are estimates in USD.
| Model | Total, USD | Per primary request, USD | Input / output / cache, USD per 1M tokens |
|---|---|---|---|
| Claude Sonnet 4.6Anthropic · Rate checked | 13.5000 | 0.013500 | 3 / 15 / 0.3 |
| Beam 1.0 501B A23BArtificial Analysis · Rate checked | 1.4000 | 0.001400 | 0.4 / 1.2 / 0.04 |
| Claude Fable 5Anthropic · Rate checked | 45.0000 | 0.045000 | 10 / 50 / 1 |
| Claude Fable 5.1Anthropic · Rate checked | 45.0000 | 0.045000 | 10 / 50 / 0.25 |
| Claude Fable 5.2Anthropic · Rate checked | 36.0000 | 0.036000 | 8 / 40 / 0.2 |
| Claude Haiku 4.5Anthropic · Rate checked | 4.5000 | 0.004500 | 1 / 5 / 0.1 |
| Claude Haiku 5.5Anthropic · Rate checked | 0.4500 | 0.000450 | 0.1 / 0.5 / 0.01 |
| Claude Opus 4.5Anthropic · Rate checked | 22.5000 | 0.022500 | 5 / 25 / 0.5 |
| Claude Opus 4.6Anthropic · Rate checked | 22.5000 | 0.022500 | 5 / 25 / 0.5 |
| Claude Opus 4.7Anthropic · Rate checked | 22.5000 | 0.022500 | 5 / 25 / 0.5 |
| Claude Opus 4.8Anthropic · Rate checked | 22.5000 | 0.022500 | 5 / 25 / 0.5 |
| Claude Opus 5Anthropic · Rate checked | 22.5000 | 0.022500 | 5 / 25 / 0.5 |
| Claude Opus 5.5Anthropic · Rate checked | 18.0000 | 0.018000 | 4 / 20 / 0.2 |
| Claude Sonnet 4.5Anthropic · Rate checked | 13.5000 | 0.013500 | 3 / 15 / 0.3 |
| Claude Sonnet 5Anthropic · Rate checked | 9.0000 | 0.009000 | 2 / 10 / 0.2 |
| Claude Sonnet 5.5Anthropic · Rate checked | 9.0000 | 0.009000 | 2 / 10 / 0.1 |
| GLM-5Rate source · Rate checked | 3.6000 | 0.003600 | 1 / 3.2 / 0.2 |
| GLM-5.1Rate source · Rate checked | 5.0000 | 0.005000 | 1.4 / 4.4 / 0.26 |
| GLM-5.2Rate source · Rate checked | 5.0000 | 0.005000 | 1.4 / 4.4 / 0.26 |
| GLM-5.3Rate source · Rate checked | 5.0000 | 0.005000 | 1.4 / 4.4 / 0.26 |
| GLM-5.3 FlashRate source · Rate checked | 0.5500 | 0.000550 | 0.15 / 0.5 / 0.03 |
| GPT-4.1OpenAI · Rate checked | 8.0000 | 0.008000 | 2 / 8 / 0.5 |
| GPT-4.1 MiniOpenAI · Rate checked | 1.6000 | 0.001600 | 0.4 / 1.6 / 0.1 |
| GPT-4.1 nanoOpenRouter · Rate checked | 0.4000 | 0.000400 | 0.1 / 0.4 / 0.03 |
| GPT-4oOpenAI · Rate checked | 10.0000 | 0.010000 | 2.5 / 10 / 1.25 |
| GPT-4o MiniOpenAI · Rate checked | 0.6000 | 0.000600 | 0.15 / 0.6 / 0.075 |
| GPT-5OpenAI · Rate checked | 7.5000 | 0.007500 | 1.25 / 10 / 0.125 |
| GPT-5 MiniOpenAI · Rate checked | 1.5000 | 0.001500 | 0.25 / 2 / 0.025 |
| GPT-5 ProOpenAI · Rate checked | 90.0000 | 0.090000 | 15 / 120 / — |
| GPT-5 nanoOpenAI · Rate checked | 0.3000 | 0.000300 | 0.05 / 0.4 / 0.005 |
| GPT-5.1OpenAI · Rate checked | 7.5000 | 0.007500 | 1.25 / 10 / 0.125 |
| GPT-5.2OpenAI · Rate checked | 10.5000 | 0.010500 | 1.75 / 14 / 0.175 |
| GPT-5.4 MiniOpenAI · Rate checked | 3.7500 | 0.003750 | 0.75 / 4.5 / 0.075 |
| GPT-5.4 nanoOpenAI · Rate checked | 1.0250 | 0.001025 | 0.2 / 1.25 / 0.02 |
| GPT-5.6 LunaOpenRouter · Rate checked | 1.0000 | 0.001000 | 0.2 / 1.2 / 0.02 |
| GPT-5.6 SolOpenRouter · Rate checked | 18.0000 | 0.018000 | 4 / 20 / 0.4 |
| GPT-5.6 TerraOpenRouter · Rate checked | 10.0000 | 0.010000 | 2 / 12 / 0.2 |
| GPT-6 AstraOpenRouter · Rate checked | 45.0000 | 0.045000 | 10 / 50 / 1 |
| GPT-6 LunaOpenRouter · Rate checked | 0.4500 | 0.000450 | 0.1 / 0.5 / 0.01 |
| GPT-6 SolOpenRouter · Rate checked | 9.0000 | 0.009000 | 2 / 10 / 0.2 |
| GPT-6.1 SolOpenRouter · Rate checked | 9.0000 | 0.009000 | 2 / 10 / 0.1 |
| GPT-6.1 TerraOpenRouter · Rate checked | 4.5000 | 0.004500 | 1 / 5 / 0.05 |
| Gemini 3.5 FlashRate source · Rate checked | 7.5000 | 0.007500 | 1.5 / 9 / 0.15 |
| Gemini 3.5 Flash LiteRate source · Rate checked | 1.8500 | 0.001850 | 0.3 / 2.5 / 0.03 |
| Gemini 3.6 FlashRate source · Rate checked | 3.3750 | 0.003375 | 0.75 / 3.75 / 0.075 |
| Gemini 3.8 FlashRate source · Rate checked | 3.3750 | 0.003375 | 0.75 / 3.75 / 0.075 |
| Gemini 4 ArgonRate source · Rate checked | 9.0000 | 0.009000 | 2 / 10 / 0.1 |
| Gemini 4 CarbonRate source · Rate checked | 9.0000 | 0.009000 | 2 / 10 / 0.1 |
| Gemini 4 HydrogenRate source · Rate checked | 6.7500 | 0.006750 | 1.5 / 7.5 / 0.075 |
| Gemma 4 26B A4B ITOpenRouter · Rate checked | 0.2475 | 0.000247 | 0.0675 / 0.225 / 0.0375 |
| Gemma 4 31B ITOpenRouter · Rate checked | 0.6000 | 0.000600 | 0.2 / 0.4 / — |
| GlimpseOpenRouter · Rate checked | 2.7000 | 0.002700 | 0.6 / 3 / 0.06 |
| Grok 4.3Rate source · Rate checked | 3.7500 | 0.003750 | 1.25 / 2.5 / 0.2 |
| Grok 4.5Rate source · Rate checked | 7.0000 | 0.007000 | 2 / 6 / 0.3 |
| Grok 4.6Rate source · Rate checked | 7.0000 | 0.007000 | 2 / 6 / 0.5 |
| Grok 4.7Rate source · Rate checked | 7.0000 | 0.007000 | 2 / 6 / 0.5 |
| Grok Build 0.1Rate source · Rate checked | 3.0000 | 0.003000 | 1 / 2 / 0.2 |
| Kimi K2.7 CodeOpenRouter · Rate checked | 2.9500 | 0.002950 | 0.6 / 3.5 / 0.16 |
| Kimi K3Vercel AI Gateway · Rate checked | 13.5000 | 0.013500 | 3 / 15 / 0.3 |
| Kimi K3.1 ProOpenRouter · Rate checked | 9.0000 | 0.009000 | 2 / 10 / 0.2 |
| LFM2.5-24B-A2BOpenRouter · Rate checked | 0.4500 | 0.000450 | 0.05 / 0.7 / 0.025 |
| LongCat-2.5Vercel AI Gateway · Rate checked | 1.2000 | 0.001200 | 0.3 / 1.2 / 0.006 |
| MiniMax M3.1 FlashOpenRouter · Rate checked | 0.6000 | 0.000600 | 0.15 / 0.6 / 0.015 |
| Muse WonderOpenRouter · Rate checked | 18.0000 | 0.018000 | 4 / 20 / 0.2 |
| O3 ProOpenAI · Rate checked | 80.0000 | 0.080000 | 20 / 80 / — |
| Pareto 26.10OpenRouter · Rate checked | 3.2000 | 0.003200 | 0.8 / 3.2 / 0.03 |
| Particle-1OpenRouter · Rate checked | 0.3500 | 0.000350 | 0.05 / 0.5 / 0.003 |
| Qwen3 14BOpenRouter · Rate checked | 0.3600 | 0.000360 | 0.12 / 0.24 / — |
| Qwen3 32BOpenRouter · Rate checked | 0.3000 | 0.000300 | 0.08 / 0.28 / — |
| Qwen3 Coder NextOpenRouter · Rate checked | 0.6400 | 0.000640 | 0.12 / 0.8 / 0.07 |
| Qwen3.5 397B A17BOpenRouter · Rate checked | 3.0000 | 0.003000 | 0.6 / 3.6 / 0.12 |
| Qwen3.6 27BOpenRouter · Rate checked | 2.2400 | 0.002240 | 0.32 / 3.2 / — |
| Qwen3.6 35B A3BOpenRouter · Rate checked | 0.6500 | 0.000650 | 0.1 / 0.9 / 0.025 |
Cost = requests × (1 + additional / 100) × [input × (1 − cache / 100) × input rate + input × cache / 100 × cache rate + output × output rate] / 1,000,000.
Additional requests use the same average token counts and cache share. Cache means reading an existing cache. Known input-length tiers apply to the whole prompt, including cached tokens. Taxes, cache writes and storage, tools, images, audio and batch discounts are excluded. A price comparison does not measure model quality; this is a scenario, not a benchmark.
A model's price per million tokens is the start of a budget. The useful comparison is the cost of finishing your task: input, output, cache writes and reads, extra calls, and retries. This page gives a reproducible calculation, with a dated provider example and a worksheet you can reuse.
Start with the workload
Write down the same workload for every candidate: requests per day, input tokens per request, output tokens per request, and the fraction of answers you accept. Count the system instructions, conversation history and tool results that you send again. A long conversation can make a small question expensive.
Use token counts from your actual requests. A word count is an approximation, and the approximation changes with language, code and the tokenizer. Keep an ordinary case and a large case: a budget based only on an average hides the expensive tail.
The calculation
For ordinary text requests without caching:
Cost = (input tokens × input price + output tokens × output price) ÷ 1,000,000.
Multiply this by the number of calls, including intermediate agent calls. For a monthly estimate, calculate the total tokens for the month rather than rounding each tiny request to cents.
Claude Sonnet 4.6's provider page lists $3 per million input tokens and $15 per million output tokens, checked on 31 October 2026. These are the direct API rates used below, not a chat subscription price.
| Illustrative workload | Input / call | Output / call | Cost / call | 10,000 calls |
|---|---|---|---|---|
| Short reply | 2,000 | 1,000 | $0.021 | $210 |
| Document question | 20,000 | 2,000 | $0.090 | $900 |
| Large context | 200,000 | 8,000 | $0.720 | $7,200 |
For the middle row: 20,000 × $3 / 1M = $0.06 of input; 2,000 × $15 / 1M = $0.03 of output. The $900 total is arithmetic for the stated workload, not a measurement of a real application's bill. Extra services, taxes and negotiated terms are outside it.
Separate cache hits from writes
A repeated prefix is useful only when the provider reports a cache hit. Anthropic's caching documentation describes prefix matching, expiry, and separate writes and reads. Its pricing table lists Sonnet 4.6 cache reads at $0.30/1M tokens and five-minute writes at $3.75/1M, checked on the same date.
Suppose 18,000 of the middle row's 20,000 input tokens are an eligible cached prefix. A warm hit costs 18,000 × $0.30 / 1M + 2,000 × $3 / 1M + 2,000 × $15 / 1M = $0.0414. Ten thousand such hits cost $414. A request that creates that five-minute cache instead costs $0.1035. Include misses, new writes and expiry before estimating a saving.
Compare completed results
Keep quality and cost in the same worksheet. For illustration, a $0.09 attempt with a 90% acceptance rate costs $0.10 per accepted result; a $0.06 attempt at 50% acceptance costs $0.12. This assumes independent retries with the same cost until success. Both rates are invented examples, not model benchmarks.
For a real comparison, run the same set of tasks, record every call and count accepted results using the same criteria. Report total spend divided by accepted results, alongside latency and failures. A model's name or a leaderboard position does not supply those measurements for your workflow.
Check the offer before choosing
Match the exact model version, provider and billing unit. Verify the rate for your context length and region, and any cache, batch or tool charges. Image, audio and video pricing can use different units; this text-token worksheet cannot compare them without conversion.
For coding tools, start with the Codex setup and usage guide, Claude Code setup and billing guide or Cursor plans and usage guide. The Codex, Claude Code and Cursor comparison adds subscription costs and human review time to the task budget; this API worksheet covers the token-billed part.
The live price table and model catalogue show facts observed by Signal Forge. Each model page links to its evidence. A missing price means it is unestablished in this catalogue, never zero. Use the Sonnet 4.6 card to compare this dated example with current observations, and the Claude timeline for related changes.
For another API workload, the Gemini 3.8 Flash guide gives acceptance checks and explains how to match a model to a provider offer. Record the provider and API identifier before comparing bills from different services.
To update this worksheet, replace the two rates, measured token totals, cache mix and acceptance counts. Keep the date and provider beside the numbers so another person can reproduce the comparison.