ClawRouter README

The project's README from github.com/BlockRunAI/ClawRouter. As one markdown file: README.md.

ClawRouter Banner

The LLM router built for autonomous agents

Agents can't sign up for accounts. Agents can't enter credit cards.
Agents can only sign transactions.

ClawRouter is the only LLM router that lets agents operate independently.

Pay however you like: credit card — sign up at user.blockrun.ai, top up, mint an API key
or USDC on Solana or Base (x402 wallet, no account at all).
Or neither — 6 models are free, with no signup, no key and no wallet.


6 free models  Agent native  Card or USDC  Local routing  x402 USDC  Open source

npm version npm downloads GitHub stars CI TypeScript License: MIT

USDC Hackathon Winner x402 Protocol Base Network Solana OpenClaw Plugin Telegram

ClawRouter is an open-source smart LLM router that reduces AI API costs by up to 84%. It analyzes each request across 15 dimensions and routes to the cheapest capable model in under 1ms, entirely locally. It is the only LLM router that an autonomous agent can pay for by itself — a wallet signature is the account, and USDC micropayments over the x402 protocol are the billing — and it takes an ordinary credit card too: sign up at user.blockrun.ai, top up, and run the same router on an API key. 78 models from OpenAI, Anthropic, Google, xAI, DeepSeek, and more. MIT licensed.


What BlockRun is

BlockRun lets agents pay for the outcome — every LLM, tool and data source, best value per dollar.

Not a seat, not a subscription, not a monthly minimum you keep paying while the agent idles. An agent asks for one thing — an answer, an image, a transcript, a price, a call placed — and pays for that one thing at the moment it happens. Nothing to sign up for, nothing to cancel.

Every LLM 78 chat models across 9 providers, behind one endpoint and one balance
Every tool 10 image models, 8 video models, music, 5 voices, img2img editing, and outbound phone calls that come back as transcripts
Every data source web, news and neural search; prediction markets; live crypto and equity quotes; on-chain SQL over 100M+ labeled wallets; DEX routing; RPC across 40 chains
Best value per dollar 15-dimension local routing sends each request to the cheapest model that can actually do it — 84% below pinning Claude Opus 5 on the same traffic, computed from a published workload mix rather than estimated

ClawRouter is how an agent reaches it. BlockRun is the gateway and the billing; ClawRouter is the MIT-licensed router that runs on your machine, decides which model each request deserves, and settles the bill — a wallet signature in USDC, or a credit-card-funded API key. The rest of this README is about ClawRouter.


Why ClawRouter exists

Every other LLM router was built for human developers — create an account, get an API key, pick a model from a dashboard, pay with a credit card.

Agents can't do any of that.

ClawRouter is built for the agent-first world:

This is the stack that lets agents operate autonomously: x402 + USDC + local routing.

…and if you are a human, not an agent

Every "no X needed" above is a capability, not a restriction. ClawRouter takes a credit card too. Sign up at user.blockrun.ai, top up, mint an API key, and run clawrouter login brk_live_…. Same router, same 78 models, same local routing — calls go to api.blockrun.ai on a bearer token and bill your account credit. No crypto, no gas, no seed phrase.

You are Pay with Setup
Just trying it Nothing Install and pin a free model
A person Credit card → account credit Sign up at user.blockrun.ai → clawrouter login brk_live_…
An autonomous agent USDC on Solana or Base, per request Nothing — a wallet is generated on first run (Solana by default)

Full walkthrough: Paying with a credit card.


How it compares

OpenRouter LiteLLM Martian Portkey ClawRouter
Models 200+ 100+ Smart routing Gateway 78
Free tier Rate-limited BYO keys No No 6 models, no signup
Routing Manual selection Manual selection Smart (closed) Observability Smart (open source)
Auth Account + API key Your API keys Account + API key Account + API key Wallet signature or API key
Payment Credit card BYO keys Credit card $49-499/mo USDC per-request or card credit
Runs locally No Yes No No Yes
Open source No Yes No Partial Yes
Agent-ready No No No No Yes

✓ Open source · ✓ Smart routing · ✓ Runs locally · ✓ Crypto native · ✓ Agent ready

We're the only one that checks all five boxes.


Quick Start

No wallet? 6 models work free out of the box. Install, run, and pin free/nemotron-3.5-lightning (or any of the 6) — no crypto, no signup, no balance required. Add a credit card or USDC later when you want paid models.

