Skip to content

feat(models): add Claude Opus 4.8 across anthropic/bedrock/vertex/azure_ai - #29204

Closed
oss-agent-shin wants to merge 5 commits into
BerriAI:litellm_oss_agent_shin_daily_branchfrom
oss-agent-shin:lit3410-claude-opus-4-8
Closed

feat(models): add Claude Opus 4.8 across anthropic/bedrock/vertex/azure_ai#29204
oss-agent-shin wants to merge 5 commits into
BerriAI:litellm_oss_agent_shin_daily_branchfrom
oss-agent-shin:lit3410-claude-opus-4-8

Conversation

@oss-agent-shin

Copy link
Copy Markdown
Contributor

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

File Change
model_prices_and_context_window.json +9 SKU entries for claude-opus-4-8 (anthropic, 4× bedrock regional, global bedrock, 2× vertex, azure_ai)
litellm/model_prices_and_context_window_backup.json Same 9 entries — this is the file the runtime actually loads via GetModelCostMap.load_local_model_cost_map(); drifting from the source JSON silently breaks pip-installed deployments
litellm/constants.py anthropic.claude-opus-4-8 added to BEDROCK_CONVERSE_MODELS so Bedrock dispatch routes to converse (instead of legacy invoke, which drops output_config.effort)
litellm/setup_wizard.py Add claude-opus-4-8 to the Anthropic models list + refresh the provider description
tests/test_litellm/test_claude_opus_4_8_config.py 48 regression tests pinning entry presence, pricing, context window, capability flags, provider routing, bedrock_output_config_effort_ceiling, and the bundled-backup loader path

All 9 entries mirror the existing claude-opus-4-7 schema (same pricing, same context, same capability surface per Anthropic's models page), with one provider-specific exception — azure_ai/claude-opus-4-8 caps max_input_tokens at 200k per the Microsoft Foundry footnote in Anthropic's docs.

Pricing & spec source

Verified against Anthropic's official models page:

Field Value
Anthropic API ID claude-opus-4-8
Bedrock ID anthropic.claude-opus-4-8
Vertex ID claude-opus-4-8
Input price $5 / MTok
Output price $25 / MTok
Cross-region uplift (us./eu./au.) +10% (matches all prior Opus 4.x SKUs)
Context window 1M tokens (200k on Microsoft Foundry)
Max output 128k tokens
Adaptive thinking yes
Vision / tools / PDF / prompt-caching / computer-use yes

Evidence

BEFORE — clean upstream main (no Opus 4.8 entries)

>>> import litellm
>>> litellm.get_model_info(model="claude-opus-4-8", custom_llm_provider="anthropic")
Exception: This model isn't mapped yet. model=claude-opus-4-8, custom_llm_provider=anthropic.
Add it here - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json.

>>> litellm.get_model_info(model="anthropic.claude-opus-4-8", custom_llm_provider="bedrock_converse")
Exception: This model isn't mapped yet. model=anthropic.claude-opus-4-8, custom_llm_provider=bedrock_converse.
Add it here - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json.

vertex_ai/claude-opus-4-8 was even worse — it silently wildcard-fell-back to vertex_ai/claude-opus-4 which 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

claude-opus-4-8                       in=5.00e-06 out=2.50e-05 max_in=1000000 max_out=128000 provider=anthropic
anthropic.claude-opus-4-8             in=5.00e-06 out=2.50e-05 max_in=1000000 max_out=128000 provider=bedrock_converse
us.anthropic.claude-opus-4-8          in=5.50e-06 out=2.75e-05 max_in=1000000 max_out=128000 provider=bedrock_converse
eu.anthropic.claude-opus-4-8          in=5.50e-06 out=2.75e-05 max_in=1000000 max_out=128000 provider=bedrock_converse
au.anthropic.claude-opus-4-8          in=5.50e-06 out=2.75e-05 max_in=1000000 max_out=128000 provider=bedrock_converse
global.anthropic.claude-opus-4-8      in=5.00e-06 out=2.50e-05 max_in=1000000 max_out=128000 provider=bedrock_converse
vertex_ai/claude-opus-4-8             in=5.00e-06 out=2.50e-05 max_in=1000000 max_out=128000 provider=vertex_ai-anthropic_models
vertex_ai/claude-opus-4-8@default     in=5.00e-06 out=2.50e-05 max_in=1000000 max_out=128000 provider=vertex_ai-anthropic_models
azure_ai/claude-opus-4-8              in=5.00e-06 out=2.50e-05 max_in=200000  max_out=128000 provider=azure_ai

Synthetic billing math for 1M input + 500k output tokens:

claude-opus-4-8 (anthropic)            $17.50  ✓ matches $5 + $12.50 published rate
anthropic.claude-opus-4-8 (bedrock)    $17.50  ✓
us.anthropic.claude-opus-4-8 (xregion) $19.25  ✓ matches +10% uplift
vertex_ai/claude-opus-4-8              $17.50  ✓ — was $90.00 via the wildcard fallback (5.1× overcharge)

Regression tests

$ pytest tests/test_litellm/test_claude_opus_4_8_config.py -v
============================== 48 passed in 0.35s ==============================

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=xhigh on the Bedrock variants, and presence in litellm.constants.BEDROCK_CONVERSE_MODELS.

Pre-existing related tests still green (4-6 + 4-7 configs + bedrock common utils + 1hr cache pricing):

$ pytest tests/test_litellm/test_claude_opus_4_6_config.py          tests/test_litellm/llms/bedrock/test_bedrock_common_utils.py          tests/test_litellm/test_bedrock_anthropic_1hr_cache_pricing.py -v
============================== 41 passed in 0.89s ==============================

Notes for reviewers

  • Push path: the agent's GITHUB_TOKEN lacks repo+workflow scopes, so the branch was pushed via PUT /repos/{owner}/{repo}/contents/{path} (one commit per file, 5 commits total). Diff is still 4 source files + 1 test file as expected.
  • No dated alias (claude-opus-4-8-YYYYMMDD) is added. Anthropic's docs page (the models comparison table) lists only claude-opus-4-8 for 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.
  • Backup JSON parity is the highest-impact line in this PR — the bundled backup is what litellm.get_model_info reads in air-gapped / no-HTTP deployments and what every regression test loads via GetModelCostMap.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

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@greptile-apps

greptile-apps Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

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

  • All 9 new SKU entries are present in both JSON files with correct base pricing, context windows, capability flags, and bedrock_output_config_effort_ceiling; the Bedrock BEDROCK_CONVERSE_MODELS registration and the setup wizard update are correct.
  • The anthropic-native claude-opus-4-8 entry (in both JSON files) stores provider_specific_entry as a JSON array of pairs instead of an object; every other Opus 4.x entry uses the object form, and the cost-calculation code calls .get() directly on this value — silently discarding the 10% geo/speed uplift for all affected requests.
  • The 48 new regression tests cover entry presence and base pricing but do not exercise the geo/speed multiplier path, so the format bug passes undetected.

Confidence Score: 3/5

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

Important Files Changed

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

Comment on lines +10247 to +10258
"provider_specific_entry": [
[
"us",
1.1
],
[
"fast",
6.0
]
],
"supports_minimal_reasoning_effort": true,
"supports_output_config": true

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.

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

Simon-Stone added a commit to Simon-Stone/litellm that referenced this pull request May 29, 2026
…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
@github-actions

Copy link
Copy Markdown
Contributor

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.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants