Skip to main content
BenchLM

How LLM Token Pricing Works: A Complete Guide to API Costs in 2026

Learn how LLM API pricing works — from tokens, input/output costs, and reasoning tokens to vision, embedding, and fine-tuning pricing. Includes real cost examples, free tiers, and 6 strategies to cut your AI spend.

In this article9 sections

An LLM API bill is the sum of billable token buckets, not one price multiplied by visible words. Start with this: monthly list-price cost = the cost of uncached input + cache writes + cache reads + output + any separate tool charges, across every billed attempt.

The price inputs and provider rules in this guide were checked on September 22, 2026. One material correction comes first. The previous version was wrong by a factor of ten on 10,000 embedding queries a day at 500 tokens each and $0.02 per million. For 30 days, the correct result is $3/month.

That correction is a useful warning. A tidy rate table cannot rescue the wrong units, a missing retry, or an output nobody can use.

What a token price actually covers

A token is the unit a model tokenizer produces from text or other supported input. The same sentence can produce different counts across tokenizers, languages, code, and formatting. Use the free LLM token counter for an estimate, then use the target provider's counting method for the request you will send. For a deeper definition, read what an AI token is and what one costs.

For cost work, keep four token buckets separate:

  • Uncached input: the prompt, system instructions, retrieved context, schemas, and conversation history billed at the ordinary input rate.
  • Cache writes and reads: eligible repeated prefixes billed under provider-specific write, read, lifetime, and scope rules.
  • Output: response tokens generated by the model. The input/output ratio belongs to the exact SKU and mode; there is no safe universal multiplier.
  • Reasoning: intermediate tokens that some endpoints count inside output usage even when the reasoning text is hidden.

Anthropic's current Sonnet 5 migration guide says thinking tokens are billed as output and share the configured completion budget. In the saved run later in this guide, one response used 254 reasoning tokens inside a 300-token budget and truncated its JSON. Visible output length would not have explained either the charge or the failure.

Reasoning and non-reasoning models still need task-specific testing. The reasoning model rankings and non-reasoning rankings can supply candidates; neither ranking substitutes for the usage receipt from your own workload.

40 confirmed releases in the last 30 daysFollow price changes with Radar

The base formula

For an all-uncached text request:

Cost per call = input tokens / 1,000,000 × input rate + output tokens / 1,000,000 × output rate

Then multiply by billed calls, not user-visible jobs. A document pipeline with three model calls per document has three call-level charges before retries. If a selected call is attempted again, the retry is another billable attempt unless the provider reports otherwise.

Use a fuller ledger when caching applies:

Cost = uncached input cost + cache-write cost + cache-read cost + output cost + separate tool charges

Do not charge cached tokens again as ordinary input. Do not assume an advertised cache-read price applies to a prompt that misses the minimum prefix, expires, changes an invalidating parameter, or crosses an account scope.

The corrected embedding calculation

OpenAI's text-embedding-3-small model page listed standard input at $0.02 per million tokens when checked on September 22. This hypothetical workload is:

10,000 queries/day × 500 tokens/query × 30 days = 150,000,000 tokens/month

150,000,000 / 1,000,000 × $0.02 = $3/month

That is hypothetical arithmetic, not a measured RAG bill. Generation, storage, retrieval, reranking, retries, and embedding a document corpus sit outside it. The example cannot establish whether embeddings are material in a different system.

Three synthetic workloads, calculated from dated rates

The table below uses three fixed workloads so the arithmetic is inspectable:

Table 1
Synthetic workload Monthly units Calls per unit Input per call Output per call
Retrieval/summarization 100,000 requests 1 8,000 800
Draft generation 10,000 drafts 1 1,000 4,000
Structured extraction 10,000 documents 3 1,500 150

Evidence: calculated from synthetic inputs. These are list-price calculations, not observed customer usage, model quality, latency, reliability, or invoices.

Rate inputs checked September 22: Anthropic's pricing page listed Haiku 4.5 at $1/$5 and Sonnet 5 at $2/$10 per million input/output tokens. OpenAI's API pricing listed GPT-5.6 Terra Standard short-context at $2/$12; the Terra model page applies a higher tier above 272K input tokens for the full request. DeepSeek's pricing page listed V4.1 Flash cache-miss peak at $0.30/$1.20 and off-peak at $0.15/$0.60. The two DeepSeek columns are scheduling cases, not separate models or an assumed monthly blend.

