Skip to main content

Quick Deploy

LiteLLM can be deployed to Render with a single click: Deploy to Render
1

Click Deploy Button

Click the “Deploy to Render” button above to start the deployment process.
2

Connect GitHub

Authorize Render to access the LiteLLM repository (or fork it to your account).
3

Configure Environment

Set required environment variables:
  • LITELLM_MASTER_KEY - Master key for authentication
  • OPENAI_API_KEY - Your OpenAI API key (if using OpenAI)
  • ANTHROPIC_API_KEY - Your Anthropic API key (if using Anthropic)
  • Additional provider keys as needed
4

Deploy

Render will automatically:
  • Build the Docker image
  • Provision a PostgreSQL database
  • Deploy the service with SSL
  • Provide a public URL

Manual Render Deployment

Create New Web Service

1

Create Service

  1. Go to Render Dashboard
  2. Click New +Web Service
  3. Connect your Git repository or use https://github.com/BerriAI/litellm
2

Configure Service

Basic Settings:
  • Name: litellm-proxy
  • Region: Choose closest to your users
  • Branch: main
  • Runtime: Docker
  • Dockerfile Path: ./Dockerfile
3

Set Instance Type

Recommended tiers:
  • Development: Starter ($7/month)
  • Production: Standard (25/month)orPro(25/month) or Pro (85/month)
  • Enterprise: Pro Plus ($250/month)
Resource recommendations:
Development:  512MB RAM, 0.5 CPU
Production:   2GB RAM, 1 CPU
High Traffic: 4GB RAM, 2 CPU
4

Configure Environment

Add environment variables (see configuration section below)

Database Setup

Create PostgreSQL Database

1

Create Database

  1. From Render Dashboard, click New +PostgreSQL
  2. Choose same region as web service
  3. Select database plan:
    • Free: 90-day trial (1GB storage)
    • Starter: $7/month (10GB storage)
    • Standard: $20/month (50GB storage)
2

Get Connection String

After creation, copy the Internal Database URL:
postgresql://user:[email protected]/litellm_db
3

Add to Web Service

In your web service environment variables:
DATABASE_URL=postgresql://user:[email protected]/litellm_db
STORE_MODEL_IN_DB=True
Use the Internal Database URL (not External) for better performance and security within Render.

Environment Configuration

Required Variables

# Authentication
LITELLM_MASTER_KEY=sk-1234  # Change this!

# Database (use Render's PostgreSQL internal URL)
DATABASE_URL=postgresql://user:pass@host/db
STORE_MODEL_IN_DB=True

Provider API Keys

OPENAI_API_KEY=sk-proj-...

Optional Configuration

# Redis for caching (use Render Redis)
REDIS_HOST=red-xxx.oregon-redis.render.com
REDIS_PORT=6379
REDIS_PASSWORD=your-redis-password

# Observability
LANGFUSE_PUBLIC_KEY=pk-...
LANGFUSE_SECRET_KEY=sk-...
LANGFUSE_HOST=https://cloud.langfuse.com

# Debug logging
LITELLM_LOG=DEBUG
DETAILED_DEBUG=True

Configuration File

Using config.yaml

Create a config.yaml file in your repository:
config.yaml
model_list:
  - model_name: gpt-4o
    litellm_params:
      model: gpt-4o
      api_key: os.environ/OPENAI_API_KEY
  
  - model_name: claude-sonnet-4
    litellm_params:
      model: anthropic/claude-sonnet-4-20250514
      api_key: os.environ/ANTHROPIC_API_KEY

  - model_name: gpt-4o-azure
    litellm_params:
      model: azure/gpt-4o
      api_key: os.environ/AZURE_API_KEY
      api_base: os.environ/AZURE_API_BASE
      api_version: "2024-02-15-preview"

general_settings:
  master_key: os.environ/LITELLM_MASTER_KEY
  database_url: os.environ/DATABASE_URL
  
  # Enable UI
  ui: true
  
  # Rate limiting
  max_parallel_requests: 100
  
  # Caching
  cache: true
  cache_params:
    type: redis

router_settings:
  routing_strategy: latency-based-routing
  allowed_fails: 3
  cooldown_time: 30
Update Docker command in render.yaml:
services:
  - type: web
    name: litellm
    runtime: docker
    dockerCommand: litellm --config /app/config.yaml --port 4000

Custom Domain

1

Add Custom Domain

  1. In service settings, go to Custom Domains
  2. Click Add Custom Domain
  3. Enter your domain: api.yourdomain.com
2

Configure DNS

Add a CNAME record in your DNS provider:
Type:  CNAME
Name:  api
Value: litellm-proxy.onrender.com
TTL:   Auto
3

Wait for Verification

Render will automatically provision SSL certificate via Let’s Encrypt. This takes 5-10 minutes.
Render provides free SSL certificates for all custom domains automatically.

Redis for Caching

Create Redis Instance

1

Create Redis

  1. Click New +Redis
  2. Name: litellm-cache
  3. Plan: Free (25MB) or Starter ($10/month, 256MB)
  4. Region: Same as web service
2

Get Connection Details

Copy from Redis dashboard:
  • Internal Redis URL: redis://red-xxx:6379
  • Or individual fields: Host, Port, Password
3

Configure LiteLLM

Add to web service environment:
REDIS_HOST=red-xxx.oregon-redis.render.com
REDIS_PORT=6379
REDIS_PASSWORD=your-password
Or use the full URL:
REDIS_URL=redis://:[email protected]:6379

Deployment Strategies

Auto-Deploy from Git

Render automatically deploys when you push to your branch:
git add .
git commit -m "Update LiteLLM config"
git push origin main
Render will:
  1. Detect the push
  2. Build new Docker image
  3. Run database migrations
  4. Deploy with zero-downtime

Manual Deploy

Trigger manual deployment from dashboard:
  1. Go to your service
  2. Click Manual DeployDeploy latest commit
  3. Or Clear build cache & deploy for clean build

Blueprint (render.yaml)

Define infrastructure as code:
render.yaml
services:
  - type: web
    name: litellm-proxy
    runtime: docker
    repo: https://github.com/BerriAI/litellm
    region: oregon
    plan: standard
    branch: main
    dockerCommand: litellm --port 4000
    envVars:
      - key: LITELLM_MASTER_KEY
        generateValue: true
      - key: DATABASE_URL
        fromDatabase:
          name: litellm-db
          property: connectionString
      - key: OPENAI_API_KEY
        sync: false  # Set manually
      - key: STORE_MODEL_IN_DB
        value: "True"
    healthCheckPath: /health/liveliness

databases:
  - name: litellm-db
    plan: starter
    region: oregon
    databaseName: litellm
    user: litellm
Deploy blueprint:
render blueprint deploy

Monitoring and Logs

View Logs

  1. Go to service dashboard
  2. Click Logs tab
  3. View real-time logs or search history
# Filter logs
# In Render UI, use search box:
ERROR
DEBUG
/chat/completions

Health Checks

Render automatically monitors your service using the health check endpoint:
healthCheckPath: /health/liveliness
healthCheckTimeout: 10
healthCheckInterval: 30
View health status in service dashboard.

Metrics

Render provides built-in metrics:
  • CPU usage
  • Memory usage
  • Request count
  • Response time
  • Error rate
Access via Metrics tab in service dashboard.

Scaling

Horizontal Scaling

1

Enable Autoscaling

  1. Go to service Settings
  2. Scroll to Scaling
  3. Enable Autoscaling
2

Configure Limits

Min instances: 1
Max instances: 5
3

Set Triggers

  • CPU threshold: 70%
  • Memory threshold: 80%
  • Scale up delay: 2 minutes
  • Scale down delay: 10 minutes

Vertical Scaling

Upgrade instance type in SettingsPlan:
  • Starter: 512MB RAM, 0.5 CPU
  • Standard: 2GB RAM, 1 CPU
  • Pro: 4GB RAM, 2 CPU
  • Pro Plus: 8GB RAM, 4 CPU

Troubleshooting

Build Failures

# Check build logs in Render dashboard
# Common issues:

# 1. Docker build timeout
# Solution: Enable "Docker Layer Caching" in settings

# 2. Out of memory during build
# Solution: Upgrade to Standard plan or higher

# 3. npm/pip install failures  
# Solution: Clear build cache and redeploy

Service Won’t Start

# Check logs for errors

# Missing environment variable
ERROR: LITELLM_MASTER_KEY not set
# Solution: Add in environment settings

# Database connection failed
ERROR: Could not connect to database
# Solution: Verify DATABASE_URL is correct

# Port binding error
ERROR: Address already in use
# Solution: Don't set PORT env var (Render sets automatically)

Database Connection Issues

# Use internal URL, not external
# ✅ Correct:
DATABASE_URL=postgresql://user:[email protected]/db

# ❌ Wrong (external URL, slower):
DATABASE_URL=postgresql://user:[email protected]/db

# Test connection from web service shell
psql $DATABASE_URL

Slow Performance

# 1. Check if database and service are in same region
# 2. Enable Redis caching
# 3. Upgrade to higher instance plan
# 4. Enable autoscaling
# 5. Use Render's load balancer for multiple instances

Cost Optimization

Free Tier Setup

Web Service: Free (with limits)
PostgreSQL:  Free 90-day trial
Redis:       Free (25MB)

Total: $0 for 90 days
After trial: ~$7/month minimum

Production Setup

Web Service: Standard ($25/month)
PostgreSQL:  Starter ($7/month)
Redis:       Starter ($10/month)

Total: $42/month

High-Traffic Setup

Web Service: Pro ($85/month) with autoscaling
PostgreSQL:  Standard ($20/month)
Redis:       Standard ($35/month)

Total: ~$140/month base + autoscaling
Render provides $5/month credit for students and open-source projects.

Comparison with Other Platforms

FeatureRenderRailwayFly.io
Free tier✅ Limited✅ $5 credit✅ Limited
Managed PostgreSQL
Auto SSL
Autoscaling
Docker support
Zero-downtime deploys
Built-in monitoring

Next Steps

Railway

Alternative PaaS deployment

Monitoring

Add observability and alerts

Security

Secure your deployment

Performance

Optimize for production

Build docs developers (and LLMs) love