The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
(security fix) - update base image for all docker images to `python:3.13.1-slim` (#7388)
Ishaan Jaff564ecc728d2a
diff --git a/docker/Dockerfile.database b/docker/Dockerfile.databaseindex 733a6f70aed..96bfa9705d6 100644--- a/docker/Dockerfile.database+++ b/docker/Dockerfile.database@@ -1,8 +1,8 @@# Base image for building-ARG LITELLM_BUILD_IMAGE=python:3.11.8-slim+ARG LITELLM_BUILD_IMAGE=python:3.13.1-slim# Runtime image-ARG LITELLM_RUNTIME_IMAGE=python:3.11.8-slim+ARG LITELLM_RUNTIME_IMAGE=python:3.13.1-slim# Builder stageFROM $LITELLM_BUILD_IMAGE AS builderdiff --git a/docker/Dockerfile.non_root b/docker/Dockerfile.non_rootindex d31c9e1b7e8..4f1a2dce337 100644--- a/docker/Dockerfile.non_root+++ b/docker/Dockerfile.non_root@@ -1,8 +1,8 @@# Base image for building-ARG LITELLM_BUILD_IMAGE=python:3.11.8-slim+ARG LITELLM_BUILD_IMAGE=python:3.13.1-slim# Runtime image-ARG LITELLM_RUNTIME_IMAGE=python:3.11.8-slim+ARG LITELLM_RUNTIME_IMAGE=python:3.13.1-slim# Builder stageFROM $LITELLM_BUILD_IMAGE AS builderdiff --git a/litellm-js/spend-logs/Dockerfile b/litellm-js/spend-logs/Dockerfileindex e96b6a1fa4b..a325b5cbc91 100644--- a/litellm-js/spend-logs/Dockerfile+++ b/litellm-js/spend-logs/Dockerfile@@ -1,5 +1,5 @@# Use the specific Node.js v20.11.0 image-FROM node:20.18.1+FROM node:20.18.1-alpine3.20# Set the working directory inside the containerWORKDIR /appdiff --git a/litellm/proxy/proxy_load_test/litellm_proxy_config.yaml b/litellm/proxy/proxy_load_test/litellm_proxy_config.yamldeleted file mode 100644index 2e107d36689..00000000000--- a/litellm/proxy/proxy_load_test/litellm_proxy_config.yaml+++ /dev/null@@ -1,6 +0,0 @@-model_list:- - model_name: gpt-3.5-turbo- litellm_params:- model: openai/my-fake-model- api_key: my-fake-key- api_base: http://0.0.0.0:8090\ No newline at end of filediff --git a/litellm/proxy/proxy_load_test/litellm_router_proxy/Dockerfile b/litellm/proxy/proxy_load_test/litellm_router_proxy/Dockerfiledeleted file mode 100644index f5787f0da38..00000000000--- a/litellm/proxy/proxy_load_test/litellm_router_proxy/Dockerfile+++ /dev/null@@ -1,20 +0,0 @@-# Use the official Python image as the base image-FROM python:3.9-slim--# Set the working directory in the container-WORKDIR /app--# Copy the Python requirements file-COPY requirements.txt .--# Install the Python dependencies-RUN pip install --no-cache-dir -r requirements.txt--# Copy the application code-COPY . .--# Expose the port the app will run on-EXPOSE 8090--# Start the application-CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8090"]\ No newline at end of filediff --git a/litellm/proxy/proxy_load_test/litellm_router_proxy/main.py b/litellm/proxy/proxy_load_test/litellm_router_proxy/main.pydeleted file mode 100644index a81f9a56d6f..00000000000--- a/litellm/proxy/proxy_load_test/litellm_router_proxy/main.py+++ /dev/null@@ -1,57 +0,0 @@-# import sys, os-# sys.path.insert(-# 0, os.path.abspath("../")-# ) # Adds the parent directory to the system path-from fastapi import FastAPI, Request-from fastapi.middleware.cors import CORSMiddleware--import litellm--app = FastAPI()--app.add_middleware(- CORSMiddleware,- allow_origins=["*"],- allow_credentials=True,- allow_methods=["*"],- allow_headers=["*"],-)--litellm_router = litellm.Router(- model_list=[- {- "model_name": "anything", # model alias -> loadbalance between models with same `model_name`- "litellm_params": { # params for litellm completion/embedding call- "model": "openai/anything", # actual model name- "api_key": "sk-1234",- "api_base": "https://exampleopenaiendpoint-production.up.railway.app/",- },- }- ]-)---# for completion[email protected]("/chat/completions")[email protected]("/v1/chat/completions")-async def completion(request: Request):- # this proxy uses the OpenAI SDK to call a fixed endpoint-- response = await litellm_router.acompletion(- model="anything",- messages=[- {- "role": "user",- "content": "hello who are you",- }- ],- )-- return response---if __name__ == "__main__":- import uvicorn-- # run this on 8090, 8091, 8092 and 8093- uvicorn.run(app, host="0.0.0.0", port=8090)diff --git a/litellm/proxy/proxy_load_test/locustfile.py b/litellm/proxy/proxy_load_test/locustfile.pydeleted file mode 100644index 9e4977b1060..00000000000--- a/litellm/proxy/proxy_load_test/locustfile.py+++ /dev/null@@ -1,34 +0,0 @@-import uuid--from locust import HttpUser, between, task---class MyUser(HttpUser):- wait_time = between(1, 5)-- @task- def chat_completion(self):- headers = {- "Content-Type": "application/json",- "Authorization": "Bearer sk-1234",- # Include any additional headers you may need for authentication, etc.- }-- # Customize the payload with "model" and "messages" keys- payload = {- "model": "fake-openai-endpoint",- "messages": [- {- "role": "system",- "content": f"{uuid.uuid4()} this is a very sweet test message from ishaan"- * 100,- },- {"role": "user", "content": "Hello, how are you?"},- ],- # Add more data as necessary- }-- # Make a POST request to the "chat/completions" endpoint- self.client.post("chat/completions", json=payload, headers=headers)-- # Print or log the response if neededdiff --git a/litellm/proxy/proxy_load_test/openai_endpoint.py b/litellm/proxy/proxy_load_test/openai_endpoint.pydeleted file mode 100644index ebb9c1ce4ff..00000000000--- a/litellm/proxy/proxy_load_test/openai_endpoint.py+++ /dev/null@@ -1,50 +0,0 @@-# import sys, os-# sys.path.insert(-# 0, os.path.abspath("../")-# ) # Adds the parent directory to the system path-import uuid--from fastapi import FastAPI, Request-from fastapi.middleware.cors import CORSMiddleware--app = FastAPI()--app.add_middleware(- CORSMiddleware,- allow_origins=["*"],- allow_credentials=True,- allow_methods=["*"],- allow_headers=["*"],-)---# for completion[email protected]("/chat/completions")[email protected]("/v1/chat/completions")-async def completion(request: Request):- return {- "id": f"chatcmpl-{uuid.uuid4().hex}",- "object": "chat.completion",- "created": 1677652288,- "model": "gpt-3.5-turbo-0125",- "system_fingerprint": "fp_44709d6fcb",- "choices": [- {- "index": 0,- "message": {- "role": "assistant",- "content": "\n\nHello there, how may I assist you today?",- },- "logprobs": None,- "finish_reason": "stop",- }- ],- "usage": {"prompt_tokens": 9, "completion_tokens": 12, "total_tokens": 21},- }---if __name__ == "__main__":- import uvicorn-- # run this on 8090, 8091, 8092 and 8093- uvicorn.run(app, host="0.0.0.0", port=8090)diff --git a/litellm/proxy/proxy_load_test/simple_litellm_proxy.py b/litellm/proxy/proxy_load_test/simple_litellm_proxy.pydeleted file mode 100644index fd5d99df4d6..00000000000--- a/litellm/proxy/proxy_load_test/simple_litellm_proxy.py+++ /dev/null@@ -1,51 +0,0 @@-# import sys, os-# sys.path.insert(-# 0, os.path.abspath("../")-# ) # Adds the parent directory to the system path-from fastapi import FastAPI, Request-from fastapi.middleware.cors import CORSMiddleware-from openai import AsyncOpenAI--import litellm--app = FastAPI()--app.add_middleware(- CORSMiddleware,- allow_origins=["*"],- allow_credentials=True,- allow_methods=["*"],- allow_headers=["*"],-)--litellm_client = AsyncOpenAI(- base_url="https://exampleopenaiendpoint-production.up.railway.app/",- api_key="sk-1234",-)---# for completion[email protected]("/chat/completions")[email protected]("/v1/chat/completions")-async def completion(request: Request):- # this proxy uses the OpenAI SDK to call a fixed endpoint-- response = await litellm.acompletion(- model="openai/anything",- messages=[- {- "role": "user",- "content": "hello who are you",- }- ],- client=litellm_client,- )-- return response---if __name__ == "__main__":- import uvicorn-- # run this on 8090, 8091, 8092 and 8093- uvicorn.run(app, host="0.0.0.0", port=8090)diff --git a/litellm/proxy/proxy_load_test/simple_litellm_router_proxy.py b/litellm/proxy/proxy_load_test/simple_litellm_router_proxy.pydeleted file mode 100644index a81f9a56d6f..00000000000--- a/litellm/proxy/proxy_load_test/simple_litellm_router_proxy.py+++ /dev/null@@ -1,57 +0,0 @@-# import sys, os-# sys.path.insert(-# 0, os.path.abspath("../")-# ) # Adds the parent directory to the system path-from fastapi import FastAPI, Request-from fastapi.middleware.cors import CORSMiddleware--import litellm--app = FastAPI()--app.add_middleware(- CORSMiddleware,- allow_origins=["*"],- allow_credentials=True,- allow_methods=["*"],- allow_headers=["*"],-)--litellm_router = litellm.Router(- model_list=[- {- "model_name": "anything", # model alias -> loadbalance between models with same `model_name`- "litellm_params": { # params for litellm completion/embedding call- "model": "openai/anything", # actual model name- "api_key": "sk-1234",- "api_base": "https://exampleopenaiendpoint-production.up.railway.app/",- },- }- ]-)---# for completion[email protected]("/chat/completions")[email protected]("/v1/chat/completions")-async def completion(request: Request):- # this proxy uses the OpenAI SDK to call a fixed endpoint-- response = await litellm_router.acompletion(- model="anything",- messages=[- {- "role": "user",- "content": "hello who are you",- }- ],- )-- return response---if __name__ == "__main__":- import uvicorn-- # run this on 8090, 8091, 8092 and 8093- uvicorn.run(app, host="0.0.0.0", port=8090)diff --git a/litellm/proxy/proxy_load_test/simple_proxy.py b/litellm/proxy/proxy_load_test/simple_proxy.pydeleted file mode 100644index cf3fb4148bf..00000000000--- a/litellm/proxy/proxy_load_test/simple_proxy.py+++ /dev/null@@ -1,48 +0,0 @@-# import sys, os-# sys.path.insert(-# 0, os.path.abspath("../")-# ) # Adds the parent directory to the system path-from fastapi import FastAPI, Request-from fastapi.middleware.cors import CORSMiddleware-from openai import AsyncOpenAI--app = FastAPI()--app.add_middleware(- CORSMiddleware,- allow_origins=["*"],- allow_credentials=True,- allow_methods=["*"],- allow_headers=["*"],-)--litellm_client = AsyncOpenAI(- base_url="https://exampleopenaiendpoint-production.up.railway.app/",- api_key="sk-1234",-)---# for completion[email protected]("/chat/completions")[email protected]("/v1/chat/completions")-async def completion(request: Request):- # this proxy uses the OpenAI SDK to call a fixed endpoint-- response = await litellm_client.chat.completions.create(- model="anything",- messages=[- {- "role": "user",- "content": "hello who are you",- }- ],- )-- return response---if __name__ == "__main__":- import uvicorn-- # run this on 8090, 8091, 8092 and 8093- uvicorn.run(app, host="0.0.0.0", port=8090)