This is a simple repo exploring Vercel AI SDK. It's meant to share the code from my YouTube Channel:
This is by all means not production ready software. This is just to help get you started quickly.
- Make sure you register for an OpenAI API key. (See how to here)
- Copy
.env.example
to a new file called.env
or.env.local
.env
is tracked in git, be careful about handling your API key properly - install dependencies
npm install
# or
yarn install
# or
pnpm install
- run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
Open http://localhost:3000 with your browser to see the result.
- chat/route.ts handles the requests being sent to Open AI. They stream the responses back to the UI.
- page/tsx handles the form, hooks and communicates with the api route.