From ec0de310e8e42c4131fbb84d4d2ac8f124fc57f8 Mon Sep 17 00:00:00 2001 From: Andrew Stout Date: Fri, 8 Aug 2025 16:49:55 -0500 Subject: [PATCH] Refactored litellm script to use uv --- ct/litellm.sh | 5 +++-- frontend/public/json/litellm.json | 2 +- install/litellm-install.sh | 24 +++++++++++------------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/ct/litellm.sh b/ct/litellm.sh index c8e69fcf..db655293 100644 --- a/ct/litellm.sh +++ b/ct/litellm.sh @@ -28,9 +28,10 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi + msg_info "Updating $APP" - $STD apt-get update - pip install litellm[proxy] --upgrade + PYTHON_VERSION="3.13" setup_uv + $STD "$VENV_PATH/bin/python" -m pip install --upgrade litellm[proxy] prisma msg_ok "Updated $APP" exit } diff --git a/frontend/public/json/litellm.json b/frontend/public/json/litellm.json index 24ab079e..b2e7b7d7 100644 --- a/frontend/public/json/litellm.json +++ b/frontend/public/json/litellm.json @@ -10,7 +10,7 @@ "privileged": false, "interface_port": 4000, "documentation": "https://docs.litellm.ai/", - "config_path": "/opt/litellm.yaml", + "config_path": "/opt/litellm/litellm.yaml", "website": "https://www.litellm.ai/", "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/litellm-light.webp", "description": "LLM proxy to call 100+ LLMs in a unified interface & track spend, set budgets per virtual key/user", diff --git a/install/litellm-install.sh b/install/litellm-install.sh index 41dc2fc6..ed65b4ac 100644 --- a/install/litellm-install.sh +++ b/install/litellm-install.sh @@ -13,18 +13,16 @@ setting_up_container network_check update_os -msg_info "Setup Python3" -$STD apt-get install -y \ - python3 \ - python3-dev \ - python3-pip -rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED -msg_ok "Setup Python3" +PYTHON_VERSION="3.13" setup_uv -msg_info "Installing ${APPLICATION}" -$STD pip install 'litellm[proxy]' -$STD pip install 'prisma' -msg_ok "Installed ${APPLICATION}" +msg_info "Setting up Virtual Environment" +mkdir -p /opt/litellm +cd /opt/litellm +$STD uv venv /opt/litellmtwo/.venv +$STD /opt/litellmtwo/.venv/bin/python -m ensurepip --upgrade +$STD /opt/litellmtwo/.venv/bin/python -m pip install --upgrade pip +$STD /opt/litellmtwo/.venv/bin/python -m pip install litellm[proxy] prisma +msg_ok "Installed LiteLLM" PG_VERSION="17" setup_postgresql @@ -47,7 +45,7 @@ msg_ok "Set up PostgreSQL" msg_info "Creating Service" mkdir -p /opt -cat </opt/litellm.yaml +cat </opt/litellm/litellm.yaml general_settings: master_key: sk-1234 database_url: postgresql://$DB_USER:$DB_PASS@127.0.0.1:5432/$DB_NAME @@ -60,7 +58,7 @@ Description=LiteLLM [Service] Type=simple -ExecStart=litellm --config /opt/litellm.yaml --use_prisma_migrate +ExecStart=/opt/litellm/.venv/bin/litellm --config /opt/litellm/litellm.yaml --use_prisma_migrate Restart=always [Install]