如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
🚅 LiteLLM
LiteLLM AI 网关
支持 100+ 大语言模型的开源 AI 网关。可自托管,企业级就绪。以 OpenAI 格式调用任何 LLM。
LiteLLM Proxy Server (AI Gateway) | Hosted Proxy | Enterprise Tier | Website
LiteLLM 是一个开源 AI 网关,为您提供单一、统一的接口,可使用 OpenAI 格式调用 100+ LLM 提供商——包括 OpenAI、Anthropic、Gemini、Bedrock、Azure 等。
您可以将其用作 Python SDK 进行直接库集成,或将 AI 网关(代理服务器) 部署为团队或组织的集中式服务。
跳转到 LiteLLM 代理(LLM 网关)文档 跳转到支持的 LLM 提供商
跨提供商管理 LLM 调用很快会变得复杂——每个模型都有不同的 SDK、身份验证模式、请求格式和错误类型。LiteLLM 消除了这种摩擦:
Netflix
LLM - 调用 100+ LLM(Python SDK + AI 网关)
所有支持的端点 - /chat/completions、/responses、/embeddings、/images、/audio、/batches、/rerank、/a2a、/messages 等。
uv add litellm
from litellm import completion
import os
os.environ["OPENAI_API_KEY"] = "your-openai-key"
os.environ["ANTHROPIC_API_KEY"] = "your-anthropic-key"
# OpenAI
response = completion(model="openai/gpt-4o", messages=[{"role": "user", "content": "Hello!"}])
# Anthropic
response = completion(model="anthropic/claude-sonnet-4-20250514", messages=[{"role": "user", "content": "Hello!"}])
快速入门 - 端到端教程 - 设置虚拟密钥,发起首次请求
uv tool install 'litellm[proxy]'
litellm --model gpt-4o
import openai
client = openai.OpenAI(api_key="anything", base_url="http://0.0.0.0:4000")
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}]
)
文档:LLM 提供商
| 提供商 | /chat/completions | /messages | /responses | /embeddings | /image/generations | /audio/transcriptions | /audio/speech | /moderations | /batches | /rerank |
|---|---|---|---|---|---|---|---|---|---|---|
Abliteration (abliteration) | ✅ | |||||||||
AI/ML API (aiml) | ✅ | ✅ | ✅ | ✅ | ✅ | |||||
AI21 (ai21) | ✅ | ✅ | ✅ | |||||||
AI21 Chat (ai21_chat) | ✅ | ✅ | ✅ | |||||||
| Aleph Alpha | ✅ | ✅ | ✅ | |||||||
| Amazon Nova | ✅ | ✅ | ✅ | |||||||
Anthropic (anthropic) | ✅ | ✅ | ✅ | ✅ | ||||||
Anthropic Text (anthropic_text) | ✅ | ✅ | ✅ | ✅ | ||||||
| Anyscale | ✅ | ✅ | ✅ | |||||||
AssemblyAI (assemblyai) | ✅ | ✅ | ✅ | ✅ | ||||||
Auto Router (auto_router) | ✅ | ✅ | ✅ | |||||||
AWS - Bedrock (bedrock) | ✅ | ✅ | ✅ | ✅ | ✅ | |||||
AWS - Sagemaker (sagemaker) | ✅ | ✅ | ✅ | ✅ | ||||||
Azure (azure) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
Azure AI (azure_ai) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
Azure Text (azure_text) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |||
Baseten (baseten) | ✅ | ✅ | ✅ | |||||||
Bytez (bytez) | ✅ | ✅ | ✅ | |||||||
Cerebras (cerebras) | ✅ | ✅ | ✅ | |||||||
Clarifai (clarifai) | ✅ | ✅ | ✅ | |||||||
Cloudflare AI Workers (cloudflare) | ✅ | ✅ | ✅ | |||||||
Codestral (codestral) | ✅ | ✅ | ✅ | |||||||
Cohere (cohere) | ✅ | ✅ | ✅ | ✅ | ✅ | |||||
Cohere Chat (cohere_chat) | ✅ | ✅ | ✅ | |||||||
CometAPI (cometapi) | ✅ | ✅ | ✅ | ✅ | ||||||
CompactifAI (compactifai) | ✅ | ✅ | ✅ | |||||||
Custom (custom) | ✅ | ✅ | ✅ | |||||||
Custom OpenAI (custom_openai) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |||
Dashscope (dashscope) | ✅ | ✅ | ✅ | ✅ | ✅ | |||||
Databricks (databricks) | ✅ | ✅ | ✅ | |||||||
DataRobot (datarobot) | ✅ | ✅ | ✅ | |||||||
Deepgram (deepgram) | ✅ | ✅ | ✅ | ✅ | ||||||
DeepInfra (deepinfra) | ✅ | ✅ | ✅ | |||||||
Deepseek (deepseek) | ✅ | ✅ | ✅ | |||||||
ElevenLabs (elevenlabs) | ✅ | ✅ | ✅ | ✅ | ✅ | |||||
Empower (empower) | ✅ | ✅ | ✅ | |||||||
Fal AI (fal_ai) | ✅ | ✅ | ✅ | ✅ | ||||||
Featherless AI (featherless_ai) | ✅ | ✅ | ✅ | |||||||
Fireworks AI (fireworks_ai) | ✅ | ✅ | ✅ | |||||||
FriendliAI (friendliai) | ✅ | ✅ | ✅ | |||||||
Galadriel (galadriel) | ✅ | ✅ | ✅ | |||||||
GitHub Copilot (github_copilot) | ✅ | ✅ | ✅ | ✅ | ||||||
GitHub Models (github) | ✅ | ✅ | ✅ | |||||||
| Google - PaLM | ✅ | ✅ | ✅ | |||||||
Google - Vertex AI (vertex_ai) | ✅ | ✅ | ✅ | ✅ | ✅ | |||||
Google AI Studio - Gemini (gemini) | ✅ | ✅ | ✅ | |||||||
GradientAI (gradient_ai) | ✅ | ✅ | ✅ | |||||||
Groq AI (groq) | ✅ | ✅ | ✅ | |||||||
Heroku (heroku) | ✅ | ✅ | ✅ | |||||||
Hosted VLLM (hosted_vllm) | ✅ | ✅ | ✅ | |||||||
Huggingface (huggingface) | ✅ | ✅ | ✅ | ✅ | ✅ | |||||
Hyperbolic (hyperbolic) | ✅ | ✅ | ✅ | |||||||
IBM - Watsonx.ai (watsonx) | ✅ | ✅ | ✅ | ✅ | ||||||
Infinity (infinity) | ✅ | |||||||||
Jina AI (jina_ai) | ✅ | |||||||||
Lambda AI (lambda_ai) | ✅ | ✅ | ✅ | |||||||
Lemonade (lemonade) | ✅ | ✅ | ✅ | |||||||
LiteLLM Proxy (litellm_proxy) | ✅ | ✅ | ✅ | ✅ | ✅ | |||||
Llamafile (llamafile) | ✅ | ✅ | ✅ | |||||||
LM Studio (lm_studio) | ✅ | ✅ | ✅ | |||||||
Maritalk (maritalk) | ✅ | ✅ | ✅ | |||||||
| Meta - Llama API | ✅ | ✅ | ✅ |
我们欢迎对LiteLLM的贡献!无论是修复错误、添加功能还是改进文档,我们都感谢您的帮助。
这需要安装uv。
git clone https://github.com/BerriAI/litellm.git
cd litellm
make install-dev # 安装开发依赖
make format # 格式化代码
make lint # 运行所有linting检查
make test-unit # 运行单元测试
make format-check # 仅检查格式
有关详细的贡献指南,请参见CONTRIBUTING.md。
[!NOTE] 📖 想要为文档做贡献?LiteLLM文档已迁移到单独的仓库:https://github.com/BerriAI/litellm-docs%E3%80%82%E8%AF%B7%E5%9C%A8%E8%AF%A5%E4%BB%93%E5%BA%93%E6%8F%90%E4%BA%A4%E6%96%87%E6%A1%A3PR%E3%80%82%E6%96%87%E6%A1%A3%E6%89%98%E7%AE%A1%E4%BA%8Edocs.litellm.ai%E3%80%82
LiteLLM遵循https://google.github.io/styleguide/pyguide.html%E3%80%82
我们的自动化检查包括:
在您的PR被合并之前,所有这些检查都必须通过。
来自真实用户的反馈,见证轩辕镜像的优质服务