Two ways to pay for the paid ones — pick one, the rest of ClawRouter is identical:

Wallet (default) API key
Who it is for Autonomous agents, and anyone happy holding USDC People who would rather pay with a card
Setup Nothing — a wallet is generated on first run Sign up at user.blockrun.ai, top up, mint a key, clawrouter login brk_live_…
Auth An x402 signature per request Authorization: Bearer brk_live_…
Gateway sol.blockrun.ai (Solana, default) / blockrun.ai (Base) api.blockrun.ai
Billing USDC leaves your wallet per call, non-custodial Card-funded account credit, drawn down at exact usage
Fees $0.001/tx settlement fee (covers on-chain gas) 5.5% + $0.30 on the top-up, then list price with nothing per call

ClawRouter prefers the API key whenever one is configured, so clawrouter login is all it takes to switch and clawrouter logout is all it takes to switch back.

Where do I sign up? user.blockrun.ai — sign in with Google, add credit with a card under Credits, mint a key under API Keys. That one key covers all 78 chat models plus images, video, speech and the live-data APIs. No wallet, no crypto, no seed phrase.

Desktop control plane (macOS)

The Electron app in apps/desktop provides one-click connections for OpenClaw, Codex, Hermes, DeepSeek Harness, and Pi, plus model pricing/context, wallet balances, Solana/Base switching, and Coinbase Onramp. It snapshots each agent's existing config before changing it and restores the original bytes when you disconnect. Wallets are shared through ~/.blockrun; older ClawRouter wallets are copied there automatically without overwriting existing Core files.

Option A — OpenClaw Agent

OpenClaw is an AI coding agent. If you're using it, ClawRouter installs as a plugin. Two paths:

A1. Recommended — one-shot install script:

curl -fsSL https://blockrun.ai/ClawRouter-update | bash
openclaw gateway restart

This handles everything: registration, models config, auth profile, wallet setup. Smart routing (blockrun/auto) is now your default model.

OpenClaw now also bundles an unrelated plugin named clawrouter (@openclaw/clawrouter). BlockRun uses the distinct plugin id blockrun-clawrouter; the installer preserves the official plugin and allows both products to coexist.

A2. If you prefer pure npm:

npm install -g @blockrun/clawrouter
clawrouter setup            # finishes OpenClaw integration — REQUIRED
openclaw gateway restart

⚠️ Skipping clawrouter setup will leave you broken. Bare npm install -g only puts the package on disk; it does NOT register the plugin with OpenClaw, sync the models allowlist, or write the auth profile. Symptom: /models in your bot shows only OpenClaw's defaults instead of the 55 BlockRun models. Run clawrouter setup to repair, or use path A1 to begin with.

Option B — Standalone (continue.dev, Cursor, VS Code, any OpenAI-compatible client)

Using Claude Code? Check out BRCC — it's purpose-built for Claude Code with the same smart routing and x402 payments.

Using NousResearch Hermes? See ClawRouter-Hermes — a Python plugin that wires Hermes into the ClawRouter proxy. Same wallet, same 78 models, same x402 USDC settlement on Solana & Base.

No OpenClaw required. ClawRouter runs as a local proxy on port 8402.

1. Start the proxy

npx @blockrun/clawrouter

2. Fund your wallet — optional, skip for free tier Your wallet address is printed on first run. For paid models, send a few USDC on Solana (the default chain) or Base — $5 covers thousands of requests. Prefer a card? Sign up at user.blockrun.ai and run clawrouter login brk_live_… instead. To stay at $0, pin any of the 6 free models (e.g. free/nemotron-3.5-lightning) or use /model free inside OpenClaw.

3. Point your client at http://localhost:8402

continue.dev — ~/.continue/config.yaml

Important: apiBase must end with /v1/ (including the trailing slash). Without it, continue.dev constructs the URL as /chat/completions instead of /v1/chat/completions, and the proxy returns 404.

models:
  - name: ClawRouter Auto
    provider: openai
    model: blockrun/auto
    apiBase: http://localhost:8402/v1/
    apiKey: x402
    roles:
      - chat
      - edit
      - apply

To pin a specific model, replace blockrun/auto with any model from blockrun.ai/models, e.g. anthropic/claude-opus-5, xai/grok-4.5.

Both provider: openai and provider: clawrouter work — just make sure apiBase ends with /v1/.

