You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23โ€“26.RSVP โ†’
Socket
Book a DemoSign in
Socket

@blockrun/clawrouter

Package Overview
Dependencies
Maintainers
1
Versions
226
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blockrun/clawrouter

Smart LLM router โ€” save 92% on inference costs. 41+ models, one wallet, x402 micropayments.

Source
npmnpm
Version
0.12.36
Version published
Weekly downloads
3.4K
-27.01%
Maintainers
1
Weekly downloads
ย 
Created
Source
ClawRouter Banner

The agent-native LLM router for OpenClaw

Route every request to the right model at the right price.
15-dimension scoring, <1ms local routing, optimized for autonomous agents.
One wallet, 41+ models, zero API keys.

92% savingsย  No API keysย  41+ modelsย  Non-custodialย  Fast routing

npm version npm downloads GitHub stars CI TypeScript License: MIT

USDC Hackathon Winner x402 Protocol Base Network Solana OpenClaw Plugin Telegram

๐Ÿ“‘ Quick Navigation

SectionDescription
Quick StartInstall in 2 minutes
Routing Profileseco / auto / premium / free
Image Generation/imagegen with 5 models
How It Works15-dimension local routing
Models & Pricing41+ models, full price list
ScreenshotsSee it in action
Paymentx402 non-custodial USDC
ConfigurationEnvironment variables
Troubleshootingdoctor AI-powered diagnostics
vs OpenRouterWhy ClawRouter wins
SupportTelegram, X, founders

API Docs: Image Generation & Editing ยท Architecture ยท Configuration

๐Ÿš€ Quick Start

# 1. Install with smart routing enabled
curl -fsSL https://blockrun.ai/ClawRouter-update | bash
openclaw gateway restart

# 2. Fund your wallet with USDC on Base or Solana (address printed on install)
# $5 is enough for thousands of requests

Done! Smart routing (blockrun/auto) is now your default model.

๐ŸŽฏ Routing Profiles

Choose your routing strategy with /model <profile>:

ProfileStrategySavingsBest For
/model autoBalanced (default)74-100%General use
/model ecoCheapest possible95-100%Maximum savings
/model premiumBest quality0%Mission-critical
/model freeFree tier only100%Zero cost

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

๐ŸŽจ Image Generation

Generate images directly from chat with /imagegen:

/imagegen a dog dancing on the beach
/imagegen --model dall-e-3 a futuristic city at sunset
/imagegen --model banana-pro --size 2048x2048 mountain landscape
ModelProviderPriceMax Size
nano-bananaGoogle Gemini Flash$0.05/image1024x1024
banana-proGoogle Gemini Pro$0.10/image4096x4096
dall-e-3OpenAI DALL-E 3$0.04/image1792x1024
gpt-imageOpenAI GPT Image 1$0.02/image1536x1024
fluxBlack Forest Flux 1.1$0.04/image1024x1024

Default model: nano-banana. Images are returned as hosted URLs for compatibility with Telegram, Discord, and other clients.

โœ๏ธ Image Editing (img2img)

Edit existing images with /img2img โ€” pass a local file and describe what to change:

/img2img --image ~/photo.png change the background to a starry sky
/img2img --image ./cat.jpg --mask ./mask.png remove the background
/img2img --image /tmp/portrait.png --size 1536x1024 add a hat
OptionRequiredDescription
--image <path>YesLocal image file path (supports ~/)
--mask <path>NoMask image (white = area to edit)
--model <model>NoModel to use (default: gpt-image-1)
--size <WxH>NoOutput size (default: 1024x1024)

Supported model: gpt-image-1 (OpenAI GPT Image 1, $0.02/image).

API endpoint: POST http://localhost:8402/v1/images/image2image โ€” accepts local file paths, URLs, or base64 data URIs:

curl -X POST http://localhost:8402/v1/images/image2image \
  -H "Content-Type: application/json" \
  -d '{"prompt":"add sunglasses","image":"~/photo.png"}'

See Image Generation & Editing docs for full API reference and code examples.

โšก How It Works

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

Request โ†’ Weighted Scorer (15 dimensions) โ†’ Tier โ†’ Cheapest Model โ†’ Response
TierECO ModelAUTO ModelPREMIUM Model
SIMPLEnvidia/gpt-oss-120b (FREE)kimi-k2.5 ($0.60/$3.00)kimi-k2.5
MEDIUMgemini-2.5-flash-lite ($0.10/$0.40)grok-code-fast ($0.20/$1.50)gpt-5.2-codex ($1.75/$14.00)
COMPLEXgemini-2.5-flash-lite ($0.10/$0.40)gemini-3.1-pro ($2/$12)claude-opus-4.6 ($5/$25)
REASONINGgrok-4-fast ($0.20/$0.50)grok-4-fast ($0.20/$0.50)claude-sonnet-4.6 ($3/$15)

Blended average: $2.05/M vs $25/M for Claude Opus = 92% savings

๐Ÿ’ฐ Models & Pricing

41+ models across 7 providers, one wallet:

