Build an AI chatbot
Give your product a brain. Up and running without managing servers.
Tools in this stack
- 1OpenAI
Create an OpenAI account and generate an API key from the API Keys page. Store this key securely as an environment variable called OPENAI_API_KEY. Choose a model like gpt-4o-mini for cost-effective conversations or gpt-4o for more complex reasoning tasks.
Open OpenAI - 2Vercel AI SDK
Install the Vercel AI SDK with npm install ai openai. Create an API route that initializes the OpenAI client and uses streamText() to stream responses back to the client. This handles all the complexity of streaming and provides React hooks for your chat UI.
Open Vercel AI SDK - 3Supabase
Create a conversations table with columns for id, user_id, created_at, and a messages JSONB column to store the chat history. Enable Row Level Security so users can only access their own conversations. Use the Supabase client to save and load conversation history.
Open Supabase
Other stacks you might like
Know a better stack?
Share your favourite tool combination with the community.