Run ChatGPT on a VPS

Set up an always-on AI assistant on a rented server using ChatGPT via OpenAI.

Before you start

Treat API keys like passwords.

1. Connect to your VPS

Open Terminal (Mac/Linux) or PowerShell (Windows):

ssh root@YOUR_SERVER_IP

2. Update and secure

apt update && apt -y upgrade
ufw allow OpenSSH && ufw --force enable

3. Install OpenClaw

curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt-get install -y nodejs
npm i -g openclaw

4. Run the setup wizard

openclaw onboard

Choose OpenAI and paste your API key when prompted.

5. Start it

openclaw gateway start

Check status anytime: openclaw gateway status

6. Connect Telegram (optional)

Create a bot with @BotFather, copy the token, then:

openclaw config set channels.telegram.botToken "YOUR_BOT_TOKEN"
openclaw config set channels.telegram.enabled true
openclaw gateway restart

Message your bot and it will connect to ChatGPT through OpenClaw.

Done

Your assistant runs 24/7 on your VPS. Restart the gateway after reboots with openclaw gateway start.