LLM APIs charge per token, with separate prices for input tokens (everything you send: system prompt, chat history, documents) and output tokens (everything the model writes), quoted in US dollars per million tokens. A request's cost is input tokens × input price plus output tokens × output price, and discounts for cached input and batch jobs, or surcharges for very long prompts, change those rates.
All prices below were checked on the providers' official pricing pages on October 26, 2026. They change often; check the page before budgeting.
The basic formula
cost = (input_tokens / 1,000,000) × input_price
+ (output_tokens / 1,000,000) × output_price
A token is a chunk of text, often a word or part of one; how many tokens is a word has real counts. To size a prompt before sending it, paste it into the token counter. After a request, the response's usage field reports the exact numbers you were billed for.
What the major APIs charge (as of October 26, 2026)
| Model | Input | Cached input | Output | Notes |
|---|---|---|---|---|
| Claude Opus 5.5 | $4.00 | $0.20 | $20.00 | Cache writes extra (below) |
| Claude Sonnet 5.5 | $2.00 | $0.10 | $10.00 | |
| Claude Haiku 5.5 | $0.10 | $0.01 | $0.50 | Prompts up to 100,000 tokens; $0.50 / $2.50 above |
| OpenAI gpt-6.1-sol | $2.00 | $0.10 | $10.00 | Up to 272K input tokens; $4.00 / $15.00 above |
| OpenAI gpt-6-luna | $0.10 | $0.01 | $0.50 | Up to 272K input tokens |
| Gemini 2.5 Pro | $1.25 | $0.125 | $10.00 | Prompts up to 200K tokens; $2.50 / $15.00 above |
| Gemini 2.5 Flash | $0.30 | $0.03 | $2.50 | Text, image and video input; audio costs more |
Prices are USD per million tokens, standard (non-batch) tier. The table is a sample; each page lists more models. The spread is the point: the cheapest models here cost a fortieth of the most expensive per input token, so model choice is usually the biggest lever on cost.
Worked example: one request
A support assistant on Claude Sonnet 5.5 sends a 10,000-token prompt (instructions, a few documents, the question) and gets a 1,000-token answer:
input: 10,000 / 1,000,000 × $2.00 = $0.020
output: 1,000 / 1,000,000 × $10.00 = $0.010
total = $0.030
At 1,000 such requests a day, that is $30 a day, about $900 over 30 days. The same traffic on Claude Haiku 5.5 would cost $0.0015 per request ($0.001 + $0.0005), or $45 over 30 days, if the smaller model's answers are good enough.
Why chat conversations get expensive
The API is stateless: every turn resends the whole conversation as input. A chat where each user message and reply adds about 500 tokens grows like this:
| Turn | Input tokens sent | Input cost on Sonnet 5.5 |
|---|---|---|
| 1 | 2,000 (system prompt + question) | $0.004 |
| 10 | 6,500 | $0.013 |
| 50 | 26,500 | $0.053 |
By turn 50 each message costs over 13 times as much input as the first. This is where trimming or summarising history pays off; how to reduce AI token usage covers the options, and what is a context window explains the hard ceiling on how much you can send.
Prompt caching: cheaper repeated input
If many requests start with the same long prefix (a system prompt, a manual, tool definitions), providers can cache it and charge much less to reuse it. Anthropic's pricing, as an example, works with multipliers on the base input price:
- 5-minute cache write: 1.25× base input. 1-hour cache write: 2×.
- Cache read: 0.1× base input on most models; 0.05× on Claude Opus 5.5 and Sonnet 5.5.
Take the support assistant again, with an 8,000-token fixed prefix and 2,000 new tokens per question on Sonnet 5.5:
first request (writes the cache):
8,000 × $2.50/M = $0.0200 (cache write, 1.25×)
2,000 × $2.00/M = $0.0040
1,000 × $10.00/M = $0.0100 (output)
total = $0.0340
later requests within the cache lifetime:
8,000 × $0.10/M = $0.0008 (cache read, 0.05×)
2,000 × $2.00/M = $0.0040
1,000 × $10.00/M = $0.0100
total = $0.0148
Every cached request costs about half as much as the uncached $0.030, and the saving grows with the size of the shared prefix. Anthropic notes a 5-minute write pays for itself after a single cache read. OpenAI and Google list cached-input prices too (the "Cached input" column above); Google also bills context-cache storage per hour for some models.
Batch processing: half price for work that can wait
All three providers offer asynchronous batch processing at a discount. Anthropic's Batch API is 50% off both input and output. OpenAI publishes a separate Batch price table, where gpt-6.1-sol is $1.00 input and $5.00 output, half its standard rates. Google's page describes its Batch API as a "50% cost reduction" (Gemini 2.5 Pro: $0.625 input, $5.00 output for prompts up to 200K tokens). Results come back later instead of instantly, so it suits evaluations, bulk classification and overnight document processing, not chat. On Anthropic, batch and caching discounts stack.
Thinking and reasoning tokens are billed as output
Models that reason before answering generate tokens you may never see, and you pay for them at the output rate:
- OpenAI's reasoning guide says reasoning tokens are not visible via the API but "are billed as output tokens" and occupy context window space. They are reported in
usage.output_tokens_details.reasoning_tokens. - Anthropic reports the thinking share of billed output tokens in
usage.output_tokens_details.thinking_tokens. - Google's price list labels Gemini output prices as "including thinking tokens".
Because of this, the visible text can understate what you are billed for; measure from the usage field, not from the answer's length. Where the API offers an effort or thinking-budget setting, lowering it is a direct cost control.
Other things that change the bill
- Long-context tiers. Some models charge more per token once the prompt passes a threshold: Gemini 2.5 Pro above 200K tokens, OpenAI's listed models above 272K, Claude Haiku 5.5 above 100,000. Anthropic states that its Claude 4.6 and later models, except Haiku 5.5, charge the same per-token rate across the full 1M-token window.
- Tool definitions. Tool schemas are sent as input tokens, and Anthropic adds a fixed tool-use system prompt whenever tools are present. Long tool lists cost money on every request.
- Images, audio and files are converted to tokens and billed as input, often at different rates; Gemini 2.5 Flash, for example, prices audio input at $1.00 per million tokens versus $0.30 for text.
- Region pinning. On the Claude API, requesting US-only inference (
inference_geo: "us") on Claude 4.6 and later models applies a 1.1× multiplier to all token prices. - Retries. A retried request is a new request and is billed again when it succeeds, so retry loops for 429 errors should be bounded.
How to keep API costs predictable
- Log the
usageobject of every response so you know real input, output and cached token counts. - Set
max_tokensto what your use case actually needs. - Route simple tasks to a small model and keep the large one for hard cases.
- Cache fixed prefixes and send offline work through the batch API.
- Set a spend limit in the provider's console so a bug cannot run up an unbounded bill.
Frequently asked questions
- Why are output tokens more expensive than input tokens?
- Providers price them separately, and on the price lists checked in October 2026 output costs several times more than input: five times on Claude Sonnet 5.5 and OpenAI's gpt-6.1-sol, eight times on Gemini 2.5 Pro. So a long answer costs more than a prompt of the same length, and capping output length is one of the most effective cost controls.
- Do cached tokens count toward rate limits?
- On the Claude API, for most current models, no: only uncached input tokens and cache writes count toward the input-tokens-per-minute limit, while cache reads do not. So caching lowers both the bill and rate-limit pressure. Other providers count tokens differently; check their rate-limit documentation.
- If a Claude Haiku 5.5 prompt is over 100,000 tokens, is the whole request priced higher?
- Yes. Anthropic prices each Haiku 5.5 request on its own: if the prompt, counting cache reads and writes, is over 100,000 tokens, that request pays the higher input and output prices even if part of the prompt was a cache hit. Earlier requests keep the prices they were billed at.
- How do I estimate my monthly bill?
- Measure average input and output tokens per request from the usage field of a few real responses, multiply each by its per-token price, and multiply by expected requests per month. Add a margin for retries and long conversations, which resend earlier messages as input every turn.