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…
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)
- A Tailscale account (free at tailscale.com)
Step 1: Secure the VPS with Tailscale
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 -aG sudo 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 pingworks finetailscale sshhangs indefinitely- Verbose SSH (
ssh -vvv) stalls atexpecting 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.
openclaw / openclaw
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.
Website · Docs · DeepWiki · Getting Started · Updating · Showcase · FAQ · Wizard · Nix · Docker · Discord
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;…
Install Node.js 22+
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs
node --version # Should be v22+
Install pnpm
curl -fsSL https://get.pnpm.io/install.sh | sh -
source ~/.bashrc
pnpm --version
Clone and build
mkdir -p ~/GIT && cd ~/GIT
git clone https://github.com/openclaw/openclaw.git
cd openclaw
# Install dependencies
pnpm install
# Build the UI and TypeScript
pnpm ui:build
pnpm build
Run the onboard wizard
pnpm openclaw onboard \
--non-interactive \
--accept-risk \
--flow quickstart \
--mode local \
--skip-channels \
--skip-skills \
--install-daemon
This creates:
~/.openclaw/openclaw.json— main configuration~/.openclaw/workspace/— agent workspace- A systemd user service for the gateway
- Gateway listening on
127.0.0.1:18789(loopback only — not exposed!)
Verify it’s running:
pnpm openclaw gateway status
You should see:
Gateway: bind=loopback (127.0.0.1), port=18789
Runtime: running (pid XXXXX)
RPC probe: ok
Dashboard: http://127.0.0.1:18789/
Step 3: Subscribe to Kimi Code and Get an API Key
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.
Subscribe
- Go to kimi.com/code
- Log in or create an account
- Select a Coding Plan (starts at ~$19/month for the Andante tier)
Your quota refreshes on a 7-day rolling cycle. Unused quota does not carry over.
Generate an API key
- Go to the Kimi Code Console
- Navigate to API Keys
- Click Create New Key
- Copy the key immediately — it’s only shown once!
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.
Step 4: Configure OpenClaw with Kimi Code
Run the interactive config:
pnpm openclaw config
Select:
- Model
- Moonshot AI
- Kimi Coding API key
- Paste your API key from the Kimi Code Console
Or do it in one shot:
pnpm openclaw onboard --kimi-code-api-key "YOUR_API_KEY"
Restart the gateway to apply:
pnpm openclaw gateway restart
Test it
pnpm openclaw agent --message "Hello! What model are you?"
You should get a response from Kimi K2.5.
Step 5: Access the Dashboard
The dashboard runs on localhost:18789 on the VPS. Since we locked down all ports, we access it through an SSH tunnel.
From your local machine:
ssh -L 18789:localhost:18789 admin@YOUR_VPS_TAILSCALE_IP
Or with Tailscale SSH:
tailscale ssh -L 18789:localhost:18789 admin@YOUR_VPS_TAILSCALE_IP
Now open your browser:
http://localhost:18789/?token=YOUR_GATEWAY_TOKEN
You’ll find the gateway token in ~/.openclaw/openclaw.json under gateway.auth.token.
The dashboard gives you a web UI to chat with your AI, manage sessions, configure channels, and more.
Step 6: Keep It Running
The onboard wizard already installed a systemd user service. Make sure it survives reboots:
# Enable lingering so user services run without login
sudo loginctl enable-linger admin
# Check status
systemctl --user status openclaw-gateway
Updating OpenClaw
cd ~/GIT/openclaw
git pull --rebase origin main
pnpm install
pnpm ui:build
pnpm build
pnpm openclaw gateway restart
Architecture Overview
Here’s what the final setup looks like:
┌─────────────────────────┐ ┌──────────────────────────┐
│ Your Machine │ │ VPS (Ubuntu 24.04) │
│ │ │ │
│ Browser ──SSH tunnel──────────────→ OpenClaw Gateway :18789│
│ │ │ └── Kimi K2.5 API │
│ Terminal │ │ └── Workspace │
│ └── tailscale ssh ──────────────→ Shell access │
│ │ │ │
│ Tailscale ◄──WireGuard──────────► Tailscale │
└─────────────────────────┘ └──────────────────────────┘
Firewall: ALL public ports CLOSED
Only Tailscale (100.64.0.0/10) allowed
No public IP exposure. No open ports. No password authentication. Just a WireGuard tunnel and your AI assistant waiting on the other side.
Security Checklist
- [x] UFW firewall: deny all incoming except Tailscale
- [x] SSH: disabled (using Tailscale SSH instead)
- [x] Root login: disabled
- [x] Password auth: disabled
- [x] OpenClaw gateway: bound to loopback only
- [x] Dashboard access: via SSH tunnel only
- [x] API key: stored in server config, never exposed
- [x] Auto-updates: enabled on VPS
Useful Commands
# Gateway management
pnpm openclaw gateway status
pnpm openclaw gateway restart
pnpm openclaw logs
# Health check
pnpm openclaw doctor
# Send a message
pnpm openclaw agent --message "Your message here"
# List available models
pnpm openclaw models list
# Reconfigure
pnpm openclaw config
Wrapping Up
For under $25/month (VPS + Kimi Code) you get a private AI assistant that:
- Runs 24/7 on your own hardware
- Is completely invisible to the internet
- Supports WhatsApp, Telegram, Slack, and dozens more channels
- Uses a powerful AI model (Kimi K2.5 via Kimi Code subscription)
- Remembers your conversations and preferences
The hardest part was honestly debugging the WSL Tailscale MTU issue. Everything else was surprisingly smooth.
Resources:
- OpenClaw GitHub
- OpenClaw Docs
- Tailscale
- Kimi Code — subscribe and get your API key
- Kimi Code Console — manage API keys and devices
- Kimi Code Docs — membership benefits and usage details
Have you self-hosted an AI assistant? What’s your setup? Let me know in the comments!