Skip to content

fix(catalog): add current OpenRouter Claude routes (sonnet 5, opus 4.8/-fast, opus 4.7-fast, fable 5) - #33070

Closed
devin-ai-integration[bot] wants to merge 2 commits into
litellm_internal_stagingfrom
litellm_openrouter_claude_catalog_33068
Closed

devin-ai-integration[bot] wants to merge 2 commits into
litellm_internal_stagingfrom
litellm_openrouter_claude_catalog_33068

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Relevant issues

Fixes #33068

Linear ticket

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • 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 (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Screenshots / Proof of Fix

Five Claude routes that OpenRouter currently serves had no openrouter/* entry in the catalog, so litellm resolved zero cost and the generic 200k/64k fallback window for them; cost tracking silently reported nothing and the reported limits were wrong. The live pricing and token limits added here were read straight off the OpenRouter models API so cost tracking matches what OpenRouter actually bills

Confirmed against https://openrouter.ai/api/v1/models at capture time:

anthropic/claude-sonnet-5     | in 0.000002 out 0.00001  cache_r 0.0000002 cache_w 0.0000025  | ctx 1000000 maxout 128000
anthropic/claude-opus-4.8     | in 0.000005 out 0.000025 cache_r 0.0000005 cache_w 0.00000625 | ctx 1000000 maxout 128000
anthropic/claude-opus-4.8-fast| in 0.00001  out 0.00005  cache_r 0.000001  cache_w 0.0000125  | ctx 1000000 maxout 128000
anthropic/claude-opus-4.7-fast| in 0.00003  out 0.00015  cache_r 0.000003  cache_w 0.0000375  | ctx 1000000 maxout 128000
anthropic/claude-fable-5      | in 0.00001  out 0.00005  cache_r 0.000001  cache_w 0.0000125  | ctx 1000000 maxout 128000

Before (base c2141b1113, issue reproduction; every route falls back to zero cost and the wrong window):

$ LITELLM_LOCAL_MODEL_COST_MAP=True python -c "import litellm; ..."
openrouter/anthropic/claude-sonnet-5      | in 0 out 0 ctx 200000 maxout 64000
openrouter/anthropic/claude-opus-4.8      | in 0 out 0 ctx 200000 maxout 64000
openrouter/anthropic/claude-opus-4.8-fast | in 0 out 0 ctx 200000 maxout 64000
openrouter/anthropic/claude-opus-4.7-fast | in 0 out 0 ctx 200000 maxout 64000
openrouter/anthropic/claude-fable-5       | in 0 out 0 ctx 200000 maxout 64000

After (this branch ed5eebee35, live proxy started with python litellm/proxy/proxy_cli.py --config config.yaml, queried over HTTP):

$ curl -s http://localhost:4000/v1/model/info -H "Authorization: Bearer sk-1234"
openrouter/anthropic/claude-sonnet-5      | input 2e-06  output 1e-05    ctx 1000000 maxout 128000
openrouter/anthropic/claude-opus-4.8      | input 5e-06  output 2.5e-05  ctx 1000000 maxout 128000
openrouter/anthropic/claude-opus-4.8-fast | input 1e-05  output 5e-05    ctx 1000000 maxout 128000
openrouter/anthropic/claude-opus-4.7-fast | input 3e-05  output 0.00015  ctx 1000000 maxout 128000
openrouter/anthropic/claude-fable-5       | input 1e-05  output 5e-05    ctx 1000000 maxout 128000

I could not run a live /chat/completions against OpenRouter to show spend tracking end to end because this environment has no OPENROUTER_API_KEY; happy to add that run if a key is provided

Type

🐛 Bug Fix

Changes

Added the five current OpenRouter Claude routes (openrouter/anthropic/claude-sonnet-5, claude-opus-4.8, claude-opus-4.8-fast, claude-opus-4.7-fast, claude-fable-5) to both model_prices_and_context_window.json and the bundled litellm/model_prices_and_context_window_backup.json, mirroring the shape of the existing openrouter/anthropic/claude-opus-4.7 entry. Cache read/write token costs follow Anthropic's standard 0.1x/1.25x-of-input ratios, which line up with the OpenRouter input_cache_read / input_cache_write values

Added test_shipped_backup_has_current_openrouter_claude_routes in tests/test_litellm/litellm_core_utils/test_get_model_cost_map.py, a regression test that asserts each of the five routes ships in the bundled backup with the correct provider, per-token costs, and 1M/128k token limits. It fails on the base branch (the keys don't exist) and passes here

Link to Devin session: https://app.devin.ai/sessions/b0a16337125d4d89a007f589c00298f5

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@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 Jul 13, 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 Jul 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds five missing OpenRouter Claude model entries (openrouter/anthropic/claude-sonnet-5, claude-opus-4.8, claude-opus-4.8-fast, claude-opus-4.7-fast, claude-fable-5) to both JSON catalog files, fixing silently-zero cost tracking and wrong context-window fallbacks for those routes. A regression test is included that loads the local backup and asserts exact pricing and token limits for each entry.

  • Pricing values (input/output/cache read/write) match the figures quoted in the PR description from OpenRouter's models API, and the cache ratios follow the standard 0.1× / 1.25× of input cost.
  • Both model_prices_and_context_window.json and the bundled litellm/model_prices_and_context_window_backup.json receive identical additions and are kept in sync.
  • The new regression test uses only local file loading (GetModelCostMap.load_local_model_cost_map()), so it introduces no network calls to CI.

Confidence Score: 4/5

Safe to merge; changes are additive catalog entries with no impact on existing routes or runtime logic

The change is purely additive — five new JSON entries and one new test. The pricing math checks out against the PR description's quoted OpenRouter values. The only open question is whether the capability flags (computer use, extended reasoning, adaptive thinking) are accurate for claude-fable-5, which appears to have had its flags copied from claude-opus-4.7 rather than sourced per-model from OpenRouter's API response.

The capability flags in both JSON files for openrouter/anthropic/claude-fable-5 deserve a second look to confirm they reflect what OpenRouter actually exposes for that route

Important Files Changed

Filename Overview
model_prices_and_context_window.json Adds five new OpenRouter Claude model entries (sonnet-5, opus-4.8, opus-4.8-fast, opus-4.7-fast, fable-5) with pricing sourced from OpenRouter's API; all entries share identical capability flags copied from the existing claude-opus-4.7 entry, which may not be accurate for every model (e.g. claude-fable-5)
litellm/model_prices_and_context_window_backup.json Identical additions to the bundled backup JSON, kept in sync with the root file; matches the root file exactly
tests/test_litellm/litellm_core_utils/test_get_model_cost_map.py Adds a regression test verifying the five new routes are present in the backup with the correct provider, per-token costs, and 1M/128k token limits; uses only local file loading — no network calls

Reviews (1): Last reviewed commit: "fix(catalog): add current OpenRouter Cla..." | Re-trigger Greptile

Comment on lines +29957 to +29983
"supports_xhigh_reasoning_effort": true
},
"openrouter/anthropic/claude-opus-4.8": {
"supports_adaptive_thinking": true,
"cache_creation_input_token_cost": 6.25e-06,
"cache_read_input_token_cost": 5e-07,
"input_cost_per_token": 5e-06,
"litellm_provider": "openrouter",
"max_input_tokens": 1000000,
"max_output_tokens": 128000,
"max_tokens": 128000,
"mode": "chat",
"output_cost_per_token": 2.5e-05,
"source": "https://openrouter.ai/anthropic/claude-opus-4.8",
"supports_assistant_prefill": false,
"supports_computer_use": true,
"supports_function_calling": true,
"supports_pdf_input": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_max_reasoning_effort": true,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true
},
"openrouter/anthropic/claude-opus-4.8-fast": {

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.

P2 Capability flags copied verbatim from claude-opus-4.7 for claude-fable-5

All five new entries share identical capability flags (including supports_computer_use, supports_reasoning, supports_adaptive_thinking, supports_xhigh_reasoning_effort). This appears to have been copied wholesale from the existing openrouter/anthropic/claude-opus-4.7 entry. For claude-fable-5 in particular — a creative/storytelling-oriented model — it's worth verifying that OpenRouter actually exposes computer use, extended reasoning, and adaptive thinking on this route, since incorrectly advertising those capabilities can cause litellm to attempt features the model doesn't support and produce unexpected errors or incorrect behavior at call time.

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!

@codspeed

codspeed Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_openrouter_claude_catalog_33068 (dd1ae9e) with litellm_internal_staging (c2141b1)

Open in CodSpeed

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Superseded by rolling registry audit #37902, which reverified and absorbed the provider-documented metadata changes at field level

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.

[Bug]: openrouter catalog missing current Claude models (sonnet-5, opus-4.8/-fast, opus-4.7-fast, fable-5) — no pricing/limits resolved

1 participant