Expand description
Centralised pricing logic for Anthropic models.
All cost calculations live here so that the engine, TUI, and any future consumer share a single source of truth. Update this file — and only this file — whenever Anthropic changes its pricing.
Prices are in USD per million tokens. Source: https://platform.claude.com/docs/en/about-claude/pricing (“Model pricing”, “Batch processing”, “Long context pricing” and “Feature-specific pricing → Prompt caching”).
| Model | Input | Output | Cache read |
|---|---|---|---|
| Fable 5.1 / Mythos 5.1 | $10.00 | $50.00 | 0.025× |
| Fable 5 / Mythos 5 | $10.00 | $50.00 | 0.10× |
| Opus 5.5 | $4.00 | $20.00 | 0.05× |
| Opus 4.5 – 5 | $5.00 | $25.00 | 0.10× |
| Opus 4 / 4.1 (and Opus 3) | $15.00 | $75.00 | 0.10× |
| Sonnet 5.5 | $2.00 | $10.00 | 0.05× |
| Sonnet 5 | $2.00 | $10.00 | 0.10× |
| Sonnet (other) | $3.00 | $15.00 | 0.10× |
| Haiku 5.5, prompt ≤ 100k | $0.10 | $0.50 | 0.10× |
| Haiku 5.5, prompt > 100k | $0.50 | $2.50 | 0.10× |
| Haiku 3.5 | $0.80 | $4.00 | 0.10× |
| Haiku 3 (historical) | $0.25 | $1.25 | fallback* |
| Haiku (other) | $1.00 | $5.00 | 0.10× |
Historical Opus 3 / Haiku 3 input and output rates: https://www.anthropic.com/news/claude-3-family (verified 2026-10-10). *Legacy cache rates use the standard multiplier fallback; historical cache support and prices were not verified from that launch source.
Sonnet 5. The official model overview explicitly lists $2 input / $10 output per million tokens (verified 2026-10-10): https://platform.claude.com/docs/en/models/sonnet-5/overview. These are standard global direct-API estimates, not complete invoices: fast-mode/residency multipliers and server-tool charges are not modeled. Unknown-model fallbacks and routed/cloud/subscription model IDs are estimates, not verified provider invoice rates or net charges after credits/discounts.
Haiku 5.5 is priced by prompt length (“Long context pricing”): a prompt
of over 100,000 tokens pays the higher row. The prompt is everything the
request sent — uncached input + cache reads + cache writes — so
calculate_cost_split picks the tier per request from those counts.
Cache pricing (relative to input price):
- Cache reads: 0.10× input price, except where the docs list a
per-model multiplier (see
cache_read_multiplier) - Cache write (5m): 1.25× input price (5-minute TTL, the default)
- Cache write (1h): 2.00× input price (1-hour TTL, opt-in via
cache_ttl)
Functions§
- cache_
read_ multiplier - Cache-read price as a multiple of the input price (https://platform.claude.com/docs/en/about-claude/pricing, “Prompt caching”). The docs list 0.025× for Fable 5.1 / Mythos 5.1 and 0.05× for Opus 5.5 / Sonnet 5.5; every other model uses the standard 0.1× (also the conservative default for models this table does not know).
- calculate_
cost - Calculate the USD cost of a single model turn (no cache-write TTL split).
- calculate_
cost_ optional_ split - Split-aware cost for callers holding an aggregate plus an optional TTL
split (the shape of
SessionEvent::Usage). When either split bucket is present, preserve its known count and assign any aggregate remainder to the conservative 1h rate. This is an estimate, not an inferred TTL. A split sum exceeding the aggregate is malformed metadata: retain the larger split sum rather than dropping known writes or lowering the request’s price tier. Arithmetic saturates. When both areNone, TTL is explicitly unknown and the existing aggregate-at-5m estimate is retained (potentially underbilling). - calculate_
cost_ split - Calculate the USD cost of a single model turn with the cache-write TTL split made first-class.