Cloudflare Worker that proxies HTTP + WebSocket to an OpenClaw agent.
Two modes:
- GCP proxy (free tier) — proxies to a GCP VM running OpenClaw. No paid CF features needed.
- CF Containers (paid, beta) — runs OpenClaw in a Cloudflare Container sandbox.
This repo ships in GCP proxy mode by default.
npm install -g wrangler
wrangler logingit clone https://github.com/0xChitlin/clawworker
cd clawworker
npm installwrangler secret put GATEWAY_TOKEN # token clients use to auth
wrangler secret put ADMIN_TOKEN # token for /admin route[vars]
GCP_HOST = "YOUR_GCP_VM_IP"
AGENT_PORT = "80" # or the specific PM2 port for this agent
AGENT_ID = "agent-001"wrangler deployYour Worker is live at clawworker.<your-subdomain>.workers.dev.
| Route | Auth | Description |
|---|---|---|
GET /health |
None | Liveness check + backend ping |
ALL /api/* |
Bearer token | Proxy to OpenClaw API |
GET /ws |
Bearer token or ?token= |
WebSocket relay |
GET /admin |
Admin token | Worker status |
cp .dev.vars.example .dev.vars
# edit .dev.vars with your values
wrangler devWhen you want to move off GCP and run OpenClaw serverlessly on Cloudflare:
- Upgrade Cloudflare account to Workers Paid ($5/mo)
- Request Containers beta access
- Swap
src/index.tsback to the Container version (see git history) - Deploy with
wrangler deploy