From 126b87e3fa786e4cdc15092e7616b4eb7fa7410c Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Thu, 25 Jan 2024 11:32:05 -0800 Subject: [PATCH] (fix) raise exception budget_duration is set and max_budget is Not --- litellm/proxy/proxy_server.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 8b42b94a9..6004fd836 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -1651,11 +1651,12 @@ async def startup_event(): user_id="default_user_id", ) - if ( - prisma_client is not None - and litellm.max_budget > 0 - and litellm.budget_duration is not None - ): + if prisma_client is not None and litellm.max_budget > 0: + if litellm.budget_duration is None: + raise Exception( + "budget_duration not set on Proxy. budget_duration is required to use max_budget." + ) + # add proxy budget to db in the user table await generate_key_helper_fn( user_id=litellm_proxy_budget_name,