Menu Close

llm-chat-react-vercel

LLM Chat with React, OpenAI, and Vercel

Deploy with Vercel

screenshot

This is an example of a conversational (with voice!) React app that calls a simple serverless backend written in Python.

The backend automatically gets deployed to appropraite endpoint if using Vercel. Use the “Deploy” button above to deploy it to your own project.

Setup

  • You will need an OpenAI API token set to the OPENAI_API_KEY env variable. This app uses the GPT-4 model.
  • If have gpt-4 API access, set the OPENAI_API_MODEL env var to gpt-4, otherwise it will use gpt-3.5-turbo.
npm install

Running locally

# This starts the backend
npm i -g vercel
vercel dev

Deploying

# Only need to set the key once
vercel env add OPENAI_API_KEY
vercel deploy
View Source Code
Posted in Development