Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

chatgpt-demo

> AI 编程
Open source

Minimal web UI for ChatGPT.

7.9K stars0 likes2 views
WebsiteGitHub

About

Minimal web UI for ChatGPT.

ChatGPT-API Demo

English | 简体中文

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

** Live preview**: https://chatgpt.ddiu.me

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

Introducing Anse

Looking for multi-chat, image-generation, and more powerful features? Take a look at our newly launched Anse.

More info on https://github.com/ddiu8081/chatgpt-demo/discussions/247.

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.
    bash
     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:
    bash
     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 https://beta.openai.com/signup.

Getting Started

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

Deploy

Deploy With Vercel

Need website password?

Deploy with the SITE_PASSWORD

Deploy With Netlify

Step-by-step deployment tutorial:

  1. Fork this project, Go to https://app.netlify.com/start new Site, select the project you forked done, and connect it with your GitHub account.

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

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

Deploy with Docker

Environment variables refer to the documentation below. Docker Hub address.

Direct run

bash
docker run --name=chatgpt-demo -e OPENAI_API_KEY=YOUR_OPEN_API_KEY -p 3000:3000 -d ddiu8081/chatgpt-demo:latest

-e define environment variables in the container.

Docker compose

yaml
version: '3'

services:
  chatgpt-demo:
    image: ddiu8081/chatgpt-demo:latest
    container_name: chatgpt-demo
    restart: always
    ports:
      - '3000:3000'
    environment:
      - OPENAI_API_KEY=YOUR_OPEN_API_KEY
      # - HTTPS_PROXY=YOUR_HTTPS_PROXY
      # - OPENAI_API_BASE_URL=YOUR_OPENAI_API_BASE_URL
      # - HEAD_SCRIPTS=YOUR_HEAD_SCRIPTS
      # - PUBLIC_SECRET_KEY=YOUR_SECRET_KEY
      # - SITE_PASSWORD=YOUR_SITE_PASSWORD
      # - OPENAI_API_MODEL=YOUR_OPENAI_API_MODEL
bash
# start
docker compose up -d
# down
docker-compose down

Deploy with Sealos

1.Register a Sealos account for free sealos cloud

2.Click App Launchpad button

3.Click Create Application button

4.Just fill in according to the following figure, and click on it after filling out Deploy Application button

bash
App Name: chatgpt-demo
Image Name: ddiu8081/chatgpt-demo:latest
CPU: 0.5Core
Memory: 1G
Container Ports: 3000
Accessible to the Public: On
Environment: OPENAI_API_KEY=YOUR_OPEN_API_KEY

5.Obtain the access link and click directly to access it. If you need to bind your own domain name, you can also fill in your own domain name in Custom domain and follow the prompts to configure the domain name CNAME

6.Wait for one to two minutes and open this link

Deploy on more servers

Please refer to the official deployment documentation: https://docs.astro.build/en/guides/deploy

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. http://127.0.0.1:7890 null
OPENAI_API_BASE_URL Custom base url for OpenAI API. https://api.openai.com
HEAD_SCRIPTS Inject analytics or other scripts before </head> of the page null
PUBLIC_SECRET_KEY Secret string for the project. Use for generating signatures for API calls null
SITE_PASSWORD Set password for site, support multiple password separated by comma. If not set, site will be public null
OPENAI_API_MODEL ID of the model to use. List models gpt-3.5-turbo

Enable Automatic Updates

After forking the project, you need to manually enable Workflows and Upstream Sync Action on the Actions page of the forked project. Once enabled, automatic updates will be scheduled every day:

Frequently Asked Questions

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

A: Configure environment variables HTTPS_PROXY,reference: https://github.com/ddiu8081/chatgpt-demo/issues/34

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

A: The Node version needs to be v18 or later, reference: https://github.com/ddiu8081/chatgpt-demo/issues/65

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

A: You can refer to this tutorial: https://github.com/ddiu8081/chatgpt-demo/discussions/270

Contributing

This project exists thanks to all those who contributed.

Thank you to all our supporters!

License

MIT © ddiu8081

Issues· 48 open

View all issuesOpen on GitHub
  • #466

    The service stopped unexpectedly, showing url concatenation error

    Updated Feb 13, 2025
  • #465

    gpt-4o模型错误:model_not_found The model `gpt-4o` does not exist or you do not have access to it. 在我

    Updated Sep 26, 2024
  • #464

    netlify部署失败

    Updated Jun 18, 2024
  • #463

    请问如何查看API在代码的哪里~如果想修改该如何做

    enhancementUpdated Feb 27, 2024
  • #462

    [GET] "http://esm.sh/@iconify-json/ph/icons.json": <no response> fetch failed

    Updated Feb 19, 2024
  • #460

    如何使用宝塔面板部署

    Updated Jan 22, 2024
  • #440

    netlify自动部署失败

    Updated Dec 27, 2023
  • #458

    No Auto Scroll When Generating Text

    Updated Dec 26, 2023
  • #454

    Vercel重新部署失败,提示@vercel/analytics 被全局安装了,而Vercel 不支持全局安装的包。

    Updated Dec 1, 2023
  • #445

    使用docker部署后站点密码无法生效

    Updated Nov 7, 2023

> Tags

TypeScriptastrochatgptchatgpt4gpt-3

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
CategoryAI 编程
PricingOpen source

> Related tools

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.