Repository navigation
fix(model_prices): consolidate claude-haiku-5-5 over-100k pricing and capability flags - #45151
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> (cherry picked from commit 186f6c8)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> (cherry picked from commit 75c9c3f)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> (cherry picked from commit 53163d2)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> (cherry picked from commit febed31)
…er and in batch Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> (cherry picked from commit 218c00c)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> (cherry picked from commit 37b6f2f)
…aude-haiku-5-5 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> (cherry picked from commit 6e91e0e)
…ility flags Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> (cherry picked from commit 1f97bb2)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> (cherry picked from commit 3d25260)
Price-Sync: litellm-providers (cherry picked from commit ee3822c)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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)".
|
|
kerry seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
@BugBot run |
|
| def test_haiku_5_5_runtime_profile(local_model_cost_map: None, model: str, provider: str) -> None: | ||
| assert AnthropicModelInfo.is_adaptive_thinking_model(model, provider) is True | ||
| assert AnthropicModelInfo._is_always_on_thinking_model(model, provider) is False | ||
| assert AnthropicModelInfo.forced_tool_use_unsupported(model.removeprefix("anthropic/")) is False |
There was a problem hiding this comment.
This new bug-fix test file violates AGENTS.md: extend existing mapped test files. Move these regressions there before merging so path-based selection includes them
Context Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
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>
…ter claude-haiku-5.5 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
@BugBot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 2ff29da. Configure here.
Takes the claude-haiku-5-5 and claude-haiku-5.5 cost map rows (Anthropic, Bedrock, Bedrock Mantle, Azure AI, Vertex AI, OpenRouter, Perplexity) from upstream v1.106.0-dev.2, along with the over-100k prompt tier fields and tests they need. The Vertex flag fix and the Azure integer prompt cache minimum come along with the rows. Upstream sources: 5cd1126 (BerriAI#45108), 46d440a (BerriAI#45151, haiku-related hunks only), d174c43 (BerriAI#45114), f0031e9 (BerriAI#45116). The rebased model info helper gets explicit kwargs for the four over-100k batch rates. The haiku config test calls the adaptive thinking helper on AnthropicModelInfo instead of the public alias that upstream added in a later refactor.
Takes the claude-haiku-5-5 and claude-haiku-5.5 cost map rows (Anthropic, Bedrock, Bedrock Mantle, Azure AI, Vertex AI, OpenRouter, Perplexity) from upstream v1.106.0-dev.2, along with the over-100k prompt tier fields and tests they need. The Vertex flag fix and the Azure integer prompt cache minimum come along with the rows. Upstream sources: 5cd1126 (BerriAI#45108), 46d440a (BerriAI#45151, haiku-related hunks only), d174c43 (BerriAI#45114), f0031e9 (BerriAI#45116). The rebased model info helper gets explicit kwargs for the four over-100k batch rates. The haiku config test calls the adaptive thinking helper on AnthropicModelInfo instead of the public alias that upstream added in a later refactor.
Takes the claude-haiku-5-5 and claude-haiku-5.5 cost map rows (Anthropic, Bedrock, Bedrock Mantle, Azure AI, Vertex AI, OpenRouter, Perplexity) from upstream v1.106.0-dev.2, along with the over-100k prompt tier fields and tests they need. The Vertex flag fix and the Azure integer prompt cache minimum come along with the rows. Upstream sources: 5cd1126 (BerriAI#45108), 46d440a (BerriAI#45151, haiku-related hunks only), d174c43 (BerriAI#45114), f0031e9 (BerriAI#45116). The rebased model info helper gets explicit kwargs for the four over-100k batch rates. The haiku config test calls the adaptive thinking helper on AnthropicModelInfo instead of the public alias that upstream added in a later refactor.
Backport of BerriAI#45108 to stable/1.103.x. Cherry-picked from 5cd1126 (main). Prerequisite for BerriAI#45151: adds the claude-haiku-5-5 entries that fix corrects. Cost-map conflicts resolved by appending the new entries; schema test lives under tests/test_litellm on this line. The cost-map schema and its schema test also allow cache_creation_input_token_cost_batches, cache_read_input_token_cost_batches and supports_anthropic_compaction, which these entries carry and main already allows.
… capability flags (BerriAI#45151) Backport of BerriAI#45151 to stable/1.103.x. Cherry-picked from 46d440a (main). Adapted to the line: the model-catalog Rust crate is not on this line so its two files are dropped; tests live under tests/test_litellm; conflicts resolved by keeping the line's fields plus the over-100k fields this PR adds. Prerequisite from BerriAI#39861 ported minimally: the standard above-threshold loop skips *_batches keys, so a non-batch request over 100k is not billed at the batch tier. The batch long-context tier tests are dropped since this line's batch cost path has no long-context tiers, and the runtime profile test calls the line's private _is_adaptive_thinking_model.
Backport of BerriAI#45108 to stable/1.105.x. Cherry-picked from 5cd1126 (main). Prerequisite for BerriAI#45151: adds the claude-haiku-5-5 entries that fix corrects. Cost-map conflicts resolved by appending the new entries.
… capability flags (BerriAI#45151) Backport of BerriAI#45151 to stable/1.105.x. Cherry-picked from 46d440a (main). Conflicts resolved by keeping the line's fields and adding only the over-100k fields this PR introduces; cost-map entries replaced per model.
TLDR
Problem this solves:
claude-haiku-5-5were billed at the flat batch rateHow it solves it:
claude-haiku-5-5ABOVE_THRESHOLD_COST_KEY_PATTERNnow also matches*_above_Nk_tokens_batches, soget_model_inforeturns them*_above_100k_tokensfields onModelInfoBase(ReadOnly) andCustomPricingLiteLLMParamsthinking_always_on: falseandsupports_forced_tool_use: trueon the Haiku 5.5 rowsUser Flow
Before: a team sending 150k-token prompts to Claude Haiku 5.5 sees spend lower than the vendor bills
"model": "bedrock/us.anthropic.claude-haiku-5-5"and a 150k-token promptinput_cost_per_tokenfor every token, not the over-100k rateclaude-haiku-5-5with the same prompt is logged atinput_cost_per_token_batches(5e-08)"thinking": {"type": "disabled"}or"tool_choice": {"type": "tool", ...}is treated as unsupported for Haiku 5.5After: the same requests are logged at the vendor's long-context rates and both options work
input_cost_per_token_above_100k_tokensinput_cost_per_token_above_100k_tokens_batches(2.5e-07)Relevant issues
Supersedes #45134, #45137, #45139 and #45140. Takes only the
openrouter/anthropic/claude-haiku-5.5row from #44910 (withsupports_adaptive_thinkingandprompt_cache_min_tokensadded), which stays open for its other audit changes. The commits from each source PR are cherry-picked with their original authorsPre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Local checks at the branch tip:
tests/unit/test_claude_haiku_5_5_config.py,tests/unit/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py,tests/unit/test_model_prices_schema.py,tests/unit/test_utils.py::test_aaamodel_prices_and_context_window_json_is_validand the custom pricing denylist test pass (313 passed, including a Vertex regional uplift case).cargo test -p litellm-model-catalogpasses. A script checked that the cost-map diff against main is exactly the union of the source PRs' changes plus the OpenRouter row, and that the cost map has no duplicate keysType
🐛 Bug Fix
Caveats (if any)
Low
Final Attestation
Note
Medium Risk
Changes billing rates for long prompts and batch jobs on a widely used model; incorrect thresholds would under- or over-charge customers, though coverage is backed by extensive unit tests.
Overview
Adds over-100,000 prompt token pricing for Claude Haiku 5.5 across the cost map (Anthropic, Bedrock/Mantle regions, Azure AI, Vertex, OpenRouter), including batch tier fields on
claude-haiku-5-5and a newcache_creation_input_token_cost_above_1hr_above_100k_tokensrate.Extends the pricing schema end-to-end: Rust
ModelInfo, JSON schema, PythonModelInfoBase/CustomPricingLiteLLMParams, and dashboardschema.d.ts.ABOVE_THRESHOLD_COST_KEY_PATTERNnow matches*_above_Nk_tokens_batchesso/model/infoand cost logic can surface those keys.Corrects Haiku 5.5 capability flags on provider rows:
thinking_always_on: falseandsupports_forced_tool_use: true(replacing the previous inverted values on several Bedrock rows). Updates some Bedrock pricing source URLs to the AWS price list.Adds registry validation (Rust), cost-calculator parametrized tests (standard, batch, Vertex regional uplift), and
test_claude_haiku_5_5_config.pyfor cost-map rows and tool-choice / thinking runtime behavior.Reviewed by Cursor Bugbot for commit 2ff29da. Bugbot is set up for automated code reviews on this repo. Configure here.