About: Software Engineer with 10+ years in enterprise solutions. Oracle/SQL by day, Python & AI experiments by night. Blockchain enthusiast. Exploring how AI tools can solve problems.
Joined:
Apr 15, 2019
Self-Hosting OpenClaw AI Assistant on a VPS with Tailscale VPN (Zero Public Ports)
Publish Date: Feb 4
8 0
I wanted my own AI assistant — one that runs 24/7 on my server, remembers everything, and doesn't expose a single port to the internet. Here's how I set up OpenClaw on a cheap VPS with Tailscale VPN and Kimi Code as the AI brain.
Why Kimi Code Instead of Claude?
If you've been following the AI tool scene, you probably know that OpenClaw was originally built around Anthropic's Claude models. So why not just use a Claude subscription?
Because Anthropic will ban you for it.
In January 2026, Anthropic started enforcing their TOS against using Claude Pro/Max subscriptions through third-party tools. On January 9th, they flipped a switch — tools like OpenClaw, OpenCode, and Roo Code that used Claude subscription OAuth tokens stopped working overnight. Users got hit with: "This credential is only authorized for use with Claude Code."
The crackdown targeted any tool "spoofing" the Claude Code client. DHH called it "very customer hostile." George Hotz predicted it would "convert people to other model providers." And that's exactly what happened.
You can still use Claude via a proper API key (that's allowed under the TOS), but API pricing adds up fast — Claude Sonnet 4 runs $3/$15 per million tokens in/out. Heavy usage can easily cost $1,000+/month.
Kimi Code is the opposite approach. Moonshot AI explicitly permits personal use of their API key in compatible third-party agents. Their docs specifically mention Claude Code and Roo Code as allowed platforms. For ~$19/month you get a subscription with a rolling weekly quota, the K2.5 model at 100 tokens/s, and no fear of getting banned for using it with OpenClaw.
What We're Building
By the end of this guide you'll have:
OpenClaw — an open-source personal AI assistant with a web dashboard, CLI, and optional messaging integrations (WhatsApp, Telegram, Discord, etc.)
Tailscale VPN — zero-config WireGuard mesh that makes your VPS invisible to the internet
Kimi Code — a subscription-based AI coding service from Moonshot AI with the powerful K2.5 model, 100 tokens/s output speed, and compatibility with third-party tools
The whole stack costs under $25/month (VPS + Kimi Code subscription) and takes about 30 minutes to set up.
Prerequisites
A VPS (I used Hetzner CX22 — 4GB RAM, Ubuntu 24.04, ~€4/month)
A local machine (Linux, macOS, or Windows with WSL)
The goal is simple: no public ports, no attack surface. Your VPS will only be reachable through your private Tailscale network.
Install Tailscale on the VPS
SSH into your fresh VPS (this is the last time you'll use the public IP):
ssh root@YOUR_VPS_PUBLIC_IP
Install Tailscale and authenticate:
curl -fsSL https://tailscale.com/install.sh | sh
tailscale up --ssh
The --ssh flag enables Tailscale SSH — a built-in SSH server that authenticates via your Tailscale identity. No keys, no passwords, no exposed port 22.
Create a non-root user
adduser admin
usermod -aGsudo admin
Lock down the firewall
# Install UFW
apt install ufw -y# Default: deny everything
ufw default deny incoming
ufw default allow outgoing
# Allow only Tailscale subnet
ufw allow in on tailscale0
ufw allow in from 100.64.0.0/10
# Enable firewall
ufw enable
Disable traditional SSH
Since Tailscale SSH handles authentication, disable the regular SSH daemon:
systemctl disable --now ssh
Verify the lockdown
ufw status
You should see only Tailscale traffic allowed. Your VPS now has zero public ports.
Install Tailscale on your local machine
On your local machine (Linux/WSL):
curl -fsSL https://tailscale.com/install.sh | sh
sudo systemctl start tailscaled
sudo tailscale up
Now connect to your VPS — no public IP needed:
tailscale ssh admin@YOUR_VPS_TAILSCALE_IP
That's it. You're in via an encrypted WireGuard tunnel, and nobody on the internet can even see your server exists.
WSL Users: Fix the MTU Issue
If you're running Tailscale in WSL and SSH connections hang (connect but never complete the handshake), you've hit a known MTU bug. The Tailscale interface defaults to MTU 1280, but WSL's network stack can't handle packets that large on the WireGuard tunnel.
Symptoms:
tailscale ping works fine
tailscale ssh hangs indefinitely
Verbose SSH (ssh -vvv) stalls at expecting SSH2_MSG_KEX_ECDH_REPLY
Fix:
sudo ip link set dev tailscale0 mtu 1200
This is a temporary fix that resets on WSL restart. To make it permanent, add it to your shell profile:
echo'sudo ip link set dev tailscale0 mtu 1200 2>/dev/null'>> ~/.bashrc
Or add a sudoers rule so it doesn't prompt for a password:
# /etc/sudoers.d/tailscale-mtu
your_username ALL=(ALL) NOPASSWD: /usr/sbin/ip link set dev tailscale0 mtu 1200
Step 2: Install OpenClaw
OpenClaw (formerly Clawdbot, then Moltbot) is an open-source personal AI assistant created by Peter Steinberger. It has 68k+ stars on GitHub and supports dozens of messaging channels, tools, cron jobs, webhooks, and more.
Your own personal AI assistant. Any OS. Any Platform. The lobster way. 🦞
🦞 OpenClaw — Personal AI Assistant
EXFOLIATE! EXFOLIATE!
OpenClaw is a personal AI assistant you run on your own devices
It answers you on the channels you already use (WhatsApp, Telegram, Slack, Discord, Google Chat, Signal, iMessage, Microsoft Teams, WebChat), plus extension channels like BlueBubbles, Matrix, Zalo, and Zalo Personal. It can speak and listen on macOS/iOS/Android, and can render a live Canvas you control. The Gateway is just the control plane — the product is the assistant.
If you want a personal, single-user assistant that feels local, fast, and always-on, this is it.
Preferred setup: run the onboarding wizard (openclaw onboard). It walks through gateway, workspace, channels, and skills. The CLI wizard is the recommended path and works on macOS, Linux, and Windows (via WSL2;…
Kimi Code is a subscription-based AI coding service by Moonshot AI. It powers the K2.5 model at up to 100 tokens/s and works with third-party tools like OpenClaw, Claude Code, and Roo Code.
Security note: Treat your API key like a password. Never commit it to Git or expose it in client-side code. Kimi Code allows personal use in compatible third-party agents, but requests consume your subscription quota.