forked from phoenix/litellm-mirror
(fix) use get_attr for valid_token
This commit is contained in:
parent
25332b4a60
commit
63f18e7163
1 changed files with 3 additions and 2 deletions
|
@ -383,8 +383,9 @@ async def user_api_key_auth(
|
|||
|
||||
# Token exists, not expired now check if its in budget for the user
|
||||
if valid_token.spend is not None and valid_token.user_id is not None:
|
||||
user_max_budget = user_id_information.max_budget
|
||||
user_current_spend = user_id_information.spend
|
||||
user_max_budget = getattr(user_id_information, "max_budget", None)
|
||||
user_current_spend = getattr(user_id_information, "spend", None)
|
||||
|
||||
if user_max_budget is not None and user_current_spend is not None:
|
||||
if user_current_spend > user_max_budget:
|
||||
raise Exception(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue