> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/BerriAI/litellm/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy to Render

> One-click deployment of LiteLLM to Render with automatic SSL and managed database

## Quick Deploy

LiteLLM can be deployed to Render with a single click:

<a href="https://render.com/deploy?repo=https://github.com/BerriAI/litellm" target="_blank">
  <img src="https://render.com/images/deploy-to-render-button.svg" alt="Deploy to Render" />
</a>

<Steps>
  <Step title="Click Deploy Button">
    Click the "Deploy to Render" button above to start the deployment process.
  </Step>

  <Step title="Connect GitHub">
    Authorize Render to access the LiteLLM repository (or fork it to your account).
  </Step>

  <Step title="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
  </Step>

  <Step title="Deploy">
    Render will automatically:

    * Build the Docker image
    * Provision a PostgreSQL database
    * Deploy the service with SSL
    * Provide a public URL
  </Step>
</Steps>

## Manual Render Deployment

### Create New Web Service

<Steps>
  <Step title="Create Service">
    1. Go to [Render Dashboard](https://dashboard.render.com/)
    2. Click **New +** → **Web Service**
    3. Connect your Git repository or use `https://github.com/BerriAI/litellm`
  </Step>

  <Step title="Configure Service">
    **Basic Settings:**

    * **Name:** `litellm-proxy`
    * **Region:** Choose closest to your users
    * **Branch:** `main`
    * **Runtime:** `Docker`
    * **Dockerfile Path:** `./Dockerfile`
  </Step>

  <Step title="Set Instance Type">
    **Recommended tiers:**

    * **Development:** Starter (\$7/month)
    * **Production:** Standard ($25/month) or Pro ($85/month)
    * **Enterprise:** Pro Plus (\$250/month)

    **Resource recommendations:**

    ```yaml theme={null}
    Development:  512MB RAM, 0.5 CPU
    Production:   2GB RAM, 1 CPU
    High Traffic: 4GB RAM, 2 CPU
    ```
  </Step>

  <Step title="Configure Environment">
    Add environment variables (see configuration section below)
  </Step>
</Steps>

## Database Setup

### Create PostgreSQL Database

<Steps>
  <Step title="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)
  </Step>

  <Step title="Get Connection String">
    After creation, copy the **Internal Database URL**:

    ```
    postgresql://user:pass@dpg-xxx-a.oregon-postgres.render.com/litellm_db
    ```
  </Step>

  <Step title="Add to Web Service">
    In your web service environment variables:

    ```bash theme={null}
    DATABASE_URL=postgresql://user:pass@dpg-xxx-a.oregon-postgres.render.com/litellm_db
    STORE_MODEL_IN_DB=True
    ```
  </Step>
</Steps>

<Warning>
  Use the **Internal Database URL** (not External) for better performance and security within Render.
</Warning>

## Environment Configuration

### Required Variables

```bash theme={null}
# 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

<Tabs>
  <Tab title="OpenAI">
    ```bash theme={null}
    OPENAI_API_KEY=sk-proj-...
    ```
  </Tab>

  <Tab title="Anthropic">
    ```bash theme={null}
    ANTHROPIC_API_KEY=sk-ant-...
    ```
  </Tab>

  <Tab title="Azure OpenAI">
    ```bash theme={null}
    AZURE_API_KEY=your-key
    AZURE_API_BASE=https://your-resource.openai.azure.com
    AZURE_API_VERSION=2024-02-15-preview
    ```
  </Tab>

  <Tab title="AWS Bedrock">
    ```bash theme={null}
    AWS_ACCESS_KEY_ID=AKIA...
    AWS_SECRET_ACCESS_KEY=your-secret
    AWS_REGION_NAME=us-east-1
    ```
  </Tab>
</Tabs>

### Optional Configuration

```bash theme={null}
# 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:

```yaml config.yaml theme={null}
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`:

```yaml theme={null}
services:
  - type: web
    name: litellm
    runtime: docker
    dockerCommand: litellm --config /app/config.yaml --port 4000
```

## Custom Domain

<Steps>
  <Step title="Add Custom Domain">
    1. In service settings, go to **Custom Domains**
    2. Click **Add Custom Domain**
    3. Enter your domain: `api.yourdomain.com`
  </Step>

  <Step title="Configure DNS">
    Add a CNAME record in your DNS provider:

    ```
    Type:  CNAME
    Name:  api
    Value: litellm-proxy.onrender.com
    TTL:   Auto
    ```
  </Step>

  <Step title="Wait for Verification">
    Render will automatically provision SSL certificate via Let's Encrypt.
    This takes 5-10 minutes.
  </Step>
</Steps>

<Tip>
  Render provides free SSL certificates for all custom domains automatically.
</Tip>

## Redis for Caching

### Create Redis Instance

<Steps>
  <Step title="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
  </Step>

  <Step title="Get Connection Details">
    Copy from Redis dashboard:

    * **Internal Redis URL:** `redis://red-xxx:6379`
    * Or individual fields: Host, Port, Password
  </Step>

  <Step title="Configure LiteLLM">
    Add to web service environment:

    ```bash theme={null}
    REDIS_HOST=red-xxx.oregon-redis.render.com
    REDIS_PORT=6379
    REDIS_PASSWORD=your-password
    ```

    Or use the full URL:

    ```bash theme={null}
    REDIS_URL=redis://:password@red-xxx.oregon-redis.render.com:6379
    ```
  </Step>
</Steps>

## Deployment Strategies

### Auto-Deploy from Git

Render automatically deploys when you push to your branch:

```bash theme={null}
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 Deploy** → **Deploy latest commit**
3. Or **Clear build cache & deploy** for clean build

### Blueprint (render.yaml)

Define infrastructure as code:

```yaml render.yaml theme={null}
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:

```bash theme={null}
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

```bash theme={null}
# Filter logs
# In Render UI, use search box:
ERROR
DEBUG
/chat/completions
```

### Health Checks

Render automatically monitors your service using the health check endpoint:

```yaml theme={null}
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

<Steps>
  <Step title="Enable Autoscaling">
    1. Go to service **Settings**
    2. Scroll to **Scaling**
    3. Enable **Autoscaling**
  </Step>

  <Step title="Configure Limits">
    ```yaml theme={null}
    Min instances: 1
    Max instances: 5
    ```
  </Step>

  <Step title="Set Triggers">
    * **CPU threshold:** 70%
    * **Memory threshold:** 80%
    * **Scale up delay:** 2 minutes
    * **Scale down delay:** 10 minutes
  </Step>
</Steps>

### Vertical Scaling

Upgrade instance type in **Settings** → **Plan**:

* **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

```bash theme={null}
# 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

```bash theme={null}
# 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

```bash theme={null}
# Use internal URL, not external
# ✅ Correct:
DATABASE_URL=postgresql://user:pass@dpg-xxx-a.oregon-postgres.render.com/db

# ❌ Wrong (external URL, slower):
DATABASE_URL=postgresql://user:pass@dpg-xxx.oregon-postgres.render.com/db

# Test connection from web service shell
psql $DATABASE_URL
```

### Slow Performance

```bash theme={null}
# 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

```yaml theme={null}
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

```yaml theme={null}
Web Service: Standard ($25/month)
PostgreSQL:  Starter ($7/month)
Redis:       Starter ($10/month)

Total: $42/month
```

### High-Traffic Setup

```yaml theme={null}
Web Service: Pro ($85/month) with autoscaling
PostgreSQL:  Standard ($20/month)
Redis:       Standard ($35/month)

Total: ~$140/month base + autoscaling
```

<Tip>
  Render provides \$5/month credit for students and open-source projects.
</Tip>

## Comparison with Other Platforms

| Feature               | Render    | Railway      | Fly.io    |
| --------------------- | --------- | ------------ | --------- |
| Free tier             | ✅ Limited | ✅ \$5 credit | ✅ Limited |
| Managed PostgreSQL    | ✅         | ✅            | ❌         |
| Auto SSL              | ✅         | ✅            | ✅         |
| Autoscaling           | ✅         | ❌            | ✅         |
| Docker support        | ✅         | ✅            | ✅         |
| Zero-downtime deploys | ✅         | ✅            | ✅         |
| Built-in monitoring   | ✅         | ✅            | ✅         |

## Next Steps

<CardGroup cols={2}>
  <Card title="Railway" icon="train" href="/deployment/railway">
    Alternative PaaS deployment
  </Card>

  <Card title="Monitoring" icon="chart-line" href="/deployment/monitoring">
    Add observability and alerts
  </Card>

  <Card title="Security" icon="shield" href="/deployment/security">
    Secure your deployment
  </Card>

  <Card title="Performance" icon="gauge" href="/deployment/performance">
    Optimize for production
  </Card>
</CardGroup>
