From 9e9306fd2b3e2398966c4884f4e0ede370ed5efc Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Tue, 23 Apr 2024 19:19:16 +0100 Subject: [PATCH] feat: add LITELLM_PROXY_HOST to configure address litellm listens on --- backend/apps/litellm/main.py | 3 ++- backend/config.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/apps/litellm/main.py b/backend/apps/litellm/main.py index ad5c2afd5..b1752f8c6 100644 --- a/backend/apps/litellm/main.py +++ b/backend/apps/litellm/main.py @@ -28,6 +28,7 @@ from config import ( MODEL_FILTER_LIST, DATA_DIR, LITELLM_PROXY_PORT, + LITELLM_PROXY_HOST, ) from litellm.utils import get_llm_provider @@ -95,7 +96,7 @@ async def run_background_process(command): async def start_litellm_background(): log.info("start_litellm_background") # Command to run in the background - command = f"litellm --port {LITELLM_PROXY_PORT} --telemetry False --config ./data/litellm/config.yaml" + command = f"litellm --port {LITELLM_PROXY_PORT} --host {LITELLM_PROXY_HOST} --telemetry False --config ./data/litellm/config.yaml" await run_background_process(command) diff --git a/backend/config.py b/backend/config.py index 3f67c00d2..f421c8aea 100644 --- a/backend/config.py +++ b/backend/config.py @@ -507,3 +507,4 @@ AUDIO_OPENAI_API_KEY = os.getenv("AUDIO_OPENAI_API_KEY", OPENAI_API_KEY) LITELLM_PROXY_PORT = int(os.getenv("LITELLM_PROXY_PORT", "14365")) if LITELLM_PROXY_PORT < 0 or LITELLM_PROXY_PORT > 65535: raise ValueError("Invalid port number for LITELLM_PROXY_PORT") +LITELLM_PROXY_HOST = os.getenv("LITELLM_PROXY_HOST", "127.0.0.1")