@blockrun/clawrouter 0.12.244 → 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 +28 -21
- package/dist/cli.js +275 -70
- package/dist/index.d.ts +9 -2
- package/dist/index.js +275 -70
- package/dist/router/index.js +48 -34
- package/docs/configuration.md +2 -9
- package/package.json +3 -3
- package/skills/clawrouter/SKILL.md +4 -4
- package/src/top-models.json +0 -1
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,15 +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
|
-
//
|
|
3013
|
-
//
|
|
3014
|
-
//
|
|
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.
|
|
3015
3028
|
"google/gemini-3.1-flash-lite",
|
|
3016
3029
|
// $0.25/$1.50 — newest flash-lite
|
|
3017
3030
|
"openai/gpt-5.4-nano",
|
|
@@ -3128,8 +3141,8 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
3128
3141
|
"openai/gpt-5.3-codex",
|
|
3129
3142
|
"deepseek/deepseek-chat",
|
|
3130
3143
|
// Cheap, reliable
|
|
3131
|
-
"
|
|
3132
|
-
// NVIDIA free ultimate backstop (was
|
|
3144
|
+
"nvidia/step-3.7-flash"
|
|
3145
|
+
// NVIDIA free ultimate backstop (was gpt-oss-120b; 400s since ~2026-08)
|
|
3133
3146
|
]
|
|
3134
3147
|
},
|
|
3135
3148
|
REASONING: {
|
|
@@ -3218,8 +3231,8 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
3218
3231
|
// Previous flagship — 6,213ms, reliable
|
|
3219
3232
|
"deepseek/deepseek-chat",
|
|
3220
3233
|
// 1,431ms — cheap, reliable
|
|
3221
|
-
"
|
|
3222
|
-
// NVIDIA free ultimate backstop (was
|
|
3234
|
+
"nvidia/step-3.7-flash"
|
|
3235
|
+
// NVIDIA free ultimate backstop (was gpt-oss-120b; 400s since ~2026-08)
|
|
3223
3236
|
]
|
|
3224
3237
|
},
|
|
3225
3238
|
REASONING: {
|
|
@@ -3276,6 +3289,7 @@ export {
|
|
|
3276
3289
|
LIVE_MODEL_PROFILES,
|
|
3277
3290
|
PortfolioStrategy,
|
|
3278
3291
|
RulesStrategy,
|
|
3292
|
+
applyUnavailableModels,
|
|
3279
3293
|
calculateModelCost,
|
|
3280
3294
|
classifyByRules,
|
|
3281
3295
|
filterByExcludeList,
|
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. 71 models (
|
|
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 71 models from OpenAI, Anthropic, Google, DeepSeek, xAI, NVIDIA, and more.
|
|
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 -->71<!-- /br:models.chatVisible --> models from 9 providers (<!-- br:models.free -->
|
|
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 -->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.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-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],
|
|
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
|
|