AI [PRO]
For AI integration, 2 great packages are used
- openai (opens in a new tab) - For using OpenAI's ChatGPT.
- vercel/ai (opens in a new tab) - A universal library to easily connect UI and models providers (e.g OpenAI).
The corresponding package is located at packages/ai
.
OpenAI Setup
-
You need to create an account on OpenAI platform (opens in a new tab).
-
Go to API keys in the sidebar and create a new API key. Copy it and paste into the
.env
file.
OPENAI_API_KEY=
Note that you need to buy credits before you can start prompting ChatGPT, otherwise the OpenAI API will fail with the error. You can buy credits by going to Settings > Billing in the sidebar.
- The chat with AI playground is available at
http://localhost:3000/ai
. Feel free to tweak it to accomodate to your needs.