@blockrun/clawrouter 0.12.245 → 0.12.246
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -11
- package/dist/cli.js +61 -33
- package/dist/index.d.ts +9 -2
- package/dist/index.js +61 -33
- package/dist/router/index.js +48 -33
- package/docs/anthropic-cost-savings.md +1 -1
- package/docs/anthropic-third-party-harness-changes.md +2 -2
- package/docs/clawrouter-cuts-llm-api-costs-500x.md +1 -1
- package/docs/clawrouter-vs-openrouter-llm-routing-comparison.md +3 -3
- package/docs/configuration.md +2 -9
- package/package.json +3 -3
- package/skills/clawrouter/SKILL.md +4 -4
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ Agents can only sign transactions.<br><br>
|
|
|
34
34
|
|
|
35
35
|
</div>
|
|
36
36
|
|
|
37
|
-
> **ClawRouter** is an open-source smart LLM router that reduces AI API costs by up to <!-- br:savings.autoVsBaselinePct -->88<!-- /br:savings.autoVsBaselinePct -->%. It analyzes each request across <!-- br:clawrouter.dimensions -->15<!-- /br:clawrouter.dimensions --> dimensions and routes to the cheapest capable model in under 1ms, entirely locally. ClawRouter is the only LLM router built for autonomous AI agents — it uses wallet signatures for authentication (no API keys) and USDC micropayments via the x402 protocol (no credit cards). <!-- br:models.chatVisible -->
|
|
37
|
+
> **ClawRouter** is an open-source smart LLM router that reduces AI API costs by up to <!-- br:savings.autoVsBaselinePct -->88<!-- /br:savings.autoVsBaselinePct -->%. It analyzes each request across <!-- br:clawrouter.dimensions -->15<!-- /br:clawrouter.dimensions --> dimensions and routes to the cheapest capable model in under 1ms, entirely locally. ClawRouter is the only LLM router built for autonomous AI agents — it uses wallet signatures for authentication (no API keys) and USDC micropayments via the x402 protocol (no credit cards). <!-- br:models.chatVisible -->71<!-- /br:models.chatVisible --> models from OpenAI, Anthropic, Google, xAI, DeepSeek, and more. MIT licensed.
|
|
38
38
|
|
|
39
39
|
---
|
|
40
40
|
|
|
@@ -61,7 +61,7 @@ This is the stack that lets agents operate autonomously: **x402 + USDC + local r
|
|
|
61
61
|
|
|
62
62
|
| | OpenRouter | LiteLLM | Martian | Portkey | **ClawRouter** |
|
|
63
63
|
| ---------------- | ----------------- | ---------------- | ----------------- | ----------------- | ---------------------------------------------------------------------- |
|
|
64
|
-
| **Models** | 200+ | 100+ | Smart routing | Gateway | **<!-- br:models.chatVisible -->
|
|
64
|
+
| **Models** | 200+ | 100+ | Smart routing | Gateway | **<!-- br:models.chatVisible -->71<!-- /br:models.chatVisible -->** |
|
|
65
65
|
| **Free tier** | Rate-limited | BYO keys | No | No | **<!-- br:models.free -->5<!-- /br:models.free --> models, no signup** |
|
|
66
66
|
| **Routing** | Manual selection | Manual selection | Smart (closed) | Observability | **Smart (open source)** |
|
|
67
67
|
| **Auth** | Account + API key | Your API keys | Account + API key | Account + API key | **Wallet signature** |
|
|
@@ -107,7 +107,7 @@ openclaw gateway restart
|
|
|
107
107
|
|
|
108
108
|
> **Using Claude Code?** Check out [BRCC](https://blockrun.ai/brcc.md) — it's purpose-built for Claude Code with the same smart routing and x402 payments.
|
|
109
109
|
>
|
|
110
|
-
> **Using NousResearch Hermes?** See [ClawRouter-Hermes](https://github.com/BlockRunAI/ClawRouter-Hermes) — a Python plugin that wires Hermes into the ClawRouter proxy. Same wallet, same <!-- br:models.chatVisible -->
|
|
110
|
+
> **Using NousResearch Hermes?** See [ClawRouter-Hermes](https://github.com/BlockRunAI/ClawRouter-Hermes) — a Python plugin that wires Hermes into the ClawRouter proxy. Same wallet, same <!-- br:models.chatVisible -->71<!-- /br:models.chatVisible --> models, same x402 USDC settlement on Base & Solana.
|
|
111
111
|
|
|
112
112
|
No OpenClaw required. ClawRouter runs as a local proxy on port 8402.
|
|
113
113
|
|
|
@@ -213,7 +213,7 @@ Request → Weighted Scorer → Tier → Best Model → Response
|
|
|
213
213
|
|
|
214
214
|
| Tier | ECO Model | AUTO Model | PREMIUM Model |
|
|
215
215
|
| --------- | --------------------------------------- | --------------------------------------- | ---------------------------- |
|
|
216
|
-
| SIMPLE |
|
|
216
|
+
| SIMPLE | step-3.7-flash (**FREE**) | gemini-2.5-flash ($0.30/$2.50) | kimi-k2.7 † ($0.95/$4.00) |
|
|
217
217
|
| MEDIUM | gemini-3.1-flash-lite ($0.25/$1.50) | kimi-k2.7 ($0.95/$4.00) | gpt-5.3-codex ($1.75/$14.00) |
|
|
218
218
|
| COMPLEX | gemini-3.1-flash-lite ($0.25/$1.50) | gemini-3.1-pro ($2/$12) | claude-fable-5 ($10/$50) |
|
|
219
219
|
| REASONING | grok-4-1-fast-reasoning † ($0.20/$0.50) | grok-4-1-fast-reasoning † ($0.20/$0.50) | claude-sonnet-4.6 ($3/$15) |
|
|
@@ -393,7 +393,7 @@ No Surf account, no API key — settles directly to Surf's Base treasury in USDC
|
|
|
393
393
|
|
|
394
394
|
## Models & Pricing
|
|
395
395
|
|
|
396
|
-
<!-- br:models.chatVisible -->
|
|
396
|
+
<!-- br:models.chatVisible -->71<!-- /br:models.chatVisible --> models across 9 providers, one wallet. **<!-- br:models.free -->5<!-- /br:models.free --> models are $0 — paid models start at fractions of a cent.**
|
|
397
397
|
|
|
398
398
|
> **💡 "Cost per request"** = estimated cost for a typical chat message (~500 input + 500 output tokens). Paid requests also carry a flat **$0.001/tx settlement fee** (covers on-chain gas; already included in the price the gateway quotes). Free models never pay it.
|
|
399
399
|
|
|
@@ -498,15 +498,14 @@ Request → 402 (price: $0.003) → wallet signs USDC → retry → response
|
|
|
498
498
|
|
|
499
499
|
USDC stays in your wallet until spent — non-custodial. Price is visible in the 402 header before signing.
|
|
500
500
|
|
|
501
|
-
**Dual-chain support:** Pay with **USDC** on **Base (EVM)** or **USDC on Solana**. Both wallets are derived from a single BIP-39 mnemonic on first run.
|
|
501
|
+
**Dual-chain support:** Pay with **USDC** on **Base (EVM)** or **USDC on Solana**. Both wallets are derived from a single BIP-39 mnemonic on first run. New installs default to **Solana**; existing installs stay on **Base** unless switched with `/wallet solana`.
|
|
502
502
|
|
|
503
503
|
```bash
|
|
504
504
|
/wallet # Check balance and address (both chains)
|
|
505
505
|
/wallet export # Export mnemonic + keys for backup
|
|
506
506
|
/wallet recover # Restore wallet from mnemonic on a new machine
|
|
507
507
|
/wallet solana # Switch to Solana USDC payments
|
|
508
|
-
/wallet base # Switch
|
|
509
|
-
/chain solana # Alias for /wallet solana
|
|
508
|
+
/wallet base # Switch to Base (EVM) USDC payments
|
|
510
509
|
/stats # View usage and savings
|
|
511
510
|
/stats clear # Reset usage statistics
|
|
512
511
|
/exclude # Show excluded models
|
|
@@ -654,7 +653,7 @@ npm test
|
|
|
654
653
|
|
|
655
654
|
**The LLM router built for autonomous agents**
|
|
656
655
|
|
|
657
|
-
You're here. <!-- br:models.chatVisible -->
|
|
656
|
+
You're here. <!-- br:models.chatVisible -->71<!-- /br:models.chatVisible --> models, local smart routing, x402 USDC payments — the only stack that lets agents operate independently.
|
|
658
657
|
|
|
659
658
|
`curl -fsSL https://blockrun.ai/ClawRouter-update | bash`
|
|
660
659
|
|
|
@@ -665,7 +664,7 @@ You're here. <!-- br:models.chatVisible -->70<!-- /br:models.chatVisible --> mod
|
|
|
665
664
|
|
|
666
665
|
**BlockRun for Claude Code**
|
|
667
666
|
|
|
668
|
-
Run Claude Code with <!-- br:models.chatVisible -->
|
|
667
|
+
Run Claude Code with <!-- br:models.chatVisible -->71<!-- /br:models.chatVisible --> models, no rate limits, no Anthropic account, no phone verification. Pay per request with USDC — your wallet is your identity.
|
|
669
668
|
|
|
670
669
|
`curl -fsSL https://blockrun.ai/brcc-install | bash`
|
|
671
670
|
|
|
@@ -678,7 +677,7 @@ Run Claude Code with <!-- br:models.chatVisible -->70<!-- /br:models.chatVisible
|
|
|
678
677
|
|
|
679
678
|
**ClawRouter for NousResearch Hermes**
|
|
680
679
|
|
|
681
|
-
Python plugin that wraps the ClawRouter proxy for `hermes-agent`. Same <!-- br:models.chatVisible -->
|
|
680
|
+
Python plugin that wraps the ClawRouter proxy for `hermes-agent`. Same <!-- br:models.chatVisible -->71<!-- /br:models.chatVisible --> models, same x402 USDC payments on Base & Solana, native Hermes ergonomics.
|
|
682
681
|
|
|
683
682
|
`pip install hermes-plugin-clawrouter`
|
|
684
683
|
|
package/dist/cli.js
CHANGED
|
@@ -33594,6 +33594,21 @@ function applyPromotions(tierConfigs, promotions, profile, now2 = /* @__PURE__ *
|
|
|
33594
33594
|
}
|
|
33595
33595
|
return result;
|
|
33596
33596
|
}
|
|
33597
|
+
function applyUnavailableModels(tierConfigs, unavailableModels) {
|
|
33598
|
+
if (!unavailableModels || unavailableModels.length === 0) return tierConfigs;
|
|
33599
|
+
const dead = new Set(unavailableModels);
|
|
33600
|
+
let result = tierConfigs;
|
|
33601
|
+
for (const tier of Object.keys(tierConfigs)) {
|
|
33602
|
+
const config = tierConfigs[tier];
|
|
33603
|
+
const alive = [config.primary, ...config.fallback].filter((model) => !dead.has(model));
|
|
33604
|
+
if (alive.length === 0 || alive[0] === config.primary && alive.length === config.fallback.length + 1) {
|
|
33605
|
+
continue;
|
|
33606
|
+
}
|
|
33607
|
+
if (result === tierConfigs) result = { ...tierConfigs };
|
|
33608
|
+
result[tier] = { primary: alive[0], fallback: alive.slice(1) };
|
|
33609
|
+
}
|
|
33610
|
+
return result;
|
|
33611
|
+
}
|
|
33597
33612
|
function getStrategy(name) {
|
|
33598
33613
|
const strategy = registry.get(name);
|
|
33599
33614
|
if (!strategy) {
|
|
@@ -34291,6 +34306,7 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
34291
34306
|
profile = useAgenticTiers ? "agentic" : "auto";
|
|
34292
34307
|
}
|
|
34293
34308
|
tierConfigs = applyPromotions(tierConfigs, config.promotions, profile, options.now);
|
|
34309
|
+
tierConfigs = applyUnavailableModels(tierConfigs, options.unavailableModels);
|
|
34294
34310
|
const agenticScoreValue = ruleResult.agenticScore;
|
|
34295
34311
|
if (estimatedTokens > config.overrides.maxTokensForceComplex) {
|
|
34296
34312
|
const decision2 = selectModel(
|
|
@@ -34419,18 +34435,6 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
34419
34435
|
supportsTools: false,
|
|
34420
34436
|
supportsVision: false
|
|
34421
34437
|
},
|
|
34422
|
-
"free/gpt-oss-120b": {
|
|
34423
|
-
contextWindow: 128e3,
|
|
34424
|
-
maxOutputTokens: 16384,
|
|
34425
|
-
supportsTools: false,
|
|
34426
|
-
supportsVision: false
|
|
34427
|
-
},
|
|
34428
|
-
"free/gpt-oss-20b": {
|
|
34429
|
-
contextWindow: 128e3,
|
|
34430
|
-
maxOutputTokens: 16384,
|
|
34431
|
-
supportsTools: false,
|
|
34432
|
-
supportsVision: false
|
|
34433
|
-
},
|
|
34434
34438
|
"free/seed-oss-36b": {
|
|
34435
34439
|
contextWindow: 131072,
|
|
34436
34440
|
maxOutputTokens: 16384,
|
|
@@ -34503,6 +34507,18 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
34503
34507
|
supportsTools: true,
|
|
34504
34508
|
supportsVision: true
|
|
34505
34509
|
},
|
|
34510
|
+
"nvidia/nemotron-nano-9b-v2": {
|
|
34511
|
+
contextWindow: 131072,
|
|
34512
|
+
maxOutputTokens: 16384,
|
|
34513
|
+
supportsTools: false,
|
|
34514
|
+
supportsVision: false
|
|
34515
|
+
},
|
|
34516
|
+
"nvidia/step-3.7-flash": {
|
|
34517
|
+
contextWindow: 131072,
|
|
34518
|
+
maxOutputTokens: 16384,
|
|
34519
|
+
supportsTools: false,
|
|
34520
|
+
supportsVision: false
|
|
34521
|
+
},
|
|
34506
34522
|
"openai/gpt-4.1": {
|
|
34507
34523
|
contextWindow: 128e3,
|
|
34508
34524
|
maxOutputTokens: 16384,
|
|
@@ -34976,9 +34992,12 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
34976
34992
|
const targetTier = (features.taskType === "reasoning_mcq" || features.taskType === "reasoning_math") && (base3.tier === "SIMPLE" || base3.tier === "MEDIUM") ? "REASONING" : base3.tier;
|
|
34977
34993
|
const tierConfig = tierConfigs[targetTier];
|
|
34978
34994
|
const configuredCandidates = tierConfig ? getFallbackChain(targetTier, tierConfigs) : [];
|
|
34995
|
+
const unavailable = new Set(options.unavailableModels ?? []);
|
|
34979
34996
|
const chain3 = [
|
|
34980
34997
|
.../* @__PURE__ */ new Set([...configuredCandidates, ...evidenceCandidates(features.taskType)])
|
|
34981
|
-
].filter(
|
|
34998
|
+
].filter(
|
|
34999
|
+
(model2) => typeof model2 === "string" && model2.length > 0 && !unavailable.has(model2)
|
|
35000
|
+
);
|
|
34982
35001
|
const eligible = chain3.filter(
|
|
34983
35002
|
(model2) => isEligible(model2, features, maxOutputTokens, options)
|
|
34984
35003
|
);
|
|
@@ -35055,13 +35074,7 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
35055
35074
|
...eligibleCandidates.filter(
|
|
35056
35075
|
(model2) => !scoredModels.includes(model2) && !webResearchFallbackOrder.includes(model2)
|
|
35057
35076
|
)
|
|
35058
|
-
] :
|
|
35059
|
-
...scoredModels,
|
|
35060
|
-
...eligibleCandidates.filter((model2) => !scoredModels.includes(model2))
|
|
35061
|
-
] : [
|
|
35062
|
-
...scoredModels,
|
|
35063
|
-
...eligibleCandidates.filter((model2) => !scoredModels.includes(model2))
|
|
35064
|
-
];
|
|
35077
|
+
] : [...scoredModels, ...eligibleCandidates.filter((model2) => !scoredModels.includes(model2))];
|
|
35065
35078
|
const model = ranked[0] ?? base3.model;
|
|
35066
35079
|
const selectedTierConfigs = {
|
|
35067
35080
|
...tierConfigs,
|
|
@@ -36173,8 +36186,8 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
36173
36186
|
// $0.20/$1.25, 1M context
|
|
36174
36187
|
"xai/grok-4-fast-non-reasoning",
|
|
36175
36188
|
// 1,143ms, $0.20/$0.50 — fast fallback
|
|
36176
|
-
"
|
|
36177
|
-
//
|
|
36189
|
+
"nvidia/step-3.7-flash"
|
|
36190
|
+
// FREE backstop — new NVIDIA free tier (gpt-oss-120b now 400s; probed 2026-08-21)
|
|
36178
36191
|
]
|
|
36179
36192
|
},
|
|
36180
36193
|
MEDIUM: {
|
|
@@ -36247,14 +36260,15 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
36247
36260
|
// Eco tier configs - absolute cheapest (blockrun/eco)
|
|
36248
36261
|
ecoTiers: {
|
|
36249
36262
|
SIMPLE: {
|
|
36250
|
-
primary: "
|
|
36251
|
-
// FREE! $0.00/$0.00 —
|
|
36263
|
+
primary: "nvidia/step-3.7-flash",
|
|
36264
|
+
// FREE! $0.00/$0.00 — new NVIDIA free tier flagship
|
|
36252
36265
|
fallback: [
|
|
36253
|
-
"
|
|
36254
|
-
// FREE —
|
|
36255
|
-
//
|
|
36256
|
-
// (410
|
|
36257
|
-
//
|
|
36266
|
+
"nvidia/nemotron-nano-9b-v2",
|
|
36267
|
+
// FREE — compact + fast (~0.7s), high-volume light tasks
|
|
36268
|
+
// This head keeps rotting with NVIDIA's free hosting: deepseek-v4-flash
|
|
36269
|
+
// (410, 2026-08-12), seed-oss-36b (410, 2026-08-03), then gpt-oss-120b/20b
|
|
36270
|
+
// (400 Unknown model, probed 2026-08-21). Each retirement retargets the
|
|
36271
|
+
// two free rungs to the current free tier; the paid rungs below never move.
|
|
36258
36272
|
"google/gemini-3.1-flash-lite",
|
|
36259
36273
|
// $0.25/$1.50 — newest flash-lite
|
|
36260
36274
|
"openai/gpt-5.4-nano",
|
|
@@ -36371,8 +36385,8 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
36371
36385
|
"openai/gpt-5.3-codex",
|
|
36372
36386
|
"deepseek/deepseek-chat",
|
|
36373
36387
|
// Cheap, reliable
|
|
36374
|
-
"
|
|
36375
|
-
// NVIDIA free ultimate backstop (was
|
|
36388
|
+
"nvidia/step-3.7-flash"
|
|
36389
|
+
// NVIDIA free ultimate backstop (was gpt-oss-120b; 400s since ~2026-08)
|
|
36376
36390
|
]
|
|
36377
36391
|
},
|
|
36378
36392
|
REASONING: {
|
|
@@ -36461,8 +36475,8 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
36461
36475
|
// Previous flagship — 6,213ms, reliable
|
|
36462
36476
|
"deepseek/deepseek-chat",
|
|
36463
36477
|
// 1,431ms — cheap, reliable
|
|
36464
|
-
"
|
|
36465
|
-
// NVIDIA free ultimate backstop (was
|
|
36478
|
+
"nvidia/step-3.7-flash"
|
|
36479
|
+
// NVIDIA free ultimate backstop (was gpt-oss-120b; 400s since ~2026-08)
|
|
36466
36480
|
]
|
|
36467
36481
|
},
|
|
36468
36482
|
REASONING: {
|
|
@@ -57934,6 +57948,14 @@ Then run: npx @blockrun/clawrouter`
|
|
|
57934
57948
|
solanaAddress = await getSolanaAddress(derived.solanaPrivateKeyBytes);
|
|
57935
57949
|
} catch {
|
|
57936
57950
|
}
|
|
57951
|
+
let solanaDefaultSaved = false;
|
|
57952
|
+
if (solanaAddress) {
|
|
57953
|
+
try {
|
|
57954
|
+
await savePaymentChain("solana");
|
|
57955
|
+
solanaDefaultSaved = true;
|
|
57956
|
+
} catch {
|
|
57957
|
+
}
|
|
57958
|
+
}
|
|
57937
57959
|
console.log(`[ClawRouter]`);
|
|
57938
57960
|
console.log(`[ClawRouter] \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`);
|
|
57939
57961
|
console.log(`[ClawRouter] NEW WALLET GENERATED \u2014 BACK UP YOUR KEY NOW`);
|
|
@@ -57946,6 +57968,12 @@ Then run: npx @blockrun/clawrouter`
|
|
|
57946
57968
|
console.log(`[ClawRouter] Mnemonic : ${MNEMONIC_FILE}`);
|
|
57947
57969
|
console.log(`[ClawRouter]`);
|
|
57948
57970
|
console.log(`[ClawRouter] Both EVM (Base) and Solana wallets are ready.`);
|
|
57971
|
+
if (solanaDefaultSaved) {
|
|
57972
|
+
console.log(
|
|
57973
|
+
`[ClawRouter] Default payment chain: Solana \u2014 fund the Solana address above with USDC.`
|
|
57974
|
+
);
|
|
57975
|
+
console.log(`[ClawRouter] To switch to Base, run in OpenClaw: /wallet base`);
|
|
57976
|
+
}
|
|
57949
57977
|
console.log(`[ClawRouter] To back up, run in OpenClaw:`);
|
|
57950
57978
|
console.log(`[ClawRouter] /wallet export`);
|
|
57951
57979
|
console.log(`[ClawRouter]`);
|
package/dist/index.d.ts
CHANGED
|
@@ -767,7 +767,11 @@ type PaymentChain = "base" | "solana";
|
|
|
767
767
|
type ProxyOptions = {
|
|
768
768
|
wallet: WalletConfig;
|
|
769
769
|
apiBase?: string;
|
|
770
|
-
/**
|
|
770
|
+
/**
|
|
771
|
+
* Payment chain: "base" or "solana". New installs persist "solana" at wallet
|
|
772
|
+
* generation; absent config resolves to "base" for pre-existing installs.
|
|
773
|
+
* Can also be set via CLAWROUTER_PAYMENT_CHAIN env var.
|
|
774
|
+
*/
|
|
771
775
|
paymentChain?: PaymentChain;
|
|
772
776
|
/** Port to listen on (default: 8402) */
|
|
773
777
|
port?: number;
|
|
@@ -895,6 +899,8 @@ declare function savePaymentChain(chain: "base" | "solana"): Promise<void>;
|
|
|
895
899
|
/**
|
|
896
900
|
* Load the persisted payment chain selection from disk.
|
|
897
901
|
* Returns "base" if no file exists or the file is invalid.
|
|
902
|
+
* New installs persist "solana" at wallet generation, so an absent file
|
|
903
|
+
* means a pre-existing install whose funds live on Base.
|
|
898
904
|
*/
|
|
899
905
|
declare function loadPaymentChain(): Promise<"base" | "solana">;
|
|
900
906
|
/**
|
|
@@ -1488,7 +1494,8 @@ declare function buildPartnerTools(proxyBaseUrl: string): PartnerToolDefinition[
|
|
|
1488
1494
|
* # Install the plugin
|
|
1489
1495
|
* openclaw plugins install @blockrun/clawrouter
|
|
1490
1496
|
*
|
|
1491
|
-
* # Fund your wallet with USDC
|
|
1497
|
+
* # Fund your wallet with USDC (Solana for new installs, Base for existing ones;
|
|
1498
|
+
* # the funding address is printed on install)
|
|
1492
1499
|
*
|
|
1493
1500
|
* # Use smart routing (auto-picks cheapest model)
|
|
1494
1501
|
* openclaw models set blockrun/auto
|
package/dist/index.js
CHANGED
|
@@ -35385,6 +35385,21 @@ function applyPromotions(tierConfigs, promotions, profile, now2 = /* @__PURE__ *
|
|
|
35385
35385
|
}
|
|
35386
35386
|
return result;
|
|
35387
35387
|
}
|
|
35388
|
+
function applyUnavailableModels(tierConfigs, unavailableModels) {
|
|
35389
|
+
if (!unavailableModels || unavailableModels.length === 0) return tierConfigs;
|
|
35390
|
+
const dead = new Set(unavailableModels);
|
|
35391
|
+
let result = tierConfigs;
|
|
35392
|
+
for (const tier of Object.keys(tierConfigs)) {
|
|
35393
|
+
const config = tierConfigs[tier];
|
|
35394
|
+
const alive = [config.primary, ...config.fallback].filter((model) => !dead.has(model));
|
|
35395
|
+
if (alive.length === 0 || alive[0] === config.primary && alive.length === config.fallback.length + 1) {
|
|
35396
|
+
continue;
|
|
35397
|
+
}
|
|
35398
|
+
if (result === tierConfigs) result = { ...tierConfigs };
|
|
35399
|
+
result[tier] = { primary: alive[0], fallback: alive.slice(1) };
|
|
35400
|
+
}
|
|
35401
|
+
return result;
|
|
35402
|
+
}
|
|
35388
35403
|
function getStrategy(name) {
|
|
35389
35404
|
const strategy = registry.get(name);
|
|
35390
35405
|
if (!strategy) {
|
|
@@ -36082,6 +36097,7 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
36082
36097
|
profile = useAgenticTiers ? "agentic" : "auto";
|
|
36083
36098
|
}
|
|
36084
36099
|
tierConfigs = applyPromotions(tierConfigs, config.promotions, profile, options.now);
|
|
36100
|
+
tierConfigs = applyUnavailableModels(tierConfigs, options.unavailableModels);
|
|
36085
36101
|
const agenticScoreValue = ruleResult.agenticScore;
|
|
36086
36102
|
if (estimatedTokens > config.overrides.maxTokensForceComplex) {
|
|
36087
36103
|
const decision2 = selectModel(
|
|
@@ -36210,18 +36226,6 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
36210
36226
|
supportsTools: false,
|
|
36211
36227
|
supportsVision: false
|
|
36212
36228
|
},
|
|
36213
|
-
"free/gpt-oss-120b": {
|
|
36214
|
-
contextWindow: 128e3,
|
|
36215
|
-
maxOutputTokens: 16384,
|
|
36216
|
-
supportsTools: false,
|
|
36217
|
-
supportsVision: false
|
|
36218
|
-
},
|
|
36219
|
-
"free/gpt-oss-20b": {
|
|
36220
|
-
contextWindow: 128e3,
|
|
36221
|
-
maxOutputTokens: 16384,
|
|
36222
|
-
supportsTools: false,
|
|
36223
|
-
supportsVision: false
|
|
36224
|
-
},
|
|
36225
36229
|
"free/seed-oss-36b": {
|
|
36226
36230
|
contextWindow: 131072,
|
|
36227
36231
|
maxOutputTokens: 16384,
|
|
@@ -36294,6 +36298,18 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
36294
36298
|
supportsTools: true,
|
|
36295
36299
|
supportsVision: true
|
|
36296
36300
|
},
|
|
36301
|
+
"nvidia/nemotron-nano-9b-v2": {
|
|
36302
|
+
contextWindow: 131072,
|
|
36303
|
+
maxOutputTokens: 16384,
|
|
36304
|
+
supportsTools: false,
|
|
36305
|
+
supportsVision: false
|
|
36306
|
+
},
|
|
36307
|
+
"nvidia/step-3.7-flash": {
|
|
36308
|
+
contextWindow: 131072,
|
|
36309
|
+
maxOutputTokens: 16384,
|
|
36310
|
+
supportsTools: false,
|
|
36311
|
+
supportsVision: false
|
|
36312
|
+
},
|
|
36297
36313
|
"openai/gpt-4.1": {
|
|
36298
36314
|
contextWindow: 128e3,
|
|
36299
36315
|
maxOutputTokens: 16384,
|
|
@@ -36767,9 +36783,12 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
36767
36783
|
const targetTier = (features.taskType === "reasoning_mcq" || features.taskType === "reasoning_math") && (base3.tier === "SIMPLE" || base3.tier === "MEDIUM") ? "REASONING" : base3.tier;
|
|
36768
36784
|
const tierConfig = tierConfigs[targetTier];
|
|
36769
36785
|
const configuredCandidates = tierConfig ? getFallbackChain(targetTier, tierConfigs) : [];
|
|
36786
|
+
const unavailable = new Set(options.unavailableModels ?? []);
|
|
36770
36787
|
const chain3 = [
|
|
36771
36788
|
.../* @__PURE__ */ new Set([...configuredCandidates, ...evidenceCandidates(features.taskType)])
|
|
36772
|
-
].filter(
|
|
36789
|
+
].filter(
|
|
36790
|
+
(model2) => typeof model2 === "string" && model2.length > 0 && !unavailable.has(model2)
|
|
36791
|
+
);
|
|
36773
36792
|
const eligible = chain3.filter(
|
|
36774
36793
|
(model2) => isEligible(model2, features, maxOutputTokens, options)
|
|
36775
36794
|
);
|
|
@@ -36846,13 +36865,7 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
36846
36865
|
...eligibleCandidates.filter(
|
|
36847
36866
|
(model2) => !scoredModels.includes(model2) && !webResearchFallbackOrder.includes(model2)
|
|
36848
36867
|
)
|
|
36849
|
-
] :
|
|
36850
|
-
...scoredModels,
|
|
36851
|
-
...eligibleCandidates.filter((model2) => !scoredModels.includes(model2))
|
|
36852
|
-
] : [
|
|
36853
|
-
...scoredModels,
|
|
36854
|
-
...eligibleCandidates.filter((model2) => !scoredModels.includes(model2))
|
|
36855
|
-
];
|
|
36868
|
+
] : [...scoredModels, ...eligibleCandidates.filter((model2) => !scoredModels.includes(model2))];
|
|
36856
36869
|
const model = ranked[0] ?? base3.model;
|
|
36857
36870
|
const selectedTierConfigs = {
|
|
36858
36871
|
...tierConfigs,
|
|
@@ -37964,8 +37977,8 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
37964
37977
|
// $0.20/$1.25, 1M context
|
|
37965
37978
|
"xai/grok-4-fast-non-reasoning",
|
|
37966
37979
|
// 1,143ms, $0.20/$0.50 — fast fallback
|
|
37967
|
-
"
|
|
37968
|
-
//
|
|
37980
|
+
"nvidia/step-3.7-flash"
|
|
37981
|
+
// FREE backstop — new NVIDIA free tier (gpt-oss-120b now 400s; probed 2026-08-21)
|
|
37969
37982
|
]
|
|
37970
37983
|
},
|
|
37971
37984
|
MEDIUM: {
|
|
@@ -38038,14 +38051,15 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
38038
38051
|
// Eco tier configs - absolute cheapest (blockrun/eco)
|
|
38039
38052
|
ecoTiers: {
|
|
38040
38053
|
SIMPLE: {
|
|
38041
|
-
primary: "
|
|
38042
|
-
// FREE! $0.00/$0.00 —
|
|
38054
|
+
primary: "nvidia/step-3.7-flash",
|
|
38055
|
+
// FREE! $0.00/$0.00 — new NVIDIA free tier flagship
|
|
38043
38056
|
fallback: [
|
|
38044
|
-
"
|
|
38045
|
-
// FREE —
|
|
38046
|
-
//
|
|
38047
|
-
// (410
|
|
38048
|
-
//
|
|
38057
|
+
"nvidia/nemotron-nano-9b-v2",
|
|
38058
|
+
// FREE — compact + fast (~0.7s), high-volume light tasks
|
|
38059
|
+
// This head keeps rotting with NVIDIA's free hosting: deepseek-v4-flash
|
|
38060
|
+
// (410, 2026-08-12), seed-oss-36b (410, 2026-08-03), then gpt-oss-120b/20b
|
|
38061
|
+
// (400 Unknown model, probed 2026-08-21). Each retirement retargets the
|
|
38062
|
+
// two free rungs to the current free tier; the paid rungs below never move.
|
|
38049
38063
|
"google/gemini-3.1-flash-lite",
|
|
38050
38064
|
// $0.25/$1.50 — newest flash-lite
|
|
38051
38065
|
"openai/gpt-5.4-nano",
|
|
@@ -38162,8 +38176,8 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
38162
38176
|
"openai/gpt-5.3-codex",
|
|
38163
38177
|
"deepseek/deepseek-chat",
|
|
38164
38178
|
// Cheap, reliable
|
|
38165
|
-
"
|
|
38166
|
-
// NVIDIA free ultimate backstop (was
|
|
38179
|
+
"nvidia/step-3.7-flash"
|
|
38180
|
+
// NVIDIA free ultimate backstop (was gpt-oss-120b; 400s since ~2026-08)
|
|
38167
38181
|
]
|
|
38168
38182
|
},
|
|
38169
38183
|
REASONING: {
|
|
@@ -38252,8 +38266,8 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
38252
38266
|
// Previous flagship — 6,213ms, reliable
|
|
38253
38267
|
"deepseek/deepseek-chat",
|
|
38254
38268
|
// 1,431ms — cheap, reliable
|
|
38255
|
-
"
|
|
38256
|
-
// NVIDIA free ultimate backstop (was
|
|
38269
|
+
"nvidia/step-3.7-flash"
|
|
38270
|
+
// NVIDIA free ultimate backstop (was gpt-oss-120b; 400s since ~2026-08)
|
|
38257
38271
|
]
|
|
38258
38272
|
},
|
|
38259
38273
|
REASONING: {
|
|
@@ -57791,6 +57805,14 @@ Then run: npx @blockrun/clawrouter`
|
|
|
57791
57805
|
solanaAddress = await getSolanaAddress(derived.solanaPrivateKeyBytes);
|
|
57792
57806
|
} catch {
|
|
57793
57807
|
}
|
|
57808
|
+
let solanaDefaultSaved = false;
|
|
57809
|
+
if (solanaAddress) {
|
|
57810
|
+
try {
|
|
57811
|
+
await savePaymentChain("solana");
|
|
57812
|
+
solanaDefaultSaved = true;
|
|
57813
|
+
} catch {
|
|
57814
|
+
}
|
|
57815
|
+
}
|
|
57794
57816
|
console.log(`[ClawRouter]`);
|
|
57795
57817
|
console.log(`[ClawRouter] \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`);
|
|
57796
57818
|
console.log(`[ClawRouter] NEW WALLET GENERATED \u2014 BACK UP YOUR KEY NOW`);
|
|
@@ -57803,6 +57825,12 @@ Then run: npx @blockrun/clawrouter`
|
|
|
57803
57825
|
console.log(`[ClawRouter] Mnemonic : ${MNEMONIC_FILE}`);
|
|
57804
57826
|
console.log(`[ClawRouter]`);
|
|
57805
57827
|
console.log(`[ClawRouter] Both EVM (Base) and Solana wallets are ready.`);
|
|
57828
|
+
if (solanaDefaultSaved) {
|
|
57829
|
+
console.log(
|
|
57830
|
+
`[ClawRouter] Default payment chain: Solana \u2014 fund the Solana address above with USDC.`
|
|
57831
|
+
);
|
|
57832
|
+
console.log(`[ClawRouter] To switch to Base, run in OpenClaw: /wallet base`);
|
|
57833
|
+
}
|
|
57806
57834
|
console.log(`[ClawRouter] To back up, run in OpenClaw:`);
|
|
57807
57835
|
console.log(`[ClawRouter] /wallet export`);
|
|
57808
57836
|
console.log(`[ClawRouter]`);
|
package/dist/router/index.js
CHANGED
|
@@ -363,6 +363,21 @@ function applyPromotions(tierConfigs, promotions, profile, now = /* @__PURE__ */
|
|
|
363
363
|
}
|
|
364
364
|
return result;
|
|
365
365
|
}
|
|
366
|
+
function applyUnavailableModels(tierConfigs, unavailableModels) {
|
|
367
|
+
if (!unavailableModels || unavailableModels.length === 0) return tierConfigs;
|
|
368
|
+
const dead = new Set(unavailableModels);
|
|
369
|
+
let result = tierConfigs;
|
|
370
|
+
for (const tier of Object.keys(tierConfigs)) {
|
|
371
|
+
const config = tierConfigs[tier];
|
|
372
|
+
const alive = [config.primary, ...config.fallback].filter((model) => !dead.has(model));
|
|
373
|
+
if (alive.length === 0 || alive[0] === config.primary && alive.length === config.fallback.length + 1) {
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
if (result === tierConfigs) result = { ...tierConfigs };
|
|
377
|
+
result[tier] = { primary: alive[0], fallback: alive.slice(1) };
|
|
378
|
+
}
|
|
379
|
+
return result;
|
|
380
|
+
}
|
|
366
381
|
var RulesStrategy = class {
|
|
367
382
|
name = "rules";
|
|
368
383
|
route(prompt, systemPrompt, maxOutputTokens, options) {
|
|
@@ -414,6 +429,7 @@ ${value.slice(-(scanLimit - prefixLength))}`;
|
|
|
414
429
|
profile = useAgenticTiers ? "agentic" : "auto";
|
|
415
430
|
}
|
|
416
431
|
tierConfigs = applyPromotions(tierConfigs, config.promotions, profile, options.now);
|
|
432
|
+
tierConfigs = applyUnavailableModels(tierConfigs, options.unavailableModels);
|
|
417
433
|
const agenticScoreValue = ruleResult.agenticScore;
|
|
418
434
|
if (estimatedTokens > config.overrides.maxTokensForceComplex) {
|
|
419
435
|
const decision2 = selectModel(
|
|
@@ -552,18 +568,6 @@ var DEFAULT_MODEL_CAPABILITIES = Object.freeze({
|
|
|
552
568
|
supportsTools: false,
|
|
553
569
|
supportsVision: false
|
|
554
570
|
},
|
|
555
|
-
"free/gpt-oss-120b": {
|
|
556
|
-
contextWindow: 128e3,
|
|
557
|
-
maxOutputTokens: 16384,
|
|
558
|
-
supportsTools: false,
|
|
559
|
-
supportsVision: false
|
|
560
|
-
},
|
|
561
|
-
"free/gpt-oss-20b": {
|
|
562
|
-
contextWindow: 128e3,
|
|
563
|
-
maxOutputTokens: 16384,
|
|
564
|
-
supportsTools: false,
|
|
565
|
-
supportsVision: false
|
|
566
|
-
},
|
|
567
571
|
"free/seed-oss-36b": {
|
|
568
572
|
contextWindow: 131072,
|
|
569
573
|
maxOutputTokens: 16384,
|
|
@@ -636,6 +640,18 @@ var DEFAULT_MODEL_CAPABILITIES = Object.freeze({
|
|
|
636
640
|
supportsTools: true,
|
|
637
641
|
supportsVision: true
|
|
638
642
|
},
|
|
643
|
+
"nvidia/nemotron-nano-9b-v2": {
|
|
644
|
+
contextWindow: 131072,
|
|
645
|
+
maxOutputTokens: 16384,
|
|
646
|
+
supportsTools: false,
|
|
647
|
+
supportsVision: false
|
|
648
|
+
},
|
|
649
|
+
"nvidia/step-3.7-flash": {
|
|
650
|
+
contextWindow: 131072,
|
|
651
|
+
maxOutputTokens: 16384,
|
|
652
|
+
supportsTools: false,
|
|
653
|
+
supportsVision: false
|
|
654
|
+
},
|
|
639
655
|
"openai/gpt-4.1": {
|
|
640
656
|
contextWindow: 128e3,
|
|
641
657
|
maxOutputTokens: 16384,
|
|
@@ -1732,9 +1748,12 @@ var PortfolioStrategy = class {
|
|
|
1732
1748
|
const targetTier = (features.taskType === "reasoning_mcq" || features.taskType === "reasoning_math") && (base.tier === "SIMPLE" || base.tier === "MEDIUM") ? "REASONING" : base.tier;
|
|
1733
1749
|
const tierConfig = tierConfigs[targetTier];
|
|
1734
1750
|
const configuredCandidates = tierConfig ? getFallbackChain(targetTier, tierConfigs) : [];
|
|
1751
|
+
const unavailable = new Set(options.unavailableModels ?? []);
|
|
1735
1752
|
const chain = [
|
|
1736
1753
|
.../* @__PURE__ */ new Set([...configuredCandidates, ...evidenceCandidates(features.taskType)])
|
|
1737
|
-
].filter(
|
|
1754
|
+
].filter(
|
|
1755
|
+
(model2) => typeof model2 === "string" && model2.length > 0 && !unavailable.has(model2)
|
|
1756
|
+
);
|
|
1738
1757
|
const eligible = chain.filter(
|
|
1739
1758
|
(model2) => isEligible(model2, features, maxOutputTokens, options)
|
|
1740
1759
|
);
|
|
@@ -1811,13 +1830,7 @@ var PortfolioStrategy = class {
|
|
|
1811
1830
|
...eligibleCandidates.filter(
|
|
1812
1831
|
(model2) => !scoredModels.includes(model2) && !webResearchFallbackOrder.includes(model2)
|
|
1813
1832
|
)
|
|
1814
|
-
] :
|
|
1815
|
-
...scoredModels,
|
|
1816
|
-
...eligibleCandidates.filter((model2) => !scoredModels.includes(model2))
|
|
1817
|
-
] : [
|
|
1818
|
-
...scoredModels,
|
|
1819
|
-
...eligibleCandidates.filter((model2) => !scoredModels.includes(model2))
|
|
1820
|
-
];
|
|
1833
|
+
] : [...scoredModels, ...eligibleCandidates.filter((model2) => !scoredModels.includes(model2))];
|
|
1821
1834
|
const model = ranked[0] ?? base.model;
|
|
1822
1835
|
const selectedTierConfigs = {
|
|
1823
1836
|
...tierConfigs,
|
|
@@ -2929,8 +2942,8 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
2929
2942
|
// $0.20/$1.25, 1M context
|
|
2930
2943
|
"xai/grok-4-fast-non-reasoning",
|
|
2931
2944
|
// 1,143ms, $0.20/$0.50 — fast fallback
|
|
2932
|
-
"
|
|
2933
|
-
//
|
|
2945
|
+
"nvidia/step-3.7-flash"
|
|
2946
|
+
// FREE backstop — new NVIDIA free tier (gpt-oss-120b now 400s; probed 2026-08-21)
|
|
2934
2947
|
]
|
|
2935
2948
|
},
|
|
2936
2949
|
MEDIUM: {
|
|
@@ -3003,14 +3016,15 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
3003
3016
|
// Eco tier configs - absolute cheapest (blockrun/eco)
|
|
3004
3017
|
ecoTiers: {
|
|
3005
3018
|
SIMPLE: {
|
|
3006
|
-
primary: "
|
|
3007
|
-
// FREE! $0.00/$0.00 —
|
|
3019
|
+
primary: "nvidia/step-3.7-flash",
|
|
3020
|
+
// FREE! $0.00/$0.00 — new NVIDIA free tier flagship
|
|
3008
3021
|
fallback: [
|
|
3009
|
-
"
|
|
3010
|
-
// FREE —
|
|
3011
|
-
//
|
|
3012
|
-
// (410
|
|
3013
|
-
//
|
|
3022
|
+
"nvidia/nemotron-nano-9b-v2",
|
|
3023
|
+
// FREE — compact + fast (~0.7s), high-volume light tasks
|
|
3024
|
+
// This head keeps rotting with NVIDIA's free hosting: deepseek-v4-flash
|
|
3025
|
+
// (410, 2026-08-12), seed-oss-36b (410, 2026-08-03), then gpt-oss-120b/20b
|
|
3026
|
+
// (400 Unknown model, probed 2026-08-21). Each retirement retargets the
|
|
3027
|
+
// two free rungs to the current free tier; the paid rungs below never move.
|
|
3014
3028
|
"google/gemini-3.1-flash-lite",
|
|
3015
3029
|
// $0.25/$1.50 — newest flash-lite
|
|
3016
3030
|
"openai/gpt-5.4-nano",
|
|
@@ -3127,8 +3141,8 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
3127
3141
|
"openai/gpt-5.3-codex",
|
|
3128
3142
|
"deepseek/deepseek-chat",
|
|
3129
3143
|
// Cheap, reliable
|
|
3130
|
-
"
|
|
3131
|
-
// NVIDIA free ultimate backstop (was
|
|
3144
|
+
"nvidia/step-3.7-flash"
|
|
3145
|
+
// NVIDIA free ultimate backstop (was gpt-oss-120b; 400s since ~2026-08)
|
|
3132
3146
|
]
|
|
3133
3147
|
},
|
|
3134
3148
|
REASONING: {
|
|
@@ -3217,8 +3231,8 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
3217
3231
|
// Previous flagship — 6,213ms, reliable
|
|
3218
3232
|
"deepseek/deepseek-chat",
|
|
3219
3233
|
// 1,431ms — cheap, reliable
|
|
3220
|
-
"
|
|
3221
|
-
// NVIDIA free ultimate backstop (was
|
|
3234
|
+
"nvidia/step-3.7-flash"
|
|
3235
|
+
// NVIDIA free ultimate backstop (was gpt-oss-120b; 400s since ~2026-08)
|
|
3222
3236
|
]
|
|
3223
3237
|
},
|
|
3224
3238
|
REASONING: {
|
|
@@ -3275,6 +3289,7 @@ export {
|
|
|
3275
3289
|
LIVE_MODEL_PROFILES,
|
|
3276
3290
|
PortfolioStrategy,
|
|
3277
3291
|
RulesStrategy,
|
|
3292
|
+
applyUnavailableModels,
|
|
3278
3293
|
calculateModelCost,
|
|
3279
3294
|
classifyByRules,
|
|
3280
3295
|
filterByExcludeList,
|
|
@@ -50,7 +50,7 @@ This is where you're paying for real value:
|
|
|
50
50
|
|
|
51
51
|
## The Solution: ClawRouter
|
|
52
52
|
|
|
53
|
-
[ClawRouter](https://github.com/BlockRunAI/ClawRouter) is an open-source local proxy that sits between your app and <!-- br:models.chatVisible -->
|
|
53
|
+
[ClawRouter](https://github.com/BlockRunAI/ClawRouter) is an open-source local proxy that sits between your app and <!-- br:models.chatVisible -->71<!-- /br:models.chatVisible --> AI models. It saves you money in three ways: **smart routing**, **token optimization**, and **response caching**.
|
|
54
54
|
|
|
55
55
|
```
|
|
56
56
|
┌─────────────┐ ┌──────────────────────────────┐ ┌──────────────────┐
|
|
@@ -31,7 +31,7 @@ This is exactly the problem [ClawRouter](https://github.com/BlockRunAI/ClawRoute
|
|
|
31
31
|
|
|
32
32
|
## ClawRouter: Smart Routing for Agents
|
|
33
33
|
|
|
34
|
-
ClawRouter is an open-source local proxy that sits between your agent and <!-- br:models.chatVisible -->
|
|
34
|
+
ClawRouter is an open-source local proxy that sits between your agent and <!-- br:models.chatVisible -->71<!-- /br:models.chatVisible --> LLM models across 9 providers. It analyzes every request across 15 dimensions and routes it to the cheapest model that can handle it — in under 1ms, entirely locally.
|
|
35
35
|
|
|
36
36
|
```
|
|
37
37
|
Your Agent → ClawRouter (localhost:8402) → Best model for the job
|
|
@@ -74,7 +74,7 @@ Then point your agent at `http://localhost:8402/v1/` with any OpenAI-compatible
|
|
|
74
74
|
|
|
75
75
|
- **No API keys to manage** — wallet-based cryptographic auth
|
|
76
76
|
- **No subscriptions** — pay per request in USDC (Base or Solana)
|
|
77
|
-
- **No vendor lock-in** — <!-- br:models.chatVisible -->
|
|
77
|
+
- **No vendor lock-in** — <!-- br:models.chatVisible -->71<!-- /br:models.chatVisible --> models, switch anytime
|
|
78
78
|
- **You control your wallet** — non-custodial, funds never held by a third party
|
|
79
79
|
- **Budget caps** — set a max spend per session, ClawRouter gracefully downgrades when budget runs low
|
|
80
80
|
- **Token compression** — 7-layer pipeline reduces token costs by 7–40% before they hit any provider
|
|
@@ -135,7 +135,7 @@ Less context repeated = fewer tokens = lower cost. Agents that need to recall ea
|
|
|
135
135
|
|
|
136
136
|
### 7. x402 Micropayments — Wallet-Based Budget Control
|
|
137
137
|
|
|
138
|
-
<p align="center"><img src="assets/blockrun-clawrouter-x402-usdc-micropayment-wallet-budget-control.png" alt="Budget limits enforced by physical construction — wallet loaded via Base/Solana, pay per call across <!-- br:models.chatVisible -->
|
|
138
|
+
<p align="center"><img src="assets/blockrun-clawrouter-x402-usdc-micropayment-wallet-budget-control.png" alt="Budget limits enforced by physical construction — wallet loaded via Base/Solana, pay per call across <!-- br:models.chatVisible -->71<!-- /br:models.chatVisible --> models, balance hits zero and the valve shuts cleanly" width="720"></p>
|
|
139
139
|
|
|
140
140
|
ClawRouter pays for inference via [x402](https://x402.org/) USDC micropayments (Base or Solana). You load a wallet. Each inference call costs exactly what it costs. When the wallet runs low, requests stop cleanly.
|
|
141
141
|
|
|
@@ -222,7 +222,7 @@ OpenRouter doesn't always pass through provider-specific features correctly. Ima
|
|
|
222
222
|
|
|
223
223
|
**Direct provider routing.** ClawRouter routes through BlockRun's API directly to providers — not through a second aggregator. One hop, not two. Provider-specific features work because there's no middleman translating them.
|
|
224
224
|
|
|
225
|
-

|
|
226
226
|
|
|
227
227
|
---
|
|
228
228
|
|
|
@@ -240,7 +240,7 @@ When new models launch, OpenRouter's catalog lags. Users configure a model that
|
|
|
240
240
|
|
|
241
241
|
### How ClawRouter Solves This
|
|
242
242
|
|
|
243
|
-
ClawRouter maintains a curated catalog of <!-- br:models.chatVisible -->
|
|
243
|
+
ClawRouter maintains a curated catalog of <!-- br:models.chatVisible -->71<!-- /br:models.chatVisible --> models across 9 providers (including 9 free models), updated with each release. Delisted models have automatic redirect aliases:
|
|
244
244
|
|
|
245
245
|
```typescript
|
|
246
246
|
// Delisted models redirect automatically
|
|
@@ -268,7 +268,7 @@ No silent drops. No stale catalog. Models are benchmarked for speed, quality, an
|
|
|
268
268
|
| **Rate limits** | Per-key, shared | Per-wallet, independent |
|
|
269
269
|
| **Vision support** | Images sometimes dropped | Auto-detected, vision-only fallback |
|
|
270
270
|
| **Tool calling** | Silent failures with some models | Flag-based filtering, guaranteed support |
|
|
271
|
-
| **Model catalog** | Laggy, silent drops | Curated <!-- br:models.chatVisible -->
|
|
271
|
+
| **Model catalog** | Laggy, silent drops | Curated <!-- br:models.chatVisible -->71<!-- /br:models.chatVisible --> models, redirect aliases |
|
|
272
272
|
| **Budget control** | Monthly invoice | Per-session cap (`maxCostPerRun`) |
|
|
273
273
|
| **Setup** | Create account, paste key | Agent generates wallet, auto-configured |
|
|
274
274
|
| **Average cost** | $25/M tokens (Opus direct) | auto-routed = **<!-- br:savings.autoVsBaselinePct -->88<!-- /br:savings.autoVsBaselinePct -->% savings** |
|
package/docs/configuration.md
CHANGED
|
@@ -158,17 +158,10 @@ Response (dual-chain):
|
|
|
158
158
|
|
|
159
159
|
```bash
|
|
160
160
|
/wallet solana # Switch to Solana USDC payments
|
|
161
|
-
/wallet base # Switch
|
|
161
|
+
/wallet base # Switch to Base (EVM) USDC payments
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
```bash
|
|
167
|
-
/chain solana
|
|
168
|
-
/chain base
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
The selected chain is persisted across gateway restarts.
|
|
164
|
+
The selected chain is persisted across gateway restarts (in `~/.openclaw/blockrun/payment-chain`). New installs default to **Solana** (persisted when the wallet is first generated); existing installs without a saved selection stay on **Base**, where their funds already live. The `CLAWROUTER_PAYMENT_CHAIN` environment variable (`solana` or `base`) overrides the persisted selection.
|
|
172
165
|
|
|
173
166
|
### Switch Wallets
|
|
174
167
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockrun/clawrouter",
|
|
3
|
-
"version": "0.12.
|
|
4
|
-
"description": "Smart LLM router — save 88% on inference costs.
|
|
3
|
+
"version": "0.12.246",
|
|
4
|
+
"description": "Smart LLM router — save 88% on inference costs. 71 models (5 free), one wallet, x402 micropayments.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
"devDependencies": {
|
|
113
|
-
"@blockrun/router-core": "https://codeload.github.com/BlockRunAI/router-core/tar.gz/
|
|
113
|
+
"@blockrun/router-core": "https://codeload.github.com/BlockRunAI/router-core/tar.gz/d7bc10ce184b3daa40bcc115b523fd629d847a52",
|
|
114
114
|
"@eslint/js": "^10.0.1",
|
|
115
115
|
"eslint": "^10.2.0",
|
|
116
116
|
"openclaw": "^2026.7.2-beta.7",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: clawrouter
|
|
3
|
-
description: Hosted-gateway LLM router — save 88% on inference costs. A local proxy that forwards each request to the blockrun.ai gateway, which routes to the cheapest capable model across
|
|
3
|
+
description: Hosted-gateway LLM router — save 88% on inference costs. A local proxy that forwards each request to the blockrun.ai gateway, which routes to the cheapest capable model across 71 models from OpenAI, Anthropic, Google, DeepSeek, xAI, NVIDIA, and more. 5 free NVIDIA models included. Also exposes realtime market data (global stocks, crypto, FX, commodities), Twitter/X intelligence, prediction-market data across Polymarket, Kalshi, Limitless, Opinion, Predict.Fun, dFlow + UMA oracle resolution + wallet identity & clustering, phone-number intelligence (carrier + SIM-swap fraud detection) plus AI-powered outbound voice calls (Twilio + Bland.ai), AND the Surf unified crypto data API (84 endpoints — CEX/DEX, on-chain SQL over 80+ ClickHouse tables, 100M+ labeled wallets, prediction markets, social/CT mindshare, news, VC fund intel) as built-in agent tools. Not a local-inference tool — prompts are sent to the blockrun.ai gateway.
|
|
4
4
|
triggers:
|
|
5
5
|
- "clawrouter"
|
|
6
6
|
- "claw router"
|
|
@@ -53,7 +53,7 @@ metadata:
|
|
|
53
53
|
|
|
54
54
|
# ClawRouter
|
|
55
55
|
|
|
56
|
-
Hosted-gateway LLM router that saves <!-- br:savings.autoVsBaselinePct -->88<!-- /br:savings.autoVsBaselinePct -->% on inference costs by forwarding each request to the blockrun.ai gateway, which picks the cheapest model capable of handling it across <!-- br:models.chatVisible -->
|
|
56
|
+
Hosted-gateway LLM router that saves <!-- br:savings.autoVsBaselinePct -->88<!-- /br:savings.autoVsBaselinePct -->% on inference costs by forwarding each request to the blockrun.ai gateway, which picks the cheapest model capable of handling it across <!-- br:models.chatVisible -->71<!-- /br:models.chatVisible --> models from 9 providers (<!-- br:models.free -->5<!-- /br:models.free --> free NVIDIA models). All billing flows through one USDC wallet; you do not hold provider API keys.
|
|
57
57
|
|
|
58
58
|
**This is not a local-inference tool.** ClawRouter is a thin local proxy. Your prompts are sent over HTTPS to the blockrun.ai gateway for model execution. If your workload requires inference that never leaves your machine, use a local runtime like Ollama — ClawRouter is not the right tool for that use case.
|
|
59
59
|
|
|
@@ -85,7 +85,7 @@ ClawRouter does **not** collect or forward third-party provider API keys. You do
|
|
|
85
85
|
| ----------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
86
86
|
| `walletKey` | Yes | EVM private key used to sign USDC micropayments via x402. **Auto-generated locally on first run** — no user input required. Never transmitted over the network; only detached payment signatures are sent. |
|
|
87
87
|
| `solanaKey` | Yes | Solana keypair (BIP-44 `m/44'/501'/0'/0'`). Auto-derived from the same local mnemonic via `@scure/bip32` + `@scure/bip39`. |
|
|
88
|
-
| `gateway` | No | Gateway URL. Defaults: `https://blockrun.ai/api` (
|
|
88
|
+
| `gateway` | No | Gateway URL. Defaults: `https://sol.blockrun.ai/api` (Solana, default chain for new installs) · `https://blockrun.ai/api` (Base, default for pre-existing installs). |
|
|
89
89
|
| `routing` | No | Optional override of the default four-tier router. |
|
|
90
90
|
|
|
91
91
|
**How and where keys are stored:**
|
|
@@ -141,7 +141,7 @@ Rules handle ~~80% of requests in <1ms. Only ambiguous queries hit the LLM class
|
|
|
141
141
|
|
|
142
142
|
## Available Models
|
|
143
143
|
|
|
144
|
-
<!-- br:models.chatVisible -->
|
|
144
|
+
<!-- br:models.chatVisible -->71<!-- /br:models.chatVisible --> models including: gpt-5.6-terra [balanced, stable default], gpt-5.6-sol [flagship], gpt-5.6-luna [cost-efficient], gpt-5.6-sol/terra/luna-pro [pro reasoning tiers], gpt-5.5, gpt-5.5-pro [max compute], chat-latest [ChatGPT Instant], gpt-5.4, gpt-4o, o3, claude-fable-5, claude-opus-5 [Anthropic flagship, 1M ctx], claude-opus-4.8, claude-opus-4.7, claude-opus-4.5, claude-sonnet-5, claude-sonnet-4.6, gemini-3.1-pro, gemini-3.6-flash, gemini-3.5-flash-lite, gemini-2.5-flash, deepseek-v4-pro, deepseek-chat, grok-4.5, grok-4.3, grok-build-0.1, kimi-k3 [1M ctx flagship], kimi-k2.7, qwen3.7-max [Qwen flagship, 1M ctx], qwen3.7-plus, qwen3.7-flash, hy3 [Tencent], mimo [Xiaomi MiMo-V2.5 Pro, 1M ctx], and 5 free NVIDIA models (nemotron-3-nano-omni-30b-a3b-reasoning [vision], mistral-nemotron, step-3.7-flash, nemotron-nano-9b-v2, nemotron-nano-12b-v2-vl [vision]).
|
|
145
145
|
|
|
146
146
|
## Built-in Agent Tools
|
|
147
147
|
|