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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(router): address Greptile review comments
Sameer Kankute7b5e7e05b1fb
diff --git a/litellm/proxy/management_endpoints/model_management_endpoints.py b/litellm/proxy/management_endpoints/model_management_endpoints.pyindex 694fa2b1d55..c091f6b5812 100644--- a/litellm/proxy/management_endpoints/model_management_endpoints.py+++ b/litellm/proxy/management_endpoints/model_management_endpoints.py@@ -32,6 +32,7 @@ from litellm.proxy._types import (ProxyErrorTypes,ProxyException,TeamModelAddRequest,+ TeamModelDeleteRequest,UpdateTeamRequest,UserAPIKeyAuth,)@@ -40,6 +41,7 @@ from litellm.proxy.common_utils.encrypt_decrypt_utils import encrypt_value_helpefrom litellm.proxy.management_endpoints.common_utils import _is_user_team_adminfrom litellm.proxy.management_endpoints.team_endpoints import (team_model_add,+ team_model_delete,update_team,)from litellm.proxy.management_helpers.audit_logs import create_object_audit_log@@ -344,14 +346,15 @@ async def _add_team_model_to_db(prisma_client=prisma_client,)- await team_model_add(- data=TeamModelAddRequest(- team_id=_team_id,- models=[original_model_name],- ),- http_request=Request(scope={"type": "http"}),- user_api_key_dict=user_api_key_dict,- )+ if original_model_name:+ await team_model_add(+ data=TeamModelAddRequest(+ team_id=_team_id,+ models=[original_model_name],+ ),+ http_request=Request(scope={"type": "http"}),+ user_api_key_dict=user_api_key_dict,+ )return model_response@@ -469,6 +472,14 @@ async def _update_existing_team_model_assignment()if old_public_name and public_model_name != old_public_name:+ await team_model_delete(+ data=TeamModelDeleteRequest(+ team_id=team_id,+ models=[old_public_name],+ ),+ http_request=Request(scope={"type": "http"}),+ user_api_key_dict=user_api_key_dict,+ )await team_model_add(data=TeamModelAddRequest(team_id=team_id,diff --git a/litellm/router.py b/litellm/router.pyindex 247f209e338..767938d11fb 100644--- a/litellm/router.py+++ b/litellm/router.py@@ -8870,7 +8870,9 @@ class Router:model = _model_from_aliasif model not in self.model_names:- # Check for team-specific deployments by team_public_model_name+ # Check for team-specific deployments by team_public_model_name.+ # This intentionally takes priority over team pattern routers below,+ # so that named team deployments shadow wildcard/pattern routes.if request_team_id is not None:team_deployments = self._get_all_deployments(model_name=model, team_id=request_team_id