Claude Token Counter & Prompt Cache Calculator
Count Claude Opus, Sonnet, and Haiku tokens locally and compare standard API spend against 5-minute prompt caching, 1-hour caching, and the 50% Batch API discount
Free, no signup — your prompts and CLAUDE.md stay in this browser.
- Total Input Tokens
- 440
- 361 cached prefix + 79 user
- 5-Min Cache Total
- $0.270
- Saves $0.00 (0%)
- Batch API (50% off)
- $0.135
- Saves $0.135 (50%)
Editable Sonnet 5.5 rates ($/MTok)
5-min write: $2.500/MTok (1.25×) · 1-hr write: $4.000/MTok (2×) · Cache read: $0.100/MTok (0.05×)
Context window (1M)
Claude Sonnet 5.5 — Session Cost Breakdown (21 calls: 1 write + 20 hits)
Compares Standard Messages API, 5-minute & 1-hour Prompt Caching, and the 50% Batch API discount.
| Billing Mode | Cache Multipliers | Session Total (21 calls) | Effective / Call | Savings vs Standard |
|---|---|---|---|---|
| Standard API (No Cache) | 1.0× input | $0.270 | $0.013 | Baseline |
| 5-Minute Prompt Caching | 1.25× write / 0.05× read | $0.270 | $0.013 | Save $0.00 (0%) |
| 1-Hour Prompt Caching | 2× write / 0.05× read | $0.270 | $0.013 | Save $0.00 (0%) |
| Batch API (Standard) | 0.5× total | $0.135 | $0.0064 | Save $0.135 (50%) |
| Batch API + 5-Min Cache | 0.5× (1.25×w / 0.05×r) | $0.135 | $0.0064 | Save $0.135 (50%) |
Compare All Claude Models (21 calls)
Click a row to switch active model.
| Claude Model | In / Out ($/MTok) | Standard | 5-Min Cache | 1-Hr Cache | Batch API (50%) |
|---|---|---|---|---|---|
| Claude Fable 5.2 | $8 / $40 | $1.082 | $1.082 | $1.082 | $0.541 |
| Claude Opus 5.5 | $4 / $20 | $0.541 | $0.541 | $0.541 | $0.270 |
| Claude Sonnet 5.5 | $2 / $10 | $0.270 | $0.270 | $0.270 | $0.135 |
| Claude Haiku 5.5 | $0.1 / $0.5 | $0.014 | $0.014 | $0.014 | $0.0068 |
| Claude Opus 4.8 | $5 / $25 | $0.676 | $0.676 | $0.676 | $0.338 |
| Claude Sonnet 4.6 | $3 / $15 | $0.406 | $0.406 | $0.406 | $0.203 |
| Claude Haiku 4.5 | $1 / $5 | $0.135 | $0.135 | $0.135 | $0.068 |
How Anthropic prompt caching cuts API bills
Most Claude agent loops, RAG pipelines, and coding assistants resend the same large prefix on every turn: system instructions, CLAUDE.md project rules, tool JSON schemas, and reference files. With prompt caching, you write that prefix once and reuse it at 90% to 97.5% off on every cache hit, depending on the model.
- 5-minute cache (1.25× write): The TTL refreshes on every hit. Ideal for interactive chats, multi-step tool use, and Claude Code sessions where turns arrive within minutes of each other.
- 1-hour cache (2× write): Pays a slightly higher write premium in exchange for keeping the cache warm across slower user bursts or background evaluation queues.
- Cache hits (0.1× on most models): 0.05× on Claude Opus 5.5 and Sonnet 5.5, and 0.025× on Claude Fable 5.1 and 5.2. Each hit also refreshes the entry's TTL at no extra cost.
- Batch API (50% flat discount): Halves both input and output rates for workloads that can wait up to 24 hours — and stacks with prompt caching when batched prompts share a prefix.
Claude model tiers & reference rates
Anthropic list prices as of November 2026 (platform.claude.com pricing). Every $/MTok rate in the calculator above is editable, so you can model negotiated rates or data-residency pricing.
| Model | Input / Output | Cache Hit | Min Cache Prefix | Context Window | Notes |
|---|---|---|---|---|---|
| Claude Fable 5.2 | $8 / $40 per MTok | 0.025× input | 512 tokens | 1M | Most capable model · cache hits 0.025× |
| Claude Opus 5.5 | $4 / $20 per MTok | 0.05× input | 512 tokens | 1M | Flagship reasoning & coding · cache hits 0.05× |
| Claude Sonnet 5.5 | $2 / $10 per MTok | 0.05× input | 512 tokens | 1M | Balanced speed & intelligence · cache hits 0.05× |
| Claude Haiku 5.5 | $0.1 / $0.5 per MTok | 0.1× input | 512 tokens | 1M | Lowest cost · $0.50 / $2.50 for prompts over 100K tokens |
| Claude Opus 4.8 | $5 / $25 per MTok | 0.1× input | 1,024 tokens | 1M | Previous-generation Opus |
| Claude Sonnet 4.6 | $3 / $15 per MTok | 0.1× input | 1,024 tokens | 1M | Previous-generation Sonnet (older tokenizer) |
| Claude Haiku 4.5 | $1 / $5 per MTok | 0.1× input | 4,096 tokens | 200K | Previous-generation Haiku · 4,096-token cache minimum |
Minimum cacheable prefix by model
A prefix shorter than the minimum is processed without caching and returns no error; check that cache_creation_input_tokens is above 0 on the first call.
| Minimum | Models |
|---|---|
| 512 tokens | Fable 5.2 / 5.1 / 5, Mythos 5.x, Opus 5.5, Opus 5, Sonnet 5.5, Haiku 5.5 |
| 1,024 tokens | Opus 4.8, Sonnet 5, Sonnet 4.6, Sonnet 4.5, Opus 4.1, Opus 4, Sonnet 4 |
| 2,048 tokens | Opus 4.7, Mythos Preview |
| 4,096 tokens | Opus 4.6, Opus 4.5, Haiku 4.5 |
Built for Claude developers
Writing project instructions for Claude Code? Draft a lean instruction file with our CLAUDE.md & AGENTS.md Generator, then paste it into the System Prompt box above to verify how much of your context budget it consumes on every session.
Need to share a formatted Claude response or artifact with teammates? Export it cleanly with Claude to PDF, or compare Claude costs against OpenAI GPT-5, Gemini 2.5, and Llama 4 in our multi-model LLM Token Counter.
Frequently Asked Questions
How do Anthropic’s 5-minute and 1-hour prompt caching multipliers work?
When you tag a static prefix with cache_control, the first call pays a cache write surcharge: 1.25× the base input price for a 5-minute TTL, or 2× for a 1-hour TTL. Every later call that hits the warm prefix pays a fraction of the input price for those tokens: 0.1× on most models, 0.05× on Claude Opus 5.5 and Sonnet 5.5, and 0.025× on Claude Fable 5.1 and 5.2. A 5-minute cache pays for itself after one hit; a 1-hour cache after two.
What is the minimum token count required for Claude prompt caching?
It depends on the model: 512 tokens on Claude Fable 5.x, Opus 5.5, Opus 5, Sonnet 5.5 and Haiku 5.5; 1,024 on Opus 4.8, Sonnet 5 and Sonnet 4.6; 2,048 on Opus 4.7; and 4,096 on Opus 4.6, Opus 4.5 and Haiku 4.5. A shorter prefix is silently processed without caching (no error, cache_creation_input_tokens is 0), so this tool flags it beside your System Prompt box and prices it at the standard rate.
Can you combine Anthropic’s Batch API 50% discount with prompt caching?
Yes. Message Batches cut input and output rates by 50%, and Anthropic’s caching multipliers stack with that discount, so requests in a batch that share an identical cached prefix cost less again. The breakdown table shows both Batch-only and Batch + 5-min cache totals.
Is my system prompt or CLAUDE.md sent to Anthropic or MarkdownTools?
No. Token counts and cost projections are computed 100% locally in your browser using an offline Claude-tuned BPE estimator. Nothing is transmitted over the network. For exact billable token counts before sending a production batch, use Anthropic’s free /v1/messages/count_tokens API endpoint.
Does Claude charge more for long prompts?
Claude 4.6 and later models (except Haiku 5.5) include the full 1M-token context window at standard per-token prices. Claude Haiku 5.5 is the exception: a request whose prompt is over 100,000 tokens, cache reads and writes included, pays $0.50 / $2.50 per MTok instead of $0.10 / $0.50, and the calculator switches to those rates automatically. Claude Haiku 4.5 has a 200K window.