How to estimate LLM API cost: tokens, prompt caching, batch pricing and cost per task
A step-by-step guide to working out what an AI task will cost, with the vendors' current multipliers, a worked agent example and a method for comparing models by cost per finished task.
· 7 min read
Written by AI from the sources linked below. How we use AI
On this page
- In short
- Why this matters now
- Step 1: what a token is and how a bill is built
- Step 2: prompt caching, the largest lever for repeated context
- Step 3: a worked example
- Step 4: batch and flexible processing for work that can wait
- Step 5: premium modes cost more
- Step 6: compare cost per task, not per token
- Common mistakes
- Quick checklist
- Sources
In short
An LLM API bill is the sum of four things: input tokens, output tokens, cached input tokens, and any premium mode you switch on. To estimate a job, count how many of each your task sends and receives, multiply by the model's price per million tokens, and add up the steps. The biggest levers are prompt caching for repeated context (a cache hit costs 5% to 10% of the normal input price on Anthropic's current models), the Batch API for work that can wait (half price on both vendors), and choosing the cheapest model that passes your own test. Compare cost per finished task, not price per token.
Why this matters now
Prices have moved a lot this year. We tracked the cuts since June: OpenAI lists GPT-6.1 Sol at US$2 per million input tokens and US$10 per million output tokens, and Anthropic lists Claude Sonnet 5.5 at the same US$2 and US$10. When two vendors price a tier identically, the headline price no longer separates them, and the way you use the model decides your bill. This guide shows how to work that bill out. Prices below were read from the vendors' pages on 26 October 2026; check the pages before you budget, because they change.
Step 1: what a token is and how a bill is built
A token is a chunk of text, often a short word or part of one, that the model reads or writes. APIs bill separately for the tokens you send (input) and the tokens the model returns (output), quoted per million tokens (MTok). Output costs more than input on the text models in this guide: for Sonnet 5.5 it is US$10 against US$2, a factor of five, and the same ratio holds for GPT-6.1 Sol.
Two things make real bills differ from a simple count:
- Context is re-sent. A chat or an agent sends the whole conversation, tools and instructions again on every call. A 100,000-token context used over 40 steps is 4 million input tokens, not 100,000.
- Output is the pricey part. Everything the model writes is billed at the output rate. How much a model writes varies by model, which is why per-task cost can differ from what the price lists suggest (more on that below).
Step 2: prompt caching, the largest lever for repeated context
If many requests start with the same text, the provider can reuse the work it already did on that prefix. OpenAI's documentation says caching "reuses work when requests share the same prompt prefix", is on by default for supported models, and discounts cached input by up to 95%. It also says the entire rendered prefix must match: a change before the cached part means the later part cannot match.
Anthropic publishes the multipliers. Relative to the base input price, a five-minute cache write costs 1.25 times, a one-hour write costs 2 times, and a read (a hit) costs 0.1 times, or 0.05 times on Claude Opus 5.5 and Sonnet 5.5, and 0.025 times on Claude Fable 5.1. That is how the listed cache-read prices come out: US$0.10 per million for Sonnet 5.5 (5% of US$2) and US$0.20 for Opus 5.5 (5% of US$4). OpenAI's pricing page lists GPT-6.1 Sol at US$0.10 cached input and US$2.50 for a 30-minute cache write, also 1.25 times the base input price.
Practical rules, from the vendors' documentation and our explainer on how prompt caching works:
- Put stable content first (system prompt, tool definitions, reference documents) and changing content last.
- Do not edit earlier parts of a conversation; changing anything before the cached part breaks the match.
- Watch the cache window: Anthropic's cache writes are valid for five minutes or one hour, and OpenAI lists 30-minute and 12-hour write options on its pricing page.
- Monitor your hit rate. OpenAI offers a dashboard and a cache-diagnostics tool for this.
Cloudflare reported cutting its AI code-review cost 68% mostly by fixing prompt caching, a real-world example of the same lever.
Step 3: a worked example
The numbers below are an illustration with assumptions we chose, not a measurement. Suppose an agent task has 40 steps. It starts with a 100,000-token context (instructions, tools, files). Each step adds 2,000 new input tokens and the model writes 1,000 tokens. We price it at Sonnet 5.5 or GPT-6.1 Sol rates, which both list US$2 input, US$10 output and US$0.10 cached read, with a cache write at US$2.50.
Without caching: every step sends about 102,000 input tokens, so 40 steps send about 4.08 million input tokens. At US$2 per million that is US$8.16. Output is 40,000 tokens at US$10 per million, or US$0.40. Total about US$8.56.
With caching: the first step writes the 100,000-token prefix to the cache at US$2.50 per million: US$0.25. The other 39 steps read it at US$0.10 per million: 3.9 million tokens, US$0.39. The new 2,000 tokens per step, 80,000 in all, are billed at the normal US$2 rate: US$0.16. Output is still US$0.40. Total about US$1.20.
| US$ | |
|---|---|
| No caching | 8.56 |
| With caching | 1.20 |
Source: audiotale.net calculation from OpenAI and Anthropic list prices (26 Oct 2026); assumptions in text
That is about 86% less, and the cached task is dominated by output (US$0.40) and the cache write. This simplified example ignores details such as caching the new tokens as they accumulate, so a real bill will differ. The point is the shape: with a large reused context, caching moves the bill from input to output.
Step 4: batch and flexible processing for work that can wait
If a job does not need an answer right away, such as scoring a dataset, summarising an archive or running evaluations, the vendors sell a cheaper path. Anthropic says its Batch API gives a 50 percent discount on both input and output tokens, so Sonnet 5.5 costs US$1 and US$5 per million in batch. OpenAI's pricing page shows the same halving for its batch rates (GPT-6.1 Sol at US$1 and US$5), and its Flex processing, in beta with limited model availability, prices tokens at Batch rates in exchange for slower responses and occasional resource unavailability. Anthropic states that the cache multipliers stack with the batch discount.
The trade is time: batch work completes asynchronously, so it suits offline jobs, not a chat window.
Step 5: premium modes cost more
Speed has a price. Anthropic lists fast mode for Opus 5.5 at US$8 input and US$40 output per million tokens, twice the standard US$4 and US$20. OpenAI's page lists a Fast tier at twice the standard rate (GPT-6.1 Sol at US$4 and US$20) and an Ultrafast tier at six times (US$12 and US$60). Data residency costs extra too: Anthropic applies a 1.1 times multiplier for US-only inference, and OpenAI adds a 10% uplift for regional processing endpoints on models released since 5 March 2026. Turn these on only where latency or location truly requires them.
One more detail: pricing can depend on prompt length. Anthropic lists Haiku 5.5 at US$0.10 input and US$0.50 output for prompts up to 100,000 tokens, and US$0.50 and US$2.50 above that. Check for such tiers before assuming a flat rate.
Step 6: compare cost per task, not per token
A cheaper token does not always make a cheaper task. An Artificial Analysis comparison, as reported by implicator.ai, put GPT-6 Sol at maximum effort at US$1.06 per task and Claude Opus 5.5 at default settings at US$1.34 per task, even though Sol's per-token prices (US$2 and US$10) are half of Opus 5.5's (US$4 and US$20). Sol's per-task cost was therefore about 79% of Opus's, not 50%. Our reading is that the cheaper-per-token model produced more tokens or needed more steps for each task, but the report does not say so; it is an inference. The lesson stands either way: measure on your own tasks.
A simple method:
- Pick 20 to 50 real tasks that represent your workload.
- Run each candidate model on them, with your real prompts and caching on.
- Record total tokens by type (input, cached, output) and whether the result passed your check.
- Compute cost per task and cost per passing task. A model that is cheaper but passes less often can lose.
- Re-run when prices or models change; the table has moved every few weeks since June.
Common mistakes
- Counting only the new message. The whole context is billed on every call unless it is cached.
- Breaking the cache by accident. A timestamp or changing ID at the top of a prompt means no prefix ever matches.
- Using the biggest model for everything. Anthropic positions Haiku 5.5 for classification, extraction and routing; a small model on easy calls frees budget for the hard ones.
- Ignoring long-context tiers and premium modes that quietly multiply the rate.
- Trusting list prices from a blog. Read the vendor's pricing page on the day you decide.
Quick checklist
- Do I know my input, cached and output tokens per task?
- Is my stable prefix first and unchanged between calls?
- Can any of this run in batch?
- Did I measure cost per passing task on at least two models?
- Have I read both vendors' current pricing pages this week?
Sources
- Anthropic, Claude pricing documentation: model prices, caching multipliers, Batch API, fast mode and data residency multipliers.
- OpenAI, API pricing: model prices, cached input, batch, Fast and Ultrafast tiers, regional uplift.
- OpenAI, Prompt caching guide and Flex processing guide.
- implicator.ai, OpenAI's GPT-6 Sol at half price: the Artificial Analysis per-task costs.
- audiotale.net: how LLM API prices fell since June, how prompt caching works.
Written by
The official account of the people who run audiotale.net: announcements, conversation starters and the newsroom's drafts. Posts written with AI say so. Every other account here is a real person.
Read next
GPT-6.1 Sol $2/$10 and Opus 5.5 $4/$20: how LLM API prices fell since June
OpenAI's and Anthropic's own price pages now list frontier models at a fraction of June's prices; we check today's rates and lay out the cuts that got them there.
audiotale.net team7 min read
AGENTS.md in ~/Downloads can hijack Codex and Claude Code, Forever Security finds
Forever Security says a web page can plant an instructions file in Downloads that Codex and Claude Code obey if started there; no CVE, and no patch is planned.
audiotale.net team7 min read
Anthropic donates Agent Skills (SKILL.md) to the Agentic AI Foundation
The open skills format used by 70+ agent platforms now sits under the Linux Foundation's AAIF; what changes today, what is only promised, and what we couldn't verify.
audiotale.net team7 min read