From 3045a2d9b3e0418f2cd42b8d13de68b9b48275f2 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Mon, 8 Jul 2024 16:04:44 -0700 Subject: [PATCH] fix(proxy_server.py): add license protection for 'allowed_ip' address feature --- litellm/proxy/_new_secret_config.yaml | 1 + litellm/proxy/proxy_server.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yaml index 1c0b70d79c..956234f851 100644 --- a/litellm/proxy/_new_secret_config.yaml +++ b/litellm/proxy/_new_secret_config.yaml @@ -19,3 +19,4 @@ model_list: general_settings: alerting: ["slack"] alerting_threshold: 10 + allowed_ips: ["192.168.1.1"] \ No newline at end of file diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 08994a957e..58da69858b 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -1690,6 +1690,12 @@ class ProxyConfig: ui_access_mode = general_settings.get( "ui_access_mode", "all" ) # can be either ["admin_only" or "all"] + ### ALLOWED IP ### + allowed_ips = general_settings.get("allowed_ips", None) + if allowed_ips is not None and premium_user is False: + raise ValueError( + "allowed_ips is an Enterprise Feature. Please add a valid LITELLM_LICENSE to your envionment." + ) ## BUDGET RESCHEDULER ## proxy_budget_rescheduler_min_time = general_settings.get( "proxy_budget_rescheduler_min_time", proxy_budget_rescheduler_min_time