Click to expand full model list
ModelInput $/MOutput $/MContextReasoning
OpenAI
gpt-5.2$1.75$14.00400K*
gpt-4o$2.50$10.00128K
gpt-4o-mini$0.15$0.60128K
gpt-oss-120bFREEFREE128K
o1$15.00$60.00200K*
o1-mini$1.10$4.40128K*
o3$2.00$8.00200K*
o4-mini$1.10$4.40128K*
Anthropic
claude-opus-4.6$5.00$25.00200K*
claude-sonnet-4.6$3.00$15.00200K*
claude-haiku-4.5$1.00$5.00200K
Google
gemini-3.1-pro$2.00$12.001M*
gemini-3-pro-preview$2.00$12.001M*
gemini-3-flash-preview$0.50$3.001M
gemini-2.5-pro$1.25$10.001M*
gemini-2.5-flash$0.30$2.501M
gemini-2.5-flash-lite$0.10$0.401M
DeepSeek
deepseek-chat$0.28$0.42128K
deepseek-reasoner$0.28$0.42128K*
xAI
grok-4-0709$0.20$1.50131K*
grok-4-1-fast-reasoning$0.20$0.50131K*
grok-code-fast-1$0.20$1.50131K
Moonshot
kimi-k2.5$0.60$3.00262K*
MiniMax
minimax-m2.5$0.30$1.20205K*

Free tier: gpt-oss-120b costs nothing and serves as automatic fallback when wallet is empty.

๐Ÿ“ธ Screenshots

Smart Routing in Action

ClawRouter savings
Telegram Integration

Telegram demo

The flow:

  • Wallet auto-generated on Base (L2) โ€” saved at ~/.openclaw/blockrun/wallet.key
  • Fund with $1 USDC โ€” enough for hundreds of requests
  • Request any model โ€” ClawRouter picks the cheapest capable one
  • Pay per request โ€” non-custodial, you hold your keys

๐Ÿ’ณ Payment

No account. No API key. Payment IS authentication via x402.

Request โ†’ 402 (price: $0.003) โ†’ wallet signs USDC โ†’ retry โ†’ response

USDC stays in your wallet until spent - non-custodial. Price is visible in the 402 header before signing.

Dual-chain support: Pay with USDC on Base (EVM) or USDC on Solana โ€” no SOL token accepted. Both wallets are derived from a single BIP-39 mnemonic on first run.

/wallet              # Check balance and address (both chains)
/wallet export       # Export mnemonic + keys for backup
/wallet recover      # Restore wallet from mnemonic on a new machine
/wallet solana       # Switch to Solana USDC payments
/wallet base         # Switch back to Base (EVM) USDC payments
/chain solana        # Alias for /wallet solana
/stats               # View usage and savings
/stats clear         # Reset usage statistics

Fund your wallet:

  • Base (EVM): Send USDC on Base to your EVM address
  • Solana: Send USDC on Solana to your Solana address
  • Coinbase/CEX: Withdraw USDC to either network
  • Credit card: Don't have USDC? Reach out to @bc1max on Telegram โ€” we accept credit card payments

โš™๏ธ Configuration

For basic usage, no configuration needed. For advanced options:

VariableDefaultDescription
BLOCKRUN_WALLET_KEYauto-generatedYour wallet private key
BLOCKRUN_PROXY_PORT8402Local proxy port
CLAWROUTER_DISABLEDfalseDisable smart routing
CLAWROUTER_SOLANA_RPC_URLhttps://api.mainnet-beta.solana.comSolana RPC endpoint

Full reference: docs/configuration.md

๐ŸฅŠ vs OpenRouter

OpenRouter / LiteLLMClawRouter
SetupHuman creates accountAgent generates wallet
AuthAPI key (shared secret)Wallet signature (cryptographic)
PaymentPrepaid balance (custodial)Per-request (non-custodial)
RoutingProprietary / closedOpen source, client-side
Rate limitsPer-key quotasNone (your wallet, your limits)
Cost$25/M (Opus equivalent)$2.05/M blended average

Full comparison โ†’

๐Ÿฉบ Troubleshooting

When things go wrong, run the doctor:

npx @blockrun/clawrouter doctor

This collects diagnostics and sends them to Claude Sonnet for AI-powered analysis:

๐Ÿฉบ BlockRun Doctor v0.12.24

System
  โœ“ OS: darwin arm64
  โœ“ Node: v20.11.0

Wallet
  โœ“ Address: 0x1234...abcd
  โœ“ Balance: $12.50

Network
  โœ“ BlockRun API: reachable (142ms)
  โœ— Local proxy: not running on :8402

๐Ÿ“ค Sending to Claude Sonnet 4.6 (~$0.003)...

๐Ÿค– AI Analysis:
The local proxy isn't running. Run `openclaw gateway restart` to fix.

Use Opus for complex issues:

npx @blockrun/clawrouter doctor opus

Ask a specific question:

npx @blockrun/clawrouter doctor "why is my request failing?"
npx @blockrun/clawrouter doctor opus "ๆทฑๅบฆๅˆ†ๆžๆˆ‘็š„้…็ฝฎ"

Cost: Sonnet ~$0.003 (default) | Opus ~$0.01

๐Ÿ›  Development

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

๐Ÿ“ž Support

ChannelLink
๐Ÿ“… Schedule Democalendly.com/vickyfu9/30min
๐Ÿ’ฌ Community Telegramt.me/blockrunAI
๐Ÿฆ X / Twitterx.com/BlockRunAI
๐Ÿ“ฑ Founder Telegram@bc1max
โœ‰๏ธ Emailvicky@blockrun.ai

๐Ÿ“š More Resources

ResourceDescription
DocumentationFull docs
Model PricingAll models & prices
Image Generation & EditingAPI examples, 5 models
Routing ProfilesECO/AUTO/PREMIUM details
ArchitectureTechnical deep dive
ConfigurationEnvironment variables
vs OpenRouterWhy ClawRouter wins
FeaturesAll features
TroubleshootingCommon issues

MIT License ยท BlockRun โ€” Pay-per-request AI infrastructure

โญ If ClawRouter saves you money, consider starring the repo!

Keywords

llm

FAQs

Package last updated on 13 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts