AI token cost is the number almost every team gets wrong on the first attempt, and it is the number that decides whether an AI feature ships or quietly gets shelved. A prototype that costs a few pence per request feels free. The same prototype, wired into a product with twenty thousand users a month, arrives as an invoice nobody put in the budget. The arithmetic in between is not complicated — but it is unforgiving, and almost nobody does it before writing the code.
This guide is a working AI token cost calculator in article form. It sets out the four numbers you need, the live per-million-token rates as of August 2026, the multipliers that quietly double or halve the bill, and a fully worked example you can copy for your own large language model feature. Every figure below is arithmetic you can check, not a vendor estimate.
The reason this matters more than it did a year ago is that model pricing has stopped being the whole story. Caching, batching, reasoning tokens and model routing now move the final AI token cost by a factor of three or more on identical workloads. Two teams building the same chatbot on the same model can land on wildly different bills, and the difference is almost never the model — it is how they structured the request.
Our AI strategy and artificial intelligence and machine learning teams run this exact calculation with UK clients before a single line of production code is written, because a cost model built after launch is a post-mortem, not a plan.
Table of contents
- Why AI Token Cost Is the Hardest Number to Forecast
- What Actually Counts as a Token
- The AI Token Cost Formula: Four Numbers You Need
- Model Rates in August 2026
- Building an AI Token Cost Calculator: A Worked Example
- The Multipliers Everyone Forgets
- Three Levers That Cut AI Token Cost the Most
- AI Token Cost Mistakes That Blow the Budget
- From Estimate to a Budget You Can Defend
- AI Token Cost Calculator FAQs
- References
Why AI Token Cost Is the Hardest Number to Forecast
Traditional software costs scale with something you can count in advance: users, requests, storage, seats. AI token cost does not. It scales with how much text moves through the model, and that quantity is only loosely related to how many people use the feature.
Usage and spend are only loosely coupled
A single user question might cost a tenth of a penny or fifty pence depending on how much context the application attaches to it. Retrieval-augmented generation pulls in documents. Tool definitions add schema. Conversation history grows every turn. The user typed twelve words; the model read twelve thousand tokens. This is why halving your request volume often barely dents the AI token cost — the per-request payload was the problem, not the number of requests.
Output is where the money is
Output tokens are billed at roughly five times the input rate on every major model. On Claude Opus 5 the split is $5 per million input against $25 per million output. On GPT-5.6 Sol it is $5 against $30. A verbose model that answers in four paragraphs where two would do is not a style problem; it is a line item. Any credible AI token cost calculator has to treat input and output as separate variables, because a change that halves output length saves five times what the same reduction in input would.
Reasoning tokens are invisible until the invoice
Current models think before they answer, and those thinking tokens are billed at the output rate even though the user never sees them. A request with adaptive thinking enabled can generate several thousand tokens of reasoning before it produces a two-sentence reply. Teams that estimated their AI token cost from visible output alone routinely under-forecast by a factor of two or three. This is the single most common surprise in the first month of production.
What Actually Counts as a Token
Before the formula makes sense, it helps to be precise about the unit you are buying, because a lot of bad estimates start with a bad token count.
The rough rule, and why it is only rough
The working approximation for English prose is about four characters per token, or roughly 0.75 tokens per word — so 1,000 words is somewhere near 1,330 tokens. That is fine for a back-of-envelope figure. It is not fine for a budget. Code, JSON, non-English text, and structured markup all tokenise far less efficiently, sometimes at half the rate. A 1,000-word block of Python can easily exceed 2,000 tokens.
Never estimate Claude tokens with an OpenAI tokeniser
This trips up more teams than any other technical detail. tiktoken is OpenAI’s tokeniser, and it undercounts Claude tokens by roughly 15–20% on typical English text — considerably more on code or non-English input. An AI token cost model built on tiktoken figures but billed against Anthropic rates will be optimistic by a fifth before you have made a single other mistake. Use the provider’s own counting endpoint: Anthropic exposes POST /v1/messages/count_tokens, which returns the exact input token count for a given model, system prompt, tool set and message list, and costs nothing to call.
Count the whole request, not the prompt
The billed input is everything the model reads: tool definitions, the system prompt, every prior turn you resend, retrieved documents, images, and the current user message. Tool schemas in particular are easy to forget — a dozen well-documented tools can add several thousand tokens to every single request in the conversation. When you build your AI token cost calculator, count the request as the API sees it, not as it looks in your prompt template.
The AI Token Cost Formula: Four Numbers You Need
Strip away the complexity and every AI token cost estimate reduces to the same expression. You need four inputs, and you can obtain all four in an afternoon.
Cost per interaction = (input tokens × input rate) + (output tokens × output rate)
Monthly AI token cost = cost per interaction × interactions per month
The four numbers are: input tokens per interaction, output tokens per interaction, the per-million rates for your chosen model, and your expected monthly interaction volume. Rates are published. Volume is a product forecast. The two token counts are the ones you must measure rather than guess, and measuring them properly is what separates an AI token cost calculator that holds up from one that embarrasses you in a budget review.
Measure, do not estimate, the token counts
Build ten to twenty representative interactions — the genuinely typical ones, not the demo you show executives — and run each through the provider’s token counting endpoint. Record input tokens per interaction and, from real completions, output tokens per interaction. Take the mean and the 90th percentile. The mean drives your expected AI token cost; the 90th percentile tells you what a bad month looks like.
Define an interaction honestly
An “interaction” must map to something your product actually charges for or your users actually do. For a chatbot it is usually a full conversation, not a single message, because conversations resend history and a per-message figure will understate the AI token cost badly. For a document processor it is one document. For an autonomous agent it is one task — and an agent task can trigger dozens of model calls, which is why AI agent cost overruns look nothing like chatbot overruns.
Model Rates in August 2026
Rates move, so treat this table as a snapshot to be re-checked rather than a constant. All figures are US dollars per million tokens on the providers’ first-party APIs at the time of writing, August 2026.
| Model | Input /MTok | Output /MTok | Context | Best fit |
|---|---|---|---|---|
| Claude Haiku 4.5 | $1.00 | $5.00 | 200K | Classification, routing, high volume |
| GPT-5.6 Luna | $0.20 | $1.20 | — | Cheapest bulk processing |
| Claude Sonnet 5 | $3.00 | $15.00 | 1M | Balanced production workhorse |
| Gemini 3.1 Pro | $2.00 | $12.00 | — | Balanced, doubles above 200K |
| GPT-5.6 Terra | $2.00 | $12.00 | — | Balanced production workhorse |
| Claude Opus 5 | $5.00 | $25.00 | 1M | Complex agents, hard reasoning |
| GPT-5.6 Sol | $5.00 | $30.00 | — | Premium reasoning |
| Claude Fable 5 | $10.00 | $50.00 | 1M | Long-horizon autonomous work |
Two footnotes worth carrying into your AI token cost model. Claude Sonnet 5 is running an introductory rate of $2.00 / $10.00 per million through 31 August 2026, so a budget built on the introductory figure needs a 50% uplift baked in for September onwards. And Gemini 3.1 Pro doubles its rate above 200,000 tokens of context, which turns a long-context design decision into a pricing decision. A fuller side-by-side sits in our LLM API pricing comparison.
Do not pick the model from this table alone
The cheapest model that succeeds is cheaper than the expensive model that succeeds, but it is far more expensive than either if it fails and the request has to be retried on a better model. A 20% failure rate on a cheap model that falls back to a premium one costs more than running the premium model outright. Route by task difficulty, measure the fallback rate, and fold that rate into your AI token cost calculator as a real multiplier.
Building an AI Token Cost Calculator: A Worked Example
Abstract formulas convince nobody. Here is a complete AI token cost calculation for a realistic feature — a customer support assistant with a knowledge base — carried all the way to a monthly figure.
The measured inputs
Assume a support assistant on Claude Sonnet 5 at list rates ($3.00 input, $15.00 output per million tokens). Measurement across twenty representative conversations produced these figures:
- Fixed prefix per request — system prompt, tool definitions and retrieved knowledge: 10,000 tokens
- Average conversation length: 5 turns, so that prefix is resent 5 times
- Growing conversation history: about 1,200 tokens of additional context per turn, 6,000 tokens across the conversation
- Total assistant output across the conversation: 2,500 tokens
- Expected volume: 20,000 conversations per month
The baseline arithmetic
Total input tokens per conversation are the prefix resent every turn plus the accumulated history: (10,000 × 5) + 6,000 = 56,000 input tokens. Output is 2,500 tokens.
- Input: 56,000 ÷ 1,000,000 × $3.00 = $0.168
- Output: 2,500 ÷ 1,000,000 × $15.00 = $0.0375
- Cost per conversation: $0.2055
- Monthly AI token cost: $0.2055 × 20,000 = $4,110
That is the number most teams never calculate until it appears on a card statement. Notice what dominates it.
Applying prompt caching
Nearly three-quarters of the AI token cost is one unchanging block of text being re-read four unnecessary times. Prompt caching fixes exactly this. Cache writes are billed at 1.25× the input rate on a five-minute time-to-live; cache reads are billed at roughly 0.1×.
Caching the 10,000-token prefix means one write and four reads per conversation:
- Cache write: 10,000 × 1.25 = 12,500 effective tokens
- Cache reads: 10,000 × 4 turns × 0.1 = 4,000 effective tokens
- Uncached history: 6,000 tokens
- Effective input: 22,500 tokens (down from 56,000)
- Input: 22,500 ÷ 1,000,000 × $3.00 = $0.0675
- Cost per conversation: $0.105 — a 49% reduction
- Monthly AI token cost: $2,100
Adding model routing
Suppose 60% of conversations are routine — order status, password resets, opening hours — and can be handled by Claude Haiku 4.5 at $1.00 / $5.00 per million. The same cached conversation on Haiku costs (22,500 ÷ 1,000,000 × $1.00) + (2,500 ÷ 1,000,000 × $5.00) = $0.0225 + $0.0125 = $0.035.
Blended: (0.6 × $0.035) + (0.4 × $0.105) = $0.021 + $0.042 = $0.063 per conversation, or $1,260 per month.
Same feature, same answers on the queries that matter, and the AI token cost falls by 69%. Neither change required a cheaper vendor or a worse product — only a different request shape.
The Multipliers Everyone Forgets
The base rate is the starting point, not the answer. A handful of multipliers apply on top, and they swing the final AI token cost in both directions.
| Mechanism | Effect on rate | When it applies |
|---|---|---|
| Cache read | ~0.1× input | Repeated prefix within the cache lifetime |
| Cache write, 5-minute TTL | 1.25× input | First request that establishes the cache |
| Cache write, 1-hour TTL | 2× input | Bursty traffic with gaps over five minutes |
| Batch API | 0.5× both | Work that tolerates up to 24 hours latency |
| Reasoning tokens | Billed at output rate | Any request with thinking enabled |
| Retries and fallbacks | 1× per extra attempt | Failed parses, refusals, timeouts |
| Long-context tier | Up to 2× on some models | Requests above a provider threshold |
Caching only pays if the prefix actually repeats
Caching is a prefix match: any byte that changes anywhere in the cached region invalidates everything after it. Interpolating a timestamp, a session ID or a user name into the top of your system prompt means you pay the 1.25× write premium on every single request and never once collect the 0.1× read. There is also a minimum cacheable length — 512 tokens on Claude Opus 5, 1,024 on Claude Sonnet 5 — below which nothing caches and no error is raised. Verify with the cache_read_input_tokens field in the response before you write the saving into your AI token cost forecast.
The 50% batch discount is the easiest money on the table
Anything that does not need an answer in the next few seconds — overnight enrichment, bulk classification, document summarisation, evaluation runs — belongs on the Batch API at half price. Batches accept up to 100,000 requests, most complete within an hour, and the ceiling is 24 hours. A surprising share of production AI workload is latency-tolerant and running on the synchronous endpoint purely out of habit.
Budget for retries explicitly
Every failed JSON parse, every safety refusal, every timeout that triggers a second attempt bills in full. If 5% of requests are retried once, your real AI token cost is 1.05× the modelled figure. Measure the rate rather than assuming it is negligible; on strict schema extraction it rarely is.
Three Levers That Cut AI Token Cost the Most
Given a fixed engineering budget, these three deliver the largest reduction per hour invested. The worked example above used the first two and cut spend by 69%.
Lever one: restructure the prompt for cache hits
Put everything stable at the front — system prompt, tool definitions, few-shot examples, retrieved documents that persist across turns — and everything volatile at the back. Serialise tool definitions deterministically so their byte order never changes. Do not swap models mid-conversation; caches are model-scoped. This is usually a day of work and it is the highest-return change available on almost any conversational workload.
Lever two: route by task difficulty
Not every request needs a frontier model. Classification, routing, extraction, summarisation and formatting are handled well by the cheapest tier, which typically costs a fifth of the mid tier. Build a router, measure quality on a held-out set, and escalate only what genuinely fails. The 60/40 split in the worked example is conservative; many support workloads split 80/20.
Lever three: shrink what you retrieve
Retrieval systems that return ten documents when three would answer the question are paying seven documents’ worth of AI token cost on every request, forever. Tighten chunking, rerank aggressively, and cap the context you attach. Our guide to RAG versus fine-tuning versus long context covers the architectural trade-off, and a well-run cloud adoption programme should treat retrieval volume as a cost metric alongside latency.
AI Token Cost Mistakes That Blow the Budget
Most overruns are not exotic. They come from the same short list of estimation errors, and every one of them is avoidable before launch.
| Mistake | Typical impact | Fix |
|---|---|---|
| Estimating per message, not per conversation | Understates by 3–5× | Model the whole session including resent history |
| Ignoring reasoning tokens | Understates by 2–3× | Measure real output including thinking |
| Using an OpenAI tokeniser for Claude | Understates by 15–20% | Use the provider’s count_tokens endpoint |
| Forgetting tool definitions | Adds thousands of tokens per call | Count the request as the API receives it |
| Budgeting on an introductory rate | Step change when it expires | Forecast on list price, treat discounts as upside |
| Assuming caching works without checking | Pays 1.25× and saves nothing | Verify cache_read_input_tokens is non-zero |
| No per-feature attribution | Overrun invisible until month end | Tag every call with feature and tenant |
The agent multiplier deserves its own warning
Everything above assumes a request-response shape. Autonomous agents break that assumption: one user instruction can trigger dozens of model calls, each carrying the full conversation plus accumulated tool results. An agent AI token cost is frequently ten to fifty times a chatbot’s for the same user-visible action, and it is far less predictable because the model decides how many steps to take. Cap iterations, cap spend per task, and treat unbounded agent loops as the budget risk they are.
Pilot economics never survive contact with production
A pilot runs on short prompts, cooperative test users and a tiny knowledge base. Production runs on long histories, awkward questions and a knowledge base that has quadrupled. Scale your pilot AI token cost by measured production payload sizes, not by user count alone, or the forecast will be wrong in the one direction that hurts.
From Estimate to a Budget You Can Defend
An AI token cost calculator is only useful if its output survives a finance conversation. That means three things beyond the arithmetic.
Express it as unit economics, not a monthly total
“£3,300 a month” invites a haggle. “£0.05 per resolved support ticket, against £4.20 for a human-handled one” invites approval. Divide your monthly AI token cost by the unit your business already measures — tickets resolved, documents processed, leads qualified — and the conversation shifts from cost to margin. The same framing underpins any credible enterprise AI ROI calculation.
Forecast three scenarios, not one
Give expected, high and worst cases. Expected uses mean token counts at forecast volume. High uses the 90th-percentile token counts you measured earlier. Worst assumes list pricing with introductory discounts expired, no caching benefit realised, and volume 50% above plan. If the worst case is survivable, the feature ships.
Instrument before launch, not after
Tag every API call with feature, tenant and environment from the first commit. Log input tokens, output tokens, cache reads and cache writes per call. Without that, a doubled AI token cost is a mystery you investigate for a fortnight; with it, it is a dashboard filter. This attribution layer is the foundation of both AI cost governance and the broader FinOps for AI practice, and retrofitting it is far harder than building it in. Treat token telemetry as first-class data analytics, not as debug logging.
AI Token Cost Calculator FAQs
How much does it cost to run an AI chatbot per user?
It depends almost entirely on conversation length and context size, but the worked example above gives a defensible anchor: roughly $0.06 to $0.21 per five-turn conversation on a mid-tier model, depending on whether caching and routing are in place. Multiply by conversations per user per month. A user having ten conversations a month costs between $0.60 and $2.10 in AI token cost — a range wide enough that the architecture, not the vendor, decides your margin.
Is a bigger context window cheaper or more expensive?
More expensive in practice. A larger window does not change the per-token rate on most models, but it removes the constraint that was keeping your payloads small, and teams reliably fill the space available. Some models also charge a premium above a threshold — Gemini 3.1 Pro doubles its rate beyond 200,000 tokens. Treat context capacity as a budget you spend deliberately.
Can I just use a cheaper model to cut AI token cost?
Sometimes, but test it properly. The cheapest model that reliably completes the task is genuinely cheaper. A cheap model that fails 20% of the time and escalates to a premium model costs more than the premium model alone, once you count the wasted first attempt. Measure success rate on a held-out set before switching.
How accurate should I expect my estimate to be?
A carefully measured AI token cost estimate — real token counts from the counting endpoint, real output lengths including reasoning, honest volume forecasts — typically lands within 20% of actual for the first month. Estimates built on word-count rules of thumb are routinely out by a factor of two or more. The measurement work is a day; the difference is the budget.
Do prompt caching savings apply to every workload?
No. Caching pays when a substantial, byte-identical prefix repeats within the cache lifetime. Long system prompts, stable tool sets and multi-turn conversations benefit enormously. One-shot requests with entirely different content each time cache nothing and simply pay the write premium — for those, batching and model selection are the levers that move AI token cost instead.
References
More AI coverage: explore Progressive Robot's AI Models, Tools & Releases hub — hands-on reviews, setup guides and benchmarks in one place.