Preface#
This article contains a large number of images and practical content, as well as solutions to difficulties encountered.
It is suitable for new players with a spirit of exploration.
This article is written for friends in mainland China and other countries and regions that cannot access ChatGPT.
Some links in this article contain affiliate links.
For example, servers, virtual cards, receiving code numbers, etc.
If you register through the link, both you and I will receive some benefits, please be aware.
Key points included in this article:
How to register an OpenAI account, how to recharge OpenAI, how to obtain the official OpenAI API, how to obtain and use a virtual credit card from the United States, how to use a receiving code platform to get foreign phone numbers to receive verification codes, how to set up a server and build a website, how to use Docker to build projects on the server, how to set up server reverse proxy, how to point a domain name to the server, how to install LobeChat on Android and iPhone mobile devices, etc.
Rambling#
Hello everyone, I am A Diao.
Have you ever received a request from your boss asking you:
Can you set up a ChatGPT for me? I want to use it.
This is a very simple request.
The boss may have seen ChatGPT in a short video or somewhere else,
and others are using it very well; if he doesn't use it himself, it seems like he will be eliminated.
This is a natural demand that arises after sensing a sense of crisis.
However, using ChatGPT in China is indeed not easy, or rather, very difficult.
You can't teach your boss how to do it:
First, teach him how to use a scientific internet connection, then teach him how to set up a global proxy, then teach him how to switch nodes, and finally teach him how to enter the URL in the address bar.
From the moment you start teaching until he successfully reaches the page below,
it takes some, or even a lot of effort.
How to say it, the boss is very busy and has no time to remember.
The boss's demand is very simple: it should be ready to use immediately, without remembering anything.
Is it possible to achieve this?
The answer is yes, and today I will teach you how to achieve it.
The simplest solution:#
What is the simplest solution?
That is to give up using ChatGPT and replace it with domestic AI tools.
Qianwen, Doubao, Yuanbao, KIMI, etc.
But none of these are ChatGPT; domestic AI is still improving and is a follower.
If we don't limit ourselves to ChatGPT, this article would end here, because alternatives are easy to find.
But, it is still not ChatGPT, not the tool released by OpenAI.
This feeling is like wanting to find a sister to date,
but others push a guy to you and tell you it's about the same.
You say, even if I take a step back, I still want a sister,
and others say, this one is also hungry and can talk, it's the same.
Is it the same? Is it about the same?
I still feel there is quite a difference.
So today I will teach you how to use ChatGPT immediately and conveniently.
The latest and strongest AI is paid#
Of course, we also need to have the most basic concept,
using the latest and most advanced AI will definitely incur charges.
Just like when ChatGPT4o was just released, many traffic generation experts told you it was free to use,
but in reality, either they give you one or two unsatisfactory uses a day, or you can't use it at all without recharging.
Just like now with the O1-preview model, it is so expensive that you can hardly find anyone who can let you use it for free.
Breaking down the demand#
The core demand after breaking it down is:
-
Access without using a scientific internet connection.
-
Able to have conversations using the latest ChatGPT model.
If the person reading this article is a boss, you don't need to understand it,
just pass this article to your subordinates to do it, and remember to approve the budget first.
Yes, despite the attempts, the cost of use is not high, but it is not free.
Achieving it with LobeChat#
We use LobeChat to build a server to solve the above demands.
Official website: github.com/lobehub/lobe-chat
While solving the above problems, LobeChat has other benefits:
-
You can build one for friends/relatives who don't understand any technology to use.
-
Privacy and security, data is stored locally in the browser, each user is isolated.
(Note: The official API, even the creator cannot see user chat records)
-
Not only can you experience OpenAI, but once you learn, you can add any large model vendor.
-
You can set up a mobile app, ready to use.
These are things that the native ChatGPT cannot provide.
The final achieved effect#
Everyone knows I have a tool page, the address is diao.page (hereinafter referred to as Diao Page)
Visiting this URL allows you to see some services I use, equivalent to my favorites.
So imagine, if visiting chat.diao.page is equivalent to visiting ChatGPT,
(Note: Earlier, the ChatGPT access URL was chat.openai.com)
And it can also be opened in China, without needing a scientific internet connection, and there can be an app on the phone,
Isn't that achieving immediate use?
Yes, this is the final effect we achieved (the domain name is yours).
Three major steps to specific implementation#
So, how to do it?
Don't think too complicated; it's like putting an elephant in a refrigerator requires a few steps:
Open the refrigerator, put the elephant inside, and then close the refrigerator.
We also need a few steps to access the ChatGPT service via domain name.
First major step, obtain the ChatGPT API to make the ChatGPT model available for our use.#
Second major step, obtain a server to install LobeChat and integrate the API to provide web services.#
Third major step, obtain a domain name and point the domain name to the server.#
Important notes for friends who want to tinker#
Before starting the formal steps, there are a few important things to clarify in advance,
because the formal steps are written for beginners,
this is an advanced explanation, written in advance for friends who want to tinker.
-
If using the official OpenAI API, the server cannot be located in mainland China or Hong Kong, otherwise it will report an error.
-
After placing it abroad, our requirement for the server's IP is: it can be accessed regardless of whether it is using a scientific internet connection.
-
If using a transit API, the server location is arbitrary, but the transit API needs to change parameters when building the application.
-
The O1-preview model is very expensive, do not try it lightly; I recommend using the O1mini and Gpt0806 models.
-
When reverse proxying, Rainyun does not need to open a firewall in 1Panel, while other servers may need to open a firewall in 1Panel.
Prepare an online document#
Prepare a notebook or online document, as there will be many addresses and account passwords to remember later.
If it is a notebook, remember to save it regularly.
100% understandable tutorial starts here#
First major step: Obtain the ChatGPT API#
What is an API#
What is an API? Simply understand it as you recharged 100 yuan at the ChatGPT bakery.
The bakery gives you a string of encrypted characters: "bread eat me".
From now on, anyone entering the store just needs to tell the waiter "bread eat me" to consume, and the money will be deducted from your card.
At this point, "bread eat me" is your official ChatGPT API.
Of course, if you go to Tongyi Qianwen bakery or KIMI bakery, you definitely cannot use it, after all, this is given to you by the ChatGPT bakery.
There are also transit APIs on the market, which are usually universal after conversion (not elaborated here).
APIs are usually very long, generated by irregular characters to prevent decryption.
At the same time, there is also a risk of leakage; anyone who obtains your API can consume,
so keep it safe, preferably only you know.
How to obtain the official ChatGPT API#
How can you get the official ChatGPT API?
Just like buying bread, first register at the bakery, recharge, and then get the API.
That is, first register an OpenAI account, then recharge, and then obtain the API.
It is also three steps; let's start with the first step.
Obtain an OpenAI account#
To obtain the API, you must first register an OpenAI account.
Is the OpenAI account the same as the ChatGPT account?
Yes, they are the same; Lu Xun is Zhou Shuren.
Regarding the OpenAI account, I have a simpler method here.
Just buy it.
Experience the thrill of solving problems directly with money.
Note: It is best not to buy OpenAI accounts based on practical tests,
because bought accounts are easily subject to risk control due to registration IP issues.
If you are 100% unable to bind the card after being subject to risk control, consider the account issue.
Register an OpenAI account#
Now let's register together.
-
Use a scientific internet connection, preferably with nodes in the US, Japan, South Korea, or Singapore, test it yourself.
I am using a certain cat cloud's US 02 from Diao Page, the IP check is as follows.
Check address (already included in Diao Page): ping0.cc
-
Open the website: platform.openai.com
There may be a human verification, just check it.
-
Click Sign up.
(If the website does not open, check if it is global and switch proxy countries.)
-
Register; I am using Gmail here.
(Note: Can it be done without Gmail? Outlook is also fine; others have not been tested.)
-
After clicking the verification code, there may be multiple redirects, requiring re-entry, which is normal.
-
Enter your account password, remember to note the login address, account, and password in your notebook.
There may be multiple human verifications, then check your email for the verification code!
-
If this error occurs, it is most likely a node issue; switch nodes and retry.
-
After verifying the email, you will be prompted to enter your name and birthday; fill it in casually (over 18 years old).
-
You will be redirected to the homepage.
At this point, we have completed our first step, obtaining and logging into the OpenAI account.
Recharge the OpenAI account#
-
Click the gear Settings button in the upper right corner.
Billing-Add payment details-Select.
- Select Individual.
-
Then there will be a payment button; yes, it can only be paid by credit card.
Don't rush to enter; look further down.
Before recharging OpenAI#
Actually, this step of recharging is particularly skill-dependent; for reasons unknown,
it does not provide services in mainland China and Hong Kong,
therefore, if you use a credit card from mainland China or Hong Kong,
OpenAI will directly reject the payment.
So what to do if someone doesn't have a credit card at all,
let alone an overseas credit card from outside mainland China and Hong Kong.
At this point, let's set the webpage aside; we need a virtual credit card.
The function of a virtual credit card is somewhat like a debit card,
which means you pre-load money into it and then use the amount you have recharged.
We now need a virtual credit card that can be bound here.
Activate a virtual credit card#
Previously, I used Dupay, which had no issues with recharging, but they recently stopped services,
and many others have also gone bankrupt; I can't even guarantee that the ones I recommend won't go bankrupt.
(So don't leave too much money in the card; recharge small amounts multiple times to avoid losses.)
However, very few go bankrupt maliciously (meaning the money cannot be recovered; most can be refunded).
I have tested several service providers, but currently, the most convenient one is WildCard.
Reasons for recommendation:
- You can open a card and recharge it via Alipay or WeChat.
- There is a tax-free billing address for credit cards.
- Invitation code ADIAO, I get 2 dollars, and you pay 1 dollar less.
So let's get started.
- Open the link to receive the verification code to register; if you cannot obtain the verification code, first turn off the scientific internet connection.
-
Set a password,
remember to note the login address, account, and password in your notebook.
-
Click on the left side to activate WildCard payment membership, and continue to activate!
-
Choose two years, click to pay, and scan the code with Alipay (about 80 yuan).
Here, the fee is for opening the card; almost all virtual credit cards have an opening fee, generally ranging from 6 to 20 dollars.
-
After successful payment, fill in your name and email, relatively casually.
-
Then there will be an OpenAI ban prompt (click I understand) (then click complete verification).
Then you will enter the real-name verification stage; we are not doing illegal activities, so we are not afraid.
(If you are worried about information leakage or doing illegal activities, find another service yourself.)
-
After completing the verification with Alipay, you will receive a virtual credit card.
But at this point, you only have the card, and there is no money in it, so you need to recharge it before you can spend,
after all, it is not a real credit card with a credit limit.
-
Click to recharge, online recharge.
-
Choose OpenAI API, and you can recharge via WeChat or Alipay.
It is recommended to recharge 10 dollars first because the minimum on OpenAI's side is 5 dollars,
and you should leave some in the card to prevent deduction failures.
-
You can see that the recharge was successful, so you now have a virtual credit card.
Equivalent to having a US credit card with a credit limit of 10 dollars.
Note: Anyone who has this card number, security code (CVC/CVV), and expiration date can use this card,
so keep the information safe and do not disclose it to anyone.
Recharge OpenAI account with 5 dollars#
Return to the payment method addition interface of OpenAI we just visited.
At this point, we add the card, and we just fill in the information given by Wildcard one by one.
Note: If your payment fails, when seeking help from others,
be sure not to screenshot or tell others your CVV (unless you trust them).
For payment, my node is a certain cat cloud's Singapore 03,
the health of the node is shown in the picture below; it is not home broadband, nor is it a native IP,
the risk control value is generally, but it can bind the card successfully, for reference.
(Note: This article has a time sensitivity; no guarantees are made for the usability of the node.)
After successfully binding the card, we recharge 5 dollars again, turn off automatic recharge.
Then just confirm the payment.
Questions and explanations about OpenAI payment failures#
-
Question: I registered the OpenAI account using a US IP, but I used a Singapore IP when binding the card. Is this okay? Will it trigger risk control and cause the binding to fail?
Answer: Currently, practical tests show it will not; the speculation is that OpenAI uses its own/Cloudflare's risk control model during registration, but the binding and recharge use Stripe's risk control model, which are unrelated. However, this does not rule out future changes, so it is recommended to register early if needed.
-
Question: Why did my card binding fail? Is it a card issue?
Answer: There are two common error messages for OpenAI credit card binding failures.
-
The first type: as shown in the picture below.
We are unable to authenticate your payment method. Please choose a different payment method and try again.
You can see that it is still this card, but it was rejected.
(This card was rejected 4 or 5 times before being successfully bound, later proven to be an account issue.)
In this case, it is not yet a card issue; it is an IP or account issue.
Either the IP is too poor, such as using free or particularly cheap scientific internet connections.
How to confirm? Before binding the card, check it like I did using ping0.cc.
Or the account has issues, such as a purchased OpenAI account that has already been subjected to risk control.
How to confirm? Change the IP multiple times before binding; if it keeps reporting errors, suspect an account issue.
Note: Do not rush to change IP for payment; for example, if you tried a US IP and it was rejected, wait a few minutes and try a Japanese one. If it is still rejected, just give up for today; do not try multiple times in a short period, as it may lead to the OpenAI account being banned.
-
The second type: as shown in the picture below.
Your card has been declined.
This situation may still be an IP issue, and the handling method is the same as the first type.
Another possibility is that the card balance is insufficient or zero.
Another possibility is that the card is a domestic or Hong Kong bank card.
In practice, the Lianlian Industrial Bank card I often use (search for Xingye on Diao Page) is not supported.
-
Therefore, in most cases, it is an IP and account issue, not a card issue.
After all, this is a card specifically designed for OpenAI payments,
and there have been many successful cases during this time.
I have had multiple unsuccessful payments, which were later proven to be account and IP issues.
-
-
If it still does not succeed, please search for solutions yourself; here are two reference posts.
Before obtaining the OpenAI API#
Now that we have completed the recharge, we should obtain the API.
Click the Settings button in the upper right corner, then click on the left side API keys, and then click Create new secret key.
Here you will be prompted to bind a phone number.
Mainland Chinese phone numbers do not work, and Hong Kong numbers probably do not work either (not tested).
It will prompt you as shown below: OpenAI's services are not available in your country.
OpenAI's services are not available in your country.
This is also a step where everyone shows their skills.
You can only use a foreign phone number to receive the verification code, so how can you use a foreign phone number?
For example, I have a physical foreign card, which of course needs to be purchased in advance.
For instance, New Zealand's Skinny, UK's Giffgaff, etc., can be used directly.
Foreign phone numbers and verification codes#
If you do not have a foreign phone number, you can find a receiving code platform,
such as SMS-Activate or SMS-Man to buy a temporary receiving code.
Searching for "receiving code" on Diao Page can get you these two URLs.
Taking SMS-Activate as an example.
After registering and logging in, click the plus sign in the upper right corner to recharge, and you can use Alipay.
The minimum recharge is two dollars, equivalent to 198P, which is enough.
After recharging, search for OpenAI in the left search box and click.
Here you can choose the country of the receiving number.
American numbers will be more expensive, and I think it is unnecessary.
Buy a cheaper one from the Philippines, 20P, and click the shopping cart.
(What to do with the remaining money? The answer is to save it for future use.)
A confirmation box will pop up; just click Buy to confirm.
(Note: Some may say that I registered the account with a US IP, will buying a Philippine number for verification cause problems? Will it trigger risk control or ban the account?
Answer: Based on my actual tests, I have not been banned, and the account is functioning normally. For reference only.)
(Note: Some may ask if after receiving the code, will I need phone number verification in the future, or I cannot use it?
Answer: Currently, it will not; phone number verification is OpenAI's way to prevent abuse and is unrelated to two-step verification; changing the password will still receive a verification code via email.)
After clicking Buy, the page will refresh, and the phone number will appear on the right side of the page as shown below.
You fill this phone number into the OpenAI field, and you can get the verification code here.
In SMS-Activate, button 1 in the image below is to cancel, and button 2 is to change the number.
If you do not receive the verification code for a long time, change to another number and try again.
If you still do not receive it after changing the number, cancel and try buying a number from another country.
Successfully obtaining the OpenAI API#
After verifying the phone number, click Create New Secret Key again.
Then click Create secret key.
Then you will obtain the API Key (as shown in the picture below).
Note, be sure to copy it to your notebook.
The API Key will only appear once, and do not disclose it to anyone.
If you do not copy it or forget it, you can only delete it and create a new one.
At this point, congratulations,
we have completed the first step of the three major steps.
This is also the most difficult step.
The first step is the hardest, full of uncertainties.
So I have spent a lot of space explaining unexpected situations.
However, the second and third steps are very certain,
following along will not have surprises, so I think they are simpler.
The first major step, obtain the ChatGPT API to make ChatGPT serve us. ✅
Second major step: Obtain a server to install LobeChat#
Purchase the required server#
For the server, I chose Rainyun because it integrates the open-source server management panel 1Panel,
which makes it easier to operate later, and the price is not expensive with low latency.
Copy the link below to open it in your browser, or search for Rainyun, discount code is diao.
You can get a 50% discount? I can get some commission; that's about it.
Start operating like I did.
- Register and log in, remember to note the login address, account, and password in your notebook.
Then find the cloud server and click to purchase now!
-
Choose Los Angeles, USA, ultra-fast dual-line zone 2,
E5V4 chip (the chip doesn't matter, it's about the same), select KVM entry version.
It shows 25 a month here, but after you register with the discount code, it should be around ten dollars a month.
The entry-level configuration is sufficient.
-
The operating system can be left as default; later you can try others since the server is yours.
Choose 1Panel for pre-installed apps; be sure to select this to save manual installation.
Then click to purchase now.
- Then you will see the same interface as mine.
Congratulations, you have your first server.
Click on management in the image above, and it will prompt you to bind your phone or email; bind it.
After binding, there will be a pop-up window; you can read it later when doing your own project; you can close it for now.
After your purchase is complete, it will show creating for about 5-10 minutes,
the server is installing the system and 1Panel, and it will provide the 1Panel panel information.
After ten minutes, your interface will look like mine below.
First is the IP address, which is very important and will be used.
Next is the remote username and remote password of the server, which will not be used in this tutorial, but please note it in your notebook.
Log in to the server management panel 1Panel#
Then there is the 1Panel panel address, panel user, and panel password; remember to note this in your notebook.
Here you need to manually apply:
Replace $LOCAL_IP with your server IP,
It is recommended to operate in the notebook, do not operate in the address bar.
For example:
As shown in the image above, my IP address displayed in Rainyun is 154.44.10.143, and my panel address is http://$LOCAL_IP:36712/e5cbe60270
So the actual address I need to access is http://154.44.10.143:36712/e5cbe60270
(Don't access mine; the address you need to access must be different from mine.)
Example ends.
Then we access this address in the browser, as shown in the image below.
Enter your panel user and panel password to log in.
Install LobeChat#
This is the visual management page of the server; we will install the application next.
Click on the left side of the app store, click AI/large models, select LobeChat, and click install.
(In fact, selecting the ChatGPT-Next-Web next to it can also achieve our goal; those interested can try it themselves.)
How to fill in LobeChat parameters#
After clicking install, a sidebar will pop up,
As shown in the image below, I will teach you how to fill it in.
-
The defaults I haven't mentioned remain unchanged, such as name, version, port.
-
The OpenAI API key is the one we spent a lot of effort to obtain in the first step; just copy it over.
-
The OpenAI proxy URL does not need to be changed (experienced users note: the official API does not need to be changed; if it is a third-party transit API, it needs to be changed).
-
For the access password, to make it easy to use, it should not be too complicated, easy to remember, and easy to share.
Please write the access password in your notebook, like this: LobeChat access password: test.
Note: This was updated on December 6, 2024.
- For the OpenAI model list, fill in
-all,+o1-mini,+GPT-4o mini,+GPT-4o 0806
LobeChat has updated the model names; here it should be filled in as
-all,+o1-mini,+gpt-4o-mini,+gpt-4o-2024-11-20
This means blocking all models, adding the O1mini model, adding the 4omini model, and adding the 4o 1120 model.
Note: This update ended on December 6, 2024.
Advanced explanation for parameter filling 1#
(Advanced explanation, beginners can ignore it, it does not affect usage)
Here I will focus on the fifth point mentioned above,
If you leave the fifth point blank, what will happen?
That is, when you share the AI tool with others later,
your users can choose the model (as shown in the image below), so when they choose a more expensive model,
your bill will skyrocket, especially the second one, which is currently the most advanced OpenAI o1-preview.
Just a few responses can deduct you 1 dollar, which is really not affordable for us poor people.
So what will happen if you input like I did in the fifth point here?
-all,+o1-mini,+GPT-4o mini,+GPT-4o 0806
-all,+o1-mini,+gpt-4o-mini,+gpt-4o-2024-11-20
In actual use, the models your users can choose will become three,
namely OpenAI o1-mini, GPT-4o mini, and GPT-4o 1120.
These three models are not that expensive, and relatively speaking, their performance is quite good, so I set it this way.
-all means excluding all models,
+o1-mini means adding the o1-mini model to the user's choices,
and so on.
If you want to add gpt3.5 (which should be rarely used), or other models, you can refer to the official document.
This document contains the latest supported models by OpenAI; you can add them.
Usage method: find the model ID, then add +model ID after the fifth point,
or simply leave the fifth point blank (which has the risk of excessive charges).
https://github.com/lobehub/lobe-chat/blob/main/src/config/modelProviders/openai.ts
Note: The following two URLs have been added to Diao Page
If you want to know the pricing for each OpenAI model, you can refer to the official document.
https://openai.com/api/pricing/
If you want to know which model has the best cost-performance ratio, you can refer to a third-party ranking.
https://artificialanalysis.ai/
For example, how expensive is the o1-preview model? Just look at the image below, and you'll know.
But from the quality of the responses, as shown in the image below,
it can be seen that o1 mini is already very good,
and GPT-4o mini has an outstanding cost-performance ratio.
So AI also has its expensive and cheap uses.
The fifth point here mainly controls the available models and can control the budget; if the budget is really tight, using only GPT-4o mini is also fine, after all, when you do not register, accessing chatgpt.com defaults to this model.
Who dares to say that GPT-4o mini is not ChatGPT?
Okay, the advanced explanation ends here; let's continue with the installation.
Check the external access for the port#
Scroll down and check the external access for the port.
Then click confirm.
Advanced explanation for parameter filling 2#
(Advanced explanation, beginners can completely ignore)
Before confirming, you can scroll down and click to edit the compose file.
Add a line below line 14, input
- ENABLED_OLLAMA=0
Just like in the image below.
Adding this line controls the local Ollama model so that it does not display.
If not set, when users choose models, there will be some Ollama models added.
But since Ollama was not set up in advance, they are invalid models, and if used, it will report an error.
(After all, reporting an error does not incur charges, so if you don't select it while using, it doesn't matter.)
If used, it will report an error like in the image below.
If you add this command
- ENABLED_OLLAMA=0
It means you have set to hide the Ollama model,
when users choose models, they will only see OpenAI models, which looks cleaner.
If you clicked confirm too quickly and still want this feature, what should you do?
No worries, just uninstall and reinstall. (Uninstalling the application is mentioned below.)
But completing is more important than perfection; being quick is not necessarily a bad thing; I suggest you can skip this.
Follow the first step, and if you can complete it, that's great.
The advanced section ends here; remember to click confirm.
Successfully installed LobeChat#
After clicking confirm, it will enter the automatic deployment phase.
Just wait a couple of minutes for the deployment to complete.
When "started" appears in the installed list, you can access it.
Subsequent application upgrades can also be done here with one click.
Major upgrades usually occur when a service provider introduces a brand new model.
Now that it is set up,
how to access it? (In the previous step, be sure to enable external port access)
It is related to your server IP, in the format:
Your server IP:40247
For example, my server IP is 154.44.10.143,
then my LobeChat access address is 154.44.10.143:40247.
Example ends.
Forgot to enable external port access#
If you missed it in the previous step and forgot to enable external port access, what should you do?
Don't worry; just click uninstall, then delete and reinstall.
The server is yours; you can do whatever you want.
So after accessing this address, if everything goes well,
you will be redirected to the page shown below.
Click to start immediately, and you will see a similar interface as shown below,
Congratulations, the setup is complete.
Change LobeChat to Chinese interface#
If it is in English, you can change the language to Chinese according to the order in the image below.
(The language here is actually based on your browser language.)
Enter password and start experiencing#
Try typing hi in the dialogue box; it will prompt you to enter the password.
At this time, open your notebook, find the LobeChat access password,
mine is test; enter it and click confirm and retry to start chatting.
If you are using it entirely internally and do not need a domain name,
actually, you can end here; it can still be used.
At any location with internet access, enter your LobeChat access address
(my address is 154.44.10.143:40247)
and you can have conversations with ChatGPT.
Although it is dressed in LobeChat's clothing, the core is still ChatGPT.
Thus, we have completed the second step of the three major steps.
Take a sip of water and relax.
The second major step, obtain a server to provide web services for us. ✅
Third major step: Point the domain name to the server#
First, you need a domain name#
To point a domain name to the server, you first need a domain name.
If you happen to have a domain name, you can use a subdomain or a main domain.
If you want XXXXX.com to point to your AI tool, you will use the main domain.
If you want chat.XXXXX.com to point to your AI tool, you will use a subdomain.
My main domain, which is diao.page, already has a navigation page service,
so I will use a subdomain; the following is an example using a subdomain.
I want chat.diao.page to point to my LobeChat service,
Domain name setting A record#
Cloudflare resolution instructions
I have entrusted the domain name resolution to the highly-rated Cloudflare.
Therefore, I need to make an A record in Cloudflare.
In the image below, first select type A, and for name 1, this is the subdomain, which is chat.
(Note: If you are using the main domain, just fill in @ for name 1.)
The IPv4 address is the server IP, then save it.
The domain name setting is done.
Aliyun resolution instructions
If your domain name is registered with Aliyun, then Google: Aliyun domain add A record.
I found the following, refer to Aliyun's official instructions.
https://help.aliyun.com/zh/dns/add-a-dns-record#h2-a-1
Here I will also post a picture from Aliyun; as for other places where you registered, you will have to figure it out yourself.
Similarly, the subdomain is chat, so fill in chat for the host record,
(Note: If you are using the main domain, fill in @.)
Fill in your server IP for the record value, then confirm. (TTL can be ignored.)
The domain name setting is done.
Server reverse proxy setup#
At this point, it is not over yet; we need to set up a reverse proxy on the server.
I will only tell you that you need to reverse proxy and teach you how to do it.
The principle cannot be explained clearly in a short time; those interested can learn it themselves.
Install OpenResty#
First, open the server panel, find OpenResty installation, everything can be left as default.
In about two minutes, the installation will be complete,
and you will see "started" in the application store - installed, indicating that the installation is complete.
Rainyun does not require a firewall to be opened, so we can directly set up the reverse proxy.
Create reverse proxy#
Create a website in the 1Panel panel.
Then fill in your domain name for the main domain, and for the proxy address, fill in 127.0.0.1:40247.
Then click confirm (as shown in the image).
Complete domain name pointing to server#
OK, great, at this point, accessing your domain name will allow you to use it.
(The domain name setting A record has a propagation time; Cloudflare takes effect in seconds, while others may have delays, generally within 2 hours. So if you access the domain name but it doesn't open, you can wait two hours and check again.)
Of course, my domain name is chat.diao.page, as shown in the image below.
I have set up the domain name resolution with Cloudflare, so the SSL certificate does not need to be set up, which is very simple.
Of course, even without SSL, it doesn't matter, after all, it is for personal use.
The third major step, obtain a domain name, and point the domain name to the server. ✅
Praise Yourself#
Thank you for watching, and thank you for your practical experience.
Remember to praise yourself; you are the best.
Your final online document#
In the end, your password should have a total of 8 groups.
Unless leaked, I suggest not changing the default generated password.
Because a password that even you cannot remember is the best password.
If you filled in according to my prompts, your notebook should look like the image below.
The asterisks are for mosaic; yours should not have asterisks.
Check for any omissions; some cute ones may forget their passwords and have a headache.
How to install LobeChat on mobile#
LobeChat uses a Progressive Web App (PWA)
which is a relatively advanced concept, somewhat like a browser version of a mini-program.
It is lighter and faster, while the experience is smooth. (But it has not been promoted much.)
In China, this concept is not well accepted, as memory can be occupied at will, and you can only endure it.
The following link is the official documentation on how to install it.
https://lobehub.com/zh/docs/usage/features/pwa
The following is an unofficial installation guide; if there are changes, refer to the official one.
Please do not ask me how to install it on HarmonyOS unless you want to give me a device.
Android#
Android series phones (Xiaomi and others have been tested)#
First, install the Chrome browser (figure it out yourself, not elaborated here).
If using other browsers, adding to the desktop is also possible; the difference is not significant.
- Use Chrome to open your LobeChat URL, click the settings in the upper right corner.
- In the pop-up sidebar, click Add to Home Screen.
- Click install; if you are not using Chrome, you can only click to create a shortcut.
- The Chrome browser will trigger the PWA application installation; click install.
- After a minute or two, the LobeChat App will appear on your desktop!
iPhone series phones#
There may be a bug or something, inconsistent with the official instructions.
The developer said clicking share will have an Add to Dock button, but I cannot find it.
System IOS 18.1, it may only be available on Mac; test it yourself.
The following app uses the Add to Home Screen feature common to browsers.
Also, the background of the app opened on the iPhone is black, which the official instructions mentioned is normal.
-
Use Safari to open your LobeChat URL, click the share button in the middle bottom of the page.
-
In the pop-up bottom bar, click Add to Home Screen.
-
Your desktop will have the LobeChat App.
If the default installation background is black, how to switch?
You can click on me, then the moon button in the upper right corner to switch,
or click on me, general settings, theme, light color to switch.
About LobeChat's cloud service#
You can see that when you open it on the computer, the mobile version is a completely new interface, and you have to re-enter the password, etc.
I mentioned earlier that its data is stored in the browser, so it has strong privacy protection.
Therefore, you can share it with others without worrying about privacy issues,
this is also the original intention of writing this article, and the reason for doing such a complex thing,
which is to share ChatGPT with those you think are worthy through your own efforts.
But some people may say, I just want to use it myself; what if I want cloud synchronization?
The answer is very simple: choose an AI tool you think is good and buy it.
There are many options; I have used You Pro (20 dollars/month) for a long time.
You can also subscribe to ChatGPT Plus (20 dollars/month) or buy LobeChat Cloud (minimum 4.9 dollars/month),
LobeChat Cloud also supports more advanced database functions.
In LobeChat's pricing plan, if you have an API, it is 4.9 dollars a month, which I think is acceptable.
(So it is quite gratifying that you can obtain an official API in mainland China.)
If you do not have an API, it is slightly more expensive, but the benefit is that you do not need to set up and manage, and many models are available.
In the past two years, I have spent over two thousand dollars on AI usage; my evaluation is based on demand.
Postscript#
Written at the end:
- Your set domain name and server may be blocked if too many people use it (referring to hundreds or more).
There is a small probability of being blocked, and at that time, accessing your domain name will also require a scientific internet connection.
- Once set up, you can also let friends use it, let your girlfriend use it, let your parents use it,
In short, regardless of how AI develops, whether it brings changes or not, you have to experience it yourself to know.
- Taking a step back, you can tell interviewers in this not-so-easy job market,
I can also build AI tools, which may give you a better chance of being accepted.
(Maybe programmers can do this, but I am an outsider, so I say this.)
When there are more advanced things in the future, I will also study, learn, and share.
Rambling#
If placed on a Hong Kong server, when calling the official API, it will display
Country, region, or territory not supported.
That is, the country, region, or territory you are in does not support using ChatGPT.
The evil foreign forces actually want to prevent us from using it through physical isolation, hindering our progress.
The reason why this tutorial has many difficulties is that there are too many uncontrollable factors.
The official API was originally the simplest choice, but it is the hardest in China.
If you really cannot complete the first step, a transit API may be a simpler way.
But the transit API is not perfect; on the contrary, it has many loopholes.
The existing problems are:
- You cannot determine whether it is truly a forwarding transit, and whether the model is the one you selected.
- Transit APIs may sometimes disconnect, and when they do, it greatly affects the experience; you need to troubleshoot whether it is a server error, a Docker application error, or an unstable transit API.
- There is a risk of user privacy leakage with transit APIs; you wouldn't want your users' privacy to be leaked, right?
Have you successfully built it? If not, where are you stuck?
A Diao has created a Discord channel for this article; feel free to come and chat.