Repository navigation
chore(cost-map): backfill anthropic batch api prices from the pricing page - #43171
berriai-litellm-provider-info-sync[bot] wants to merge 1 commit into
Conversation
|
|
|
| "output_cost_per_token_above_200k_tokens": 2.25e-05, | ||
| "cache_creation_input_token_cost_above_200k_tokens": 7.5e-06, | ||
| "cache_read_input_token_cost_above_200k_tokens": 6e-07, | ||
| "input_cost_per_token_batches": 1.5e-06, |
There was a problem hiding this comment.
Long-context batches underpriced
For a Sonnet 4.5 batch request above 200k input tokens, this flat rate is used even though the model has higher prices above 200k. Batch pricing only recognizes tier prices with a _batches suffix, so it charges half the base price instead of half the long-context price and understates spend. The dated Sonnet 4.5 entry has the same gap.
| "output_cost_per_token_above_200k_tokens": 2.25e-05, | ||
| "cache_creation_input_token_cost_above_200k_tokens": 7.5e-06, | ||
| "cache_read_input_token_cost_above_200k_tokens": 6e-07, | ||
| "input_cost_per_token_batches": 1.5e-06, |
There was a problem hiding this comment.
Cached batch tokens mispriced
When an Anthropic batch result contains cache-read or cache-creation tokens, adding this input batch rate switches the cost calculation away from the previous path, which charged those tokens at separate cache rates. Because this entry has no cache batch rates, the new path charges them all at the plain batch input rate, making the reported spend incorrect.
Merging this PR will not alter performance
Comparing |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
… page Price-Sync: litellm-providers
773faf3 to
794c2e5
Compare
|
Rolled into the rolling registry PR #42951 after re-verifying every value against the official source. Closing as superseded |
Backfills Batch API prices on every priced anthropic row, per ruling anthropic-batch-prices-backfill (apply_value). Source: the Batch API table on https://platform.claude.com/docs/en/about-claude/pricing fetched raw ("The Batch API allows asynchronous processing of large volumes of requests with a 50% discount on both input and output tokens"). Kind page for every row, mode merge, no other field touched
claude-mythos-preview is left out: the Batch API table has no row for it
Delisted by the provider (informational, rows unchanged): claude-haiku-4-5, claude-opus-4-5, claude-sonnet-4-5 are undated alias keys whose dated forms are Active; claude-mythos-5 and claude-mythos-5-1 stay flagged per ruling anthropic-mythos-gated-flag-delisted; claude-mythos-preview already carries deprecation_date 2026-06-09
Cache and long-context batch rates (Greptile review): the page states "These multipliers stack with other pricing modifiers, including the Batch API discount and data residency" for the cache write and read multipliers, and "Prompt caching and batch processing discounts apply at standard rates across the full context window", so each row also gets a
_batchesfield at half the standard rate for every cache and above-200k field it already carries (same field names as the gemini and openai rows that carry cache_read_input_token_cost_batches and *_above_272k_tokens_batches). No 1h cache write batch field is added, the catalog has no such conventionNote
Low Risk
Catalog-only pricing metadata used for cost estimation; incorrect values could skew batch spend reporting but does not change runtime API behavior.
Overview
Adds Batch API token rates (
input_cost_per_token_batches,output_cost_per_token_batches, and matchingcache_*_batchesfields) to priced Anthropic Claude rows inmodel_prices_and_context_window.jsonand its backup, using the 50% Batch discount from Anthropic’s pricing page. Sonnet 4.5 rows also get long-context (above_200k_tokens) batch variants where those tiers already exist.Several entries gain or refresh a
sourceURL pointing atplatform.claude.com(replacing the olderdocs.anthropic.comlink onclaude-sonnet-4-5-20250929). The JSON schema documents the new*_above_200k_tokens_batchescost properties.Reviewed by Cursor Bugbot for commit 794c2e5. Bugbot is set up for automated code reviews on this repo. Configure here.