10 min read
Last month I opened my credit‑card statement and almost threw up. Anthropic charged me $4,660.87, just for Claude.
I use OpenClaw every day, but I never stopped to think about what I was actually paying for.

Most requests, no matter how simple, were routed to the Claude Opus model at $75 per million tokens.
If you don’t have a Medium membership, you can read the article here.
It was like taking a Ferrari to the grocery store.

Most of my requests are simple. Autocomplete this line. Explain this error. Fix this syntax. Maybe twenty percent of what I do actually requires a powerful model.
I don’t know when requests were routed to the most expensive model. Because switching models manually is annoying, I just left everything on Opus and hemorrhaged money.

This realization kept me up at night. So I built something to fix it.
This is a guest post written by bc1beat and it deep dives into smart LLM routing for agentic applications. We have no affiliation with ClawRouter, aside from introducing it to developers building multi-agent systems with OpenClaw. Enjoy the read and drop your questions in the comments.
ClawRouter is a smart, local router that sits between OpenClaw (or any OpenAI‑compatible client) and the AI providers.
Every time you send a request, it looks at what you’re asking and automatically picks the cheapest model that can handle it.
A typical workflow looks like this:

The routing decision happens locally on your machine.
There are no API calls involved and no added latency, the scoring runs in under 1ms.

To start saving money, install the plugin, fund your wallet and enable the smart model:
openclaw plugins install @blockrun/clawrouter$5 is enough for thousands of requests
openclaw restartEvery request now routes through BlockRun with x402 micropayments.
x402 is a new open payment protocol developed by Coinbase that enables instant, automatic stablecoin payments directly over HTTP.By reviving the HTTP 402 Payment Required status code, x402 lets services monetize APIs and digital content onchain, allowing clients, both human and machine, to programmatically pay for access without accounts, sessions, or complex authentication.
To enable smart routing, add to ~/.openclaw/openclaw.json:
{
"agents": {
"defaults": {
"model": {
"primary": "blockrun/auto"
}
}
}
}Or use /model blockrun/auto in any conversation to switch on the fly.
Already have a funded wallet?
You can export BLOCKRUN_WALLET_KEY=0x... and if you want to use a specific model, you can use blockrun/openai/gpt-4o or blockrun/anthropic/claude-sonnet-4, and till get x402 payments and usage logging.
Let’s see ClawRouter in action:

ClawRouter in action
The flow:
~/.openclaw/blockrun/wallet.keyxai/grok-3, pays per-requestClawRouter’s architecture is beautifully simple:
(1) Weighted Scorer: a rule‑based classifier looks at your prompt (and optional system prompt) across 14 dimensions such as reasoning markers, code presence, simple vs complex indicators, token length, technical terms, imperative verbs, constraints, output format, domain specificity, and more.

Each dimension is weighted, and the weighted sum goes through a sigmoid function to produce a confidence score and a tier (SIMPLE, MEDIUM, COMPLEX or REASONING).
If two or more reasoning markers are present it jumps straight to the REASONING tier.

