Route your OpenClaw through Claude Code CLI — with streaming, tools, and full workspace context.
Anthropic is restricting setup-token usage outside Claude Code (April 2026). Clawbridge is a local proxy that speaks the Anthropic Messages API but routes everything through claude -p under the hood. OpenClaw sees a normal API provider. Anthropic sees legitimate Claude Code usage.
You → Telegram → OpenClaw → http://localhost:5555 (clawbridge)
↓
claude -p --output-format stream-json
(uses your Claude subscription)
↓
Anthropic SSE streamed back to OpenClaw
Clawbridge:
- Receives Anthropic Messages API requests from OpenClaw
- Strips the hard-coded "Tools are disabled" instruction
- Injects tool bridge paths so Claude Code can use
execfor web/search/memory - Spawns
claude -pwith streaming JSON output - Translates Claude Code's
stream-json→ Anthropic SSE format - Streams the response back to OpenClaw in real time
| Feature | Direct API | Clawbridge |
|---|---|---|
| Streaming | ✅ | ✅ |
| Conversation memory | ✅ | ✅ |
| SOUL.md / MEMORY.md | ✅ | ✅ |
| Web fetch | ✅ native | ✅ via exec |
| Web search | ✅ native | ✅ via exec |
| Memory search | ✅ native | ✅ via exec |
| File read/write/exec | ✅ native | ✅ Claude Code native |
| Browser automation | ✅ | ❌ |
| Auth | setup-token | Claude subscription |
# Tool bridges
cp bin/oc-* ~/.openclaw/bin/
chmod +x ~/.openclaw/bin/oc-*
# Proxy
cp proxy/server.mjs ~/.openclaw/bin/claude-proxy.mjsAdd to openclaw.json:
{
agents: {
defaults: {
model: {
primary: "claude-proxy/claude-opus-4-6"
},
models: {
"claude-proxy/claude-opus-4-6": { alias: "proxy-opus" },
"claude-proxy/claude-sonnet-4-6": { alias: "proxy-sonnet" }
},
bootstrapMaxChars: 50000
}
},
models: {
providers: {
"claude-proxy": {
baseUrl: "http://127.0.0.1:5555",
api: "anthropic-messages",
allowPrivateNetwork: true,
models: [
{ id: "claude-opus-4-6" },
{ id: "claude-sonnet-4-6" },
{ id: "claude-haiku-4-5" }
]
}
}
}
}node ~/.openclaw/bin/claude-proxy.mjsTo run on boot (macOS):
cat > ~/Library/LaunchAgents/com.clawbridge.proxy.plist << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key><string>com.clawbridge.proxy</string>
<key>ProgramArguments</key><array>
<string>/usr/local/bin/node</string>
<string>~/.openclaw/bin/claude-proxy.mjs</string>
</array>
<key>RunAtLoad</key><true/>
<key>KeepAlive</key><true/>
<key>StandardOutPath</key><string>~/.openclaw/logs/claude-proxy.log</string>
<key>StandardErrorPath</key><string>~/.openclaw/logs/claude-proxy.log</string>
</dict>
</plist>
EOF
launchctl load ~/Library/LaunchAgents/com.clawbridge.proxy.plist/restart
Copy extensions/switch-backend/ to ~/.openclaw/extensions/ and add to config:
{
plugins: {
entries: {
"switch-backend": { enabled: true }
}
}
}Then use /switch_backend proxy or /switch_backend api to switch instantly.
| Variable | Default | Description |
|---|---|---|
CLAUDE_PROXY_PORT |
5555 |
Proxy listen port |
CLAUDE_CLI_PATH |
claude |
Path to Claude Code CLI |
OPENCLAW_TOOL_BRIDGE_DIR |
~/.openclaw/bin |
Directory with oc-* scripts |
OPENCLAW_WORKSPACE |
~/.openclaw/workspace |
Working directory for Claude Code |
Shell scripts that Claude Code calls via exec:
| Script | What it does |
|---|---|
oc-web-fetch <url> |
Fetch + extract readable text from a URL |
oc-search "query" |
Web search via DuckDuckGo (no API key) |
oc-memory "query" |
Grep workspace memory files |
oc-send <channel> <target> "msg" |
Send message via OpenClaw CLI |
| Setting | Value | Why |
|---|---|---|
bootstrapMaxChars |
50000 |
Default 20K truncates large MEMORY.md files |
allowPrivateNetwork |
true |
Required for localhost proxy |
- No browser automation — Claude Code doesn't have a browser tool
- ~3-5s overhead per turn — spawning CLI process
- ~10-15% more tokens — Claude Code's own system prompt on top of yours
proxy/
server.mjs # The proxy server (Anthropic Messages API → Claude Code CLI)
bin/
oc-web-fetch # URL fetcher
oc-search # DuckDuckGo search
oc-memory # Memory grep
oc-send # Message sender
extensions/
switch-backend/ # /switch_backend plugin for OpenClaw
MIT