Skip to content

fix(model_prices): bill claude-haiku-5-5 long prompts on every provider and in batch - #45134

Closed
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
litellm_haiku_5_5_long_context_pricing
Closed

devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
litellm_haiku_5_5_long_context_pricing

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • Haiku 5.5 long prompts were billed at base rates on Bedrock and Azure
  • Batch requests over 100k prompt tokens stayed at the cheap batch rate
  • The Rust catalog rejected the new 100k price keys as unknown fields

How it solves it:

  • Adds the over-100k rates to 13 Bedrock, Bedrock Mantle and Azure entries
  • Adds the four over-100k batch rates to claude-haiku-5-5
  • Lets get_model_info pass *_above_<N>_tokens_batches keys through, so the batch calculator sees them
  • Adds the nine 100k fields to the Rust ModelInfo struct

User 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

  1. They send POST https://litellm-domain/v1/chat/completions with "model": "bedrock/us.anthropic.claude-haiku-5-5" and a 150,000 token prompt
  2. The request succeeds and https://litellm-domain/ui/?page=logs shows $0.0165 of prompt spend (150,000 x $0.11 per 1M)
  3. AWS bills $0.0825 for the same prompt (150,000 x $0.55 per 1M)

After: the same request is logged at the price AWS bills

  1. They send the same POST https://litellm-domain/v1/chat/completions with the same model and prompt
  2. The request succeeds and https://litellm-domain/ui/?page=logs shows $0.0825 of prompt spend, matching the AWS bill

Pre-Submission checklist

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review

Screenshots / Proof of Fix

Prices come from three vendor sources, read raw:

Rates per entry:

Entries input output cache write 1h cache write cache read
anthropic., global.anthropic., azure_ai/ 5e-07 2.5e-06 6.25e-07 1e-06 5e-08
us., eu., jp., au., apac.anthropic., bedrock_mantle/anthropic. 5.5e-07 2.75e-06 6.875e-07 1.1e-06 5.5e-08
us-gov.anthropic., bedrock/us-gov-east-1/, bedrock/us-gov-west-1/, bedrock_mantle/us-gov-west-1/ 6e-07 3e-06 7.5e-07 1.2e-06 6e-08

claude-haiku-5-5 batch over 100k: input 2.5e-07, output 1.25e-06, cache write 3.125e-07, cache read 2.5e-08

Before (f0031e9)

  1. 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_5 with the new tests and the old cost map: every 100,001 token case outside the direct Anthropic entry fails, plus the batch 100,001 cases
  2. With the new cost map but the old ABOVE_THRESHOLD_COST_KEY_PATTERN (_above_\d+k?_tokens$), the two batch tests that go through litellm.get_model_info and batch_cost_calculator still fail at 100,001 tokens: get_model_info drops the *_above_100k_tokens_batches keys and the batch input rate stays 5e-08
  3. cargo test -p litellm-model-catalog --all-features --test registry_validation above_100k with the old ModelInfo: 9 failed, each with "unknown field, null, or changed value"

After (37b6f2f)

  1. The same pytest command: 16 passed. A 100,001 token batch prompt on claude-haiku-5-5 bills at 2.5e-07 input and 1.25e-06 output per token
  2. The same cargo command: 9 passed
  3. uv 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 passed

Type

🐛 Bug Fix

Caveats (if any)

Medium

  • vertex_ai/claude-haiku-5-5 and @default keep flat rates
    • Google's Vertex pricing page does not list Haiku 5.5 yet, so there is no published long-context price to copy
  • perplexity/anthropic/claude-haiku-5-5 keeps flat rates
    • Perplexity's docs publish no Haiku 5.5 long-context price, and none of its Claude rows carry tiers

Low

  • The pattern change also lets other models' *_above_<N>_tokens_batches keys (today only 200k and 272k, already declared fields) ride through get_model_info, and /model/info treats them as server-derived pricing like the existing 200k and 272k batch fields

  • The batch cache write and cache read over-100k rates are not printed by Anthropic

    • They follow the 50% batch discount, the same way the existing flat cache_*_batches keys on this entry do
  • The ignored Rust catalog tests (--include-ignored) already fail on main for unrelated fields such as a 1000.0 u64 parse

    • This PR only removes the 100k keys from those failures

Link 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 *_batches variants) on claude-haiku-5-5 and on Bedrock / Bedrock Mantle / Azure Haiku 5.5 entries that previously lacked them. model_prices_and_context_window.schema.json, the backup JSON, and Rust ModelInfo are 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_rates for several providers, plus Rust registry_validation_keeps_above_100k_tier_rates and updated schema expectations in test_utils.py.

Reviewed by Cursor Bugbot for commit 218c00c. Bugbot is set up for automated code reviews on this repo. Configure here.

…er and in batch

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@kerry-berri

Copy link
Copy Markdown
Contributor

@greptileai

@kerry-berri

Copy link
Copy Markdown
Contributor

bugbot run

@CLAassistant

CLAassistant commented Oct 7, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread model_prices_and_context_window.json Resolved
@greptile-apps

greptile-apps Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Critical risk] Adds billing tier fields that affect how customer charges are calculated.

The pricing changes appear sound, but the explicit test and comment requirements must be satisfied before merging

Findings

  1. P2 Price assertions lack sources ▶
  2. P2 New tests omit required types ▶
  3. P2 Field comments repeat names ▶

Summary

Adds Haiku 5.5 prices above 100,000 prompt tokens to 13 Bedrock, Bedrock Mantle, and Azure entries. Adds four direct Anthropic batch prices, nine Rust fields, and matching schema and regression tests

  • No concrete new billing failure was established
  • The new tests and Rust comments need changes to meet explicit repository requirements
  • devin-ai-integration[bot] explicitly deferred Vertex and Perplexity tiers because published prices were unavailable
  • devin-ai-integration[bot] acknowledged inferred batch cache prices and unrelated existing failures in ignored Rust tests

Reviews (1) · Last reviewed commit: "fix(model_prices): bill claude-haiku-5-5..." · Reviewed by Greptile

@codspeed

codspeed Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_haiku_5_5_long_context_pricing (37b6f2f) with main (c877e0f)

Open in CodSpeed

@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

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>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Superseded by #45151, which carries these commits along with the other Haiku 5.5 PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants