OpenClaw über Headroom-Proxy routen und API-Kosten senken
Headroom komprimiert OpenClaw-Toolausgaben lokal (Proxy 8787). Onboard, OTEL, launchd.
Hinweis: optionale Mac-Miete.
Architektur
OpenClaw → Headroom http://127.0.0.1:8787 → API
| Mode | When | OpenClaw hook |
|---|---|---|
headroom proxy --port 8787 | Zero code change | Set ANTHROPIC_BASE_URL in ~/.openclaw/.env |
| ContextEngine plugin | Native OpenClaw path | Headroom providers/openclaw slice |
MCP headroom_compress | MCP-heavy flows | headroom mcp install |
headroom wrap | One-shot dev | Less ideal for 24/7 gateway |
Matrix
| Pattern | Hook | Savings band | Ops |
|---|---|---|---|
| Nightly launchd audit | Proxy + plist env | 70–92% on tool-heavy turns | Keep proxy alive with LaunchAgent |
| Interactive gateway chat | Proxy or plugin | 40–70% | Low gain on tiny prompts |
| MCP-only micro tools | MCP compress tool | 30–60% | When proxy blocked |
| Already on Ollama local | Skip Headroom | N/A | See Ollama OpenClaw guide |
| Need token accounting | Proxy + OTEL | Measure, don’t guess | headroom perf + spans |
Voraussetzungen
- Gateway gesund · Python 3.10+
8 Schritte
pip install "headroom-ai[proxy]"headroom proxy --port 8787headroom perfANTHROPIC_BASE_URL=http://127.0.0.1:8787- Smoke-Test
- optionales Plugin
- launchd
- OTEL
Nacht-Audit
Bei großen Logs 60–92 % realistisch.
MCP
Proxy + MCP, mit OTEL messen.
Fehler
Connection refused: Proxy zuerst. Rechnung flach: Base-URL prüfen.
Empfehlung
Tool-lastige Agents → Proxy.
FAQ
Does Headroom send my code to a third-party API?
No for the default local proxy—compression runs on your host; see limitations.
Will OpenClaw break if compression is too aggressive?
Headroom publishes benchmark accuracy tables; use CCR retrieve when the model needs full files. Smoke-test one real audit before automating.
What port should I standardize on?
8787 is the documented default for headroom proxy --port 8787.
How does this relate to Claude Code MCP Headroom?
Same project: headroom mcp install for MCP clients; OpenClaw users usually set provider base URL to the proxy.
Can I save ~80% on every request?
No—published ranges are 47–92% by workload. Log-heavy OpenClaw audits trend high; short chat trends low. Use headroom perf and OTEL.