UNPKG

@lobehub/chat

Version:

Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.

62 lines (43 loc) 2.16 kB
--- title: 在 LobeChat 中使用 Vercel AI Gateway description: 了解如何在 LobeChat 中集成和使用 Vercel AI Gateway 的统一 API tags: - LobeChat - Vercel AI Gateway - API 密钥 - Web 界面 --- # 在 LobeChat 中使用 Vercel AI Gateway [Vercel AI Gateway](https://vercel.com/ai-gateway) 是一个统一的 API,通过单一端点提供对 100+ AI 模型的访问。它提供预算管理、使用监控、负载均衡和回退处理等功能。 本文将指导您如何在 LobeChat 中使用 Vercel AI Gateway。 <Steps> ### 第一步:在 Vercel AI Gateway 中创建 API 密钥 - 访问 [Vercel 控制台](https://vercel.com/dashboard) - 点击左侧的 **AI Gateway** 标签 - 点击左侧边栏的 **API 密钥** - 点击 **创建密钥**,然后在对话框中点击 **创建密钥** 完成创建 ### 第二步:在 LobeChat 中配置 Vercel AI Gateway - 进入 LobeChat 的 `设置` 页面 -`AI 服务提供商` 下,找到 `Vercel AI Gateway` 设置 - 输入您获得的 API 密钥 - 选择 Vercel AI Gateway 的模型,开始与 AI 助手对话 <Callout type={'warning'}> 使用过程中可能需要向 API 服务提供商付费,请参考 Vercel AI Gateway 的 [定价政策](https://vercel.com/docs/ai-gateway/models)。 </Callout> </Steps> 至此,您可以在 LobeChat 中使用 Vercel AI Gateway 提供的模型开始聊天了。 ## 模型选择 Vercel AI Gateway 支持多种模型提供商,包括: - **OpenAI**: `openai/gpt-4o``openai/gpt-4o-mini``openai/o1`- **Anthropic**: `anthropic/claude-3-5-sonnet``anthropic/claude-3-opus`- **Google**: `google/gemini-2.5-pro``google/gemini-2.0-flash`- **DeepSeek**: `deepseek/deepseek-chat``deepseek/deepseek-reasoner`- 以及更多... 如需查看完整的支持模型列表,请访问 [Vercel AI Gateway 模型](https://vercel.com/ai-gateway/models)。 ## API 配置 Vercel AI Gateway 使用 OpenAI 兼容的 API 格式。基础 URL 为: ``` https://ai-gateway.vercel.sh/v1 ``` 您可以使用任何 OpenAI 兼容的客户端与此端点和您的 API 密钥一起使用。