diff --git a/litellm/proxy/litellm_pre_call_utils.py b/litellm/proxy/litellm_pre_call_utils.py index e0e875308..e6bce5392 100644 --- a/litellm/proxy/litellm_pre_call_utils.py +++ b/litellm/proxy/litellm_pre_call_utils.py @@ -75,7 +75,7 @@ async def add_litellm_data_to_request( dict: The modified data dictionary. """ - from litellm.proxy.proxy_server import premium_user + from litellm.proxy.proxy_server import llm_router, premium_user safe_add_api_version_from_query_params(data, request) @@ -166,7 +166,8 @@ async def add_litellm_data_to_request( if user_api_key_dict.allowed_model_region is not None: data["allowed_model_region"] = user_api_key_dict.allowed_model_region - ## [Enterprise Only] Add User-IP Address + ## [Enterprise Only] + # Add User-IP Address requester_ip_address = "" if premium_user is True: # Only set the IP Address for Enterprise Users @@ -179,6 +180,15 @@ async def add_litellm_data_to_request( requester_ip_address = request.client.host data[_metadata_variable_name]["requester_ip_address"] = requester_ip_address + # Enterprise Only - Check if using tag based routing + if llm_router and llm_router.enable_tag_filtering is True: + if premium_user is not True: + verbose_proxy_logger.warning( + "router.enable_tag_filtering is on %s \n switched off router.enable_tag_filtering", + CommonProxyErrors.not_premium_user.value, + ) + llm_router.enable_tag_filtering = False + ### TEAM-SPECIFIC PARAMS ### if user_api_key_dict.team_id is not None: team_config = await proxy_config.load_team_config(