commit 6637b9d8554098771a48b592412712f14ee2c015 Author: Lutz Finsterle Date: Sun Mar 29 19:53:41 2026 +0200 Initial commit diff --git a/.env b/.env new file mode 100644 index 0000000..4393ca0 --- /dev/null +++ b/.env @@ -0,0 +1,4 @@ +LITELLM_MASTER_KEY="sk-1234" +LITELLM_SALT_KEY="sk-1234" +AZURE_API_BASE="https://openai-***********/" +AZURE_API_KEY="your-azure-api-key" diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..881305e --- /dev/null +++ b/config.yaml @@ -0,0 +1,11 @@ +model_list: + - model_name: gpt-4o + litellm_params: + model: azure/my_azure_deployment + api_base: os.environ/AZURE_API_BASE + api_key: os.environ/AZURE_API_KEY + api_version: "2025-01-01-preview" + +general_settings: + master_key: sk-1234 # 🔑 your proxy admin key (must start with sk-) + database_url: "postgresql://llmproxy:dbpassword9090@db:5432/litellm" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..56d51e8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,64 @@ +services: + litellm: + image: docker.litellm.ai/berriai/litellm:main-stable + ######################################### + ## Uncomment these lines to start proxy with a config.yaml file ## + volumes: + - ./config.yaml:/app/config.yaml + command: + - "--config=/app/config.yaml" + ############################################## + ports: + - "4000:4000" # Map the container port to the host, change the host port if necessary + environment: + DATABASE_URL: "postgresql://llmproxy:dbpassword9090@db:5432/litellm" + STORE_MODEL_IN_DB: "True" # allows adding models to proxy via UI + env_file: + - .env # Load local .env file + depends_on: + - db # Indicates that this service depends on the 'db' service, ensuring 'db' starts first + healthcheck: # Defines the health check configuration for the container + test: + - CMD-SHELL + - python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:4000/health/liveliness')" # Command to execute for health check + interval: 30s # Perform health check every 30 seconds + timeout: 10s # Health check command times out after 10 seconds + retries: 3 # Retry up to 3 times if health check fails + start_period: 40s # Wait 40 seconds after container start before beginning health checks + + db: + image: postgres:16 + restart: always + container_name: litellm_db + environment: + POSTGRES_DB: litellm + POSTGRES_USER: llmproxy + POSTGRES_PASSWORD: dbpassword9090 + ports: + - "54432:5432" + volumes: + - postgres_data:/var/lib/postgresql/data # Persists Postgres data across container restarts + healthcheck: + test: ["CMD-SHELL", "pg_isready -d litellm -U llmproxy"] + interval: 1s + timeout: 5s + retries: 10 + + prometheus: + image: prom/prometheus + volumes: + - prometheus_data:/prometheus + - ./prometheus.yml:/etc/prometheus/prometheus.yml + ports: + - "9090:9090" + command: + - "--config.file=/etc/prometheus/prometheus.yml" + - "--storage.tsdb.path=/prometheus" + - "--storage.tsdb.retention.time=15d" + restart: always + +volumes: + prometheus_data: + driver: local + postgres_data: + name: litellm_postgres_data # Named volume for Postgres data persistence diff --git a/prometheus.yml b/prometheus.yml new file mode 100644 index 0000000..e69de29