AI Gateway
统一访问所有 AI 模型
使用一个中央接口,规范您与不同 LLM 提供商的交互方式。
MLflow AI Gateway screenshot
访问 50 多家模型提供商
在一个地方定义和管理跨多个提供商的多个 LLM 端点,实现集中的 API 密钥管理和无缝集成。
Configure endpoints
流量路由与故障转移
将流量分配到多个模型,以进行 A/B 测试和逐步发布。定义故障转移链,以便在主服务不可用时,请求自动重新路由到备份提供商。
Traffic routing and fallbacks
使用情况跟踪
每个请求都将记录为 MLflow 追踪。通过统一的仪表板,可视化所有端点的请求量、延迟百分位数、Token 消耗量和成本细分。
Usage tracking dashboard
支持的提供商
通过单一的统一接口,将请求路由至任何 LLM 提供商,包括任何兼容 OpenAI 的 API 或自定义模型端点。网关会处理凭据、使用情况跟踪和故障转移,确保您的应用程序代码与特定提供商无关。
3 个简单步骤即可上手
几分钟内即可设置受治理的 LLM 访问权限。无需额外基础设施。开始使用 →
1

启动 MLflow 服务器

启动跟踪服务器。AI Gateway 开箱即用。

bash
pip install 'mlflow[genai]'
uvx mlflow server
~30 秒
2

创建端点

通过 UI 添加 API 密钥并配置端点,无需重启服务器。

bash
# Open the Gateway UI
# https://:5000/#/gateway
#
# 1. Create an API key with your
# provider credentials
# 2. Create an endpoint and link
# it to your API key
~1 分钟
3

通过网关查询

使用任何兼容 OpenAI 的 SDK。将基础 URL 指向网关,并使用您的端点名称作为模型名称。

python
from openai import OpenAI
client = OpenAI(
base_url="https://:5000"
"/gateway/mlflow/v1",
api_key="unused",
)
response = client.chat.completions.create(
model="my-endpoint",
messages=[{"role": "user",
"content": "Hello!"}],
)
~30 秒