Skip to main content

Installation

Install LiteLLM with proxy dependencies:

Basic Setup

1

Create Configuration File

Create a config.yaml file with your model configurations:
config.yaml
Never commit your master_key to version control. Use environment variables in production.
2

Set Environment Variables

Export your provider API keys:
3

Start the Proxy

Run the proxy server:
The proxy will start on http://0.0.0.0:4000 by default.
4

Test the Proxy

Make a test request using curl:

Generate a Virtual Key

Create an API key for your application:
Response:

Use the Virtual Key

Now use the generated key instead of the master key:

Access the Admin UI

Open your browser to http://localhost:4000/ui to access the admin dashboard. Login with your master key (sk-1234) to:
  • View all virtual keys
  • Create and manage keys
  • Monitor usage and spending
  • View request logs
  • Manage teams and users

Load Balancing Example

Configure multiple deployments for automatic load balancing:
config.yaml
Now requests to gpt-4 will automatically load balance across all three deployments, with fallback to Claude if all GPT-4 deployments fail.

Database Setup (Optional)

For persistent storage of keys, users, and spend data:
1

Set up PostgreSQL

2

Configure Database URL

3

Enable DB Storage

Update your config.yaml:
4

Start Proxy

The proxy will automatically run database migrations on startup:

Health Check

Verify the proxy is running:
Response:

Next Steps

Docker Deployment

Deploy with Docker for production

Configuration Options

Explore all configuration settings

Virtual Keys

Advanced key management

Budget Alerts

Set up budget monitoring

Common Issues

Port Already in Use

If port 4000 is already in use, specify a different port:

API Key Not Found

Make sure environment variables are exported:

Database Connection Failed

Verify the DATABASE_URL format: