This commit is contained in:
Harings Rob 2025-04-24 01:03:24 -07:00 committed by GitHub
commit 2ea6ffa36e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2291,6 +2291,11 @@ def register_model(model_cost: Union[str, dict]): # noqa: PLR0915
loaded_model_cost = litellm.get_model_cost_map(url=model_cost)
for key, value in loaded_model_cost.items():
## Change, if present, input_cost_per_token and output_cost_per_token to float
if "input_cost_per_token" in value:
value["input_cost_per_token"] = float(value["input_cost_per_token"])
if "output_cost_per_token" in value:
value["output_cost_per_token"] = float(value["output_cost_per_token"])
## get model info ##
try:
existing_model: dict = cast(dict, get_model_info(model=key))