This guide walks you through running an OpenClaw agent entirely on your own hardware using vLLM. Zero cloud APIs, zero per-token costs, zero data leaving your network.
Time to complete: ~15 minutes (plus model download time)
| What | Why |
|---|---|
| Linux server with NVIDIA GPU | vLLM requires CUDA. 96GB VRAM for Qwen3-Coder-Next-FP8, 24GB+ for smaller models |
| Docker + NVIDIA Container Toolkit | Easiest way to run vLLM |
| Python 3.10+ with pip | For the tool call proxy |
| Node.js 22+ | For OpenClaw |
Same machine or separate machines? Everything can run on one machine. If you have a dedicated GPU server, run vLLM + proxy there and OpenClaw wherever you want — just update the URLs.
You ←→ OpenClaw Gateway ←→ Tool Call Proxy (:8003) ←→ vLLM (:8000)
(agent loop) (SSE re-wrap + (model inference)
tool extraction)
Why the proxy? OpenClaw always requests streaming responses, but tool call extraction requires seeing the full response. The proxy intercepts requests with tools, forces non-streaming, extracts tool calls from the model's text output, then re-wraps everything as SSE chunks that OpenClaw expects. Without it, you get "No reply from agent" with 0 tokens. See ARCHITECTURE.md for the deep dive.
# Default: Qwen3-Coder-Next-FP8 (80B MoE, needs ~75GB VRAM)
./scripts/start-vllm.sh
# Or customize the model:
VLLM_MODEL="Qwen/Qwen3-8B" VLLM_TOOL_PARSER="hermes" ./scripts/start-vllm.shWait for "vLLM is ready!" — model loading takes 60-120 seconds.
Verify:
curl http://localhost:8000/v1/models| Model | VRAM | Context | Tool Parser | Notes |
|---|---|---|---|---|
| Qwen/Qwen3-Coder-Next-FP8 | ~75GB | 128K | qwen3_coder |
Best for coding agents. 80B MoE, 3B active. |
| Qwen/Qwen3-8B | ~16GB | 32K | hermes |
Good starter model for consumer GPUs |
| Qwen/Qwen3-32B | ~32GB | 32K | hermes |
Strong mid-range option |
Critical: Match the
--tool-call-parserto your model. Wrong parser = broken tool calls. Qwen3-Coder-Next usesqwen3_coder, most others usehermes.
| Flag | What | Why |
|---|---|---|
--gpu-memory-utilization 0.92 |
VRAM allocation | 0.95 can cause OOM crashes. 0.92 is safe. |
--compilation_config.cudagraph_mode=PIECEWISE |
CUDA graph compilation mode | Prevents illegal memory access with DeltaNet architectures |
--enable-auto-tool-choice |
Allow model to decide when to use tools | Required for tool calling |
--kv-cache-dtype |
KV cache precision | Do NOT use fp8 with Qwen3-Next — causes assertion errors |
# Install dependencies
pip3 install flask requests
# Start the proxy
./scripts/start-proxy.sh
# Or customize:
PROXY_PORT=8003 VLLM_URL=http://localhost:8000 ./scripts/start-proxy.shVerify:
curl http://localhost:8003/health
# Expected: {"status":"ok","vllm_url":"http://localhost:8000","max_tool_calls":500}sudo npm install -g openclaw@latest
openclaw --versionRun initial setup if this is a fresh install:
openclaw setupCopy the config template:
cp configs/openclaw.json ~/.openclaw/openclaw.jsonIf vLLM is on a different machine, edit the baseUrl:
# Edit ~/.openclaw/openclaw.json
# Change "http://localhost:8003/v1" to "http://YOUR_GPU_SERVER:8003/v1"Delete any auto-generated models cache (forces OpenClaw to re-read your config):
rm -f ~/.openclaw/agents/main/agent/models.jsonSet the API key (can be anything — vLLM doesn't validate it, but OpenClaw requires one):
export VLLM_API_KEY=vllm-local
# Or add to your shell profile:
echo 'export VLLM_API_KEY=vllm-local' >> ~/.bashrcThe compat section in openclaw.json is the most important part. Without it,
OpenClaw sends parameters that vLLM rejects silently:
"compat": {
"supportsStore": false,
"supportsDeveloperRole": false,
"supportsReasoningEffort": false,
"maxTokensField": "max_tokens"
}| Field | Why |
|---|---|
supportsStore: false |
OpenClaw sends store: false by default. vLLM rejects unknown params. |
supportsDeveloperRole: false |
Prevents sending developer role messages vLLM doesn't understand. |
supportsReasoningEffort: false |
Prevents sending reasoning effort params. |
maxTokensField: "max_tokens" |
OpenClaw defaults to max_completion_tokens. vLLM wants max_tokens. |
Quick text test:
VLLM_API_KEY=vllm-local openclaw agent --local --agent main -m 'What is 2+2?'Tool calling test:
VLLM_API_KEY=vllm-local openclaw agent --local --agent main -m 'List the files in /tmp'If both return sensible output, you're running a fully local AI agent.
For always-on operation, set up a systemd user service:
# Copy the service file
mkdir -p ~/.config/systemd/user
cp configs/openclaw-gateway.service ~/.config/systemd/user/
# Enable and start
systemctl --user daemon-reload
systemctl --user enable openclaw-gateway.service
systemctl --user start openclaw-gateway.service
# Check status
systemctl --user status openclaw-gateway.serviceOpenClaw injects workspace files into every agent session. Copy the starter templates to customize your agent's personality:
cp -r workspace/ ~/.openclaw/workspace/Edit the files to make the agent yours:
SOUL.md— Core personality and principlesIDENTITY.md— Name, role, vibeTOOLS.md— What tools and services are availableMEMORY.md— Working memory that persists across sessions
Long-running agents accumulate conversation history until they exceed the model's context window and crash. The session watchdog prevents this:
# Edit config.yaml with your preferences
nano config.yaml
# Install the session cleanup timer
./install.sh --cleanup-onlyCause: SSE re-wrapping not working. OpenClaw expects SSE but got nothing.
Fix: Make sure baseUrl in openclaw.json points to port 8003 (proxy),
not 8000 (vLLM). Test the proxy directly:
curl -X POST http://localhost:8003/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"Qwen/Qwen3-Coder-Next-FP8","messages":[{"role":"user","content":"hi"}],"stream":true}'You should see data: {...}\n\n SSE chunks ending with data: [DONE].
Cause: Using unsupported compat fields.
Fix: Only use these four validated fields:
supportsStoresupportsDeveloperRolesupportsReasoningEffortmaxTokensField
Cause: Proxy not extracting, or OpenClaw bypassing proxy.
Fix: Verify baseUrl points to port 8003. Check proxy logs:
tail -f /tmp/vllm-proxy.logCause: Model limitation with complex multi-step tool chains.
Mitigation: The proxy aborts after 500 tool calls (configurable via
MAX_TOOL_CALLS env var). For complex tasks, keep prompts single-action.
Cause: Default cudagraph mode incompatible with hybrid architectures.
Fix: Add --compilation_config.cudagraph_mode=PIECEWISE to docker run.
Cause: Using --kv-cache-dtype fp8 with Qwen3-Next.
Fix: Remove that flag. FP8 model weights are fine; FP8 KV cache is not supported for this architecture.
Fix: Add "supportsStore": false to the compat section.
Fix: Add "maxTokensField": "max_tokens" to the compat section.
To swap models, update three things:
- vLLM — Change the
--modeland--tool-call-parserflags - Proxy — No changes needed (it's model-agnostic)
- OpenClaw config — Update
id,name,contextWindow,maxTokensinopenclaw.jsonand delete~/.openclaw/agents/main/agent/models.json
Example for Qwen3-8B:
# 1. Start vLLM with different model
VLLM_MODEL="Qwen/Qwen3-8B" \
VLLM_TOOL_PARSER="hermes" \
VLLM_MAX_LEN=32768 \
./scripts/start-vllm.sh
# 2. Update openclaw.json model ID, contextWindow, maxTokens
# 3. Clear models cache
rm -f ~/.openclaw/agents/main/agent/models.jsonTo connect your agent to Discord, add a channels section to openclaw.json:
"channels": {
"discord": {
"token": "YOUR_BOT_TOKEN",
"guilds": {
"YOUR_GUILD_ID": {
"channels": {
"YOUR_CHANNEL_ID": {
"allow": true,
"requireMention": false
}
}
}
}
}
},
"plugins": {
"entries": {
"discord": {
"enabled": true
}
}
}Set requireMention: false for channels where the agent should respond to
every message, or true for channels where it only responds when @mentioned.
- Cookbook recipes — Step-by-step guides for voice agents, document Q&A, code assistants, multi-GPU clusters, and more
- research/HARDWARE-GUIDE.md — GPU buying guide with tier rankings, used market analysis, and price-performance comparisons