Legacy JSON format (~/.continue/config.json)
{
  "models": [
    {
      "title": "ClawRouter Auto",
      "provider": "openai",
      "model": "blockrun/auto",
      "apiBase": "http://localhost:8402/v1/",
      "apiKey": "x402"
    }
  ]
}
Cursor — Settings → Models → OpenAI-compatible

Set base URL to http://localhost:8402, API key to x402, model to blockrun/auto.

Any OpenAI SDK
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8402", api_key="x402")
response = client.chat.completions.create(model="blockrun/auto", messages=[...])

Routing Profiles

Choose your routing strategy with /model <profile>:

Profile Strategy Savings Best For
/model free Free NVIDIA models 100% $0 balance, learning
/model auto Balanced (default) 84% General use
/model eco Cheapest possible 98% Maximum savings
/model premium Best quality 0% Mission-critical

Shortcuts: /model grok, /model br-sonnet, /model gpt5, /model o3


How It Works

100% local routing. <1ms latency. Zero external API calls.

Routing decisions come from @blockrun/router-core — Router Core V3.5, the constraint-first portfolio router shared by every BlockRun product (ClawRouter, Franklin, the @blockrun/llm SDKs, ClawRouter-Hermes). ClawRouter inlines it at build time, pinned to an exact commit, and injects its live model catalog at startup.

Request → 15-dimens

ClawRouter (BlockRunAI/ClawRouter)

Searching Database…

这是什么?ClawRouter 是一个为自主智能体打造的开源 LLM 路由器:它能在不到 1 毫秒内、完全在本地,从 9 家服务商的 78 个模型中挑选出最便宜且能胜任任务的模型,并允许智能体通过 x402 协议以 USDC 按次付费,无需注册人工账户。
这是托管服务,还是运行在我自己机器上的程序?它是一个本地代理和命令行工具,运行在你的机器上,监听 8402 端口,并提供兼容 OpenAI 的接口;真正的计费和模型目录位于 BlockRun 网关之后,但路由决策在本地完成,不会发起任何外部调用。
我该如何让它配合我的编码智能体运行起来?如果使用 OpenClaw,请运行一键安装脚本,它会处理注册、模型配置、认证和钱包设置;对于其他任何兼容 OpenAI 的客户端(continue.dev、Cursor、VS Code),请用 npm 安装命令行工具,启动本地代理,然后把客户端的基础 URL 指向它,地址末尾加上 /v1/。
试用前我需要加密钱包或 API 密钥吗?不需要——6 个开源权重模型(包括一个支持 100 万上下文的推理模型)完全免费,无需钱包、注册或密钥;只有在要解锁其余 78 个付费模型时,才需要一个(自动生成的)钱包或 BlockRun API 密钥。
如果我只运行 npm install,跳过设置步骤,会怎样?单独运行 'npm install -g' 只会把软件包放到磁盘上,它不会向 OpenClaw 注册插件、同步模型允许列表,也不会写入认证配置文件,因此在你运行 'clawrouter setup' 之前,机器人的 /models 列表只会显示 OpenClaw 的默认选项。
路由时,我的请求会先发送到第三方服务器吗?不会——模型选择步骤完全在本地进行,不调用任何外部 API;只有实际的对话请求会发送给所选的服务商。
我可以切换哪些路由配置方案?/model free 只使用免费的 NVIDIA 模型(节省 100%),/model auto 是均衡的默认选项(节省 84%),/model eco 最大化节省(节省 98%),/model premium 始终选择质量最好的模型(节省 0%)。
它支持哪些编码智能体和客户端?它可以作为原生插件接入 OpenClaw,并附带一个 macOS 桌面应用,可一键连接 OpenClaw、Codex、Hermes、DeepSeek Harness 和 Pi。作为独立代理使用时,它也可以与 continue.dev、Cursor、VS Code 或任何兼容 OpenAI 的客户端配合使用。
它如何决定使用哪个模型?Router Core V3.5 会从 15 个维度为每个请求打分,并采用约束优先的排序方式,挑选出真正能胜任该请求的最便宜模型;该逻辑在构建时内联,并固定到某个确切的提交版本。
我可以用普通信用卡付款,而不是加密货币吗?可以——在 user.blockrun.ai 注册,用信用卡充值并生成 API 密钥,然后运行 'clawrouter login',即可把 ClawRouter 从基于钱包的 x402 付款切换为信用卡充值的账户余额。
Creator
BlockRunAI
Size
154.1 MB
Stars
6.6K
Age
8mo
Commits · 90 Days