[Complete Tutorial] How to Self Hosted GPT4 ๐Ÿ“š Dummny Steps

Self hosted gpt 4 is possible as long as you follow this tutorial!

ChatGPT is a powerful natural language processing model developed by OpenAI. It is trained on massive text corpora, enabling it to automatically understand and generate human language. It uses a Transformer neural network architecture and can handle various tasks like question answering, text generation, translation, summarization, and dialog. The current version is ChatGPT-4, and OpenAI has announced plans to release ChatGPT-5 in November 2023, which is quite exciting! But today we will first teach you how to deploy your own ChatGPT on a VPS!

Self Hosted GPT 4 Preparations

1. Apply for your OpenAI API key [Click to get API key]. If you don't have an OpenAI account yet, please register for free first.

2. You will need a VPS. Even a low-spec one is enough for use. If you don't have one, I recommend this: Browse Website Hosting Plans as Low as $10 a Month(3-day Trial Link). I'm using the same VPS in this tutorial.

Get The API key

After having an OpenAI account, open https://platform.openai.com/overview, click on your username in the top right corner, and select "view API keys" in the prompt that pops up.

Get The API key

Click "Create new secret key"

Create new secret key

Make a copy of your key and keep it locally to prevent loss and have a backup.

Make a copy of your key

SSH Connection

Log in to your Cloudways Platform using your email address and password.

From the top menu bar, open Servers.

Then, choose the server you just bought.

choose the server you wish to connect

Under Server Management, you can find your username and password. Be sure to take note of it.


Click on a credential (e.g., password) to copy it to the clipboard.

copy the credential to the clipboard

Next, return to your target server page.

return to your target server page

Click Launch SSH Terminal. This will open a new tab in your web browser.

Launch SSH Terminal

You may see a security certificate warning in your web browser, this is due to the self-signed SSL certificate hired to protect your SSH connection. Simply bypass the warning and Proceed.

Simply bypass the warning and Proceed

Then you need to input your master username, which you previously noted.


The terminal screen will only work with arrow keys for navigation, not with a mouse.

terminal screen will only work with arrow keys for navigation

Next, enter your password. Please note that no characters will appear as you type the password due to security reasons.

 enter your password

You are now connected to your server via SSH.

Environment Set-Up

Install Docker with the following command:

curl -fsSL https://get.docker.com -o get-docker.sh 
sh get-docker.sh
Install Docker

The installation will take some time. Please be patient and wait for the following results to appear.

Docker installed successfully

Next Step

Please make sure the Docker daemon is running. You can check its status by running the following command:

systemctl status docker
Docker daemon is running

The above check results show it's not running,

If the Docker daemon is not running, you can start it with the following command:

    sudo systemctl enable docker

    sudo systemctl start docker
Docker daemon is not running.jpg

After running the above command, you can check the Docker service status again to confirm if it is running:

Docker is active
Docker is active

Install ChatGPT

Use this command:

docker run \
       --name chatgpt-web \
       -p 3002:3002 \
       --env OPENAI_API_KEY=Your key \
       --restart always \
       -d chenzhaoyu94/chatgpt-web:latest

Remember to replace Your key with your own OpenAI key.

installing chatgpt

Now, your own web version of ChatGPT has been deployed.

You can now open ChatGPT by directly accessing your VPS IP at

Self hosted gpt 4