(chore) - enforce model budgets on virtual keys as enterprise feature (#7353)

* docs - enforce model budget as enterprise feature

* docs link to correct place
This commit is contained in:
Ishaan Jaff 2024-12-21 14:18:53 -08:00 committed by GitHub
parent d80307b7bb
commit 23d277f167
4 changed files with 132 additions and 136 deletions

View file

@ -1933,7 +1933,7 @@ async def _enforce_unique_key_alias(
def validate_model_max_budget(model_max_budget: Optional[Dict]) -> None:
"""
Validate the model_max_budget is GenericBudgetConfigType
Validate the model_max_budget is GenericBudgetConfigType + enforce user has an enterprise license
Raises:
Exception: If model_max_budget is not a valid GenericBudgetConfigType
@ -1944,6 +1944,12 @@ def validate_model_max_budget(model_max_budget: Optional[Dict]) -> None:
if len(model_max_budget) == 0:
return
if model_max_budget is not None:
from litellm.proxy.proxy_server import CommonProxyErrors, premium_user
if premium_user is not True:
raise ValueError(
f"You must have an enterprise license to set model_max_budget. {CommonProxyErrors.not_premium_user.value}"
)
for _model, _budget_info in model_max_budget.items():
assert isinstance(_model, str)