LiteLLM
Videos
Overview: LiteLLM on Ubuntu 24.04 on Azure: overview (watch on YouTube)
Launch and log in: LiteLLM on Ubuntu 24.04 on Azure: launch and log in (watch on YouTube)
Deep Dive: LiteLLM on Ubuntu 24.04 on Azure: deep dive (watch on YouTube)
Overview
LiteLLM is an open-source proxy and gateway that puts a single OpenAI-compatible API in front of 100+ LLM providers, including OpenAI, Anthropic, Azure OpenAI, Bedrock, Vertex AI, Mistral and Ollama. You point your applications at one endpoint, and you can switch or load-balance providers without changing client code. LiteLLM adds virtual keys, per-key budgets, rate limits and request logging.
This image installs LiteLLM 1.88 in a Python virtual environment at /opt/litellm and fronts it with an nginx reverse proxy on TCP 80. First boot generates a unique master key for every VM. The image ships no model weights and is CPU-only.
What you get:
- LiteLLM 1.88 proxy in a Python venv at
/opt/litellm - nginx reverse proxy on
:80in front of the proxy (bound to loopback:4000) - Per-VM master key
sk-…(LITELLM_MASTER_KEY) generated at first boot, in a root-only file litellm.serviceandnginx.serviceas systemd units, enabled and active- An empty model list, ready for you to add your providers
- 24/7 SecureAnyCloud support
Prerequisites
You need an active Azure subscription, an SSH key pair, and a virtual network with a subnet in the target region. Standard_B2s (2 vCPU / 4 GiB RAM) is a good starting point, because LiteLLM is a lightweight gateway and not a model server.
In the network security group (NSG), allow 22/tcp inbound from your management network and 80/tcp from the clients that call the API. For public exposure, front port 80 with TLS (see Enabling HTTPS).
Step 1 - Deploy from the Azure Marketplace
Sign in to the Azure Portal, choose Create a resource, and search the Marketplace for LiteLLM by SecureAnyCloud. Select Create.
- On Basics, pick your subscription, resource group, region and size.
- Under Administrator account, choose SSH public key and paste your key.
- Under Inbound port rules, allow SSH (22) and HTTP (80).
- Choose Review + create, then Create.
Step 2 - Deploy from the Azure CLI
Accept the Marketplace terms once per subscription, then create the VM.
# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:litellm-ubuntu-24-04:default:latest
az vm create \
--resource-group <your-rg> \
--name litellm \
--image sac1647283583153:litellm-ubuntu-24-04:default:latest \
--size Standard_B2s \
--admin-username azureuser \
--ssh-key-values ~/.ssh/id_ed25519.pub \
--vnet-name <your-vnet> --subnet <your-subnet> \
--public-ip-sku Standard
az vm open-port --resource-group <your-rg> --name litellm --port 80 --priority 1010Step 3 - Connect to your VM
Connect over SSH as azureuser.
ssh azureuser@<vm-public-ip>Step 4 - Confirm the services are running
Check the services, the listening ports and the liveliness endpoint.
systemctl is-active litellm.service nginx.service ss -tln | grep -E ':80 |:4000 ' curl -s http://127.0.0.1/health/livelinessBoth services report active. nginx listens on port 80, the LiteLLM proxy listens on loopback 4000, and the liveliness endpoint responds.
Step 5 - Retrieve your master key
First boot generates a master key that is unique to your VM and writes it to a root-only file. Callers pass it as a Bearer token. Print the file.
sudo cat /root/litellm-credentials.txtThe LITELLM_MASTER_KEY value (an sk-… string) is your admin and master key. Keep it secret. Use it to create scoped virtual keys for your applications (Step 8).
Step 6 - Add a provider
LiteLLM ships with an empty model list. Add your providers and credentials to /etc/litellm/config.yaml, then restart the service. This example adds an OpenAI model.
sudo tee -a /etc/litellm/config.yaml >/dev/null <<'YAML' model_list: - model_name: gpt-4o litellm_params: model: openai/gpt-4o api_key: os.environ/OPENAI_API_KEY YAML echo 'OPENAI_API_KEY=<set-at-first-boot>' | sudo tee -a /etc/litellm/litellm.env >/dev/null
sudo systemctl restart litellmLiteLLM supports 100+ providers. See the upstream documentation for the parameters of each.
Step 7 - Call the OpenAI-compatible API
Any OpenAI-compatible client works. Point base_url at the VM and use your master key or a virtual key. List the configured models.
KEY=$(sudo grep '^LITELLM_MASTER_KEY=' /root/litellm-credentials.txt | cut -d= -f2-)
curl -s http://127.0.0.1/models -H "Authorization: Bearer $KEY"Chat completions, embeddings and the other OpenAI routes are served at the same base URL.
Step 8 - Virtual keys, budgets and the admin UI
Use the master key to create scoped virtual keys for each application through the /key/generate API. Each virtual key has its own budget and rate limits, so you never share the master key.
LiteLLM also serves an admin UI for keys, spend and logs.
Step 9 - Confirm the runtime
Check the installed LiteLLM version.
/opt/litellm/venv/bin/pip show litellm | grep ^VersionEnabling HTTPS
For production, terminate TLS at nginx with a real domain pointed at the VM's public IP. Install certbot and request a certificate, replacing the domain with your own.
sudo apt-get update && sudo apt-get install -y certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.example.comBackup and maintenance
Your configuration lives in /etc/litellm/. Keep the OS patched with sudo apt update && sudo apt upgrade. Restart the proxy after configuration changes with sudo systemctl restart litellm. The proxy holds no model weights, so the image stays small and starts fast.
Support
SecureAnyCloud provides 24/7 support for this image. Contact us by email or chat for help with provider integration, virtual keys and budgets, load balancing, TLS and scaling.
All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
Deploy on Azure
Launch LiteLLM on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.
View this image
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com
Overview
This image runs LiteLLM 1.88 on Ubuntu 24.04 LTS. LiteLLM is an open-source gateway that puts a single OpenAI-compatible API in front of more than 100 large language model providers, including OpenAI, Anthropic, Amazon Bedrock, Azure OpenAI, Google and self-hosted models.
LiteLLM is installed in a dedicated Python virtual environment under /opt/litellm on Python 3.12. An unprivileged litellm system account runs it under a systemd service that starts the proxy on boot and restarts it on failure.
The proxy listens on the loopback address 127.0.0.1:4000 and is never exposed directly. nginx is installed as a reverse proxy on port 80 and forwards to it. The unauthenticated liveliness and readiness probes are open, and a master key gates the OpenAI-compatible API.
The proxy is secured by a master key (an sk- key). On the first boot of every deployed instance, a one-shot service generates a fresh master key that is unique to that instance. It writes the key to /root/litellm-credentials.txt (mode 0600, readable only by root). Two instances launched from the same AMI never share a key.
LiteLLM ships no model weights and calls the provider endpoints you configure, so the image is CPU-only. The default security group opens port 22 (SSH) and port 80 (HTTP) only.
Prerequisites
- An AWS account subscribed to this product in AWS Marketplace.
- An EC2 key pair in your target region for SSH access.
- A security group that allows inbound TCP 22 (SSH) from your IP and TCP 80 (HTTP) from your users.
- The recommended instance type,
m5.large. The proxy is lightweight, so size up only for high request volumes. - API keys for the LLM providers you intend to route to.
Connecting to your instance
On Ubuntu 24.04, the login user is ubuntu. Connect with your key pair, as shown in Step 3.
Step 1 - Launch from the AWS Marketplace console
- Open the product page in AWS Marketplace. Choose Continue to Subscribe, then Continue to Configuration.
- Select the LiteLLM 1.88 on Ubuntu 24.04 delivery option and your region, then choose Continue to Launch.
- Choose your instance type, VPC and subnet, key pair, and the security group described above. Then launch.
Step 2 - Launch from the AWS CLI
Launch the instance with the AWS CLI. Replace the AMI ID, key name and security group ID with your own values.
aws ec2 run-instances \
--image-id ami-xxxxxxxxxxxxxxxxx \
--instance-type m5.large \
--key-name your-key \
--security-group-ids sg-xxxxxxxx \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=litellm}]'Step 3 - Connect to your instance
Connect over SSH as ubuntu.
ssh -i your-key.pem ubuntu@<instance-public-ip>Step 4 - Confirm the services are running
Check the services, the listening ports and the liveliness endpoint.
systemctl is-active litellm.service nginx.service ss -tln | grep -E ':80 |:4000 ' curl -s http://127.0.0.1/health/livelinessThe expected output is:
active active LISTEN 0 511 0.0.0.0:80 0.0.0.0:* LISTEN 0 2048 127.0.0.1:4000 0.0.0.0:* LISTEN 0 511 [::]:80 [::]:* "I'm alive!"Step 5 - Retrieve your master key
Print the credentials file.
sudo cat /root/litellm-credentials.txt# LiteLLM - generated on first boot by litellm-firstboot.service LITELLM_URL=http://<instance-public-ip>/ LITELLM_MASTER_KEY=sk-<your-unique-key>The master key authenticates every call to the OpenAI-compatible API. It also creates scoped virtual keys.
Step 6 - Add a provider
Edit /etc/litellm/config.yaml and add your providers under model_list. Then restart the proxy.
model_list: - model_name: gpt-4o litellm_params: model: openai/gpt-4o api_key: os.environ/OPENAI_API_KEY - model_name: claude litellm_params: model: bedrock/anthropic.claude-3-5-sonnet-20240620-v1:0sudo systemctl restart litellm.servicePut provider secrets in /etc/litellm/litellm.env, for example OPENAI_API_KEY=<set-at-first-boot>, so that the os.environ/... references resolve.
Step 7 - Call the OpenAI-compatible API
Every request carries the master key as a Bearer token. List the configured models.
KEY=$(sudo grep '^LITELLM_MASTER_KEY=' /root/litellm-credentials.txt | cut -d= -f2-)
curl -s http://127.0.0.1/models -H "Authorization: Bearer $KEY"{"data":[],"object":"list"}The list is empty until you add providers in Step 6.
Point any OpenAI SDK at http://<instance-public-ip>/ with the master key as the API key, and call chat completions at /chat/completions. The interactive API documentation is served at http://<instance-public-ip>/.
Step 8 - Virtual keys, budgets and the admin UI
The master key creates scoped virtual keys for teams and applications, each with its own budget and rate limits.
Virtual keys, spend persistence and the admin UI at /ui require a database. Set DATABASE_URL in /etc/litellm/litellm.env to a PostgreSQL instance and restart the service. See the LiteLLM documentation for the key-management API.
Step 9 - Confirm the runtime
Check the installed LiteLLM version.
/opt/litellm/venv/bin/pip show litellm | grep ^VersionVersion: 1.88.0Enabling HTTPS
Point a domain at the instance's public IP, then install certbot and request a certificate. Replace the domain with your own.
sudo apt-get update && sudo apt-get install -y certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.example.comcertbot edits the nginx site at /etc/nginx/sites-available/sac-litellm to add the TLS listener and arranges automatic renewal.
Backup and maintenance
- Your configuration lives in
/etc/litellm/config.yaml(providers) and/etc/litellm/litellm.env(the master key and provider secrets). Back up both files. - Restart with
sudo systemctl restart litellm.service. Logs are in the journal:sudo journalctl -u litellm.service. - The proxy is stateless by default. If you enable
DATABASE_URL, back up that database to preserve virtual keys and spend history.
Support
SecureAnyCloud provides 24/7 technical support for this image by email and chat. Support covers LiteLLM deployment, configuring providers and model routing, load balancing and fallbacks, virtual keys and budgets, TLS termination and scaling. Contact details are on the AWS Marketplace listing.
Deploy on AWS
Launch LiteLLM on AWS with 24/7 support from SecureAnyCloud.
View on Marketplace
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com