@blockrun/clawrouter 0.12.78 → 0.12.79
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 +8 -9
- package/dist/cli.js +14 -144
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.js +14 -145
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/reinstall.sh +2 -2
- package/scripts/update.sh +1 -1
package/README.md
CHANGED
|
@@ -96,7 +96,6 @@ Choose your routing strategy with `/model <profile>`:
|
|
|
96
96
|
| `/model auto` | Balanced (default) | 74-100% | General use |
|
|
97
97
|
| `/model eco` | Cheapest possible | 95-100% | Maximum savings |
|
|
98
98
|
| `/model premium` | Best quality | 0% | Mission-critical |
|
|
99
|
-
| `/model free` | 11 free NVIDIA models | 100% | Zero cost |
|
|
100
99
|
|
|
101
100
|
**Shortcuts:** `/model grok`, `/model br-sonnet`, `/model gpt5`, `/model o3`
|
|
102
101
|
|
|
@@ -110,12 +109,12 @@ Choose your routing strategy with `/model <profile>`:
|
|
|
110
109
|
Request → Weighted Scorer (15 dimensions) → Tier → Best Model → Response
|
|
111
110
|
```
|
|
112
111
|
|
|
113
|
-
| Tier | ECO Model
|
|
114
|
-
| --------- |
|
|
115
|
-
| SIMPLE | nvidia/gpt-oss-120b (**FREE**)
|
|
116
|
-
| MEDIUM |
|
|
117
|
-
| COMPLEX |
|
|
118
|
-
| REASONING | grok-4-1-fast ($0.20/$0.50)
|
|
112
|
+
| Tier | ECO Model | AUTO Model | PREMIUM Model |
|
|
113
|
+
| --------- | ----------------------------------- | ------------------------------------- | ---------------------------- |
|
|
114
|
+
| SIMPLE | nvidia/gpt-oss-120b (**FREE**) | gemini-2.5-flash ($0.30/$2.50) | kimi-k2.5 |
|
|
115
|
+
| MEDIUM | gemini-3.1-flash-lite ($0.25/$1.50) | kimi-k2.5 ($0.60/$3.00) | gpt-5.3-codex ($1.75/$14.00) |
|
|
116
|
+
| COMPLEX | gemini-3.1-flash-lite ($0.25/$1.50) | gemini-3.1-pro ($2/$12) | claude-opus-4.6 ($5/$25) |
|
|
117
|
+
| REASONING | grok-4-1-fast ($0.20/$0.50) | grok-4-1-fast-reasoning ($0.20/$0.50) | claude-sonnet-4.6 ($3/$15) |
|
|
119
118
|
|
|
120
119
|
**Blended average: $2.05/M** vs $25/M for Claude Opus = **92% savings**
|
|
121
120
|
|
|
@@ -234,7 +233,7 @@ Edit existing images with `/img2img`:
|
|
|
234
233
|
| openai/gpt-5.2-pro | $21.00 | $168.00 | $0.0945 | 400K | reasoning, tools |
|
|
235
234
|
| openai/gpt-5.4-pro | $30.00 | $180.00 | $0.1050 | 400K | reasoning, tools |
|
|
236
235
|
|
|
237
|
-
> **Free tier:** 11 NVIDIA models cost nothing —
|
|
236
|
+
> **Free tier:** 11 NVIDIA models cost nothing — `/model free` points to nemotron-ultra-253b, or pick any free model directly (e.g., `/model nemotron`, `/model deepseek-free`, `/model devstral`).
|
|
238
237
|
> **Best value:** `gpt-5-nano` and `gemini-2.5-flash-lite` deliver strong results at ~$0.0003/request.
|
|
239
238
|
|
|
240
239
|
---
|
|
@@ -465,7 +464,7 @@ ClawRouter integrates with OpenClaw (Claude Code), ElizaOS, and any agent that m
|
|
|
465
464
|
|
|
466
465
|
### Is ClawRouter free?
|
|
467
466
|
|
|
468
|
-
ClawRouter itself is free and MIT licensed. You pay only for the LLM API calls routed through it — and 11 NVIDIA models (DeepSeek V3.2, Nemotron Ultra 253B, Mistral Large 675B, Llama 4 Maverick, and more) are completely free. Use `/model free` for
|
|
467
|
+
ClawRouter itself is free and MIT licensed. You pay only for the LLM API calls routed through it — and 11 NVIDIA models (DeepSeek V3.2, Nemotron Ultra 253B, Mistral Large 675B, Llama 4 Maverick, and more) are completely free. Use `/model free` for Nemotron Ultra 253B, or pick any free model by name.
|
|
469
468
|
|
|
470
469
|
---
|
|
471
470
|
|
package/dist/cli.js
CHANGED
|
@@ -39086,11 +39086,7 @@ var RulesStrategy = class {
|
|
|
39086
39086
|
let tierConfigs;
|
|
39087
39087
|
let profileSuffix;
|
|
39088
39088
|
let profile;
|
|
39089
|
-
if (routingProfile === "
|
|
39090
|
-
tierConfigs = config.freeTiers;
|
|
39091
|
-
profileSuffix = " | free";
|
|
39092
|
-
profile = "free";
|
|
39093
|
-
} else if (routingProfile === "eco" && config.ecoTiers) {
|
|
39089
|
+
if (routingProfile === "eco" && config.ecoTiers) {
|
|
39094
39090
|
tierConfigs = config.ecoTiers;
|
|
39095
39091
|
profileSuffix = " | eco";
|
|
39096
39092
|
profile = "eco";
|
|
@@ -40279,7 +40275,7 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
40279
40275
|
]
|
|
40280
40276
|
}
|
|
40281
40277
|
},
|
|
40282
|
-
// Eco tier configs - absolute cheapest
|
|
40278
|
+
// Eco tier configs - absolute cheapest (blockrun/eco)
|
|
40283
40279
|
ecoTiers: {
|
|
40284
40280
|
SIMPLE: {
|
|
40285
40281
|
primary: "nvidia/gpt-oss-120b",
|
|
@@ -40298,13 +40294,9 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
40298
40294
|
]
|
|
40299
40295
|
},
|
|
40300
40296
|
MEDIUM: {
|
|
40301
|
-
primary: "
|
|
40302
|
-
//
|
|
40297
|
+
primary: "google/gemini-3.1-flash-lite",
|
|
40298
|
+
// $0.25/$1.50 — newest flash-lite
|
|
40303
40299
|
fallback: [
|
|
40304
|
-
"nvidia/gpt-oss-120b",
|
|
40305
|
-
// FREE fallback
|
|
40306
|
-
"google/gemini-3.1-flash-lite",
|
|
40307
|
-
// $0.25/$1.50
|
|
40308
40300
|
"openai/gpt-5.4-nano",
|
|
40309
40301
|
// $0.20/$1.25
|
|
40310
40302
|
"google/gemini-2.5-flash-lite",
|
|
@@ -40314,15 +40306,9 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
40314
40306
|
]
|
|
40315
40307
|
},
|
|
40316
40308
|
COMPLEX: {
|
|
40317
|
-
primary: "
|
|
40318
|
-
//
|
|
40309
|
+
primary: "google/gemini-3.1-flash-lite",
|
|
40310
|
+
// $0.25/$1.50
|
|
40319
40311
|
fallback: [
|
|
40320
|
-
"nvidia/mistral-large-3-675b",
|
|
40321
|
-
// FREE — 675B brute-force
|
|
40322
|
-
"nvidia/deepseek-v3.2",
|
|
40323
|
-
// FREE
|
|
40324
|
-
"google/gemini-3.1-flash-lite",
|
|
40325
|
-
// $0.25/$1.50
|
|
40326
40312
|
"google/gemini-2.5-flash-lite",
|
|
40327
40313
|
"xai/grok-4-0709",
|
|
40328
40314
|
"google/gemini-2.5-flash",
|
|
@@ -40332,12 +40318,7 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
40332
40318
|
REASONING: {
|
|
40333
40319
|
primary: "xai/grok-4-1-fast-reasoning",
|
|
40334
40320
|
// $0.20/$0.50
|
|
40335
|
-
fallback: [
|
|
40336
|
-
"xai/grok-4-fast-reasoning",
|
|
40337
|
-
"nvidia/nemotron-ultra-253b",
|
|
40338
|
-
// FREE reasoning fallback
|
|
40339
|
-
"deepseek/deepseek-reasoner"
|
|
40340
|
-
]
|
|
40321
|
+
fallback: ["xai/grok-4-fast-reasoning", "deepseek/deepseek-reasoner"]
|
|
40341
40322
|
}
|
|
40342
40323
|
},
|
|
40343
40324
|
// Premium tier configs - best quality (blockrun/premium)
|
|
@@ -40451,73 +40432,6 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
40451
40432
|
]
|
|
40452
40433
|
}
|
|
40453
40434
|
},
|
|
40454
|
-
// Free tier configs - NVIDIA free models, smart-routed by task type (blockrun/free)
|
|
40455
|
-
freeTiers: {
|
|
40456
|
-
SIMPLE: {
|
|
40457
|
-
primary: "nvidia/gpt-oss-20b",
|
|
40458
|
-
// Fastest: small 20B for simple tasks
|
|
40459
|
-
fallback: [
|
|
40460
|
-
"nvidia/gpt-oss-120b",
|
|
40461
|
-
// Solid general-purpose
|
|
40462
|
-
"nvidia/nemotron-super-49b",
|
|
40463
|
-
// Thinking mode
|
|
40464
|
-
"nvidia/llama-4-maverick",
|
|
40465
|
-
// MoE broad coverage
|
|
40466
|
-
"nvidia/glm-4.7"
|
|
40467
|
-
// Thinking mode
|
|
40468
|
-
]
|
|
40469
|
-
},
|
|
40470
|
-
MEDIUM: {
|
|
40471
|
-
primary: "nvidia/deepseek-v3.2",
|
|
40472
|
-
// DeepSeek V3.2 quality, zero cost
|
|
40473
|
-
fallback: [
|
|
40474
|
-
"nvidia/gpt-oss-120b",
|
|
40475
|
-
// Strong 120B general-purpose
|
|
40476
|
-
"nvidia/nemotron-super-49b",
|
|
40477
|
-
// Thinking mode
|
|
40478
|
-
"nvidia/mistral-large-3-675b",
|
|
40479
|
-
// Largest Mistral
|
|
40480
|
-
"nvidia/llama-4-maverick",
|
|
40481
|
-
// MoE breadth
|
|
40482
|
-
"nvidia/glm-4.7"
|
|
40483
|
-
// Thinking mode
|
|
40484
|
-
]
|
|
40485
|
-
},
|
|
40486
|
-
COMPLEX: {
|
|
40487
|
-
primary: "nvidia/nemotron-ultra-253b",
|
|
40488
|
-
// Strongest free: 253B reasoning
|
|
40489
|
-
fallback: [
|
|
40490
|
-
"nvidia/mistral-large-3-675b",
|
|
40491
|
-
// 675B massive params
|
|
40492
|
-
"nvidia/deepseek-v3.2",
|
|
40493
|
-
// V3.2 quality
|
|
40494
|
-
"nvidia/nemotron-3-super-120b",
|
|
40495
|
-
// Thinking mode MoE
|
|
40496
|
-
"nvidia/qwen3-coder-480b",
|
|
40497
|
-
// 480B MoE for code-heavy tasks
|
|
40498
|
-
"nvidia/devstral-2-123b",
|
|
40499
|
-
// Coding-focused
|
|
40500
|
-
"nvidia/gpt-oss-120b"
|
|
40501
|
-
// Last resort
|
|
40502
|
-
]
|
|
40503
|
-
},
|
|
40504
|
-
REASONING: {
|
|
40505
|
-
primary: "nvidia/nemotron-ultra-253b",
|
|
40506
|
-
// Best free reasoning: 253B
|
|
40507
|
-
fallback: [
|
|
40508
|
-
"nvidia/nemotron-3-super-120b",
|
|
40509
|
-
// Thinking mode MoE
|
|
40510
|
-
"nvidia/nemotron-super-49b",
|
|
40511
|
-
// Thinking mode
|
|
40512
|
-
"nvidia/deepseek-v3.2",
|
|
40513
|
-
// DeepSeek reasoning
|
|
40514
|
-
"nvidia/mistral-large-3-675b",
|
|
40515
|
-
// Brute-force params
|
|
40516
|
-
"nvidia/glm-4.7"
|
|
40517
|
-
// GLM thinking mode
|
|
40518
|
-
]
|
|
40519
|
-
}
|
|
40520
|
-
},
|
|
40521
40435
|
overrides: {
|
|
40522
40436
|
maxTokensForceComplex: 1e5,
|
|
40523
40437
|
structuredOutputMinTier: "MEDIUM",
|
|
@@ -40626,10 +40540,12 @@ var MODEL_ALIASES = {
|
|
|
40626
40540
|
glm: "zai/glm-5",
|
|
40627
40541
|
"glm-5": "zai/glm-5",
|
|
40628
40542
|
"glm-5-turbo": "zai/glm-5-turbo",
|
|
40543
|
+
// Free alias — points to strongest free model
|
|
40544
|
+
free: "nvidia/nemotron-ultra-253b",
|
|
40629
40545
|
// Routing profile aliases (common variations)
|
|
40630
40546
|
"auto-router": "auto",
|
|
40631
40547
|
router: "auto"
|
|
40632
|
-
// Note: auto,
|
|
40548
|
+
// Note: auto, eco, premium are virtual routing profiles registered in BLOCKRUN_MODELS
|
|
40633
40549
|
// They don't need aliases since they're already top-level model IDs
|
|
40634
40550
|
};
|
|
40635
40551
|
function resolveModelAlias(model) {
|
|
@@ -40662,14 +40578,6 @@ var BLOCKRUN_MODELS = [
|
|
|
40662
40578
|
contextWindow: 105e4,
|
|
40663
40579
|
maxOutput: 128e3
|
|
40664
40580
|
},
|
|
40665
|
-
{
|
|
40666
|
-
id: "free",
|
|
40667
|
-
name: "Free (Smart Router - 11 NVIDIA Models)",
|
|
40668
|
-
inputPrice: 0,
|
|
40669
|
-
outputPrice: 0,
|
|
40670
|
-
contextWindow: 131072,
|
|
40671
|
-
maxOutput: 16384
|
|
40672
|
-
},
|
|
40673
40581
|
{
|
|
40674
40582
|
id: "eco",
|
|
40675
40583
|
name: "Eco (Smart Router - Cost Optimized)",
|
|
@@ -46849,8 +46757,6 @@ var BLOCKRUN_SOLANA_API = "https://sol.blockrun.ai/api";
|
|
|
46849
46757
|
var IMAGE_DIR = join8(homedir5(), ".openclaw", "blockrun", "images");
|
|
46850
46758
|
var AUTO_MODEL = "blockrun/auto";
|
|
46851
46759
|
var ROUTING_PROFILES = /* @__PURE__ */ new Set([
|
|
46852
|
-
"blockrun/free",
|
|
46853
|
-
"free",
|
|
46854
46760
|
"blockrun/eco",
|
|
46855
46761
|
"eco",
|
|
46856
46762
|
"blockrun/auto",
|
|
@@ -46872,25 +46778,6 @@ var FREE_MODELS = /* @__PURE__ */ new Set([
|
|
|
46872
46778
|
"nvidia/glm-4.7",
|
|
46873
46779
|
"nvidia/llama-4-maverick"
|
|
46874
46780
|
]);
|
|
46875
|
-
var FREE_TIER_CONFIGS = {
|
|
46876
|
-
SIMPLE: {
|
|
46877
|
-
primary: "nvidia/gpt-oss-20b",
|
|
46878
|
-
fallback: ["nvidia/gpt-oss-120b", "nvidia/nemotron-super-49b"]
|
|
46879
|
-
},
|
|
46880
|
-
MEDIUM: {
|
|
46881
|
-
primary: "nvidia/deepseek-v3.2",
|
|
46882
|
-
fallback: ["nvidia/gpt-oss-120b", "nvidia/nemotron-super-49b"]
|
|
46883
|
-
},
|
|
46884
|
-
COMPLEX: {
|
|
46885
|
-
primary: "nvidia/nemotron-ultra-253b",
|
|
46886
|
-
fallback: ["nvidia/mistral-large-3-675b", "nvidia/deepseek-v3.2", "nvidia/gpt-oss-120b"]
|
|
46887
|
-
},
|
|
46888
|
-
REASONING: {
|
|
46889
|
-
primary: "nvidia/nemotron-ultra-253b",
|
|
46890
|
-
fallback: ["nvidia/nemotron-3-super-120b", "nvidia/deepseek-v3.2"]
|
|
46891
|
-
}
|
|
46892
|
-
};
|
|
46893
|
-
var freeRequestCount = 0;
|
|
46894
46781
|
var MAX_MESSAGES = 200;
|
|
46895
46782
|
var CONTEXT_LIMIT_KB = 5120;
|
|
46896
46783
|
var HEARTBEAT_INTERVAL_MS = 2e3;
|
|
@@ -48396,7 +48283,7 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
48396
48283
|
const estimatedTokens = Math.ceil(fullText.length / 4);
|
|
48397
48284
|
const normalizedModel2 = typeof parsed.model === "string" ? parsed.model.trim().toLowerCase() : "";
|
|
48398
48285
|
const profileName = normalizedModel2.replace("blockrun/", "");
|
|
48399
|
-
const debugProfile = ["
|
|
48286
|
+
const debugProfile = ["eco", "auto", "premium"].includes(profileName) ? profileName : "auto";
|
|
48400
48287
|
const scoring = classifyByRules(
|
|
48401
48288
|
debugPrompt,
|
|
48402
48289
|
systemPrompt,
|
|
@@ -49016,14 +48903,6 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
49016
48903
|
}
|
|
49017
48904
|
}
|
|
49018
48905
|
options.onRouted?.(routingDecision);
|
|
49019
|
-
if (routingProfile === "free") {
|
|
49020
|
-
freeRequestCount++;
|
|
49021
|
-
if (freeRequestCount % 5 === 0) {
|
|
49022
|
-
balanceFallbackNotice = `> **\u{1F4A1} Tip:** Free tier gives you 11 NVIDIA models. Want Claude, GPT-5, or Gemini? Fund your wallet \u2014 starting at $0.001/request.
|
|
49023
|
-
|
|
49024
|
-
`;
|
|
49025
|
-
}
|
|
49026
|
-
}
|
|
49027
48906
|
}
|
|
49028
48907
|
}
|
|
49029
48908
|
if (!effectiveSessionId && parsedMessages.length > 0) {
|
|
@@ -49128,28 +49007,19 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
49128
49007
|
const sufficiency = await balanceMonitor.checkSufficient(bufferedCostMicros);
|
|
49129
49008
|
if (sufficiency.info.isEmpty || !sufficiency.sufficient) {
|
|
49130
49009
|
const originalModel = modelId;
|
|
49131
|
-
const fallbackTier = routingDecision?.tier ?? "SIMPLE";
|
|
49132
|
-
const freeTierConfig = FREE_TIER_CONFIGS[fallbackTier];
|
|
49133
|
-
const freeModel = freeTierConfig.primary;
|
|
49134
49010
|
console.log(
|
|
49135
|
-
`[ClawRouter] Wallet ${sufficiency.info.isEmpty ? "empty" : "insufficient"} (${sufficiency.info.balanceUSD}), falling back to free model: ${
|
|
49011
|
+
`[ClawRouter] Wallet ${sufficiency.info.isEmpty ? "empty" : "insufficient"} (${sufficiency.info.balanceUSD}), falling back to free model: ${FREE_MODEL} (requested: ${originalModel})`
|
|
49136
49012
|
);
|
|
49137
|
-
modelId =
|
|
49013
|
+
modelId = FREE_MODEL;
|
|
49138
49014
|
isFreeModel = true;
|
|
49139
49015
|
const parsed = JSON.parse(body.toString());
|
|
49140
|
-
parsed.model =
|
|
49016
|
+
parsed.model = FREE_MODEL;
|
|
49141
49017
|
body = Buffer.from(JSON.stringify(parsed));
|
|
49142
49018
|
balanceFallbackNotice = sufficiency.info.isEmpty ? `> **\u26A0\uFE0F Wallet empty** \u2014 using free model. Fund your wallet to use ${originalModel}.
|
|
49143
49019
|
|
|
49144
49020
|
` : `> **\u26A0\uFE0F Insufficient balance** (${sufficiency.info.balanceUSD}) \u2014 using free model instead of ${originalModel}.
|
|
49145
49021
|
|
|
49146
49022
|
`;
|
|
49147
|
-
freeRequestCount++;
|
|
49148
|
-
if (freeRequestCount % 5 === 0) {
|
|
49149
|
-
balanceFallbackNotice = `> **\u{1F4A1} Tip:** Free tier gives you 11 NVIDIA models. Want Claude, GPT-5, or Gemini? Fund your wallet \u2014 starting at $0.001/request.
|
|
49150
|
-
|
|
49151
|
-
`;
|
|
49152
|
-
}
|
|
49153
49023
|
options.onLowBalance?.({
|
|
49154
49024
|
balanceUSD: sufficiency.info.balanceUSD,
|
|
49155
49025
|
walletAddress: sufficiency.info.walletAddress
|