fix(catalog): align openrouter prices with live openrouter.ai rates - #39591
fix(catalog): align openrouter prices with live openrouter.ai rates#39591astraltrekkin wants to merge 2 commits into
Conversation
Update the 41 openrouter/* entries whose input, output, or cache-read costs disagreed with GET https://openrouter.ai/api/v1/models. Leave max_tokens, vision flags, and the dormant auto-updater untouched. Co-authored-by: Noa <rainbowgore@users.noreply.github.com>
Greptile SummaryThis PR updates matching OpenRouter input, output, and cache-read prices in both model catalogs and adds a local regression test for selected rates
Confidence Score: 4/5The pricing changes appear safe to merge, with non-blocking test-coverage and comment-policy cleanup recommended Both catalogs remain identical and no incorrect changed price was established, but most updated entries lack value-level regression assertions Files Needing Attention: tests/test_litellm/litellm_core_utils/test_get_model_cost_map.py
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Updates OpenRouter token and cache-read rates while preserving the existing model metadata and catalog schema |
| litellm/model_prices_and_context_window_backup.json | Mirrors the root catalog changes exactly for bundled fallback loading |
| tests/test_litellm/litellm_core_utils/test_get_model_cost_map.py | Adds local root and backup price assertions, but covers only 10 of the 41 changed entries and adds a disallowed explanatory comment |
Reviews (1): Last reviewed commit: "fix(catalog): align openrouter prices wi..." | Re-trigger Greptile
| _OPENROUTER_LIVE_COSTS = { | ||
| "openrouter/qwen/qwen3.5-plus-02-15": (2.6e-07, 1.56e-06, None), | ||
| "openrouter/openai/gpt-oss-120b": (3.7e-08, 1.7e-07, None), | ||
| "openrouter/qwen/qwen3-coder-plus": (6.5e-07, 3.25e-06, None), | ||
| "openrouter/qwen/qwen3.5-flash-02-23": (6.5e-08, 2.6e-07, None), | ||
| "openrouter/qwen/qwen3.5-27b": (1.95e-07, 1.56e-06, None), | ||
| "openrouter/gryphe/mythomax-l2-13b": (6e-08, 6e-08, None), | ||
| "openrouter/mancer/weaver": (4e-07, 7.5e-07, None), | ||
| "openrouter/xiaomi/mimo-v2.5-pro": (4.35e-07, 8.7e-07, 3.6e-09), | ||
| "openrouter/moonshotai/kimi-k2.5": (4.5e-07, 2.25e-06, 7e-08), | ||
| "openrouter/z-ai/glm-5": (6e-07, 1.92e-06, None), | ||
| } |
There was a problem hiding this comment.
Price fixture covers ten models
The regression fixture pins only 10 of 41 changed models, so incorrect rates in omitted entries can pass while producing wrong spend
Context Used: CLAUDE.md (source)
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!
| # OpenRouter headline rates from GET https://openrouter.ai/api/v1/models. | ||
| # These were the catalog values that disagreed with that API (and, for the | ||
| # two spotlight models, the public model pages that their source fields cite). |
There was a problem hiding this comment.
Fixture comment duplicates context
This prose restates the fixture's source and purpose, violating the source-comment policy and adding text that can drift from the test
Context Used: CLAUDE.md (source)
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!
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-authored-by: Noa <rainbowgore@users.noreply.github.com>
|
|
|
Superseded by rolling registry PR #39388, which applies the OpenRouter price fixes re-derived from the live catalog API plus the regression test |
TLDR
Problem this solves:
How it solves it:
User Flow
Before: a developer who bills OpenRouter traffic through LiteLLM records the wrong spend because the catalog still has last quarter's rates
"model": "openrouter/qwen/qwen3.5-plus-02-15"openrouter/openai/gpt-oss-120bshows $0.98 ($0.18 + $0.80 per 1M)After: the same traffic is billed at the rates OpenRouter publishes today
"model": "openrouter/qwen/qwen3.5-plus-02-15"openrouter/openai/gpt-oss-120bnow shows $0.207 ($0.037 + $0.17 per 1M)Relevant issues
#39501
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@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
Shared setup:
curl -s https://openrouter.ai/api/v1/models -o or.json, then compare every overlappingopenrouter/*catalog row'sinput_cost_per_token/output_cost_per_token/cache_read_input_token_costto the APIpricing.prompt/pricing.completion/pricing.input_cache_readBefore ()
27274f65e40fa38870b9e1450ab885e09074644dGET https://openrouter.ai/api/v1/modelsreturned HTTP 200 with 424 modelsmodel_prices_and_context_window.jsonat that commit:comparable=87 mismatch_fields=84 mismatch_entries=41openrouter/qwen/qwen3.5-plus-02-15registry$0.40 / $2.40vs live$0.26 / $1.56(page https://openrouter.ai/qwen/qwen3.5-plus-02-15 agrees with live)openrouter/openai/gpt-oss-120bregistry$0.18 / $0.80vs live$0.037 / $0.17(page https://openrouter.ai/openai/gpt-oss-120b agrees with live)openrouter/anthropic/claude-opus-5already matched live$5 / $25After ()
fe8a7846391127cb071b06c9a1f30551e13283b2GET https://openrouter.ai/api/v1/models(HTTP 200)comparable=87 mismatch_fields=4 mismatch_entries=2openrouter/qwen/qwen3.5-plus-02-15registry$0.26 / $1.56matches liveopenrouter/openai/gpt-oss-120bregistry$0.037 / $0.17matches liveopenrouter/anthropic/claude-opus-5still$5 / $25openrouter/deepseek/deepseek-v4-proandopenrouter/deepseek/deepseek-v4-pro-0813, not the original stale valuesType
🐛 Bug Fix
Caveats (if any)
Medium
*_above_256k_tokensfields were not part of the reported drift and were left aloneLow
max_tokensto context length and would fail the schema onopenrouter/autoFinal Attestation