Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(key_management_endpoints.py): allow master key rotations for OSS users

Krrish Dholakia077b69eafa68
diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py
index cd9dabbc34f..df5c5aae6b4 100644
--- a/litellm/proxy/management_endpoints/key_management_endpoints.py
+++ b/litellm/proxy/management_endpoints/key_management_endpoints.py
@@ -1862,7 +1862,11 @@ async def regenerate_key_fn(
user_api_key_cache,
)
- if premium_user is not True:
+ is_master_key_regeneration = data and data.new_master_key is not None
+
+ if (
+ premium_user is not True and not is_master_key_regeneration
+ ): # allow master key regeneration for non-premium users
raise ValueError(
f"Regenerating Virtual Keys is an Enterprise feature, {CommonProxyErrors.not_premium_user.value}"
)