chatgpt-web
A third-party ChatGPT Web UI page, through the official OpenAI completion API.
50K+
Important
**This project is forked from [Chanzhaoyu/chatgpt-web](https://github.com/Chanzhaoyu/chatgpt-web)**As the original project author does not agree to introduce a dependency on the database, this Hard Fork was created for independent development discussion for details
Thank you again, the great Chanzhaoyu, for your contributions to the open-source project 🙏
Some unique features have been added:
[✓] Register & Login & Reset Password & 2FA
[✓] Sync chat history
[✓] Front-end page setting apikey
[✓] Custom Sensitive Words
[✓] Set unique prompts for each chat room
[✓] Users manager
[✓] Random Key
[✓] Conversation round limit & setting different limits by user & giftcards
[✓] Implement SSO login through the auth proxy feature (need to integrate a third-party authentication reverse proxy, it can support login protocols such as LDAP/OIDC/SAML)
[✓] Web Search functionality (Real-time web search based on Tavily API)
[✓] VLLM API model support & Optional disable deep thinking mode
[✓] Context Window Control
Caution
This project is only published on GitHub, based on the MIT license, free and for open source learning usage. And there will be no any form of account selling, paid service, discussion group, discussion group and other behaviors. Beware of being deceived.
Disclaimer: This project is only released on GitHub, under the MIT License, free and for open-source learning purposes. There will be no account selling, paid services, discussion groups, or forums. Beware of fraud.

Uses the official OpenAI API to access ChatGPT:
ChatGPTAPI uses gpt-4.1 through the official OpenAI completion API (requires an API key).
Setup:
service/.env.example file and copy the contents to the service/.env file.OPENAI_API_KEY field with your OpenAI API Key (Get apiKey).Environment Variables:
For all parameter variables, check here or see:
/service/.env
[✓] Dual models
[✓] Multiple session storage and context logic
[✓] Formatting and beautifying code-like message types
[✓] Login or Register
[✓] Set API key and other information on the front-end page.
[✓] Data import and export
[✓] Save message to local image
[✓] Multilingual interface
[✓] Interface themes
[✓] VLLM API model support
[✓] Deep thinking mode switch
[✗] More...
node requires version ^20 || ^22 || ^24, and multiple local node versions can be managed using nvm.
node -v
If you have not installed pnpm before:
npm install pnpm -g
Get your OpenAI API Key and fill in the local environment variables jump
# service/.env file
# OpenAI API Key - https://platform.openai.com/overview
OPENAI_API_KEY=
To make it easier for
backend developersto understand, we did not use the front-endworkspacemode, but stored it in different folders. If you only need to do secondary development of the front-end page, delete theservicefolder.
Enter the /service folder and run the following command
pnpm install
Run the following command in the root directory
pnpm bootstrap
Enter the /service folder and run the following command
pnpm start
Run the following command in the root directory
pnpm dev
OPENAI_API_KEY requiredOPENAI_API_BASE_URL optional, available when OPENAI_API_KEY is setOPENAI_API_MODEL optional, specify the model to useAUTH_SECRET_KEY Access Password,optionalTIMEOUT_MS timeout, in milliseconds, optionalSOCKS_PROXY_HOST optional, effective with SOCKS_PROXY_PORTSOCKS_PROXY_PORT optional, effective with SOCKS_PROXY_HOSTSOCKS_PROXY_USERNAME optional, effective with SOCKS_PROXY_HOST and SOCKS_PROXY_PORTSOCKS_PROXY_PASSWORD optional, effective with SOCKS_PROXY_HOST and SOCKS_PROXY_PORTHTTPS_PROXY optional, support http,https, socks5
GIT_COMMIT_HASH=`git rev-parse HEAD`
RELEASE_VERSION=`git branch --show-current`
docker build --build-arg GIT_COMMIT_HASH=${GIT_COMMIT_HASH} --build-arg RELEASE_VERSION=${RELEASE_VERSION} -t chatgpt-web .
# foreground operation
# If run mongodb in host machine, please use MONGODB_URL=mongodb://host.docker.internal:27017/chatgpt
docker run --name chatgpt-web --rm -it -p 127.0.0.1:3002:3002 --env OPENAI_API_KEY=your_api_key --env MONGODB_URL=your_mongodb_url chatgpt-web
# background operation
docker run --name chatgpt-web -d -p 127.0.0.1:3002:3002 --env OPENAI_API_KEY=your_api_key --env MONGODB_URL=your_mongodb_url chatgpt-web
# running address
http://localhost:3002/
version: '3'
services:
app:
image: chatgptweb/chatgpt-web # always use latest, pull the tag image again when updating
container_name: chatgptweb
restart: unless-stopped
ports:
- 3002:3002
depends_on:
- database
environment:
TZ: Asia/Shanghai
# Title for site
SITE_TITLE: ChatGpt Web
# access salt,optional Allow login if not empty.
AUTH_SECRET_KEY: xxx
# mongodb's connection string
MONGODB_URL: 'mongodb://chatgpt:xxxx@database:27017'
# After register enabled, Salt for password encryption
PASSWORD_MD5_SALT: xxx
# After register enabled, super administrator
ROOT_USER: [email protected]
# Allow anyone register, Must be turned on, otherwise administrators cannot register, can be turned off later.
REGISTER_ENABLED: true
# More configurations, register an administrator after running and set it in the administrator page.
links:
- database
database:
image: mongo
container_name: chatgptweb-database
restart: unless-stopped
ports:
- '27017:27017'
expose:
- '27017'
volumes:
- mongodb:/data/db
environment:
MONGO_INITDB_ROOT_USERNAME: chatgpt
MONGO_INITDB_ROOT_PASSWORD: xxxx
MONGO_INITDB_DATABASE: chatgpt
volumes:
mongodb: {}
The OPENAI_API_BASE_URL is optional and only used when setting the OPENAI_API_KEY.
Refer to this issue https://github.com/Kerwin1202/chatgpt-web/issues/266
Note: Changing environment variables in Railway will cause re-deployment.
If you don't need the
nodeinterface of this project, you can skip the following steps.
Copy the service folder to a server that has a node service environment.
# Install
pnpm install
# Build
pnpm build
# Run
pnpm prod
PS: You can also run pnpm start directly on the server without packaging.
.env.example file content to create .env file, modify VITE_GLOB_API_URL in .env at the root directory to your actual backend interface address.dist folder to the root directory of your website service.pnpm build
Tip
Context Window Control allows users to flexibly manage context information in AI conversations, optimizing model performance and conversation effectiveness.
The context window determines the amount of chat history from the current session that the model can reference during generation:
Recommended to enable context window when:
Recommended to disable context window when:
Administrators can configure in system settings:
Tip
Deep thinking mode control is only available when the backend is configured to use VLLM API, allowing users to choose whether to enable the model's deep thinking functionality.
After enabling deep thinking, the model will use more computational resources and take longer time to simulate more complex thinking chains for logical reasoning:
The following conditions must be met to use this feature:
Recommended to enable deep thinking when:
Recommended to disable deep thinking when:
disable_thinking parameterQ: Why does Git always report an error when committing?
A: Because there is submission information verification, please follow the Commit Guidelines.
Q: Where to change the request interface if only the frontend page is used?
A: The VITE_GLOB_API_URL field in the .env file at the root directory.
Q: All red when saving the file?
A: For vscode, please install the recommended plug-in of the project or manually install the Eslint plug-in.
Q: Why doesn't the frontend have a typewriter effect?
A: One possible reason is that after Nginx reverse proxying, buffering is turned on, and Nginx will try to buffer a certain amount of data from the backend before sending it to the browser. Please try adding proxy_buffering off; after the reverse proxy parameter and then reloading Nginx. Other web server configurations are similar.
Q: The content returned is incomplete?
A: There is a length limit for the content returned by the API each time. You can modify the VITE_GLOB_OPEN_LONG_REPLY field in the .env file under the root directory, set it to true, and rebuild the front-end to enable the long reply feature, which can return the full content. It should be noted that using this feature may bring more API usage fees.
Warning
This feature is only provided for Operations Engineer with relevant experience to deploy during the integration of the enterprise's internal account management system. Improper configuration may lead to security risks.
Set env AUTH_PROXY_ENABLED=true can enable auth proxy mode.
After activating this feature, it is necessary to ensure that chatgpt-web can only be accessed through a reverse proxy.
Authentication is carried out by the reverse proxy, which then forwards the request with the header to identify the user identity.
Default header name is X-Email, can custom config use set env AUTH_PROXY_HEADER_NAME.
Recommended for current IdP to use LDAP protocol, using authelia
Recommended for current IdP to use OIDC protocol, using oauth2-proxy
Tip
Web Search functionality is based on [Tavily API](https://tavily.com/) implementation, allowing ChatGPT to access the latest web information to answer questions.
Search Query Extraction Template (for extracting search keywords from user questions):
You are a search query extraction assistant. Extract the most relevant search query from user's question and wrap it with <search_query></search_query> tags.
Current time: {current_time}
Search Result Processing Template (for processing conversations with search results):
You are a helpful assistant with access to real-time web search results. Use the provided search information to give accurate and up-to-date responses.
Current time: {current_time}
Enable Search Functionality:
Ask Questions for Real-time Information:
View Search History:
Content type
Image
Digest
sha256:7bc34cc4a…
Size
82.1 MB
Last updated
about 1 month ago
docker pull chatgptweb/chatgpt-web