Estimate AI API cost from billed input tokens, billed output tokens and every additional tool or execution charge. User counts alone are not a budget. Keep production API usage separate from a coding-assistant subscription, then measure the cost of a successful result, including retries and review.
Prices checked November 7, 2026, in USD. These are selected standard text-token rates, not a complete model catalogue or a quality ranking. The workload calculations are illustrative.
Current prices and their conditions
| Provider and model | Input per million tokens | Output per million tokens | Condition to retain in your estimate |
|---|---|---|---|
| OpenAI GPT-6.1 Sol | $2 | $10 | Standard speed, short context at or below 272K input tokens |
| OpenAI GPT-6.1 Terra | $1 | $5 | Same standard short-context basis |
| Anthropic Claude Sonnet 5.5 | $2 | $10 | Base token pricing; caching has separate rates |
| Anthropic Claude Haiku 5.5 | $0.10 | $0.50 | Prompts up to 100,000 tokens; longer prompts have different rates |
| Google Gemini 4 Argon | $2 | $10 | Promotional standard rate through November 30, 2026; $4 input and $20 output from December 1 |
Sources: OpenAI API pricing, Anthropic pricing, and Gemini Developer API pricing. Recheck the exact model, endpoint, processing tier, region and agreement before approving a budget. A Google Developer API quote is not automatically a quote for a separate cloud platform.
For OpenAI, long-context, Fast and Ultrafast processing can change the rates. Cache reads and writes also have distinct prices. Google's output price includes thinking tokens. Do not estimate billed output solely by counting the words the user sees.
A cheaper row does not establish equivalent task quality. Test your own acceptance criteria before changing models. Record successful results, failures requiring review, latency and total billed usage.
The monthly arithmetic
Consider 1,000 daily users, each making five requests per day, for 30 days. That is 150,000 requests. If each request bills 1,000 input tokens and 1,000 output tokens, the totals are 150 million input tokens and 150 million output tokens.
monthly_requests = daily_users × requests_per_user × days
input_millions = monthly_requests × input_tokens_per_request / 1,000,000
output_millions = monthly_requests × output_tokens_per_request / 1,000,000
text_cost = input_millions × input_rate + output_millions × output_rate
| Example rate pair | Input cost | Output cost | Text-token total |
|---|---|---|---|
| $2 input / $10 output | $300 | $1,500 | $1,800 |
| $1 input / $5 output | $150 | $750 | $900 |
| $0.10 input / $0.50 output | $15 | $75 | $90 |
Correction: an earlier version divided this workload's costs by an extra 1,000. At the old example rates of $3 input and $15 output, the total would be $2,700, not $2.70. The corrected method above uses tokens in millions exactly once.
These are token-only examples with no caching, batch discount, retry, search, hosting or tax. They are not observed customer bills.
A small calculator you can check
Run this example in Node. Supply current rates and measured token counts for your own feature.
function textCost({ requests, inputTokens, outputTokens, inputRate, outputRate }) {
const values = [requests, inputTokens, outputTokens, inputRate, outputRate];
if (values.some(value => !Number.isFinite(value) || value < 0)) {
throw new Error('Use finite, nonnegative quantities');
}
return requests * (inputTokens * inputRate + outputTokens * outputRate) / 1_000_000;
}
const monthly = textCost({
requests: 1000 * 5 * 30,
inputTokens: 1000,
outputTokens: 1000,
inputRate: 2,
outputRate: 10,
});
console.log(monthly.toFixed(2)); // 1800.00
This calculator deliberately models uncached text only. For a production ledger, separate uncached input, cache reads, cache writes, billed output and tools, then sum the matching rates. Never subtract cached tokens from an input total without checking how that endpoint reports usage.
Measure cost per accepted result
Suppose a workflow makes three attempts before one answer passes your checks. Count all three attempts. If a coding task needs twenty minutes of review, record that time separately from the API invoice. A low token bill can still produce an expensive accepted change.
Keep a nonsecret ledger:
date, feature, model_version, processing_tier, attempts,
uncached_input, cached_input, cache_writes, billed_output,
tool_cost_usd, total_cost_usd, accepted, review_minutes
Use identifiers for the feature or test case, not full customer prompts. Compare the median and high-cost tail, and inspect failed runs. Long conversations, retrieved documents, repeated tool output and background work can change usage even when the visible question is short.
The Devin and Claude Code comparison uses this distinction when evaluating development work. Product API spend belongs in a separate budget from seats, subscriptions and hosting.
Put controls in the application
Authenticate requests, limit per-user usage and concurrency, bound output and total run length, and set retry limits with a deadline. Reserve budget before starting concurrent work so several requests cannot all spend the same remaining allowance. Reconcile reservations with actual billed usage afterward.
Use provider alerts as another signal. Verify whether a particular limit stops requests or only notifies you; do not assume every provider's budget setting is a hard cap. Check for delayed usage reporting and an emergency disable path before launch.
Cache only when reuse is valid for that user and data version. Test lower-cost models against the same acceptance cases. Use batch processing only when the task can tolerate its turnaround and the chosen endpoint supports it. No fixed percentage saving applies to every product.
Review hosting costs alongside the API ledger, and include failure and spending-limit checks in the deployment checklist.