From 92753f558cfb737f0c73286e8315e8a2590ab254 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Tue, 5 Mar 2024 19:03:27 -0800 Subject: [PATCH] (fix) _update_team_db --- litellm/proxy/proxy_server.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 628f5585232..edb5c6970f3 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -1247,6 +1247,11 @@ async def update_database( # Calculate the new cost by adding the existing cost and response_cost new_spend = existing_spend + response_cost + if existing_spend_obj is None: + spend_per_model = {} + else: + spend_per_model = existing_spend_obj.model_spend or {} + # track cost per model, for the given team spend_per_model = existing_spend_obj.model_spend or {} current_model = kwargs.get("model")