Glossary term
Cost-Per-Token Economics in AI Applications
Understanding LLM unit economics
The transition from traditional software-as-a-service (SaaS) to generative AI introduces a fundamental shift in how compute resources are consumed and billed. In classical cloud applications, costs scale predictably with server instances, database queries, and storage capacity. In the era of Large Language Models (LLMs), compute is metered at the most granular level: the token.
Cost-per-token economics refers to the framework for measuring, modeling, and forecasting the financial expenditure required to process textual (or multimodal) data through an AI model. A token is roughly equivalent to three-quarters of an English word, though the exact mapping varies depending on the tokenizer used (OpenAI's tiktoken, Meta's Llama tokenizer, and others each split words differently).
Every API call to an LLM provider incurs a direct, variable cost tied to the number of tokens processed and generated, so unit economics determine whether an AI application stays profitable. A viral feature can flip from profitable to loss-making within weeks if nobody modeled the tail-end cost of complex edge cases: queries that pull in long context or run several rounds of reasoning before returning an answer.
Input vs. output token pricing asymmetry (prefill vs autoregressive decode compute)
A central fact of cost-per-token economics is the price asymmetry between input (prompt) tokens and output (completion) tokens. Across almost all commercial LLM providers, output tokens are priced substantially higher, typically 3 to 6 times more, than input tokens: as of August 2026, the ratio is 6x for OpenAI's GPT-5.6 tiers, 5x across Anthropic's Claude lineup and Google's Gemini Flash models, and 3x for DeepSeek.
This pricing structure reflects the underlying hardware utilization and compute intensity required during inference. When a prompt is submitted to an LLM, the model processes the entire sequence in parallel to generate the initial Key-Value (KV) cache; this prefill phase is highly parallelizable and cheap to compute on modern GPUs, so API providers can offer low rates for ingesting large amounts of context, which makes techniques like retrieval-augmented generation economically viable even with thousands of tokens of retrieved documents. Generating the response is a different process: the model predicts the next token, appends it to the context, and repeats the sequence one token at a time. This decode phase is memory-bandwidth bound and cannot be parallelized the way prefill can, and the extra compute time per output token is what justifies the premium pricing on outputs.
This asymmetry dictates architectural choices. A system that summarizes 10,000 words into a 100-word abstract costs far less to run than one that expands a 100-word prompt into a 10,000-word report, even when the total token count is identical.
Current price landscape (August 2026 snapshot)
The table below shows per-million-token list prices checked directly against each provider's official pricing page on August 21, 2026: OpenAI's API pricing page, Anthropic's Claude pricing docs, Google's Gemini API pricing page, and DeepSeek's pricing docs. Prices change often (Anthropic, for example, made Claude Sonnet 5's introductory $2/$10 rate permanent in 2026 rather than raising it as originally scheduled), so treat this as a snapshot and re-check against those pages before budgeting.
| Model | Input $/M | Cached input $/M | Output $/M | Notes |
|---|---|---|---|---|
| GPT-5.6 Sol (OpenAI) | $5.00 | $0.50 | $30.00 | Flagship tier |
| GPT-5.6 Terra (OpenAI) | $2.00 | $0.20 | $12.00 | Mid tier |
| GPT-5.6 Luna (OpenAI) | $0.20 | $0.02 | $1.20 | Small tier |
| Claude Fable 5 (Anthropic) | $10.00 | $1.00 | $50.00 | Frontier tier |
| Claude Opus 5 (Anthropic) | $5.00 | $0.50 | $25.00 | Fast mode doubles both rates |
| Claude Sonnet 5 (Anthropic) | $2.00 | $0.20 | $10.00 | 1M context at standard rates |
| Claude Haiku 4.5 (Anthropic) | $1.00 | $0.10 | $5.00 | |
| Gemini 3.7 Flash (Google) | $0.75 | $0.075 | $3.75 | Promotional rate through Dec 31, 2026; rises to $1.50/$0.15/$7.50 on Jan 1, 2027 |
| Gemini 3.5 Flash-Lite | $0.30 | $0.03 | $2.50 | |
| DeepSeek v4-pro | $1.32 | $0.044 | $3.96 | Peak rate; off-peak (most UTC hours) is half this |
| DeepSeek v4-flash | $0.44 | $0.014 | $1.32 | Peak rate; off-peak is half this |
Three structural patterns matter more than any single number:
- Cache reads are roughly 90% off. All four providers now price cached input at about one-tenth of the base input rate, which makes prompt caching the single highest-leverage optimization for agents and chatbots that resend large system prompts and histories.
- Batch is 50% off everywhere. OpenAI, Anthropic, and Google all discount asynchronous batch processing by half; DeepSeek achieves a similar effect with off-peak pricing that halves rates for most of the day.
- Per-token prices are not comparable across providers without tokenizer math. Tokenizers differ, and they change: Anthropic documents that the tokenizer introduced with Claude 4.7 and later produces roughly 30% more tokens for the same text than its predecessor. A model that looks 20% cheaper per token can cost more per document.
Modifiers stack on top of list prices. Anthropic charges a 1.25x multiplier to write a 5-minute cache entry (2x for 1-hour entries), a 1.1x multiplier for US-pinned inference, and premium fast-mode rates ($10/$50 for Claude Opus 5). Reasoning tokens on reasoning-capable models bill as output even though the user never sees them, which can multiply the effective output cost of a request several times over.
Cost optimization levers matrix
To build financially viable AI applications at scale, engineering teams pull on several architectural and operational levers to reduce token spend. Below is a matrix of the primary cost optimization strategies:
| Strategy | Description | Cost Reduction Potential | Implementation Complexity | Best Used For |
|---|---|---|---|---|
| Prompt caching | Storing the KV cache of frequently used system prompts, large documents, or tool definitions so the prefill phase doesn't need to be recomputed on every request. | High (up to 90% on input costs for repetitive prompts) | Low to medium (supported natively by many API providers) | Long system instructions, static RAG documents, codebases. |
| Model cascading | Routing simple queries to cheaper, smaller models (GPT-5.6 Luna, Claude Haiku 4.5) and reserving large, expensive models (GPT-5.6 Sol, Claude Opus 5) only for complex reasoning tasks. | Very high (can reduce average cost by 10x to 50x) | High (requires an intelligent routing layer and evaluation framework) | High-volume consumer applications, multi-step agentic workflows. |
| Batch APIs | Submitting asynchronous, non-real-time requests in bulk for processing during off-peak hours at a steep discount. | Medium (typically 50% discount) | Low (requires handling async callbacks) | Data extraction, offline summarization, synthetic data generation. |
| SLM distillation | Fine-tuning a small language model (SLM) on the outputs of a large proprietary model to reach similar performance on a narrow task at a fraction of the inference cost. | Extreme (can reduce costs by 99% versus a frontier model) | Very high (requires ML engineering, dataset curation, and hosting) | High-volume, narrow-scope tasks (classification, extraction). |
| Semantic caching | Caching the final text response of an LLM and serving it for semantically similar future queries, bypassing the LLM entirely. | High (100% savings on cache hits) | Medium (requires a vector database and similarity thresholding) | FAQs, common customer support queries, repetitive user behaviors. |
Budget modeling: formulas for forecasting monthly TCO at scale
Predicting the total cost of ownership (TCO) for an LLM feature means moving beyond simple "price per 1k tokens" math and building a probabilistic model. To forecast monthly spend, teams estimate the average session length, how much the context window grows over a session, and how often users engage.
A basic formula for modeling the daily cost of a stateless feature (where context doesn't grow) is:
Daily Cost = DAU * Avg Requests/User * [(Avg Input Tokens * Input Rate) + (Avg Output Tokens * Output Rate)]
Most AI applications, chatbots and multi-step agents among them, are stateful instead. The context window grows with every turn of the conversation, so the input token count increases linearly or exponentially. For a conversational session with N turns, the input cost calculation has to account for the buildup of previous messages.
The stateful session cost formula
Define three variables: I0 is the system prompt size, Iu is the average user message size, and Oa is the average assistant response size.
For turn k (where k ranges from 1 to N), input and output tokens work out to:
InputTokens(k) = I0 + (k - 1) * (Iu + Oa) + Iu
OutputTokens(k) = Oa
The total cost of a session sums the per-turn costs across all N turns:
Session Cost = sum over k=1..N of [ (InputTokens(k) * Input Rate) + (OutputTokens(k) * Output Rate) ]
Worked example with prices verified against Anthropic's pricing docs on August 21, 2026
Take a support chatbot on Claude Sonnet 5 ($2 input / $10 output per million tokens) with a 2,000-token system prompt (I0), 100-token user messages (Iu), 400-token responses (Oa), and 8 turns per session (N). Summing the formula above, the session processes 30,800 input tokens and 3,200 output tokens: 30,800 x $2 / 1,000,000 = $0.0616 of input, plus 3,200 x $10 / 1,000,000 = $0.032 of output, for $0.0936, or roughly 9.4 cents per session.
Prompt caching changes the math. If each turn writes its new tokens to a 5-minute cache (1.25x input rate) and reads the accumulated history from cache (0.1x input rate), only 5,600 tokens are ever written and 25,200 are read as cache hits: (5,600 x $2 x 1.25 / 1,000,000) + (25,200 x $2 x 0.1 / 1,000,000) = $0.014 + $0.00504 = $0.019 of input. Output cost is unchanged at $0.032, so the session total falls from $0.0936 to $0.0510, a 45% saving with no product change. At 100,000 sessions per day, that is the difference between $9,360 and $5,100 in daily spend.
Applying this formula to projected monthly active users (MAU) and session frequencies lets finance and product teams set baseline budgets, set rate limits, and decide whether a feature should be monetized through subscription, usage-based billing, or absorbed as a customer acquisition cost. Note that the output side of the formula understates costs for reasoning models: hidden reasoning tokens bill at the output rate, so Oa should be measured from real API usage data (which reports them) rather than from visible response length.
Production cost governance: tracking spend per session, user, and feature
Once an application is in production, theoretical budget models give way to telemetry and governance. Without granular observability, organizations risk "bill shock" at the end of the month, unable to tell which feature or user drove the spike in compute spend.
Effective cost governance means tagging every LLM API request with metadata, typically through HTTP headers or provider-specific tagging mechanisms, to pass along:
user_idortenant_idsession_idortrace_idfeature_name(for example, 'document-summary', 'inline-autocomplete')environment(for example, 'production', 'staging')
Piping this telemetry into an AI observability platform, such as Klu, or an internal data warehouse lets engineering teams build dashboards that answer questions like these:
- Which feature has the highest cost per MAU?
- Are abusive users circumventing rate limits and driving up spend?
- Did the recent prompt engineering update increase or decrease average output length?
Hard and soft limits at the tenant level keep a single runaway script or malicious user from exhausting the organization's API credits. Cost governance is an ongoing process of monitoring, analyzing, and optimizing an application's unit economics as models and pricing change.
Frequently Asked Questions
Why are output tokens so much more expensive than input tokens? Output token generation is an autoregressive process, meaning the model must generate one token at a time, sequentially. This makes the decode phase highly memory-bandwidth bound and computationally inefficient compared to the highly parallelizable prefill phase used for processing input tokens.
How does prompt caching affect cost-per-token models? Prompt caching allows API providers to store the computed Key-Value (KV) cache of a large prompt and reuse it for subsequent requests. When a cache hit occurs, the provider avoids the expensive prefill computation. As of August 2026, OpenAI, Anthropic, Google, and DeepSeek all price cache reads at roughly 10% of the standard input rate, a 90% discount on the cached portion of the prompt. Anthropic additionally charges a premium to write cache entries (1.25x input rate for 5-minute entries), so caching pays off after a single hit.
When should we consider training a Small Language Model (SLM) instead of using a commercial LLM API? SLMs become economically viable for a narrow, well-defined task, such as named entity recognition or sentiment analysis, run at very high volumes (millions of requests per day). The upfront cost of data curation and model distillation is amortized by inference costs that can run pennies per million tokens, versus dollars for a frontier proprietary model.
Which provider has the cheapest tokens? On list price alone, DeepSeek v4-flash and GPT-5.6 Luna are the cheapest mainstream options as of August 2026 (under $0.50 per million input tokens). But per-token comparisons mislead in two ways: tokenizers differ (Anthropic's current tokenizer emits roughly 30% more tokens for the same text than its predecessor, so identical documents cost different token counts on different providers), and reasoning models emit billable hidden tokens that vary by model and task. Compare providers on cost per completed task, measured on your own traffic, not on cost per token.
How do we prevent malicious users from driving up our LLM API costs?
Solid cost governance involves several layers: strict rate limiting per user or IP, maximum token limits on generation (max_tokens), analysis of queries for prompt injection attacks that attempt to bypass application constraints, and semantic caching to cheaply serve responses to repetitive spam queries.
More terms
Continue exploring the glossary.
Glossary term
Classification
It's time to build
Collaborate with your team on reliable Generative AI features.
Want expert guidance? Book a 1:1 onboarding session from your dashboard.