Skip to content

refactor(cost-map): remove openrouter rows, part 5 of 5 - #45669

Merged
klu-berri merged 8 commits into
mainfrom
litellm_remove_openrouter_cost_map_5
Oct 9, 2026
Merged

klu-berri merged 8 commits into
mainfrom
litellm_remove_openrouter_cost_map_5

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Part 5 of 5 of removing the redundant litellm_provider: openrouter rows from the cost map (OpenRouter bills from usage.cost since #45640; see #45665 for why this is split into 5 stacked deletion-only PRs). Stacked on part 4

Deletes the last six small blocks, 21 rows including openrouter/anthropic/claude-sonnet-5.5 and openrouter/mistralai/mistral-large-4-0, from model_prices_and_context_window.json and litellm/model_prices_and_context_window_backup.json, and drops openrouter/anthropic/claude-sonnet-5.5 from SONNET_5_5_VARIANTS in tests/unit/test_claude_sonnet_5_config.py. After this PR no litellm_provider: openrouter row is left. The resulting files are byte-identical to the single-PR version in #45623

Check against the base branch:

python3 -c "import json,subprocess as s;o=json.loads(s.check_output(['git','show','origin/litellm_remove_openrouter_cost_map_4:model_prices_and_context_window.json']));n=json.load(open('model_prices_and_context_window.json'));r=set(o)-set(n);print(len(r),set(n)-set(o),all(o[k]['litellm_provider']=='openrouter' for k in r),all(o[k]==n[k] for k in n))"
# 21 set() True True

Caveats once all five parts are in:

  • litellm.get_model_info("openrouter/...") and get_max_tokens raise ModelNotMappedError for these models
  • SDK completion_cost() on a rebuilt stream response raises for OpenRouter models
  • Bare model names no longer infer OpenRouter from litellm.openrouter_models, use the openrouter/ prefix
  • Deployments that relied on a built-in row's tiered or cache pricing lose it unless priced in config
  • If OpenRouter ever omits usage.cost, spend for that request falls back to the map and is 0

Link to Devin session: https://app.devin.ai/sessions/24b478924abd4f92b269b1556a5fcca6
Open in Devin Desktop: https://app.devin.ai/desktop/session/24b478924abd4f92b269b1556a5fcca6?variant=devin
Requested by: @kerry-berri


Note

Devin errored when opening this Pull Request as kerry-berri.
As a fallback, Devin opened this PR as itself.

kerry-berri and others added 5 commits October 9, 2026 21:09
… google block)

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

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


kerry seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 3/5

[Medium impact] Removes OpenRouter model pricing data from configuration.

Resolve the broken model-detail and SDK cost lookups before merging

Findings

  1. P1 Model details stop loading ▶
  2. P1 SDK cost calculation fails ▶

Summary

Removes the final 21 OpenRouter rows from both price maps and drops the OpenRouter Sonnet case from SONNET_5_5_VARIANTS

  • OpenRouter models no longer have built-in cost-map rows.

Reviews (1) · Last reviewed commit: "refactor(cost-map): remove openrouter ro..." · Reviewed by Greptile

@@ -71088,46 +70705,6 @@
"supports_vision": true,
"supports_web_search": 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 Model details stop loading

Deleting this row makes get_model_info("openrouter/mistralai/mistral-large-4-0") raise ModelNotMappedError and removes its token limits. Other providers’ rows cannot replace it, and OpenRouter has no replacement lookup. Router callers can also fail before merging user-supplied details. Keep the metadata available; removing it unconditionally violates the repository rule against breaking existing behavior without a user-controlled flag

Rule Used: What: avoid backwards-incompatible changes without a user-controlled flag Why: they break current behavior for users relying on existing functionality Bad: #22164 added _run_post_custom_auth_checks unconditi... (source)

Knowledge Base Used: Provider adapters and capabilities

@@ -68807,324 +68807,6 @@
"supports_tool_choice": true,
"supports_vision": 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 SDK cost calculation fails

Deleting these prices breaks SDK completion_cost() for rebuilt OpenRouter streams, even when usage.cost survives. For models such as openrouter/cohere/command-a-plus, that helper still reads the map and raises when lookup fails. Without a reported charge, request logging also loses its price fallback. Teach the SDK helper to use the reported charge and preserve the fallback before deleting these rows

Knowledge Base Used: Provider adapters and capabilities

@codecov

codecov Bot commented Oct 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

kerry-berri and others added 2 commits October 9, 2026 22:33
…ve_openrouter_cost_map_5

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Base automatically changed from litellm_remove_openrouter_cost_map_4 to main October 9, 2026 22:40
@klu-berri
klu-berri enabled auto-merge (squash) October 9, 2026 22:48
@klu-berri
klu-berri merged commit 3ea8069 into main Oct 9, 2026
82 checks passed
@klu-berri
klu-berri deleted the litellm_remove_openrouter_cost_map_5 branch October 9, 2026 22:48
@codspeed

codspeed Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

⚠️ 1 benchmark spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 31 untouched benchmarks


Comparing litellm_remove_openrouter_cost_map_5 (7ac5aee) with main (d1945f6)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (fe3ace9) during the generation of this report, so d1945f6 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

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.

3 participants