forked from phoenix/litellm-mirror
fix allow user to pass input_cost and output_cost
This commit is contained in:
parent
71a92b4fef
commit
486cbb990c
1 changed files with 23 additions and 6 deletions
|
@ -276,9 +276,26 @@ class LowestCostLoggingHandler(CustomLogger):
|
||||||
item_litellm_model_cost_map = litellm.model_cost.get(
|
item_litellm_model_cost_map = litellm.model_cost.get(
|
||||||
item_litellm_model_name, {}
|
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):
|
||||||
|
item_input_cost = _deployment.get("litellm_params", {}).get(
|
||||||
|
"input_cost_per_token"
|
||||||
|
)
|
||||||
|
|
||||||
|
if _deployment.get("litellm_params", {}).get("output_cost_per_token", None):
|
||||||
|
item_output_cost = _deployment.get("litellm_params", {}).get(
|
||||||
|
"output_cost_per_token"
|
||||||
|
)
|
||||||
|
|
||||||
|
if item_input_cost is None:
|
||||||
item_input_cost = item_litellm_model_cost_map.get(
|
item_input_cost = item_litellm_model_cost_map.get(
|
||||||
"input_cost_per_token", 5.0
|
"input_cost_per_token", 5.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if item_output_cost is None:
|
||||||
item_output_cost = item_litellm_model_cost_map.get(
|
item_output_cost = item_litellm_model_cost_map.get(
|
||||||
"output_cost_per_token", 5.0
|
"output_cost_per_token", 5.0
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue