mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
fix(cost): read litellm.model_cost once in _model_has_known_pricing
The cost-map reload path can swap the litellm.model_cost dict between loop iterations; binding it to a local first makes both key lookups observe the same snapshot
This commit is contained in:
parent
0b89c8f079
commit
1eb49115cf
1 changed files with 2 additions and 1 deletions
|
|
@ -1097,8 +1097,9 @@ def _model_has_known_pricing(model: str, custom_llm_provider: str) -> bool:
|
|||
pricing dimensions checked here); registration is only needed so unknown
|
||||
models can be priced at all.
|
||||
"""
|
||||
model_cost_map = litellm.model_cost
|
||||
for key in (model, f"{custom_llm_provider}/{model}"):
|
||||
entry = litellm.model_cost.get(key)
|
||||
entry = model_cost_map.get(key)
|
||||
if entry is not None and (
|
||||
entry.get("input_cost_per_token") is not None
|
||||
or entry.get("input_cost_per_second") is not None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue