Open source · MIT · v1.2
Stop paying frontier prices for “thanks!”
ClawRoute is a local proxy that classifies every LLM request in under 5ms and sends it to the cheapest model that can handle it. If that model fails, it escalates before your app ever sees a bad answer.
/how it works
Most of your traffic doesn't need your best model.
Heartbeats, acknowledgements and quick questions make up a big share of an agent's calls. ClawRoute sits between your client and your providers and decides, per request, what each one actually needs.
Your client
OpenClaw, Cursor, your own app: anything that speaks the OpenAI API.
ClawRoute · 127.0.0.1:18790
- Classify the request locally
- Route to the cheapest capable model
- Validate the answer; escalate if it fails
- Log the cost and savings to SQLite
Providers
OpenAI, Anthropic, Google, DeepSeek, or anything on OpenRouter, using your own keys.
/tiers
Five tiers, decided by rules you can read.
No model call to decide which model to call. The classifier is plain heuristics, so it's fast, free and predictable. Every default below can be changed in config.
| Tier | What lands here | Default model |
|---|---|---|
| heartbeat | Pings and liveness checks: “hi”, “are you there?” | gemini-2.5-flash-lite |
| simple | “thanks”, “ok”, emoji replies, short questions | deepseek-chat |
| moderate | General conversation (the default) | gemini-2.5-flash |
| complex | Analysis, tool use, deep threads, short code requests | claude-sonnet-4-6 |
| frontier | Code blocks, forced tool calls, very long context, images | claude-opus-4-6 |
/safety
Built so it can't break your agent.
A router that saves money but corrupts a tool call isn't worth running. These rules hold on every request.
Streams are never interrupted
Once tokens start flowing to your client, ClawRoute is committed. No restarts, no doubled output.
Tool calls are never retried
A response containing tool calls is returned as-is, so an action can't run twice.
Errors fall through
If ClawRoute itself hits an error, the request goes to the model you originally asked for.
One-call kill switch
POST /api/disable or CLAWROUTE_ENABLED=false stops all routing immediately.
Local and private
Binds to 127.0.0.1. Classification makes no network calls. Content isn't logged unless you turn it on.
No telemetry
No analytics, no phoning home. Your keys go straight to your providers.
/use it
Point your client at it. That's the integration.
ClawRoute speaks the OpenAI API, including /v1/models, so changing one base URL is enough.
// any OpenAI SDK client
const client = new OpenAI({
baseURL: "http://127.0.0.1:18790/v1",
apiKey: process.env.OPENAI_API_KEY,
});
# OpenClaw: ~/.openclaw/openclaw.json
providers.openai.baseUrl = "http://127.0.0.1:18790/v1"
Then watch what it saves:
clawroute statsToday's requests, savings and tier mix (--week for 7 days)
clawroute logRecent routing decisions and why each was made
clawroute dry-runClassify and log without rerouting: see the savings before you commit
clawroute liveLeave dry-run and start routing
clawroute disablePass everything through to the original model
/compared
ClawRoute vs OpenRouter
They solve different problems. OpenRouter gives you one key for hundreds of models. ClawRoute picks the right model for you, on your machine.
| ClawRoute | OpenRouter | |
|---|---|---|
| runs | Locally, on your machine | Their cloud |
| prompts | Never leave your machine | Pass through their servers |
| overhead | None; you pay providers directly | Platform fee per request |
| model choice | Automatic, per request | You choose |
| setup | Local install + your own keys | One key, nothing to install |
/limits
What it doesn't do.
- Classification is rules-based, not ML. Edge cases can land a tier too low; escalation on failure is the safety net.
- Token counts for streamed responses are estimated.
- Cost figures use published provider prices and can lag behind price changes.