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]

Add validation for STORE_MODEL_IN_DB when updating public model groups (#14269)

Ishaan Jaff5847037b3a13
diff --git a/litellm/proxy/management_endpoints/model_management_endpoints.py b/litellm/proxy/management_endpoints/model_management_endpoints.py
index b8762899f1e..2e1a684e397 100644
--- a/litellm/proxy/management_endpoints/model_management_endpoints.py
+++ b/litellm/proxy/management_endpoints/model_management_endpoints.py
@@ -987,7 +987,7 @@ async def update_public_model_groups(
try:
# Update the public model groups
import litellm
- from litellm.proxy.proxy_server import proxy_config
+ from litellm.proxy.proxy_server import proxy_config, store_model_in_db
# Check if user has admin permissions
if user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN:
@@ -1000,6 +1000,15 @@ async def update_public_model_groups(
},
)
+ # Check if STORE_MODEL_IN_DB is enabled
+ if store_model_in_db is not True:
+ raise HTTPException(
+ status_code=500,
+ detail={
+ "error": "Set `'STORE_MODEL_IN_DB='True'` in your env to enable this feature."
+ },
+ )
+
litellm.public_model_groups = request.model_groups
# Load existing config