Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?


Failed to load latest commit information.
Latest commit message
Commit time
March 24, 2023 20:06
March 3, 2023 13:45
March 24, 2023 11:15

ChatGPT-API Demo

English | 简体中文

A demo repo based on OpenAI GPT-3.5 Turbo API.

🍿 Live preview:

⚠️ Notice: Our API Key limit has been exhausted. So the demo site is not available now.


Running Locally

Pre environment

  1. Node: Check that both your development environment and deployment environment are using Node v18 or later. You can use nvm to manage multiple node versions locally。
     node -v
  2. PNPM: We recommend using pnpm to manage dependencies. If you have never installed pnpm, you can install it with the following command:
     npm i -g pnpm
  3. OPENAI_API_KEY: Before running this application, you need to obtain the API key from OpenAI. You can register the API key at

Getting Started

  1. Install dependencies
     pnpm install
  2. Copy the .env.example file, then rename it to .env, and add your OpenAI API key to the .env file.
  3. Run the application, the local project runs on http://localhost:3000/
     pnpm run dev


Deploy With Vercel

Deploy with Vercel

🔒 Need website password?

Deploy with the SITE_PASSWORD

Deploy with Vercel


Deploy With Netlify

Deploy with Netlify

Step-by-step deployment tutorial:

  1. Fork this project,Go to new Site, select the project you forked done, and connect it with your GitHub account.



  1. Select the branch you want to deploy, then configure environment variables in the project settings.


  1. Select the default build command and output directory, Click the Deploy Site button to start deploying the site。


Deploy with Docker

Before deploying the app, please make sure .env is configured normally.

# build
docker-compose build .
# run
docker-compose up -d
# stop
docker-compose down

Deploy on more servers

Please refer to the official deployment documentation:

Environment Variables

You can control the website through environment variables.

Name Description Default
OPENAI_API_KEY Your API Key for OpenAI. null
HTTPS_PROXY Provide proxy for OpenAI API. e.g. null
OPENAI_API_BASE_URL Custom base url for OpenAI API.
HEAD_SCRIPTS Inject analytics or other scripts before </head> of the page null
SECRET_KEY Secret string for the project. Use for generating signatures for API calls null
SITE_PASSWORD Set password for site. If not set, site will be public null
OPENAI_API_MODEL ID of the model to use. List models gpt-3.5-turbo

Frequently Asked Questions

Q: TypeError: fetch failed (can't connect to OpenAI Api)

A: Configure environment variables HTTPS_PROXY,reference: #34

Q: throw new TypeError(${context} is not a ReadableStream.)

A: The Node version needs to be v18 or later,reference: #65

Q: Accelerate domestic access without the need for proxy deployment tutorial?

A: You can refer to this tutorial: #270

Q: PWA is not working?

A: Current PWA does not support deployment on Netlify, you can choose vercel or node deployment.


This project exists thanks to all those who contributed.

Thank you to all our supporters!🙏



MIT © ddiu8081