Use OpenAi Api to build a ChatGPT web version locally

Original link:


Before ChatGPT became popular on the Internet, OpenAi couldn’t support it because many developers tried their best to squeeze their wool. For new registered accounts, there is only a free quota of $5, and the web version also has various restrictions. OpenAi uses CloudFlare’s firewall, and the IP I use is the computer room in West America, which was blocked without any accident.

In order to facilitate my continued use, I use OpenCat developed by Baye on the mobile device to perfectly solve the problem that the web version cannot be used.

On the desktop, I searched for a long time, and finally found this project: chatgpt-web , simply deployed and installed it, which fully meets my current usage needs, bypassing CloudFlare’s firewall restrictions, and using OpenAi Api to directly get answers to questions.

This article will teach you how to deploy your own ChatGPT locally through the api.

deployment process

The first thing to confirm is whether your LAN environment can access the OpenAi website. If not, please support the wall first and then come back to this article for the next deployment operation.

get API key

You can refer to this article ” OpenAI’s ChatGPT ultra-simple registration strategy! “Register, after login, you can create your api key in the following link:

The page should look like the picture below, create a copy and save it. Because it will only be displayed once.

docker deployment

To enter the command line interface of the Linux system, you must first ensure that docker is available. If you have not installed it, you can use the following code to install it. The installation method may be different in different systems, the following is the installation method under Ubuntu.

 sudo apt-get install docker-compose

Next, you need to create .env , fill in your key in quotation marks, and save it.


Then create the docker-compose.yml configuration file and save it.

 version: "3.3"
image: sheepgreen/chatgpt-web #如果是arm架构,需要改成chatgpt-web:arm
container_name: webchat
- ./.env:/chatgpt-web/.env
- "8888:8088" #8088为容器内部端口,不可更改;8888为外部映射端口,可自行更改
restart: always

Finally, enter the command docker-compose up -d , and wait for the command line to finish running to start successfully.


Open http://ip:port/chat to access the ChatGpt-web we just created.

We can test it out:


In the process of using OpenAi Api to build the ChatGPT web version, I deeply felt the impact and changes of technology on our lives. ChatGPT is not only an intelligent dialogue system, but also an idea and method of developing artificial intelligence technology.

This project also gave me a deep understanding of the existence and development of artificial intelligence technology. From machine learning, natural language processing to deep learning, neural networks and other fields, artificial intelligence technology is constantly innovating and improving. Through this practice, I am even more convinced that the future world will be inseparable from the support and application of artificial intelligence technology.

Finally, I think that in the not-too-distant future, there will be fewer and fewer low-end programmers like the porters in the construction industry now, but one will be replaced by mechanical devices and the other by artificial intelligence. And being able to drive artificial intelligence is like being able to drive an excavator, at least it will not be killed on the shore by the tide of the times.

This article is transferred from:
This site is only for collection, and the copyright belongs to the original author.