From f122aa1b736e4f349ffbf15a11997ca4df07a541 Mon Sep 17 00:00:00 2001 From: shivam Date: Tue, 14 Apr 2026 20:47:57 -0700 Subject: [PATCH 1/3] fix(router): restore BYOK key injection for vector store endpoints with team-scoped deployments When vector store endpoints (POST/GET /v1/vector_stores) are called, model=None is passed to the router. map_team_model(None, team_id) was returning None unchanged after the team model routing fix in #25148, so the router never found the team's BYOK deployment and forwarded requests without the API key. Fix: when team_model_name is None, return the matched deployment's team_public_model_name (or model_name fallback) so the router can route to it and inject the BYOK credentials. Does not affect the sibling-deployment load-balancing fix since that only applies when a non-None model is passed. Co-Authored-By: Claude Sonnet 4.6 --- litellm/router.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/litellm/router.py b/litellm/router.py index 9185e437a3a..89275fa9025 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -8321,7 +8321,9 @@ class Router: # No match found return None - def map_team_model(self, team_model_name: str, team_id: str) -> Optional[str]: + def map_team_model( + self, team_model_name: Optional[str], team_id: str + ) -> Optional[str]: """ Check if team_model_name resolves to team-specific deployments. @@ -8329,6 +8331,11 @@ class Router: sibling deployments via team_id filtering, instead of collapsing to a single internal model_name. + When team_model_name is None (e.g. vector store / file endpoints that + don't include a model in their request), returns the first matching + team deployment's team_public_model_name so the router can inject BYOK + credentials from the team-scoped deployment. + Returns: - str: the team_model_name if team deployments exist for this team - None: if no team-specific model is found @@ -8338,6 +8345,13 @@ class Router: return None for model in models: if model.get("model_info", {}).get("team_id") == team_id: + if team_model_name is None: + # No model was specified (e.g. vector store endpoints). + # Return the deployment's public model name so the router + # can route to it and inject the BYOK API key. + return model.get("model_info", {}).get( + "team_public_model_name" + ) or model.get("model_name") return team_model_name # No team-scoped deployment found; wildcard/pattern routes are From b217ad44d315cfa046569addac5bf729011f0a98 Mon Sep 17 00:00:00 2001 From: shivam Date: Thu, 23 Apr 2026 17:31:37 -0700 Subject: [PATCH 2/3] rerun tests --- litellm/router.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/router.py b/litellm/router.py index 89275fa9025..37b898deb48 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -6,7 +6,7 @@ # +-----------------------------------------------+ # # Thank you ! We ❤️ you! - Krrish & Ishaan - +#test import asyncio import copy import enum From 812044a80505f3eb1d8f5d3a5fa8f14efa1276cc Mon Sep 17 00:00:00 2001 From: shivam Date: Thu, 23 Apr 2026 17:34:19 -0700 Subject: [PATCH 3/3] rerun tests --- litellm/router.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/router.py b/litellm/router.py index 37b898deb48..89275fa9025 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -6,7 +6,7 @@ # +-----------------------------------------------+ # # Thank you ! We ❤️ you! - Krrish & Ishaan -#test + import asyncio import copy import enum