BerriAI / litellm

本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。

BerriAI / litellm

🚅 LiteLLM LiteLLM AI Gateway Open Source AI Gateway for 100+ LLMs. Self-hosted. Enterprise-ready. Call any LLM in OpenAI format. LiteLLM Proxy Server (AI Gateway) | Hosted Proxy | Enterprise Tier | Website

🚅 LiteLLM LiteLLM AI Gateway 是一个开源 AI 网关,支持 100 多种大语言模型(LLM)。支持自托管,具备企业级就绪能力。可以使用 OpenAI 格式调用任何 LLM。LiteLLM 代理服务器(AI 网关)| 托管代理 | 企业版 | 网站

What is LiteLLM LiteLLM is an open source AI Gateway that gives you a single, unified interface to call 100+ LLM providers — OpenAI, Anthropic, Gemini, Bedrock, Azure, and more — using the OpenAI format. Use it as a Python SDK for direct library integration, or deploy the AI Gateway (Proxy Server) as a centralized service for your team or organization. Jump to LiteLLM Proxy (LLM Gateway) Docs Jump to Supported LLM Providers

什么是 LiteLLM?LiteLLM 是一个开源 AI 网关,它提供了一个单一、统一的接口,让你可以使用 OpenAI 格式调用 100 多家 LLM 提供商(如 OpenAI、Anthropic、Gemini、Bedrock、Azure 等)。你可以将其作为 Python SDK 进行直接库集成,或者将 AI 网关(代理服务器)部署为团队或组织的集中式服务。跳转至 LiteLLM 代理(LLM 网关)文档,跳转至支持的 LLM 提供商。

Why LiteLLM Managing LLM calls across providers gets complicated fast — different SDKs, auth patterns, request formats, and error types for every model. LiteLLM removes that friction: Unified API — one interface for 100+ LLMs, no provider-specific SDK juggling Drop-in OpenAI compatibility — swap providers without rewriting your code Production-ready gateway — virtual keys, spend tracking, guardrails, load balancing, and an admin dashboard out of the box 8ms P95 latency at 1k RPS (benchmarks) OSS Adopters Netflix

为什么选择 LiteLLM?跨提供商管理 LLM 调用很快就会变得复杂——每个模型都有不同的 SDK、身份验证模式、请求格式和错误类型。LiteLLM 消除了这种摩擦:统一的 API——为 100 多种 LLM 提供一个接口,无需处理特定于提供商的 SDK;即插即用的 OpenAI 兼容性——无需重写代码即可切换提供商;生产就绪的网关——开箱即用的虚拟密钥、支出跟踪、护栏、负载均衡和管理仪表板;在 1k RPS 下具有 8ms 的 P95 延迟(基准测试)。开源采用者:Netflix。

Features LLMs - Call 100+ LLMs (Python SDK + AI Gateway) All Supported Endpoints - /chat/completions, /responses, /embeddings, /images, /audio, /batches, /rerank, /a2a, /messages and more.

功能:LLM - 调用 100 多种 LLM(Python SDK + AI 网关);所有支持的端点 - /chat/completions, /responses, /embeddings, /images, /audio, /batches, /rerank, /a2a, /messages 等。

Python SDK uv add litellm An independent litellm-core distribution provides the Python SDK with the same import litellm API and runtime dependencies. It has no optional extras, CLI entry points, or bundled dashboard. Install one SDK distribution per environment because litellm and litellm-core own overlapping Python files. Use litellm for the proxy, CLI, and optional extras.

Python SDK:uv add litellm。一个独立的 litellm-core 发行版提供了具有相同 import litellm API 和运行时依赖项的 Python SDK。它没有可选的额外功能、CLI 入口点或捆绑的仪表板。每个环境只能安装一个 SDK 发行版,因为 litellm 和 litellm-core 拥有重叠的 Python 文件。请将 litellm 用于代理、CLI 和可选的额外功能。