Skip to content

Commit 62eb0cc

Browse files
authored
Merge pull request #786 from stout01/ved-litellm-script
LiteLLM Script
2 parents c7c5fa5 + 8a66366 commit 62eb0cc

File tree

3 files changed

+180
-0
lines changed

3 files changed

+180
-0
lines changed

ct/litellm.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: stout01
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/BerriAI/litellm
7+
8+
APP="litellm"
9+
var_tags="${var_tags:-ai;interface}"
10+
var_cpu="${var_cpu:-2}"
11+
var_ram="${var_ram:-2048}"
12+
var_disk="${var_disk:-4}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-12}"
15+
var_unprivileged="${var_unprivileged:-1}"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
27+
if [[ ! -f /etc/systemd/system/litellm.service ]]; then
28+
msg_error "No ${APP} Installation Found!"
29+
exit
30+
fi
31+
32+
msg_info "Stopping ${APP}"
33+
systemctl stop litellm.service
34+
msg_ok "Stopped ${APP}"
35+
36+
VENV_PATH="/opt/litellm/.venv"
37+
PYTHON_VERSION="3.13" setup_uv
38+
39+
msg_info "Updating $APP"
40+
$STD "$VENV_PATH/bin/python" -m pip install --upgrade litellm[proxy] prisma
41+
42+
msg_info "Updating DB Schema"
43+
uv --directory=/opt/litellm run litellm --config /opt/litellm/litellm.yaml --use_prisma_db_push --skip_server_startup
44+
msg_ok "DB Schema Updated"
45+
46+
msg_info "Starting ${APP}"
47+
systemctl start litellm.service
48+
msg_ok "Started ${APP}"
49+
msg_ok "Updated Successfully"
50+
exit
51+
}
52+
53+
start
54+
build_container
55+
description
56+
57+
msg_ok "Completed Successfully!\n"
58+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
59+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
60+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:4000${CL}"

frontend/public/json/litellm.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "LiteLLM",
3+
"slug": "litellm",
4+
"categories": [
5+
20
6+
],
7+
"date_created": "2025-08-07",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 4000,
12+
"documentation": "https://docs.litellm.ai/",
13+
"config_path": "/opt/litellm/litellm.yaml",
14+
"website": "https://www.litellm.ai/",
15+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/litellm-light.webp",
16+
"description": "LLM proxy to call 100+ LLMs in a unified interface & track spend, set budgets per virtual key/user",
17+
"install_methods": [
18+
{
19+
"type": "default",
20+
"script": "ct/litellm.sh",
21+
"resources": {
22+
"cpu": 2,
23+
"ram": 2048,
24+
"hdd": 4,
25+
"os": "Debian",
26+
"version": "12"
27+
}
28+
}
29+
],
30+
"default_credentials": {
31+
"username": "admin",
32+
"password": "sk-1234"
33+
},
34+
"notes": [
35+
{
36+
"text": "Update master key in the config file",
37+
"type": "info"
38+
}
39+
]
40+
}

install/litellm-install.sh

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: stout01
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/BerriAI/litellm
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
PG_VERSION="17" setup_postgresql
17+
PYTHON_VERSION="3.13" setup_uv
18+
19+
msg_info "Setting up PostgreSQL"
20+
DB_NAME="litellm_db"
21+
DB_USER="litellm"
22+
DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"
23+
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
24+
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
25+
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
26+
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
27+
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';"
28+
{
29+
echo "${APPLICATION} Credentials"
30+
echo "Database Name: $DB_NAME"
31+
echo "Database User: $DB_USER"
32+
echo "Database Password: $DB_PASS"
33+
} >>~/litellm.creds
34+
msg_ok "Set up PostgreSQL"
35+
36+
msg_info "Setting up Virtual Environment"
37+
mkdir -p /opt/litellm
38+
cd /opt/litellm
39+
$STD uv venv /opt/litellm/.venv
40+
$STD /opt/litellm/.venv/bin/python -m ensurepip --upgrade
41+
$STD /opt/litellm/.venv/bin/python -m pip install --upgrade pip
42+
$STD /opt/litellm/.venv/bin/python -m pip install litellm[proxy] prisma
43+
msg_ok "Installed LiteLLM"
44+
45+
msg_info "Configuring LiteLLM"
46+
mkdir -p /opt
47+
cat <<EOF >/opt/litellm/litellm.yaml
48+
general_settings:
49+
master_key: sk-1234
50+
database_url: postgresql://$DB_USER:$DB_PASS@127.0.0.1:5432/$DB_NAME
51+
store_model_in_db: true
52+
EOF
53+
54+
uv --directory=/opt/litellm run litellm --config /opt/litellm/litellm.yaml --use_prisma_db_push --skip_server_startup
55+
msg_ok "Configured LiteLLM"
56+
57+
msg_info "Creating Service"
58+
cat <<EOF >/etc/systemd/system/litellm.service
59+
[Unit]
60+
Description=LiteLLM
61+
62+
[Service]
63+
Type=simple
64+
ExecStart=uv --directory=/opt/litellm run litellm --config /opt/litellm/litellm.yaml
65+
Restart=always
66+
67+
[Install]
68+
WantedBy=multi-user.target
69+
EOF
70+
71+
systemctl enable -q --now litellm
72+
msg_ok "Created Service"
73+
74+
motd_ssh
75+
customize
76+
77+
msg_info "Cleaning up"
78+
$STD apt-get -y autoremove
79+
$STD apt-get -y autoclean
80+
msg_ok "Cleaned"

0 commit comments

Comments
 (0)