Repository navigation
fix: add supports_mid_conversation_system to bare first-party Claude cost-map keys - #36969
Conversation
Greptile SummaryThis PR aligns bare first-party Claude 4.8+/5 metadata with provider-prefixed variants so Anthropic model-info lookups report mid-conversation system-message support consistently.
Confidence Score: 5/5The PR appears safe to merge with no actionable defects identified. The synchronized cost-map updates match the existing Claude capability generalization, and the new test accurately checks the affected first-party model family without introducing runtime or network behavior.
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Adds the capability flag to the five intended bare Claude entries, consistently with the existing fallback generalization. |
| litellm/model_prices_and_context_window_backup.json | Mirrors the root cost-map metadata changes in the packaged map used for local runtime lookups. |
| tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py | Adds a targeted data-integrity sweep covering mapped first-party Anthropic entries matched by the existing capability rule. |
Reviews (1): Last reviewed commit: "fix: add supports_mid_conversation_syste..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
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 4cd1c81. Configure here.
mateo-berri
left a comment
There was a problem hiding this comment.
LGTM. Thanks for the contribution!
6fcdea0
into
BerriAI:litellm_internal_staging
TLDR
Problem this solves:
claude-opus-4-8, the 5 family) lacksupports_mid_conversation_systemcustom_llm_provider="anthropic"lookup reports the capability as unsetHow it solves it:
User Flow
Before: a developer checking whether their model keeps mid-conversation system messages gets a wrong answer for first-party keys
litellm.get_model_info(model="claude-opus-4-8", custom_llm_provider="anthropic")supports_mid_conversation_systemcomes backNone, so their code treats a model that supports the feature as unsupportedanthropic/claude-opus-4-8,GET /model/infoshows the samenullundermodel_infomodel="vertex_ai/claude-opus-4-8"returnsTrue, so the same model reports different capabilities per routeAfter: the same lookup answers consistently on every route
litellm.get_model_info(model="claude-opus-4-8", custom_llm_provider="anthropic")supports_mid_conversation_systemcomes backTrue, matching the regional and provider-prefixed entriesGET /model/infoon the same proxy showstruefor everyanthropic/<bare key>deploymentRelevant issues
Surfaced by the reporter in #36559 (follow-up to #36968); this PR is the cost-map data fix only
Linear ticket
Part of LIT-5872 (https://linear.app/litellm-ai/issue/LIT-5872/hoisting-mid-conversation-system-reminders-on-pre-48-claude)
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@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
This is a capability-metadata fix. The flag is only read on the bedrock, vertex_ai, and azure_ai partner routes, whose entries already carry it, so no request bytes change for any model and a paid LLM call cannot demonstrate it. The user-visible surfaces are the SDK lookup and the proxy's
/model/info, so both legs below drive those against a real proxy booted from each commit, with no mocksBoth legs use the same config: five deployments whose
litellm_params.modelisanthropic/<bare key>,LITELLM_LOCAL_MODEL_COST_MAP=True, master keysk-1234Before, at 2bc9bb4 (merge base)
SDK lookup:
Proxy on port 44191 (confirmed free with
lsof -nP -iTCP:44191 -sTCP:LISTENbefore boot):GET /v1/model/infowith the same filter returned the same fivenullrowsAfter, at 4cd1c81 (PR head)
SDK lookup:
Proxy on port 43817 (confirmed free the same way):
GET /v1/model/infowith the same filter returned the same fivetruerowsBoth proxies also listed 58 unrelated deployments loaded from the dev database (the worktree
.envsetsDATABASE_URL); those rows are omitted above and are identical between legsThe new sweep test fails at the merge base (
assert missing == []reports all five keys) and passes at the headType
🐛 Bug Fix
Caveats (if any)
test_anthropic_experimental_pass_through_messages_handler.pyrather than beside the existing shipped-backup sweep intests/test_litellm/litellm_core_utils/test_get_model_cost_map.py; left as is since moving it buys nothing for a data fixjson,os, andlitellminside the function although the file already imports them at the top; harmlessFinal Attestation
The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR
4cd1c81 passes /live-pr-risk