An open-source AI chatbot app template built with Next.js, the Vercel AI SDK, OpenAI, upstash and Clerk.
Features · Model Providers · Running locally · Credits
- Next.js App Router
- React Server Components (RSCs), Suspense, and Server Actions
- Vercel AI SDK for streaming chat UI
- Support for OpenAI (default), Anthropic, Hugging Face, or custom AI chat models and/or LangChain
- Edge runtime-ready
- shadcn/ui
- Styling with Tailwind CSS
- Radix UI for headless component primitives
- Icons from Phosphor Icons
- Chat History, rate limiting, and session storage with Upstash
- Clerk for authentication
This template ships with OpenAI gpt-3.5-turbo
as the default. However, thanks to the Vercel AI SDK, you can switch LLM providers to Anthropic, Hugging Face, or using LangChain with just a few lines of code.
You will need to set up an upstash account and create a Redis Database. Only takes a few clicks!
Remember to update your environment variables (UPSTASH_URL
, UPSTASH_KEY
) in the .env
file with the appropriate credentials provided during the setup process.
You will need to set up a Clerk account and create a Clerk application. This also only takes a few clicks!
Remember to update your environment variables (NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
, CLERK_SECRET_KEY
) in the .env
file with the appropriate credentials provided during the setup process.
You will need to use the environment variables defined in .env.example
to run Next.js AI 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 OpenAI and authentication provider accounts.
- Install Vercel CLI:
npm i -g vercel
- Link local instance with Vercel and GitHub accounts (creates
.vercel
directory):vercel link
- Download your environment variables:
vercel env pull
pnpm install
pnpm dev
Your app template should now be running on localhost:3000.
This template is a fork of the main AI Chatbot from the Vercel team and other contributors. It has been modified to use Upstash and Clerk.