From 2f140e6231a96dfade20168979ed109aa384be80 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 18 Apr 2025 18:11:48 -0700 Subject: [PATCH] fix(litellm_pre_call_utils.py): support x-litellm-tags even if tag based routing not enabled --- litellm/proxy/litellm_pre_call_utils.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/litellm/proxy/litellm_pre_call_utils.py b/litellm/proxy/litellm_pre_call_utils.py index 4877ad0a36..097f798de2 100644 --- a/litellm/proxy/litellm_pre_call_utils.py +++ b/litellm/proxy/litellm_pre_call_utils.py @@ -433,14 +433,13 @@ class LiteLLMProxyRequestSetup: ) -> Optional[List[str]]: tags = None - if llm_router and llm_router.enable_tag_filtering is True: - # Check request headers for tags - if "x-litellm-tags" in headers: - if isinstance(headers["x-litellm-tags"], str): - _tags = headers["x-litellm-tags"].split(",") - tags = [tag.strip() for tag in _tags] - elif isinstance(headers["x-litellm-tags"], list): - tags = headers["x-litellm-tags"] + # Check request headers for tags + if "x-litellm-tags" in headers: + if isinstance(headers["x-litellm-tags"], str): + _tags = headers["x-litellm-tags"].split(",") + tags = [tag.strip() for tag in _tags] + elif isinstance(headers["x-litellm-tags"], list): + tags = headers["x-litellm-tags"] # Check request body for tags if "tags" in data and isinstance(data["tags"], list): tags = data["tags"]