(2) Model Selector: given a tier and confidence, the selector maps to the cheapest capable model. It also computes the estimated cost and the savings compared to a baseline of Claude Opus.
(3) x402 Signer: requests to BlockRun’s API go through a local proxy that implements the x402 micropayment protocol. Payment is authentication: your wallet signs the cost (displayed in the 402 header), and the request continues. There are no API keys, no accounts or no custodial balances; the USDC stays in your wallet until spent.
Because routing and payment happen locally, privacy and latency are preserved.
The proxy includes clever optimizations: response deduplication (30s cache), streaming heartbeats to prevent upstream timeouts, and payment pre‑authorization that skips extra round trips.
The heart of ClawRouter is the 14‑dimension weighted scorer.
Here are a few highlights from src/router/rules.ts:
The weighted sum is calibrated via a sigmoid.
If the confidence is below a configurable threshold, the router falls back to the MEDIUM tier (DeepSeek/GPT‑4o‑mini).
Overriding thresholds or adding custom keywords is as simple as editing your openclaw.yaml:
# Override tier models
plugins:
- id: "@blockrun/clawrouter"
config:
routing:
tiers:
COMPLEX:
primary: "openai/gpt-4o"
SIMPLE:
primary: "google/gemini-2.5-flash"
# Override scoring weights
routing:
scoring:
reasoningKeywords: ["proof", "theorem", "formal verification"]
codeKeywords: ["function", "class", "async", "await"]For most developers, the easiest way to adopt ClawRouter is via the OpenClaw plugin:
openclaw plugins install @blockrun/clawrouter automatically creates a wallet in ~/.openclaw/blockrun/wallet.key and prints its address. Fund it with a small amount of USDC on Base and you’re ready.blockrun/auto as your default model. From this point on, every request you send (via OpenClaw CLI, your local openai Python library, or any other client pointed at the ClawRouter proxy) will automatically go to the right model.~/.openclaw/blockrun/logs/, so you can audit costs per request.Here’s a minimal TypeScript example without OpenClaw:
import { startProxy } from "@blockrun/clawrouter";
const proxy = await startProxy({
walletKey: process.env.BLOCKRUN_WALLET_KEY!,
onReady: (port) => console.log(`Proxy on port ${port}`),
onRouted: (d) => console.log(`${d.model} saved ${(d.savings * 100).toFixed(0)}%`),
});// Any OpenAI‑compatible client works
const res = await fetch(`${proxy.baseUrl}/v1/chat/completions`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
model: "blockrun/auto",
messages: [{ role: "user", content: "What is 2+2?" }],
}),
});
console.log(await res.json());
await proxy.close();The proxy inspects the prompt, selects the cheapest model, signs the micropayment, forwards the request and returns the result.
In my own tests, trivial prompts (e.g. “Summarize this article.”) are routed to gpt‑4o‑mini at $0.60/M tokens, while deep reasoning (e.g. “Prove that √2 is irrational.”) goes to o3 or Claude Sonnet.
ClawRouter exposes a local health endpoint at /health that returns wallet status and optionally your USDC balance.
You can hook into onLowBalance and onInsufficientFunds callbacks to warn or halt operations. The roadmap includes spend controls and an analytics dashboard.
Agentic frameworks (e.g. OpenClaw, CrewAI, AutoGPT) often spawn multiple sub‑agents to solve complex tasks.
Without routing, each sub‑agent defaults to the most expensive model, quickly burning your budget.
ClawRouter’s design makes it ideal for multi‑agent workflows:
They’re built for developers. ClawRouter is built for agents.

Agents shouldn’t need a human to paste API keys. They should generate a wallet, receive funds, and pay per request programmatically.
Suppose you’re building a research assistant that needs to gather background, summarize papers and derive insights.
You can create sub‑agents:
deepseek-chat at $0.27/M.gpt-4o-mini.claude-sonnet-4.o3 or Opus.Agents interact via messages passed through a coordinator.
Each call to blockrun/auto returns the chosen model, cost estimate and savings, which you can log.
Because routing is local, there is no additional latency, crucial for swarms of dozens of agents.
Below is a pseudocode snippet using a hypothetical multi‑agent framework:
from my_agents import WebScraper, Summarizer, Synthesizer, FactChecker
from openai import OpenAIoi = OpenAI(base_url="http://127.0.0.1:8402/v1", api_key="")scraper = WebScraper(client=oi, model="blockrun/auto")
summarizer = Summarizer(client=oi, model="blockrun/auto")
synthesizer = Synthesizer(client=oi, model="blockrun/auto")
fact_checker = FactChecker(client=oi, model="blockrun/auto")articles = scraper.scrape("topic: agentic AI")
summaries = [summarizer.summarize(a) for a in articles]
draft = synthesizer.synthesize(summaries)
verified = fact_checker.verify(draft)
print(verified)Each call will automatically choose the cheapest model appropriate for the prompt.
You can introspect routing decisions via the callback onRouted to see savings and adjust your agent’s strategy if certain calls consistently trigger expensive models.
openai/gpt-4o or another id in the request. You still benefit from x402 and logging.onLowBalance and onInsufficientFunds to gracefully degrade your agent’s capabilities when funds are low: skip optional tasks or route everything to a lower tier.blockrun/auto, check if the response quality is sufficient, and if not, re‑issue the prompt with claude-sonnet-4.ClawRouter is part of BlockRun’s pay‑per‑request AI infrastructure.
Together with OpenClaw, it aims to make agents autonomous in both reasoning and billing.
The roadmap includes cascade routing, spend controls and an analytics dashboard.
For developers building agentic applications, this translates to:
The router’s local‑first philosophy means privacy, speed and flexibility are in your hands.
If you build agents or any application that invokes LLMs, give ClawRouter a try.
You might be surprised at how much efficiency you can unlock when the right tool is picked for every job.