If you do not want to run a server locally, you can use the
Deploy
button to deploy your chatbot website to Vercel (or Netlify) with a few clicks. After deployment, you can refer to Vercel or Netlify to add a custom domain.Known limits of Vercel/Netlify deployment:
- Functions have a time limit of 10 s for Free tier, but the OpenAI API sometimes cannot respond within 10 s. In that case, you would not get the response. You can upgrade to Pro tier to increase the time limit to 60 s, which should be more than enough.
- Deployments are public to all by default, which means anyone can use your API key if they have your domain name. You can upgrade to Pro tier to add a basic password authentication. For Vercel, you can also choose to use preview (instead of production) deployments only, and enable
Protect Preview Deployments
to allow only your Vercel team members to visit the site.
-
If you don’t have Node.js installed, install it from here (Node.js version >= 14.6.0 required)
-
Clone this repository
-
Navigate into the project directory
$ cd my-chatgpt
-
Install the requirements
$ yarn install
Or if you want to use
npm
$ npm install
-
Make a copy of the example environment variables file
On Linux systems:
$ cp .env.example .env
On Windows:
$ copy .env.example .env
-
Add your API key to the newly created
.env
file -
Run the app
$ yarn dev
Or use
npm
$ npm run dev
You should now be able to access the app at http://localhost:3000! For the full context behind this example app, check out the tutorial.