Repository navigation
fix(model_prices): bill claude-haiku-5-5 long prompts on every provider and in batch - #45134
devin-ai-integration[bot] wants to merge 2 commits into
Conversation
…er and in batch Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 218c00c. Configure here.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Superseded by #45151, which carries these commits along with the other Haiku 5.5 PRs |

TLDR
Problem this solves:
How it solves it:
claude-haiku-5-5get_model_infopass*_above_<N>_tokens_batcheskeys through, so the batch calculator sees themModelInfostructUser Flow
Before: a team calling Haiku 5.5 through Bedrock with a 150,000 token prompt sees spend at a fifth of what AWS bills
"model": "bedrock/us.anthropic.claude-haiku-5-5"and a 150,000 token promptAfter: the same request is logged at the price AWS bills
Pre-Submission checklist
uv run pytest tests/unit/<your_test_file>.py -vScreenshots / Proof of Fix
Prices come from three vendor sources, read raw:
*_long_ctx_*usage types: global $0.50 / $2.50 / $0.625 / $1.00 / $0.05, in-region (us-east-1, eu-central-1, ap-northeast-1, ap-southeast-2) $0.55 / $2.75 / $0.6875 / $1.10 / $0.055, GovCloud $0.60 / $3.00 / $0.75 / $1.20 / $0.06 (input / output / cache write / 1h cache write / cache read per 1M)azure_ai/claude-haiku-5-5gets Anthropic's over-100k ratesRates per entry:
anthropic.,global.anthropic.,azure_ai/us.,eu.,jp.,au.,apac.anthropic.,bedrock_mantle/anthropic.us-gov.anthropic.,bedrock/us-gov-east-1/,bedrock/us-gov-west-1/,bedrock_mantle/us-gov-west-1/claude-haiku-5-5batch over 100k: input 2.5e-07, output 1.25e-06, cache write 3.125e-07, cache read 2.5e-08Before (f0031e9)
LITELLM_LOCAL_MODEL_COST_MAP=True uv run pytest tests/unit/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py -k haiku_5_5with the new tests and the old cost map: every 100,001 token case outside the direct Anthropic entry fails, plus the batch 100,001 casesABOVE_THRESHOLD_COST_KEY_PATTERN(_above_\d+k?_tokens$), the two batch tests that go throughlitellm.get_model_infoandbatch_cost_calculatorstill fail at 100,001 tokens:get_model_infodrops the*_above_100k_tokens_batcheskeys and the batch input rate stays 5e-08cargo test -p litellm-model-catalog --all-features --test registry_validation above_100kwith the oldModelInfo: 9 failed, each with "unknown field, null, or changed value"After (37b6f2f)
claude-haiku-5-5bills at 2.5e-07 input and 1.25e-06 output per tokenuv run pytest tests/unit/test_utils.py::test_aaamodel_prices_and_context_window_json_is_valid tests/unit/test_model_prices_schema.py tests/unit/test_cost_map_guard.py: 99 passedType
🐛 Bug Fix
Caveats (if any)
Medium
vertex_ai/claude-haiku-5-5and@defaultkeep flat ratesperplexity/anthropic/claude-haiku-5-5keeps flat ratesLow
The pattern change also lets other models'
*_above_<N>_tokens_batcheskeys (today only 200k and 272k, already declared fields) ride throughget_model_info, and/model/infotreats them as server-derived pricing like the existing 200k and 272k batch fieldsThe batch cache write and cache read over-100k rates are not printed by Anthropic
cache_*_batcheskeys on this entry doThe ignored Rust catalog tests (
--include-ignored) already fail on main for unrelated fields such as a1000.0u64 parseLink to Devin session: https://app.devin.ai/sessions/c3de2ba5bc354789ad0f182a4c199da6
Open in Devin Desktop: https://app.devin.ai/desktop/session/c3de2ba5bc354789ad0f182a4c199da6?variant=devin
Requested by: @kerry-berri
Note
Medium Risk
Changes reported spend for long-context Haiku 5.5 across multiple providers; incorrect rates would misstate usage/cost logs but scope is limited to catalog pricing fields and tests.
Overview
Fixes under-billing for Claude Haiku 5.5 when prompts exceed 100k tokens (and for matching batch paths) by filling in catalog data the cost calculator already knows how to read.
The model price registry gains over-100k input/output and cache read/write rates (including 1h cache write and
*_batchesvariants) onclaude-haiku-5-5and on Bedrock / Bedrock Mantle / Azure Haiku 5.5 entries that previously lacked them.model_prices_and_context_window.schema.json, the backup JSON, and RustModelInfoare extended so those keys validate and deserialize instead of being treated as unknown.Tests lock in prompt-length tier behavior via
generic_cost_per_token/get_batch_cost_ratesfor several providers, plus Rustregistry_validation_keeps_above_100k_tier_ratesand updated schema expectations intest_utils.py.Reviewed by Cursor Bugbot for commit 218c00c. Bugbot is set up for automated code reviews on this repo. Configure here.