Instructions for configuring your OpenClaw instance to accept connections from the iOS app.
OpenClaw's HTTP API endpoints are disabled by default. You need to enable the ones you want to use.
Edit your OpenClaw config file (usually ~/.openclaw/config.json or openclaw.json in your project root):
{
"gateway": {
"http": {
"endpoints": {
"chatCompletions": {
"enabled": true
}
}
}
}
}The Open Responses API provides structured streaming events and real token usage data. To enable it:
{
"gateway": {
"http": {
"endpoints": {
"chatCompletions": {
"enabled": true
},
"responses": {
"enabled": true
}
}
}
}
}Restart OpenClaw after making config changes.
# Test Chat Completions
curl -X POST http://127.0.0.1:18789/v1/chat/completions \
-H "Authorization: Bearer YOUR_GATEWAY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "openclaw:main",
"messages": [{"role": "user", "content": "Hello, are you there?"}],
"stream": false
}'You should get back a JSON response with choices[0].message.content. If you get a connection refused or 404, the API isn't enabled or OpenClaw isn't running.
# Test Open Responses (if enabled)
curl -X POST http://127.0.0.1:18789/v1/responses \
-H "Authorization: Bearer YOUR_GATEWAY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "openclaw:main",
"input": "Hello, are you there?",
"stream": false
}'Your gateway token is set via the OPENCLAW_GATEWAY_TOKEN environment variable or the --token CLI flag when you start OpenClaw. If you haven't set one, check your OpenClaw startup command or config.
# Check if it's set in your environment
echo $OPENCLAW_GATEWAY_TOKEN
# Or look in your config
cat ~/.openclaw/config.json | grep -i tokenIf you don't have one set, add one:
export OPENCLAW_GATEWAY_TOKEN="your-secure-token-here"Use a strong random string. You'll enter this same token in the iOS app.
Your OpenClaw gateway listens on localhost by default. You need a way to reach it from your phone. Two options:
The simplest option. Install Tailscale on your server and iPhone, and your gateway is instantly accessible over an encrypted mesh network — no DNS, no tunnels, no port forwarding.
- Server: tailscale.com/download (available for macOS, Linux, Windows)
- iPhone: Install Tailscale from the App Store
Sign into the same Tailscale account on both devices.
Tailscale can provision TLS certificates for your devices automatically:
# On the server running OpenClaw
tailscale cert <hostname>.your-tailnet.ts.netOr use Tailscale Serve to proxy with automatic HTTPS:
tailscale serve https / http://127.0.0.1:18789Your gateway is now accessible at https://<hostname>.your-tailnet.ts.net from any device on your tailnet.
From your phone (with Tailscale connected):
curl -X POST https://<hostname>.your-tailnet.ts.net/v1/chat/completions \
-H "Authorization: Bearer YOUR_GATEWAY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"model":"openclaw:main","messages":[{"role":"user","content":"Hello!"}],"stream":false}'Exposes your gateway via a custom HTTPS domain without opening any ports. Useful if you want a public-facing URL or don't want to install Tailscale on your phone.
# macOS
brew install cloudflare/cloudflare/cloudflared
# Linux (Debian/Ubuntu)
curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
sudo dpkg -i cloudflared.deb
# Linux (other)
curl -L --output cloudflared https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64
sudo mv cloudflared /usr/local/bin/
sudo chmod +x /usr/local/bin/cloudflaredcloudflared tunnel login
# Select your domain and authorize in the browser
cloudflared tunnel create openclaw
# Note down the tunnel ID (UUID)Create ~/.cloudflared/config.yml:
tunnel: <TUNNEL_ID>
credentials-file: /home/<your-user>/.cloudflared/<TUNNEL_ID>.json
ingress:
- hostname: openclaw.yourdomain.com
service: http://127.0.0.1:18789
originRequest:
noTLSVerify: false
- service: http_status:404Replace <TUNNEL_ID> with the UUID from the create step and openclaw.yourdomain.com with your subdomain.
cloudflared tunnel route dns openclaw openclaw.yourdomain.com
cloudflared tunnel run openclaw# macOS
sudo cloudflared service install
sudo launchctl start com.cloudflare.cloudflared
# Linux (systemd)
sudo cloudflared service install
sudo systemctl enable cloudflared
sudo systemctl start cloudflaredFrom any other machine (or your phone):
curl -X POST https://openclaw.yourdomain.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_GATEWAY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "openclaw:main",
"messages": [{"role": "user", "content": "Hello from outside!"}],
"stream": false
}'If this returns a response, everything is working.
Open ClawTalk on your phone/simulator:
- Tap the gear icon (Settings)
- Under OpenClaw Gateway:
- URL:
https://openclaw.yourdomain.com(your tunnel/Tailscale URL) - Token: your gateway token from step 1
- API Mode: Chat Completions (default) or Open Responses (if you enabled it)
- URL:
- Go back to the chat screen
- Type a message or use voice to test
- Chat Completions: Standard OpenAI-compatible API. Works with all gateways. No token usage data.
- Open Responses: Structured streaming with real token usage. Requires the responses endpoint to be enabled in your OpenClaw config.
- Gateway token is a strong random string (not something guessable)
- Cloudflare Tunnel / Tailscale handles TLS — traffic is encrypted end-to-end
- OpenClaw gateway only listens on
127.0.0.1(localhost) — the tunnel connects locally - No ports are open on your firewall/router
- The iOS app enforces HTTPS-only — it will reject
http://URLs - API keys (ElevenLabs, OpenAI) stored in iOS Keychain, not UserDefaults
- Consider enabling Cloudflare Access for additional authentication (IP allowlists, SSO, etc.)
"Connection refused" from curl locally
- OpenClaw isn't running, or it's on a different port. Check
ps aux | grep openclawand verify the port.
404 from the /v1/chat/completions endpoint
- The HTTP API isn't enabled. Double-check your config and restart OpenClaw.
404 from the /v1/responses endpoint
- The Open Responses endpoint isn't enabled. Add
"responses": { "enabled": true }to your config.
401 Unauthorized
- Token mismatch. Make sure the token in your curl/app matches
OPENCLAW_GATEWAY_TOKEN.
502 Bad Gateway from Cloudflare
- The tunnel is running but OpenClaw isn't, or the port in
config.ymldoesn't match. Check thathttp://127.0.0.1:18789is reachable locally.
Tunnel not starting
- Check
cloudflared tunnel info openclawand verify credentials file exists.
App shows "HTTPS is required"
- The app rejects plain HTTP. Make sure your URL starts with
https://.