From e49fe47d2ea25fea052635e16231a3db5720accf Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Sat, 27 Apr 2024 14:11:00 -0700 Subject: [PATCH] fix - only run global_proxy_spend on chat completion calls --- litellm/proxy/auth/auth_checks.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/auth/auth_checks.py b/litellm/proxy/auth/auth_checks.py index c037190d35..a393ec90a0 100644 --- a/litellm/proxy/auth/auth_checks.py +++ b/litellm/proxy/auth/auth_checks.py @@ -95,7 +95,15 @@ def common_checks( f"'user' param not passed in. 'enforce_user_param'={general_settings['enforce_user_param']}" ) # 7. [OPTIONAL] If 'litellm.max_budget' is set (>0), is proxy under budget - if litellm.max_budget > 0 and global_proxy_spend is not None: + if ( + litellm.max_budget > 0 + and global_proxy_spend is not None + # only run global budget checks for OpenAI routes + # Reason - the Admin UI should continue working if the proxy crosses it's global budget + and route in LiteLLMRoutes.openai_routes.value + and route != "/v1/models" + and route != "/models" + ): if global_proxy_spend > litellm.max_budget: raise Exception( f"ExceededBudget: LiteLLM Proxy has exceeded its budget. Current spend: {global_proxy_spend}; Max Budget: {litellm.max_budget}"