Table 2
Synthetic workload Haiku 4.5 Sonnet 5 Terra Standard DeepSeek peak DeepSeek off-peak
Retrieval/summarization $1,200 $2,400 $2,560 $336 $168
Draft generation $210 $420 $500 $51 $25.50
Structured extraction $67.50 $135 $144 $18.90 $9.45

Equal token counts make the price formula easy to inspect; they do not imply tokenizer or task equivalence. The table also cannot name a winner. A lower list-price total says nothing about acceptance, retries, latency, throughput, regional uplifts, negotiated rates, or tool calls. Use the live LLM pricing comparison table for current catalog rows rather than treating this dated scenario as a replacement rate table.

Retries change the denominator

A retry share must name what is retried. Here, a 10% or 25% sensitivity means that percentage of original calls is attempted exactly one extra time with the same token mix. It is a hypothetical sensitivity, not a measured failure rate and not an infinite retry loop.

For Sonnet 5 retrieval/summarization, the all-uncached calculation moves from $2,400 to $2,640 when 10% of calls get one extra attempt, and to $3,000 at 25%. Structured extraction moves from $135 to $148.50 and $168.75. The latter workload has three calls per document; retrying one selected call does not mean repeating all three.

Count transport failures in the attempted denominator for task acceptance. Count their price only when comparable provider usage or a charge was returned. If a receipt omits usage after a request may have reached a provider, cost per acceptable result is unavailable rather than zero.

Prompt caching is a four-line ledger

Anthropic's prompt-caching documentation gives Sonnet 5 a 1,024-token minimum cacheable prompt, a five-minute default lifetime, and provider-specific rules for when a write becomes available and what refreshes or invalidates it.

This bounded synthetic case has 100,000 Sonnet 5 retrieval calls in 10,000 groups of ten. Each group shares a 4,000-token prefix. The first call writes it; the next nine read it within the assumed lifetime. Every call also carries a separate 4,000-token uncached suffix and produces 800 output tokens.

Table 3
Billable bucket Tokens Rate per million Calculated cost
Five-minute cache writes 40M $2.50 $100
Cache reads 360M $0.20 $72
Uncached suffix 400M $2.00 $800
Output 80M $10.00 $800
Total 800M input + 80M output $1,772

The same fixed tokens cost $2,400 when all input is uncached, a $628 scenario difference. It is not realized savings. The result assumes an eligible unchanged prefix, correct scope, a successful write, reads after availability, and timing inside the five-minute lifetime. Miss one of those conditions and the calculation no longer applies.

Batch is another processing mode, not a blanket instruction. Anthropic documents a 50% batch discount on input and output, but that source does not prove identical delivery time or quality for your workload. Price the exact provider, SKU, eligibility rules, and latency boundary before moving a synchronous task.

Cost per acceptable result

Token price becomes decision-useful when the denominator is an output the application can accept:

Cost per acceptable result = calculated list-price cost for attempts with comparable captured usage / accepted results

On September 14, 2026, the support-extraction fixture sent 30 authored synthetic tickets to anthropic/claude-sonnet-5 and openai/gpt-5.6-terra through OpenRouter. Each configuration ran three repetitions at temperature 0 with max_tokens: 300, strict JSON schema, interleaved ordering, and one attempt per cell with no retries. This is observed in our run for API attempts and returned usage; list cost is calculated from receipts, not an invoice.

Acceptance meant a completed response passed the strict schema and all four fields — ticket_id, category, urgency, and requested_action — matched the reviewed answer. Only whitespace runs in requested_action were normalized. The custom-benchmark method and structured-output test guide publish the fixture, checks, and downloadable evidence kit.

The list-price numerator is available only when every relevant provider attempt has complete, comparable token usage. A failed attempt with reported usage belongs in the sum. The saved pre-model gateway blocks have no provider usage. A partial or missing usage series makes the calculated list cost unavailable, and a gateway-reported charge remains a separate field rather than a silent substitute.

