Background#
Recently, I tried using chatGPT for interaction, but due to OpenAI's enhanced anti-cheating measures, the page would frequently refresh, resulting in a very poor overall interaction experience. Therefore, I started looking for ways to build my own web version of chatGPT to make the interaction smoother. Even those without programming experience can give it a try!
Prerequisites#
- OpenAI API key
- Vercel account (free registration)
- GitHub account (free registration)
- Cloudflare (free registration)
- Domain name (optional)
Once you have all of the above prepared, you can start your journey of building your own web version of chatGPT in just 10 minutes.
Building Your Own Static GPT Page in 10 Minutes#
Step 1: Find the Repository#
Open the repository https://github.com/Yidadaa/ChatGPT-Next-Web
and find the README instructions.
Click on the "Deploy" button as shown in the image above, and you will be taken to the Vercel interface to proceed.
Step 2: Configure Vercel#
On this page, select GitHub and click "Create" to create a code repository under your account and associate it with the repository in Vercel.
To obtain the OPENAI API key, go to https://platform.openai.com/account/api-keys
and click on the "Create new secret key" button. A popup will appear with a string starting with "SK", which is your OPENAI API key.
OPENAI_API_KEY
is your OpenAI API key.
CODE
is the password that needs to be set in the web page for access control. If no password is set, anyone can use it, which may lead to malicious exploitation. It is recommended to set a longer password.
Click on "Deploy" and the program will start running. Just wait for it to finish.
Congratulations! The deployment is successful. Now, find the corresponding URL and you can access your independent online web version of chatGPT. Click on "Continue to Dashboard" to go to the control panel, and find the address in the red box. Click on it to access the web version of chatGPT.
Enter the CODE (password) you set earlier to start using it.
Setting Up a Custom Domain#
After completing the above steps, you can already access your own web page for ChatGPT. However, the default domain address provided by Vercel is quite long. If you have specific requirements for the domain, you can try purchasing a domain name on your own. The detailed process of buying a domain name will not be covered here.
Here, we will explain how to configure domain forwarding.
Vercel Dashboard#
- In the Vercel dashboard, go to
Settings
→Domains
→Add
and enter your domain name.
- After adding the domain, if you see the prompt shown in the image below (Invalid Configuration), it means that in order for this domain to take effect, you need to configure the corresponding CNAME resolution in your domain registrar's management backend.
Since vercel.app is blocked in China due to heavy usage, Vercel provides separate IP and CNAME addresses for users. For users in China, you can still enjoy the services provided by Vercel by configuring separate resolution. Replace the IP and CNAME addresses used in the above steps with the following:
A Record Address: 76.223.126.88
or 76.76.21.98
, etc.
CNAME Record Address: cname-china.vercel-dns.com
Completion#
If the domain service is configured correctly, the Vercel card will look like the image below:
The above example shows the effect of a subdomain. If you want to forward the root domain, additional steps are required.
Vercel Backend#
After adding the root domain, Vercel will prompt you to add an "@" record pointing to Vercel's server, which is either 76.76.21.21 or another address provided by Vercel.
Domain Registrar Backend#
Simply point the root domain to Vercel's server address: 76.76.21.21.
Additional Reading: Difference Between A Record and CNAME#
An A record resolves a domain name to an IP address, while a CNAME record resolves a domain name to another domain name.
Their functions are similar. A CNAME allows multiple hostnames to point to an alias, which is essentially the same as pointing to an IP address because the alias also needs an A record.
Conclusion#
If you're interested after reading this article, you can give it a try. It takes less than 30 minutes to set up your own web version of chatGPT with a custom domain. The speed is really fast.
However, the free account has a limitation of only 3 API requests per minute, which is sufficient for normal use but may be inconvenient for multiple users.
Lastly, I recommend an article on how to enable GPT Plus. If you have the need, you can take a look at it: https://www.onekey.wiki/post/chatgpt-plus/