Repository navigation
refactor(cost-map): remove openrouter rows from the cost map - #45623
devin-ai-integration[bot] wants to merge 7 commits into
Conversation
…om provider usage.cost Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
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. |
|
Merging this PR will not alter performance
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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>
…uter_cost_map Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> # Conflicts: # tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_typesafe_passthrough_logging_handler.py
LiteLLM removed every OpenRouter row from its price file (BerriAI/litellm#45623). The daily price update then failed the backend and frontend tests, and merging it would have dropped OpenRouter span costs, max output token limits and input modality flags. - scripts/update_openrouter_model_prices.py writes model_prices_openrouter.json (backend and frontend copies) from OpenRouter's public model list, in LiteLLM's row format. The daily price workflow runs it; a failed fetch keeps the current file. - CostService.readModelCosts merges both files for cost estimation and ModelCapabilities. The frontend model capabilities and the provider model sync read the OpenRouter file too. - JsonUtils.readJsonFile throws FileNotFoundException naming a missing resource, and a price file that can't be read or holds no model fails with its name. - Tests cover OpenRouter pricing, prompt-size tiers, vision support and the missing-resource error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* [NA] [BE] Update model prices file * fix(pricing): price OpenRouter models from OpenRouter's model list LiteLLM removed every OpenRouter row from its price file (BerriAI/litellm#45623). The daily price update then failed the backend and frontend tests, and merging it would have dropped OpenRouter span costs, max output token limits and input modality flags. - scripts/update_openrouter_model_prices.py writes model_prices_openrouter.json (backend and frontend copies) from OpenRouter's public model list, in LiteLLM's row format. The daily price workflow runs it; a failed fetch keeps the current file. - CostService.readModelCosts merges both files for cost estimation and ModelCapabilities. The frontend model capabilities and the provider model sync read the OpenRouter file too. - JsonUtils.readJsonFile throws FileNotFoundException naming a missing resource, and a price file that can't be read or holds no model fails with its name. - Tests cover OpenRouter pricing, prompt-size tiers, vision support and the missing-resource error. --------- Co-authored-by: Andres Cruz <andresc@comet.com>
Summary
OpenRouter returns its own price in
usage.coston every response, and since #45640 (merged) every OpenRouter path bills from it: chat, image gen and edit, Responses,/v1/decisionsand the/openrouter/alpha/decisionspass-through. The 496litellm_provider: openrouterrows in the cost map are redundant, so this PR deletes them frommodel_prices_and_context_window.jsonandlitellm/model_prices_and_context_window_backup.json, regeneratesmodel_prices_and_context_window.schema.json, and drops the tests that pinned removed keys (test_openrouter_gpt_image_model_metadata.pyand single assertions intest_get_model_cost_map.py,test_utils.py,test_claude_sonnet_5_config.py,test_anthropic_chat_transformation.py,test_tool_call_cost_tracking.py). No source file changes. litellm-providers stopped syncing OpenRouter in https://github.com/BerriAI/litellm-providers/pull/254, so the rows will not come backReviewing the map diff
GitHub's default line diff mis-anchors on repeated lines like
},and shows thousands of insertions. Nothing is added:496 keys removed, none added, every removed row is OpenRouter, every remaining row is byte-identical to main. The backup file prints the same
Caveats
litellm.get_model_info("openrouter/...")andget_max_tokensnow raiseModelNotMappedErrorfor these modelscompletion_cost()on a rebuilt stream response raises for OpenRouter modelslitellm.openrouter_models, use theopenrouter/prefixusage.cost, spend for that request falls back to the map and is 0Link 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