'Add new script' (#7052)

Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com>
This commit is contained in:
push-app-to-main[bot]
2025-08-21 20:04:40 +02:00
committed by GitHub
parent 7de8934105
commit f799c90712
4 changed files with 186 additions and 0 deletions

6
ct/headers/litellm Normal file
View File

@@ -0,0 +1,6 @@
__ _ __ __ __ __ ___
/ / (_) /____ / / / / / |/ /
/ / / / __/ _ \/ / / / / /|_/ /
/ /___/ / /_/ __/ /___/ /___/ / / /
/_____/_/\__/\___/_____/_____/_/ /_/

60
ct/litellm.sh Normal file
View File

@@ -0,0 +1,60 @@
#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG
# Author: stout01
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/BerriAI/litellm
APP="LiteLLM"
var_tags="${var_tags:-ai;interface}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-4}"
var_os="${var_os:-debian}"
var_version="${var_version:-12}"
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -f /etc/systemd/system/litellm.service ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
msg_info "Stopping ${APP}"
systemctl stop litellm
msg_ok "Stopped ${APP}"
VENV_PATH="/opt/litellm/.venv"
PYTHON_VERSION="3.13" setup_uv
msg_info "Updating $APP"
$STD "$VENV_PATH/bin/python" -m pip install --upgrade litellm[proxy] prisma
msg_info "Updating DB Schema"
$STD uv --directory=/opt/litellm run litellm --config /opt/litellm/litellm.yaml --use_prisma_db_push --skip_server_startup
msg_ok "DB Schema Updated"
msg_info "Starting ${APP}"
systemctl start litellm
msg_ok "Started ${APP}"
msg_ok "Updated Successfully"
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:4000${CL}"

View File

@@ -0,0 +1,40 @@
{
"name": "LiteLLM",
"slug": "litellm",
"categories": [
20
],
"date_created": "2025-08-07",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": 4000,
"documentation": "https://docs.litellm.ai/",
"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",
"install_methods": [
{
"type": "default",
"script": "ct/litellm.sh",
"resources": {
"cpu": 2,
"ram": 2048,
"hdd": 4,
"os": "Debian",
"version": "12"
}
}
],
"default_credentials": {
"username": "admin",
"password": "sk-1234"
},
"notes": [
{
"text": "Update master key in the config file",
"type": "info"
}
]
}

View File

@@ -0,0 +1,80 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG
# Author: stout01
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/BerriAI/litellm
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
PG_VERSION="17" setup_postgresql
PYTHON_VERSION="3.13" setup_uv
msg_info "Setting up PostgreSQL"
DB_NAME="litellm_db"
DB_USER="litellm"
DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';"
{
echo "${APPLICATION} Credentials"
echo "Database Name: $DB_NAME"
echo "Database User: $DB_USER"
echo "Database Password: $DB_PASS"
} >>~/litellm.creds
msg_ok "Set up PostgreSQL"
msg_info "Setting up Virtual Environment"
mkdir -p /opt/litellm
cd /opt/litellm
$STD uv venv /opt/litellm/.venv
$STD /opt/litellm/.venv/bin/python -m ensurepip --upgrade
$STD /opt/litellm/.venv/bin/python -m pip install --upgrade pip
$STD /opt/litellm/.venv/bin/python -m pip install litellm[proxy] prisma
msg_ok "Installed LiteLLM"
msg_info "Configuring LiteLLM"
mkdir -p /opt
cat <<EOF >/opt/litellm/litellm.yaml
general_settings:
master_key: sk-1234
database_url: postgresql://$DB_USER:$DB_PASS@127.0.0.1:5432/$DB_NAME
store_model_in_db: true
EOF
uv --directory=/opt/litellm run litellm --config /opt/litellm/litellm.yaml --use_prisma_db_push --skip_server_startup
msg_ok "Configured LiteLLM"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/litellm.service
[Unit]
Description=LiteLLM
[Service]
Type=simple
ExecStart=uv --directory=/opt/litellm run litellm --config /opt/litellm/litellm.yaml
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now litellm
msg_ok "Created Service"
motd_ssh
customize
msg_info "Cleaning up"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"