Claude & OpenAI API cost calculator

By NeverPayTwice · prices checked November 23, 2026 · runs in your browser, nothing is sent anywhere

Paste the usage block from a Claude or OpenAI API response (or a whole response, or a line from a Claude Code log) and see what that request cost, split into new input, cache writes, cache reads and output. Or type the token counts yourself.

It handles the two providers' different counting (OpenAI's input total includes cached and written tokens; Anthropic's doesn't), prices each cache write at its own rate, and applies long-prompt prices: Claude Haiku 5.5 over 100,000 tokens, current OpenAI models over 272,000.

How a Claude request is priced

Every response carries a usage block. Anthropic's input_tokens counts only the new, uncached input; the cached parts are reported separately:

FieldPriced at
input_tokensthe model's input price
cache_creation_input_tokens1.25× input for the 5-minute cache, 2× for the 1-hour cache (split in cache_creation)
cache_read_input_tokensthe model's cache-read price (0.05× input on Sonnet 5.5 and Opus 5.5, 0.025× on Fable 5.2, 0.1× on Haiku 5.5 and the 4.x models)
output_tokensthe output price; thinking is billed as output and is already included

So a request's full input is input_tokens + cache_creation_input_tokens + cache_read_input_tokens. Pricing input_tokens alone makes a cached request look nearly free. More detail, with a tested Python function: what each Claude API request costs.

How an OpenAI request is priced

OpenAI counts the other way round: input_tokens (Responses API) or prompt_tokens (Chat Completions) includes cached reads and cache writes.

PartPriced at
new input = input − cached_tokens − cache_write_tokensthe model's input price
cached_tokensthe model's cached-input price (0.05× input on GPT-6.2 Astra and Sol, GPT-6.1 Sol and Terra; 0.1× on most others)
cache_write_tokenson GPT-5.6 and later: 1.25× input for the default 30-minute cache, 2.5× for the 12-hour cache (Responses API, split in cache_write_tokens_details)
output_tokens / completion_tokensthe output price; reasoning tokens are already included

A request with more than 272,000 input tokens pays the model's long-context prices for every token in it. GPT-5.6 Sol's listed price is promotional until November 30, 2026. More detail, with a tested Python function: what each OpenAI API request costs.

Things this calculator doesn't include

Questions people ask

How much does a Claude API request cost?

It depends on four token counts in the response's usage block: new input, cache writes, cache reads and output, each at the model's own price. On Claude Sonnet 5.5, a request with 1,200 new input, 2,000 cache-write, 10,000 cache-read and 400 output tokens costs $0.0124 at list prices (checked November 23, 2026).

Does input_tokens include cached tokens?

No. On the Claude API, input_tokens counts only new, uncached input. Cache writes are reported in cache_creation_input_tokens and cache reads in cache_read_input_tokens, so a request's full input is the sum of all three. Pricing input_tokens alone makes a cached request look almost free.

How much do Claude cache writes and cache reads cost?

Cache writes cost 1.25 times the model's input price for the 5-minute cache and 2 times for the 1-hour cache. Cache reads have each model's own price: $0.10 per million tokens on Sonnet 5.5, $0.20 on Opus 5.5 and Fable 5.2, and $0.01 on Haiku 5.5 for prompts up to 100,000 tokens.

Why does Claude Haiku 5.5 cost more for long prompts?

Haiku 5.5 has two price rows. A request whose prompt is over 100,000 tokens, cache reads and writes included, pays $0.50 per million input and $2.50 per million output instead of $0.10 and $0.50. The higher price applies to every token in that request, not just the part over 100,000.

Are Claude thinking tokens billed?

Yes. Thinking is billed as output tokens at the output price, whether or not you see the thinking text, and it is already included in output_tokens. The calculator prices it as part of output.

Does OpenAI's input_tokens include cached tokens?

Yes, the opposite of Anthropic. OpenAI's input_tokens (or prompt_tokens) includes cached reads and cache writes. New input is the total minus cached_tokens minus cache_write_tokens. On GPT-5.6 and later, cache writes cost 1.25 times the input price for the 30-minute cache and 2.5 times for the 12-hour cache.

Or price every request automatically

NeverPayTwice is a small app we make. Its live meter runs on your own computer, records the usage block of every Claude and OpenAI call as it happens, prices it this way, keeps a receipt with the request ID, and flags anything you paid for twice. It never blocks or changes a request and never stores your API keys. $9.99 to start, then $2.99 a month to keep (your first month is included).

Try it on your own API calls, free for 7 days. No card needed.

Try it free for 7 daysSee the demo

Sources: Anthropic's pricing page (model, cache, Haiku 5.5 long-prompt, batch and data-residency prices) and prompt caching guide, checked November 23, 2026. The calculator's code is claude-cost-calc.js (MIT); it matches our tested Python function on every case we ran.