--- title: Enforcement proxy description: The optional ClawMetry proxy in front of model calls — hard budget limits, in-flight loop detection, model routing, and the OpenClaw pause it makes real. keywords: LLM proxy budget enforcement, agent spend limit proxy, model routing, loop detection proxy eyebrow: Guard & governance --- # Enforcement proxy Observation does not need it. Enforcement of *spend*, in the moment, does. ```bash clawmetry proxy start --daily-budget 25 --monthly-budget 400 ``` The proxy listens on port 4100 by default and sits in front of your model calls. ## What it can do that nothing else can **Block a call before it costs anything.** A budget alert tells you afterwards. A detector tells you after a window of events. The proxy is the only place where a limit is a limit. **See a loop in flight.** Repeated identical calls are visible at the request level immediately, rather than after enough events have accumulated for the transcript-based detectors to see the shape. **Route by model.** Send a call to a cheaper model rather than refusing it, which keeps the agent working instead of failing. **Make an OpenClaw pause real.** OpenClaw has no pause primitive; ClawMetry's pause is a flag file that only the proxy enforces. With no proxy, a paused OpenClaw session keeps running and Guard reports `advisory_only`. ## Budget actions ```bash clawmetry proxy config --daily-budget 50 --action warn ``` | Action | At the limit | |---|---| | `warn` | The call goes through; it is recorded and surfaced | | `block` | The call is refused | | `downgrade` | The call is routed to a cheaper model | Start with `warn` until you trust the numbers. `downgrade` is usually the right production setting: the work continues, more cheaply, and the dashboard tells you it happened. `block` is for the case where an over-budget agent should genuinely stop. ## Configuration ```bash clawmetry proxy status --json clawmetry proxy config --loop-detection on clawmetry proxy stop ``` | Variable | Effect | |---|---| | `CLAWMETRY_PROXY_DAILY_USD` | Daily budget | | `CLAWMETRY_PROXY_MONTHLY_USD` | Monthly budget | | `CLAWMETRY_PROXY_AUTO_ROUTE` | Automatic model routing | | `CLAWMETRY_HARD_BLOCK` | Hard block behaviour | | `CLAWMETRY_HARD_BLOCK_ESCAPE` | The escape hatch for a hard block | ## Pointing agents at it The proxy is an HTTP proxy for provider endpoints. Configure the runtime's base URL to point at it — the same override you would use for any gateway. The mechanism differs per runtime and per SDK; the concept does not. ## Proxy versus detectors They catch different shapes and you want both: | | Proxy | Detectors | |---|---|---| | Sees | Individual requests, in flight | Windows of events, after the fact | | Catches | Tight identical loops, budget breaches | No-progress, repeated tool failures, blast radius, egress | | Acts | Immediately, before the spend | Through a [policy](/docs/guard/policies/) | | Requires | Routing traffic through it | Nothing | A tight loop costs money fast and the proxy stops it early. A session that is busy but going nowhere never trips a request-level rule at all, and only a window of events reveals it. ## When you do not need it If your agents are on providers you cannot easily reroute, or you are happy with alerting rather than blocking, skip it. Everything else in ClawMetry works without it. The one thing you lose besides hard limits is a real OpenClaw pause. ## Logging ```bash clawmetry proxy start --log-requests ``` Logs every proxied request. Useful when setting it up and verifying that traffic is actually flowing through it — a proxy nothing routes to is a very quiet failure.