ClawRouter: Zero-Key, Fast LLM Routing for Agent Payments

ClawRouter: The Zero‑Key, Ultra‑Fast LLM Router

For AI developers building autonomous agents, the cost, latency, and management of LLM APIs are perennial pain points. ClawRouter tackles all of these issues at the same time: it routes every model request to the cheapest capable provider, signs payments with your own crypto wallet, and keeps the entire process local with <1 ms latency.

Why ClawRouter Matters

  • 🚀 Zero API keys – authentication is a signed USDC transaction, no shared secrets.
  • 💸 Huge savings – weighted, 15‑dimension scoring finds the cheapest model; typical savings are 70‑90% versus a single‑provider plan.
  • Fast routing – all decisions happen client‑side; the first 1‑second response time is the “decision time,” not an external API round‑trip.
  • 🔒 Non‑custodial payments – you control the wallet; no custodial backend retains your funds.
  • 🌐 30+ models & 7 providers – from OpenAI, Anthropic, Google, DeepSeek, XAI, Moonshot, and MiniMax, all accessible with a single call.

Quick Install & Setup

ClawRouter ships with a one‑command installer that works on Linux, macOS, and Windows (WSL). In this section we show the minimal steps to get it running in 120 seconds.

# 1. Install the wrapper with smart‑routing enabled
curl -fsSL https://blockrun.ai/ClawRouter-update | bash

# 2. Restart the OpenClaw gateway so the router is loaded
openclaw gateway restart

# 3. Fund your L2 Base wallet with a few dollars USDC (just $1 works!)
#    The wallet address is printed on install:
#    $ openclaw wallet address
#
#    Example: 0x1234…ABCD (Base L2)

Once the wallet is funded, ClawRouter automatically becomes the default router (the /model auto profile). No further environment variables are needed for basic usage.

Routing Profiles Explained

ClawRouter comes with four pre‑configured routing profiles. Switch between them with the short‑form /model <profile> command.

ProfileStrategySavingsUse‑Case
/model autoBalanced74‑100%General use, high efficiency
/model ecoCheapest only95‑100%Maximising savings, low‑cost workloads
/model premiumHighest quality only0%Mission‑critical applications
/model freeFree tier only100%Zero‑cost experimentation

A Glimpse of the Code

The core of ClawRouter lives in TypeScript. The router uses a 15‑dimension weighted scorer that evaluates cost, latency, context length, and reasoning quality. The score drives a tier system that picks the cheapest model that satisfies the request’s constraints.

import { ClawRouter } from 'clawrouter'

const router = new ClawRouter({ profile: 'auto' })
const result = await router.call('gpt-4o', { prompt: 'Who won the 2024 World Series?' })
console.log(result.output)

Payment Flow

What makes ClawRouter unique is its micro‑payment system. When the router cannot fulfill a request with the wallet’s balance, the gateway returns a 402 Payment Required response with the exact price. The agent then signs the payment with its private key and re‑sends the request anonymously. No API keys, no shared secrets, no custodians. The wallet stays in your control.

Typical usage:

  • Agent sends request to /model auto.
  • Gateway checks wallet balance.
  • If insufficient, returns 402 with the price.
  • Agent signs the USD‑C equivalent using its private key (x402).
  • Gateway deducts the cost and returns the LLM output.

Advanced Configuration

While the defaults are great for most users, ClawRouter’s docs/configuration.md exposes many knobs:

  • BLOCKRUN_PROXY_PORT – change the local listening port.
  • CLAWROUTER_DISABLED – toggle smart routing off for debugging.
  • Provider‑specific overrides and custom weight matrices.

Why ClawRouter Beats the Competition

Comparing with OpenRouter and LiteLLM shows the key differentiators:

  • Cost: ~$2.05/M blended average vs $25/M for the best OpenRouter model.
  • Latency: All decisions local (<1 ms) vs external API round‑trips.
  • Security: Wallet signatures vs shared API keys.
  • Scalability: No per‑key rate limits; you control the wallet.

Getting Involved

ClawRouter is an MIT‑licensed project maintained by the BlockRun community. Contribute by:

  • Submitting pull requests – the .github/workflows folder contains continuous integration that runs tests on TypeScript, ESLint, and Prettier.
  • Adding new routing profiles or models.
  • Improving the wallet payment logic or adding support for other L2 chains.

Find the source on GitHub: BlockRunAI/ClawRouter.

Try It Out Today

Jump into development:

git clone https://github.com/BlockRunAI/ClawRouter.git
cd ClawRouter
npm install
npm run build
npm test

Once built, just run openclaw gateway start and start sending LLM requests. Save money, reduce friction, and keep your funding on your side with ClawRouter.

Original Article: View Original

Share this article