From 87fa3323ff238171f0da20c368bed025a0ee86b0 Mon Sep 17 00:00:00 2001 From: Mateo Wang <277851410+mateo-berri@users.noreply.github.com> Date: Fri, 1 May 2026 15:51:40 -0700 Subject: [PATCH] Update litellm/router.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- litellm/router.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/litellm/router.py b/litellm/router.py index ab92e1e24f..d01397fd0f 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -9422,15 +9422,21 @@ class Router: _pre_model_access_group_filter_len > 0 and len(healthy_deployments) == 0 ) + if len(healthy_deployments) == 0: + # check if the user sent in a deployment name instead + # Do not fall back when access-group filtering removed every candidate; if len(healthy_deployments) == 0: # check if the user sent in a deployment name instead # Do not fall back when access-group filtering removed every candidate; # _get_deployment_by_litellm_model does not re-apply that filter. if _pre_model_access_group_filter_len == 0: - healthy_deployments = self._get_deployment_by_litellm_model(model=model) - - if verbose_router_logger.isEnabledFor(logging.DEBUG): - verbose_router_logger.debug( + _litellm_model_deployments = self._get_deployment_by_litellm_model(model=model) + healthy_deployments = self._filter_deployments_by_model_access_groups( + model=model, + healthy_deployments=_litellm_model_deployments, + request_kwargs=request_kwargs, + request_team_id=request_team_id, + ) f"initial list of deployments: {healthy_deployments}" )