chatbot README

The project's README from github.com/vercel/chatbot. As one markdown file: README.md.

Chatbot

Chatbot

Chatbot (formerly AI Chatbot) is a free, open-source template built with Next.js and the AI SDK that helps you quickly build powerful chatbot applications.

Read Docs · Features · Model Providers · Deploy Your Own · Running locally


Features

Model Providers

This template uses the Vercel AI Gateway to access multiple AI models through a unified interface. Models are configured in lib/ai/models.ts with per-model provider routing. Included models: Mistral, Moonshot, DeepSeek, OpenAI, and xAI.

AI Gateway Authentication

For Vercel deployments: Authentication is handled automatically via OIDC tokens.

For non-Vercel deployments: You need to provide an AI Gateway API key by setting the AI_GATEWAY_API_KEY environment variable in your .env.local file.

With the AI SDK, you can also switch to direct LLM providers like OpenAI, Anthropic, Cohere, and many more with just a few lines of code.

Deploy Your Own

You can deploy your own version of Chatbot to Vercel with one click:

Deploy with Vercel

Running locally

You will need to use the environment variables defined in .env.example to run Chatbot. It's recommended you use Vercel Environment Variables for this, but a .env file is all that is necessary.

Note: You should not commit your .env file or it will expose secrets that will allow others to control access to your various AI and authentication provider accounts.

  1. Install Vercel CLI: npm i -g vercel
  2. Link local instance with Vercel and GitHub accounts (creates .vercel directory): vercel link
  3. Download your environment variables: vercel env pull
pnpm install
pnpm db:migrate # Setup database or apply latest database changes
pnpm dev

Your app template should now be running on localhost:3000.

chatbot (vercel/chatbot)

Searching Database…

这是什么?这是 Vercel 用 Next.js 和 AI SDK 打造的开源 AI 聊天机器人模板,用来作为你自己开发聊天机器人应用的起点。
那它是一个能直接用的聊天机器人,还是一个代码起点?它是一个可以改造的模板:一个完整、可运行的聊天机器人应用(包含聊天界面、登录认证、聊天记录和文件存储),你可以把它部署起来再按自己的需求修改,而不是一个托管好的成品。
我怎么在本地把它跑起来?先安装 Vercel CLI(npm i -g vercel),运行 vercel link,再用 vercel env pull 下载你的环境变量——之后应用就会在 localhost:3000 上运行。
我需要自己准备 AI 模型的 API key 吗?部署到 Vercel 上时,AI Gateway 会通过 OIDC 令牌自动完成认证。如果在其他地方运行,你就必须自己在 .env.local 里设置 AI_GATEWAY_API_KEY 变量。
配置时有什么坑需要提前知道?你必须按照 .env.example 把环境变量填好,而且千万不要把 .env 文件提交到代码仓库——它会泄露密钥,别人就能借此控制你的 AI 和认证账号。
有没有一键部署的方法?有——在 Deploy Your Own 部分,只需点击一下就能把你自己的 Chatbot 副本部署到 Vercel。
我能用 AI Gateway 之外的其他模型服务商吗?可以——只需改几行代码,就能把 AI SDK 切换为直接使用 OpenAI、Anthropic 或 Cohere 这类 LLM 服务商。
界面是用什么做的?用的是 shadcn/ui 组件,样式由 Tailwind CSS 实现,底层依赖 Radix UI 原语来保证无障碍访问和灵活性。
Creator
vercel
Size
6.2 MB
Stars
21K
Updated
CommitJul 08
Age
3y
Commits · 90 Days