This example shows how to use Pulumi to deploy a OpenAI chatbot running on Vercel. The chatbot uses the Vercel AI SDK with Next.js and OpenAI to create a ChatGPT-like AI-powered streaming chat bot.
- Pulumi account and token
- Pulumi CLI
- Vercel account and token
- OpenAI account and key
- GitHub integration installed in Vercel
Clone or fork this repo into your own GitHub repo.
Enter the vercel-py-openai-chatbot/pulumi
directory and initialize the Pulumi stack
cd vercel-py-openai-chatbot/pulumi
pulumi stack init
You will need a Vercel API token and OpenAI API key. Set the configuration variables.
pulumi config set --secret vercel:apiToken <VERCEL_API_TOKEN>
pulumi config set --secret openai_api_key <OPENAI_API_KEY>
pulumi config set git_repo <YOUR_GITHUB_REPO_PATH>
Execute the Pulumi program
pulumi up
To use your new chatbot, just follow the URL from the stack output in your browser.
If you’d like to tear down all of these resources and delete your stack, run pulumi destroy -rf --remove
. Otherwise, have fun playing around with your new chatbot and add whatever you like! 🙂
To learn more about Pulumi, OpenAI, and the Vercel AI SDK take a look at the following resources: