fix(proxy/cost): dedupe pricing-lookup warning per unresolvable model#2505
Open
Parideboy wants to merge 1 commit into
Open
fix(proxy/cost): dedupe pricing-lookup warning per unresolvable model#2505Parideboy wants to merge 1 commit into
Parideboy wants to merge 1 commit into
Conversation
Custom/unknown models routed through litellm fail pricing resolution on every request, flooding proxy.log with an identical WARNING per call. Track warned models in a module-level set and log once per model per process lifetime. Fixes headroomlabs-ai#2504 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Parideboy
requested review from
DevanshiVyas,
JerrettDavis and
chopratejas
as code owners
July 23, 2026 10:50
Contributor
PR governanceThis PR follows the template and is marked ready for human review. |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Custom/unknown models routed through the proxy (e.g.
glm-5.2via an OpenAI-compatible backend) fail litellm pricing resolution on every single request. This logs an identicalWARNING - Failed to get pricing for model X: ...line per API call, floodingproxy.login long-running sessions.Type of Change
Changes Made
_pricing_warned_models: set[str]inheadroom/proxy/cost.py.tests/test_pricing_warning_dedup.pyasserting a single warning is emitted across 5 repeatedestimate_costcalls for the same unresolvable model.Testing
Real Behavior Proof
G:\Programmi Aggiuntivi\headroom, branchfix/dedupe-pricing-warningoffupstream/mainpython -m pytest tests/test_pricing_warning_dedup.py -vCostTracker.estimate_cost()for an unresolvable model produced exactly 1WARNINGlog line instead of 5Review Readiness
Fixes #2504