Back to services

LiteLLM

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]

View alternatives to LiteLLM
Suggest edit
Open source
Self-hostable
MIT
Recent reviews

Alternatives

Tech stack

No tech stack added yet. Sign in to suggest some

Note: The official website could not be retrieved this time (the tool call limit was reached). The content below is based on existing knowledge of the project, so please refer to the official documentation for specific details.

Introduction

LiteLLM, developed by BerriAI, is an open-source project that provides a unified way to call the interfaces of various large language models (LLMs). The APIs of OpenAI, Azure OpenAI, Anthropic, Google Vertex AI / Gemini, AWS Bedrock, Cohere, Hugging Face, Ollama and other platforms all differ, and LiteLLM unifies them into OpenAI-style input and output formats. Developers only need to change a model name to switch model providers.

It can be used in two ways:

  • Python SDK: Call functions such as litellm.completion() directly in your code. Suited to developers who need to integrate multiple models into an application.
  • Proxy Server (LLM gateway): Deployed as a standalone service that exposes an OpenAI-compatible API. Suited to platform teams or AI infrastructure teams that provide model access to an entire organization.

Key Features

  • Unified interface: Call 100+ LLMs using the OpenAI format, with a consistent response structure.
  • Routing and reliability: Supports load balancing across multiple deployments, with automatic retries or fallback to backup models on failure.
  • Cost tracking and budgets: Tracks usage and spend by project, user or key, and lets you set budget limits.
  • Virtual keys and access control: The proxy server can generate virtual API keys and set available models and rate limits per team or user.
  • Logging and observability: Sends request logs to various observability and logging platforms such as Langfuse through callbacks.
  • Admin UI: The proxy server includes a web admin UI for managing keys, models and usage.
  • Streaming output: Supports streaming responses and asynchronous calls.

Installation and Deployment

SDK:

pip install litellm
from litellm import completion
response = completion(model="gpt-4o", messages=[{"role": "user", "content": "你好"}])

Proxy server:

pip install 'litellm[proxy]'
litellm --model gpt-4o

You can also deploy it with the official Docker image, defining the model list and routing strategy in a YAML configuration file. To use features such as virtual keys and cost tracking, you will generally also need to connect a PostgreSQL database.

Technical Requirements

  • A Python environment, or deployment with Docker
  • API keys from each model provider
  • Advanced gateway management features require database support

Notable Characteristics

  • The core code is open source and can be self-hosted, so your data doesn't pass through third parties.
  • It exposes an OpenAI-compatible interface, so existing applications built on the OpenAI SDK can integrate with it with little to no code changes.
  • Some enterprise-grade features (such as SSO) belong to the paid enterprise edition.