mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-09 22:31:41 +00:00
Merge c55924ad65 into a2c814654e
This commit is contained in:
commit
8319bd33ce
1 changed files with 12 additions and 7 deletions
|
|
@ -244,10 +244,6 @@ class LowestCostLoggingHandler(CustomLogger):
|
|||
or _deployment.get("model_info", {}).get("rpm", None)
|
||||
or float("inf")
|
||||
)
|
||||
item_litellm_model_name = _deployment.get("litellm_params", {}).get("model")
|
||||
item_litellm_model_cost_map = litellm.model_cost.get(item_litellm_model_name, {})
|
||||
|
||||
# check if user provided input_cost_per_token and output_cost_per_token in litellm_params
|
||||
item_input_cost = None
|
||||
item_output_cost = None
|
||||
if _deployment.get("litellm_params", {}).get("input_cost_per_token", None):
|
||||
|
|
@ -256,11 +252,20 @@ class LowestCostLoggingHandler(CustomLogger):
|
|||
if _deployment.get("litellm_params", {}).get("output_cost_per_token", None):
|
||||
item_output_cost = _deployment.get("litellm_params", {}).get("output_cost_per_token")
|
||||
|
||||
# Fallback: check model_info (mirrors tpm/rpm fallback)
|
||||
if item_input_cost is None:
|
||||
item_input_cost = item_litellm_model_cost_map.get("input_cost_per_token", 5.0)
|
||||
|
||||
item_input_cost = _deployment.get("model_info", {}).get("input_cost_per_token")
|
||||
if item_output_cost is None:
|
||||
item_output_cost = item_litellm_model_cost_map.get("output_cost_per_token", 5.0)
|
||||
item_output_cost = _deployment.get("model_info", {}).get("output_cost_per_token")
|
||||
|
||||
# Fallback: model_cost map (built-in pricing, default 5.0)
|
||||
if item_input_cost is None or item_output_cost is None:
|
||||
item_litellm_model_name = _deployment.get("litellm_params", {}).get("model")
|
||||
_model_cost_entry = litellm.model_cost.get(item_litellm_model_name, {})
|
||||
if item_input_cost is None:
|
||||
item_input_cost = _model_cost_entry.get("input_cost_per_token", 5.0)
|
||||
if item_output_cost is None:
|
||||
item_output_cost = _model_cost_entry.get("output_cost_per_token", 5.0)
|
||||
|
||||
# if litellm["model"] is not in model_cost map -> use item_cost = $10
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue