Back to Lobehub

在 LobeHub 中使用 Vercel AI Gateway

docs/usage/providers/vercel-ai-gateway.zh-CN.mdx

2.1.561.9 KB
Original Source

在 LobeHub 中使用 Vercel AI Gateway

Vercel AI Gateway 是一个统一的 API,通过单一端点提供对 100+ AI 模型的访问。它提供预算管理、使用监控、负载均衡和回退处理等功能。

本文将指导您如何在 LobeHub 中使用 Vercel AI Gateway。

<Steps> ### 第一步:在 Vercel AI Gateway 中创建 API 密钥
  • 访问 Vercel 控制台
  • 点击左侧的 AI Gateway 标签
  • 点击左侧边栏的 API 密钥
  • 点击 创建密钥,然后在对话框中点击 创建密钥 完成创建

第二步:在 LobeHub 中配置 Vercel AI Gateway

  • 进入 LobeHub 的 设置 页面
  • AI 服务提供商 下,找到 Vercel AI Gateway 设置
  • 输入您获得的 API 密钥
  • 选择 Vercel AI Gateway 的模型,开始与 AI 助手对话

<Callout type={'warning'}> 使用过程中可能需要向 API 服务提供商付费,请参考 Vercel AI Gateway 的 定价政策</Callout> </Steps>

至此,您可以在 LobeHub 中使用 Vercel AI Gateway 提供的模型开始聊天了。

模型选择

Vercel AI Gateway 支持多种模型提供商,包括:

  • OpenAI: openai/gpt-4oopenai/gpt-4o-miniopenai/o1
  • Anthropic: anthropic/claude-3-5-sonnetanthropic/claude-3-opus
  • Google: google/gemini-2.5-progoogle/gemini-2.0-flash
  • DeepSeek: deepseek/deepseek-chatdeepseek/deepseek-reasoner
  • 以及更多...

如需查看完整的支持模型列表,请访问 Vercel AI Gateway 模型

API 配置

Vercel AI Gateway 使用 OpenAI 兼容的 API 格式。基础 URL 为:

https://ai-gateway.vercel.sh/v1

您可以使用任何 OpenAI 兼容的客户端与此端点和您的 API 密钥一起使用。