Table 4
Observed in our run · support-extraction-v1-20260914113427 · 2026-09-14 · anthropic/claude-sonnet-5 (A) vs openai/gpt-5.6-terra (B) via openrouter.ai · Completed 174 of 180 attempted · 6 transport failures reported separately
Count anthropic/claude-sonnet-5 (A) openai/gpt-5.6-terra (B)
Attempted cells 90 90
Completed responses 87 87
Transport failures (reported separately) 3 3
Schema pass, over completed 86/87 (98.9%) 87/87 (100%)
Task acceptance, over attempted 84/90 (93.3%) 77/90 (85.6%)
Schema valid but wrong 2 10
Task failures by field urgency 2 category 4 · urgency 3 · requested_action 3
Latency p50 / p95 1,433 / 1,628 ms 959 / 1,273 ms
Prompt tokens (cached) 68,055 (0) 26,373 (0)
Calculated list cost, completed calls $0.2013 $0.0918
Cost per acceptable result $0.0024 $0.00119

Schema pass is counted over completed responses; task acceptance over attempted cells. Transport failures can never pass either check. Retry policy: none: one attempt per cell; transport failures recorded as attempted, not completed. Cost is calculated list price (reported usage × the rates recorded in the run's readout), not an invoice.

Each configuration attempted 90 cells and completed 87. The gateway blocked the same prompt-injection-shaped synthetic ticket three times per configuration before either model ran; those six cells have no provider usage in the saved receipts, remain attempted failures, and cannot pass. Sonnet accepted 84/90; Terra accepted 77/90. Calculated list cost was $0.2013 and $0.0918, or $0.0024 and $0.00119 per accepted result.

That is a compact denominator example, not a general model comparison. The fixture is synthetic, the route is OpenRouter, and the result says nothing about production support tickets. If accepted outputs are zero, or comparable usage is missing, cost per acceptable result is unavailable. A missing field must never turn into a $0 result.

Multimodal, fine-tuning, and free-tier scope

Images add provider- and model-specific accounting. Anthropic's vision guide currently counts image input as visual patches, applies resizing and resolution limits, then prices the resulting tokens at the selected model's input rate. Other providers use their own tokenization and media rates. Count the actual image through the target endpoint; a fixed tokens-per-image rule is not portable.

Fine-tuning has a separate training ledger and may use different inference rates. This guide does not freeze a cross-provider fine-tuning table because model availability, training modes, and rates change independently of base inference. Recheck the provider's current training and inference terms for the exact SKU.

Free credits and rate limits move even faster. Use the dated LLM API free-tier guide rather than copying an allowance into a long-lived cost model. A free tier is a prototyping constraint, not a production price assumption.

Six ways to reduce LLM API costs without inventing a savings rate

1. Measure the whole request

Log uncached input, cache writes, cache reads, output, reasoning usage, finish reason, retries, tool charges, and acceptance. A token total without its endpoint, tier, and processing mode is not reproducible.

2. Remove input the task does not use

Trim duplicate instructions, irrelevant retrieved chunks, stale conversation history, and formatting that adds tokens without changing the decision. Re-run the acceptance checks after each change; fewer tokens are only useful if the output still passes.

3. Bound output deliberately

Use a schema or explicit output contract, and set a completion limit that fits both reasoning and the visible response. Too high can waste output. Too low can truncate an otherwise valid result, as the saved 300-token run demonstrates.

4. Earn cache and batch discounts

Confirm prefix minimums, write/read prices, lifetime, scope, invalidation, request order, and observed hits before claiming cache savings. Use batch only when its eligibility and delivery window fit the job. Model each discounted bucket separately.

5. Route after acceptance testing

A router can send different tasks to different models, but the routing rule needs evidence from a fixed workload. Compare accepted results, retries, latency, and total cost. The best budget LLMs guide can shortlist candidates; it cannot supply your production denominator.

6. Price self-hosting as a system

Open-weight models such as Llama 4 Maverick, Qwen3.5 397B, and DeepSeek V3 still require hardware, utilization, energy, operations, observability, and scaling headroom. Use the Self-Hosting vs API Calculator to frame the break-even case. Do not use a generic request threshold.

What to record before choosing a model

For one fixed workload, keep these fields together:

  1. Exact model ID, endpoint, route, region, tier, and processing mode.
  2. Input, cache-write, cache-read, output, reasoning, and tool usage.
  3. Attempted calls, completed responses, failed attempts, transport failures, and retries.
  4. The acceptance rule and accepted-result count.
  5. Calculated list price, gateway-reported charge, and invoice amount as separate evidence classes.
  6. Retrieval date for every rate and rule.

That record turns a rate-card comparison into an operating decision. Track current price changes in LLM pricing updates and historical trends, count your tokens, and estimate your costs. Re-run the same workload before switching. Price movement alone does not prove a lower cost per useful output.

Frequently asked questions

01How much does it cost to use an LLM API?

List price is only the first input. Monthly cost depends on uncached input, cache writes and reads, output, reasoning tokens, retries, and accepted results. Measure those buckets on your workload, then apply the exact model, endpoint, tier, and processing-mode rates shown in the provider's current documentation.

02Why are output tokens more expensive than input tokens?

Providers price input and output as separate billing categories, and the ratio depends on the exact SKU and processing mode. The public rate card is the controlling source. Use the current rates for the endpoint you call instead of assuming output always costs two to five times more, or that one model's ratio transfers to another.

03What are reasoning tokens and how do they affect cost?

Reasoning tokens are intermediate tokens generated by some models. A provider may bill them as output even when the reasoning text is not returned. They also consume the configured completion budget on some endpoints. Record reported reasoning usage and finish reasons; visible response length alone can materially underestimate cost or explain truncation.

04How can I reduce my LLM API costs?

Start with measured usage, not a generic savings percentage. Remove input the task does not need, cap outputs carefully, avoid unnecessary retries, use eligible cache and batch modes, and route only after testing accepted results. Compare cost per acceptable result on a fixed workload before changing models or architecture.

05What is prompt caching and how much does it save?

Prompt caching prices repeated eligible prefixes differently from uncached input. Savings depend on prefix length, write cost, read price, lifetime, scope, invalidating changes, request order, and actual hit rate. Model the write, read, uncached suffix, and output as separate buckets; do not apply a headline discount to the whole request.

06How do I estimate the cost of an LLM-powered feature?

Estimate each bucket separately: tokens divided by one million, multiplied by its rate and billed calls. Add cache writes, reads, uncached input, output, retries, and tool fees. Track reasoning separately when reported, but do not add it again when the provider already includes it in output. Divide comparable attempted-call cost by accepted results when quality matters.

07How many tokens are in 1,000 words?

There is no model-independent conversion for 1,000 words. Token counts change with the tokenizer, language, code, punctuation, and formatting. Run the exact text through the target model's token-counting method or BenchLM's token counter, and treat any word-to-token ratio as a rough planning estimate rather than an invoice input.

08What is the cheapest LLM API in 2026?

There is no durable cheapest LLM API for every workload. Prices change by model, region, context tier, cache state, batch or priority mode, and time window. A low token rate can also lose its advantage after retries or rejected outputs. Use the live pricing table, then test cost per acceptable result.

09Is it cheaper to self-host an LLM or use an API?

Request volume alone does not decide this. Compare API charges with hardware, utilization, energy, operations, observability, scaling headroom, and engineering time for the exact model. BenchLM's self-hosting calculator can frame the break-even case, but the decision still needs your measured traffic and service-level requirements.

10How much does it cost to process images with an LLM?

Image cost depends on the provider's visual-token rules, resizing, resolution tier, selected model, and output. Anthropic currently calculates visual tokens from image patches and applies the model's input rate after resizing rules. Count the actual image through the target endpoint; do not reuse one fixed tokens-per-image estimate across providers.

Reader questions

External sources linked in this article

8
  1. 01Sonnet 5 migration guide
  2. 02text-embedding-3-small model page
  3. 03pricing page
  4. 04API pricing
  5. 05Terra model page
  6. 06pricing page
  7. 07prompt-caching documentation
  8. 08vision guide
8 external sources

Share or save

Share on XShare on LinkedIn
Keep readingAll research