From 1b259a929c6553e89cc1c2bdfe7f440474d33874 Mon Sep 17 00:00:00 2001 From: oss-agent-shin <279349115+oss-agent-shin@users.noreply.github.com> Date: Thu, 7 May 2026 01:53:52 +0000 Subject: [PATCH] Fix pass-through route filter constraints Co-authored-by: ishaan-berri --- .../pass_through_endpoints/pass_through_endpoints.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py index 15ae862453c..7e71626ae81 100644 --- a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py +++ b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py @@ -2559,6 +2559,7 @@ async def _filter_endpoints_by_team_allowed_routes( ) allowed_passthrough_routes: List[str] = [] + has_passthrough_route_constraints = False # retrieve team metadata team_metadata = team.metadata @@ -2566,18 +2567,23 @@ async def _filter_endpoints_by_team_allowed_routes( team_metadata is not None and team_metadata.get("allowed_passthrough_routes") is not None ): + has_passthrough_route_constraints = True allowed_passthrough_routes.extend( team_metadata.get("allowed_passthrough_routes") or [] ) - if team.access_group_ids: + team_access_group_ids = getattr(team, "access_group_ids", None) or [] + if not isinstance(team_access_group_ids, list): + team_access_group_ids = [] + if team_access_group_ids: + has_passthrough_route_constraints = True allowed_passthrough_routes.extend( await _get_pass_through_routes_from_access_groups( - access_group_ids=team.access_group_ids, + access_group_ids=team_access_group_ids, ) ) - if allowed_passthrough_routes: + if has_passthrough_route_constraints: ## FILTER pass_through_endpoints by allowed_passthrough_routes pass_through_endpoints = [ endpoint