Skip to main content

What is the LiteLLM Proxy?

The LiteLLM Proxy is a centralized AI Gateway that provides:
  • Authentication & Authorization - Virtual keys for secure access control
  • Cost Tracking - Per-user, per-project spend monitoring
  • Rate Limiting - Control usage with TPM/RPM limits
  • Load Balancing - Distribute requests across multiple deployments
  • Caching - Reduce costs with intelligent response caching
  • Admin Dashboard - Web UI for management and monitoring

Quick Installation

1

Install LiteLLM with Proxy

Install LiteLLM with proxy dependencies:
2

Start the Proxy

Start the proxy with a single model (OpenAI GPT-4):
The proxy will start on http://0.0.0.0:4000
3

Test Your Gateway

Make your first request using OpenAI SDK:
Production Deployment: For production, use the configuration file approach below with authentication enabled.

Configuration File Setup

For production deployments, use a configuration file to define your models and settings.
1

Create Config File

Create a config.yaml file:
config.yaml
2

Set Environment Variables

Set your API keys:
3

Start with Config

Start the proxy with your config file:

Create Virtual Keys

Virtual keys provide secure access control with per-key budgets and rate limits.

Use Virtual Keys

Use the generated virtual key to make requests:

Load Balancing

Distribute requests across multiple deployments of the same model:
config.yaml

Fallbacks

Automatically fallback to alternative models on failure:
config.yaml

Caching

Enable caching to reduce costs and improve response times:
config.yaml

Admin Dashboard

Access the web-based admin dashboard to:
  • Create and manage virtual keys
  • Monitor usage and costs
  • View request logs
  • Configure models and settings
1

Access Dashboard

Open your browser and navigate to:
2

Login

Login with your master key:
  • Master Key: sk-1234 (or the value from your config)
3

Explore Features

  • Keys: Create and manage virtual keys
  • Models: View and configure available models
  • Usage: Monitor costs and request metrics
  • Logs: View detailed request logs

Docker Deployment

Deploy using Docker for production:

Observability

Integrate with observability platforms:
config.yaml

API Endpoints

The proxy exposes OpenAI-compatible endpoints:

Chat Completions

POST /chat/completions

Completions

POST /completions

Embeddings

POST /embeddings

Images

POST /images/generations

Audio

POST /audio/transcriptions

Models

GET /models

Environment Variables

Common environment variables:

What’s Next?

Authentication

Set up SSO, LDAP, or custom authentication

Guardrails

Add content moderation and safety guardrails

Teams & Projects

Organize users into teams with separate budgets

Enterprise Features

Explore enterprise features like SSO and SLAs
Security Best Practices
  • Always change the default master_key
  • Use environment variables for sensitive data
  • Enable HTTPS in production
  • Use a PostgreSQL database for persistence
  • Regularly rotate API keys
Need Help? Join our Discord community or check out the full documentation.