feat(models): add Claude Opus 4.8 across anthropic/bedrock/vertex/azure_ai - #29204
Conversation
…xt_window_backup.json
…_opus_4_8_config.py
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Greptile SummaryAdds Claude Opus 4.8 across all provider surfaces (Anthropic native, AWS Bedrock single-region + cross-region profiles, Google Vertex AI, and Azure AI / Microsoft Foundry) by inserting 9 new SKU entries in both JSON price files, routing the bare Bedrock ID through the converse path, and adding it to the setup wizard.
Confidence Score: 3/5Safe to merge if the provider_specific_entry format bug is fixed first; all other changes are additive and low-risk. The anthropic-native claude-opus-4-8 entry stores provider_specific_entry as a list of pairs rather than a dict. The consumption code at litellm/llms/anthropic/cost_calculation.py calls .get() on it; a list raises AttributeError, which is swallowed by the surrounding try/except, causing the 10% inference-geo and speed-tier cost multipliers to never be applied. This means any request billed with inference_geo="us" will be under-charged at the base rate instead of the published cross-region rate — a silent billing error affecting every claude-opus-4-8 Anthropic-routed request that uses geo or speed routing. The bug is present in both JSON files and is not caught by the new tests. Both model_prices_and_context_window.json and litellm/model_prices_and_context_window_backup.json — specifically the provider_specific_entry field on the claude-opus-4-8 key needs to be changed from a list of pairs to a plain JSON object, matching the format used by claude-opus-4-7 and every other Opus entry in those files.
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Adds 9 new claude-opus-4-8 SKU entries; provider_specific_entry on the anthropic-native entry is list-of-arrays instead of a dict, breaking geo/speed cost multiplier lookup. |
| litellm/model_prices_and_context_window_backup.json | Mirrors the main JSON additions but carries the same provider_specific_entry list-format bug on the claude-opus-4-8 entry. |
| litellm/constants.py | Adds anthropic.claude-opus-4-8 to BEDROCK_CONVERSE_MODELS — straightforward, matches the pattern for claude-opus-4-7. |
| litellm/setup_wizard.py | Adds claude-opus-4-8 to the Anthropic provider model list and updates the description string — trivial and correct. |
| tests/test_litellm/test_claude_opus_4_8_config.py | 48 new pure-JSON fixture tests covering presence, pricing, context windows, capability flags, provider routing, and BEDROCK_CONVERSE_MODELS; tests don't cover geo/speed multiplier correctness so the provider_specific_entry format bug passes undetected. |
Reviews (1): Last reviewed commit: "LIT-3410: add Claude Opus 4.8 — update t..." | Re-trigger Greptile
| "provider_specific_entry": [ | ||
| [ | ||
| "us", | ||
| 1.1 | ||
| ], | ||
| [ | ||
| "fast", | ||
| 6.0 | ||
| ] | ||
| ], | ||
| "supports_minimal_reasoning_effort": true, | ||
| "supports_output_config": true |
There was a problem hiding this comment.
provider_specific_entry uses wrong list-of-arrays format instead of dict
The claude-opus-4-8 entry stores provider_specific_entry as [["us", 1.1], ["fast", 6.0]], but every other Opus model (including claude-opus-4-7 immediately above it) stores it as {"us": 1.1, "fast": 6.0}. The consumer at litellm/llms/anthropic/cost_calculation.py calls .get("us", 1.0) / .get("fast", 1.0) on this value — valid for a dict, but AttributeError for a list. The entire block is wrapped in except Exception: pass, so the geo/speed multipliers silently return 1.0 for every claude-opus-4-8 request. Any caller routing via inference_geo="us" will be under-charged by 10% with no error surfaced. The same wrong format is in litellm/model_prices_and_context_window_backup.json.
…re_ai Adds 9 SKU entries for claude-opus-4-8 across every provider surface: - claude-opus-4-8 (anthropic) - anthropic.claude-opus-4-8 (bedrock_converse, single-region) - global.anthropic.claude-opus-4-8 (bedrock_converse, global xregion) - us.anthropic.claude-opus-4-8 (bedrock_converse, +10% uplift) - eu.anthropic.claude-opus-4-8 (bedrock_converse, +10% uplift) - au.anthropic.claude-opus-4-8 (bedrock_converse, +10% uplift) - vertex_ai/claude-opus-4-8 (vertex_ai-anthropic_models) - vertex_ai/claude-opus-4-8@default (vertex_ai-anthropic_models) - azure_ai/claude-opus-4-8 (azure_ai, 200k input cap) Pricing: $5 / MTok input, $25 / MTok output, 1M context (200k on Azure), 128k max output, adaptive thinking + tools + vision + PDF + prompt caching. Also adds anthropic.claude-opus-4-8 to BEDROCK_CONVERSE_MODELS so dispatch routes to converse (not legacy invoke, which drops output_config.effort), plus 48 regression tests pinning entry presence, pricing, context windows, capability flags, provider routing, and the bundled-backup loader path. Cherry-picked surgically from upstream PR BerriAI#29204 (5 commits squashed): the upstream PR was branched off litellm_oss_agent_shin_daily_branch rather than main, so its backup-JSON commit also carried unrelated sonnet-4-6 and gemini-3.1 drift edits; those were dropped here and the 9 opus-4-8 entries were inserted via pure text-level patches (no JSON round-trip, no other edits to the file). Refs: BerriAI#29204 Refs: LIT-3410
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Summary
Adds Claude Opus 4.8 — Anthropic's most capable model — across every provider surface LiteLLM exposes: the native Anthropic API, AWS Bedrock (single-region + us./eu./au./global. cross-region inference profiles), Google Vertex AI, and Microsoft Foundry (
azure_ai/).Fixes LIT-3410.
What changes
model_prices_and_context_window.jsonclaude-opus-4-8(anthropic, 4× bedrock regional, global bedrock, 2× vertex, azure_ai)litellm/model_prices_and_context_window_backup.jsonGetModelCostMap.load_local_model_cost_map(); drifting from the source JSON silently breaks pip-installed deploymentslitellm/constants.pyanthropic.claude-opus-4-8added toBEDROCK_CONVERSE_MODELSso Bedrock dispatch routes to converse (instead of legacy invoke, which dropsoutput_config.effort)litellm/setup_wizard.pyclaude-opus-4-8to the Anthropic models list + refresh the provider descriptiontests/test_litellm/test_claude_opus_4_8_config.pybedrock_output_config_effort_ceiling, and the bundled-backup loader pathAll 9 entries mirror the existing
claude-opus-4-7schema (same pricing, same context, same capability surface per Anthropic's models page), with one provider-specific exception —azure_ai/claude-opus-4-8capsmax_input_tokensat 200k per the Microsoft Foundry footnote in Anthropic's docs.Pricing & spec source
Verified against Anthropic's official models page:
claude-opus-4-8anthropic.claude-opus-4-8claude-opus-4-8Evidence
BEFORE — clean upstream main (no Opus 4.8 entries)
vertex_ai/claude-opus-4-8was even worse — it silently wildcard-fell-back tovertex_ai/claude-opus-4which charges $15 / MTok input + $75 / MTok output (3× the published 4.8 rate), silently overcharging every billed Opus 4.8 request through Vertex.AFTER — same call on this branch resolves with correct pricing
Synthetic billing math for 1M input + 500k output tokens:
Regression tests
48 new tests covering: entry presence in both JSON files, exact pricing per SKU, 1M / 128k / 200k context windows, capability flag surface (vision, tools, PDF, prompt caching, reasoning + xhigh/max/minimal effort tiers, computer use, assistant-prefill=false), provider routing (
anthropic/bedrock_converse/vertex_ai-anthropic_models/azure_ai),bedrock_output_config_effort_ceiling=xhighon the Bedrock variants, and presence inlitellm.constants.BEDROCK_CONVERSE_MODELS.Pre-existing related tests still green (4-6 + 4-7 configs + bedrock common utils + 1hr cache pricing):
Notes for reviewers
GITHUB_TOKENlacksrepo+workflowscopes, so the branch was pushed viaPUT /repos/{owner}/{repo}/contents/{path}(one commit per file, 5 commits total). Diff is still 4 source files + 1 test file as expected.claude-opus-4-8-YYYYMMDD) is added. Anthropic's docs page (the models comparison table) lists onlyclaude-opus-4-8for both the API ID and alias columns of Opus 4.8, consistent with the 4.6-and-later "dateless format is also a pinned snapshot" policy. Speculative dated SKUs can be added in a follow-up once Anthropic publishes one.litellm.get_model_inforeads in air-gapped / no-HTTP deployments and what every regression test loads viaGetModelCostMap.load_local_model_cost_map(). The new test file pins both files in lock-step on every SKU.Session: https://litellm-agent-platform.onrender.com/sessions/9c1ef9c0-e731-43ff-bc0b-54a47ff9d778