Skip to main content

pricing_for_model

Function pricing_for_model 

Source
pub fn pricing_for_model(model: &str) -> ModelPricing
Expand description

Hardcoded as of 2026-10. Requires a code change + release when Anthropic updates pricing.

Four families price by version, so the id must carry one to get the newer rate — an alias ("fable", "opus", "sonnet") prices as the older tier:

  • Fable 5.1+ reads cache at 0.025× input ($0.25/MTok) instead of the standard 0.1× ($1/MTok) that Fable 5 pays. Everything else is identical.
  • Opus 5.5+ is $4/$20 and reads cache at 0.05× input ($0.20/MTok); Opus 5 and earlier stay at $5/$25 with the standard 0.1× read.
  • Sonnet 5+ is $2/$10; Sonnet 4.6 and earlier stay at $3/$15. The $2/$10 launch price became Sonnet 5’s standard price on 2026-09-01 — the scheduled increase to $3/$15 was cancelled. Sonnet 5.5+ reads cache at 0.05× input ($0.10/MTok); Sonnet 5 at the standard 0.1×.
  • Haiku 5.5+ is $0.10/$0.50 for prompts up to 100k tokens and 5× that above it; this returns the up-to-100k tier, and pricing_for_entry applies the long-prompt tier. Haiku 4.5 and the "haiku" alias stay at $1/$5.