@blockrun/clawrouter 0.12.78 → 0.12.80
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 +83 -194
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.js +95 -207
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/reinstall.sh +6 -6
- package/scripts/update.sh +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -183,12 +183,12 @@ type RoutingDecision = {
|
|
|
183
183
|
/** Which tier configs were used (auto/eco/premium/agentic) — avoids re-derivation in proxy */
|
|
184
184
|
tierConfigs?: Record<Tier, TierConfig>;
|
|
185
185
|
/** Which routing profile was applied */
|
|
186
|
-
profile?: "auto" | "eco" | "premium" | "agentic"
|
|
186
|
+
profile?: "auto" | "eco" | "premium" | "agentic";
|
|
187
187
|
};
|
|
188
188
|
type RouterOptions = {
|
|
189
189
|
config: RoutingConfig;
|
|
190
190
|
modelPricing: Map<string, ModelPricing>;
|
|
191
|
-
routingProfile?: "
|
|
191
|
+
routingProfile?: "eco" | "auto" | "premium";
|
|
192
192
|
hasTools?: boolean;
|
|
193
193
|
};
|
|
194
194
|
type TierConfig = {
|
|
@@ -250,8 +250,6 @@ type RoutingConfig = {
|
|
|
250
250
|
ecoTiers?: Record<Tier, TierConfig>;
|
|
251
251
|
/** Tier configs for premium profile - best quality (blockrun/premium) */
|
|
252
252
|
premiumTiers?: Record<Tier, TierConfig>;
|
|
253
|
-
/** Tier configs for free profile - NVIDIA free models only (blockrun/free) */
|
|
254
|
-
freeTiers?: Record<Tier, TierConfig>;
|
|
255
253
|
overrides: OverridesConfig;
|
|
256
254
|
};
|
|
257
255
|
|
package/dist/index.js
CHANGED
|
@@ -32906,27 +32906,38 @@ var MODEL_ALIASES = {
|
|
|
32906
32906
|
// delisted 2026-03-12
|
|
32907
32907
|
"xai/grok-3-fast": "xai/grok-4-fast-reasoning",
|
|
32908
32908
|
// delisted (too expensive)
|
|
32909
|
-
// NVIDIA —
|
|
32910
|
-
nvidia: "
|
|
32911
|
-
"gpt-120b": "
|
|
32912
|
-
"gpt-20b": "
|
|
32913
|
-
|
|
32914
|
-
"
|
|
32915
|
-
"
|
|
32916
|
-
"
|
|
32917
|
-
"
|
|
32918
|
-
|
|
32919
|
-
|
|
32920
|
-
"
|
|
32921
|
-
"
|
|
32922
|
-
"
|
|
32923
|
-
"
|
|
32924
|
-
|
|
32925
|
-
|
|
32926
|
-
"
|
|
32927
|
-
"
|
|
32928
|
-
"
|
|
32929
|
-
|
|
32909
|
+
// NVIDIA — backward compat aliases (nvidia/xxx → free/xxx)
|
|
32910
|
+
nvidia: "free/gpt-oss-120b",
|
|
32911
|
+
"gpt-120b": "free/gpt-oss-120b",
|
|
32912
|
+
"gpt-20b": "free/gpt-oss-20b",
|
|
32913
|
+
"nvidia/gpt-oss-120b": "free/gpt-oss-120b",
|
|
32914
|
+
"nvidia/gpt-oss-20b": "free/gpt-oss-20b",
|
|
32915
|
+
"nvidia/nemotron-ultra-253b": "free/nemotron-ultra-253b",
|
|
32916
|
+
"nvidia/nemotron-3-super-120b": "free/nemotron-3-super-120b",
|
|
32917
|
+
"nvidia/nemotron-super-49b": "free/nemotron-super-49b",
|
|
32918
|
+
"nvidia/deepseek-v3.2": "free/deepseek-v3.2",
|
|
32919
|
+
"nvidia/mistral-large-3-675b": "free/mistral-large-3-675b",
|
|
32920
|
+
"nvidia/qwen3-coder-480b": "free/qwen3-coder-480b",
|
|
32921
|
+
"nvidia/devstral-2-123b": "free/devstral-2-123b",
|
|
32922
|
+
"nvidia/glm-4.7": "free/glm-4.7",
|
|
32923
|
+
"nvidia/llama-4-maverick": "free/llama-4-maverick",
|
|
32924
|
+
// Free model shorthand aliases
|
|
32925
|
+
"deepseek-free": "free/deepseek-v3.2",
|
|
32926
|
+
"mistral-free": "free/mistral-large-3-675b",
|
|
32927
|
+
"glm-free": "free/glm-4.7",
|
|
32928
|
+
"llama-free": "free/llama-4-maverick",
|
|
32929
|
+
nemotron: "free/nemotron-ultra-253b",
|
|
32930
|
+
"nemotron-ultra": "free/nemotron-ultra-253b",
|
|
32931
|
+
"nemotron-253b": "free/nemotron-ultra-253b",
|
|
32932
|
+
"nemotron-super": "free/nemotron-super-49b",
|
|
32933
|
+
"nemotron-49b": "free/nemotron-super-49b",
|
|
32934
|
+
"nemotron-120b": "free/nemotron-3-super-120b",
|
|
32935
|
+
devstral: "free/devstral-2-123b",
|
|
32936
|
+
"devstral-2": "free/devstral-2-123b",
|
|
32937
|
+
"qwen-coder": "free/qwen3-coder-480b",
|
|
32938
|
+
"qwen-coder-free": "free/qwen3-coder-480b",
|
|
32939
|
+
maverick: "free/llama-4-maverick",
|
|
32940
|
+
free: "free/nemotron-ultra-253b",
|
|
32930
32941
|
// MiniMax
|
|
32931
32942
|
minimax: "minimax/minimax-m2.7",
|
|
32932
32943
|
"minimax-m2.7": "minimax/minimax-m2.7",
|
|
@@ -32938,7 +32949,7 @@ var MODEL_ALIASES = {
|
|
|
32938
32949
|
// Routing profile aliases (common variations)
|
|
32939
32950
|
"auto-router": "auto",
|
|
32940
32951
|
router: "auto"
|
|
32941
|
-
// Note: auto,
|
|
32952
|
+
// Note: auto, eco, premium are virtual routing profiles registered in BLOCKRUN_MODELS
|
|
32942
32953
|
// They don't need aliases since they're already top-level model IDs
|
|
32943
32954
|
};
|
|
32944
32955
|
function resolveModelAlias(model) {
|
|
@@ -32971,14 +32982,6 @@ var BLOCKRUN_MODELS = [
|
|
|
32971
32982
|
contextWindow: 105e4,
|
|
32972
32983
|
maxOutput: 128e3
|
|
32973
32984
|
},
|
|
32974
|
-
{
|
|
32975
|
-
id: "free",
|
|
32976
|
-
name: "Free (Smart Router - 11 NVIDIA Models)",
|
|
32977
|
-
inputPrice: 0,
|
|
32978
|
-
outputPrice: 0,
|
|
32979
|
-
contextWindow: 131072,
|
|
32980
|
-
maxOutput: 16384
|
|
32981
|
-
},
|
|
32982
32985
|
{
|
|
32983
32986
|
id: "eco",
|
|
32984
32987
|
name: "Eco (Smart Router - Cost Optimized)",
|
|
@@ -33482,11 +33485,12 @@ var BLOCKRUN_MODELS = [
|
|
|
33482
33485
|
agentic: true,
|
|
33483
33486
|
toolCalling: true
|
|
33484
33487
|
},
|
|
33485
|
-
//
|
|
33486
|
-
//
|
|
33487
|
-
//
|
|
33488
|
+
// Free models (hosted by NVIDIA, billingMode: "free" on server)
|
|
33489
|
+
// IDs use "free/" prefix so users see them as free in the /model picker.
|
|
33490
|
+
// ClawRouter maps free/xxx → nvidia/xxx before sending to BlockRun upstream.
|
|
33491
|
+
// toolCalling intentionally omitted: structured function calling unverified.
|
|
33488
33492
|
{
|
|
33489
|
-
id: "
|
|
33493
|
+
id: "free/gpt-oss-120b",
|
|
33490
33494
|
name: "[Free] GPT-OSS 120B",
|
|
33491
33495
|
version: "120b",
|
|
33492
33496
|
inputPrice: 0,
|
|
@@ -33495,7 +33499,7 @@ var BLOCKRUN_MODELS = [
|
|
|
33495
33499
|
maxOutput: 16384
|
|
33496
33500
|
},
|
|
33497
33501
|
{
|
|
33498
|
-
id: "
|
|
33502
|
+
id: "free/gpt-oss-20b",
|
|
33499
33503
|
name: "[Free] GPT-OSS 20B",
|
|
33500
33504
|
version: "20b",
|
|
33501
33505
|
inputPrice: 0,
|
|
@@ -33504,7 +33508,7 @@ var BLOCKRUN_MODELS = [
|
|
|
33504
33508
|
maxOutput: 16384
|
|
33505
33509
|
},
|
|
33506
33510
|
{
|
|
33507
|
-
id: "
|
|
33511
|
+
id: "free/nemotron-ultra-253b",
|
|
33508
33512
|
name: "[Free] Nemotron Ultra 253B",
|
|
33509
33513
|
version: "253b",
|
|
33510
33514
|
inputPrice: 0,
|
|
@@ -33514,7 +33518,7 @@ var BLOCKRUN_MODELS = [
|
|
|
33514
33518
|
reasoning: true
|
|
33515
33519
|
},
|
|
33516
33520
|
{
|
|
33517
|
-
id: "
|
|
33521
|
+
id: "free/nemotron-3-super-120b",
|
|
33518
33522
|
name: "[Free] Nemotron 3 Super 120B",
|
|
33519
33523
|
version: "3-super-120b",
|
|
33520
33524
|
inputPrice: 0,
|
|
@@ -33524,7 +33528,7 @@ var BLOCKRUN_MODELS = [
|
|
|
33524
33528
|
reasoning: true
|
|
33525
33529
|
},
|
|
33526
33530
|
{
|
|
33527
|
-
id: "
|
|
33531
|
+
id: "free/nemotron-super-49b",
|
|
33528
33532
|
name: "[Free] Nemotron Super 49B",
|
|
33529
33533
|
version: "super-49b",
|
|
33530
33534
|
inputPrice: 0,
|
|
@@ -33534,7 +33538,7 @@ var BLOCKRUN_MODELS = [
|
|
|
33534
33538
|
reasoning: true
|
|
33535
33539
|
},
|
|
33536
33540
|
{
|
|
33537
|
-
id: "
|
|
33541
|
+
id: "free/deepseek-v3.2",
|
|
33538
33542
|
name: "[Free] DeepSeek V3.2",
|
|
33539
33543
|
version: "v3.2",
|
|
33540
33544
|
inputPrice: 0,
|
|
@@ -33544,7 +33548,7 @@ var BLOCKRUN_MODELS = [
|
|
|
33544
33548
|
reasoning: true
|
|
33545
33549
|
},
|
|
33546
33550
|
{
|
|
33547
|
-
id: "
|
|
33551
|
+
id: "free/mistral-large-3-675b",
|
|
33548
33552
|
name: "[Free] Mistral Large 675B",
|
|
33549
33553
|
version: "3-675b",
|
|
33550
33554
|
inputPrice: 0,
|
|
@@ -33554,7 +33558,7 @@ var BLOCKRUN_MODELS = [
|
|
|
33554
33558
|
reasoning: true
|
|
33555
33559
|
},
|
|
33556
33560
|
{
|
|
33557
|
-
id: "
|
|
33561
|
+
id: "free/qwen3-coder-480b",
|
|
33558
33562
|
name: "[Free] Qwen3 Coder 480B",
|
|
33559
33563
|
version: "480b",
|
|
33560
33564
|
inputPrice: 0,
|
|
@@ -33563,7 +33567,7 @@ var BLOCKRUN_MODELS = [
|
|
|
33563
33567
|
maxOutput: 16384
|
|
33564
33568
|
},
|
|
33565
33569
|
{
|
|
33566
|
-
id: "
|
|
33570
|
+
id: "free/devstral-2-123b",
|
|
33567
33571
|
name: "[Free] Devstral 2 123B",
|
|
33568
33572
|
version: "2-123b",
|
|
33569
33573
|
inputPrice: 0,
|
|
@@ -33572,7 +33576,7 @@ var BLOCKRUN_MODELS = [
|
|
|
33572
33576
|
maxOutput: 16384
|
|
33573
33577
|
},
|
|
33574
33578
|
{
|
|
33575
|
-
id: "
|
|
33579
|
+
id: "free/glm-4.7",
|
|
33576
33580
|
name: "[Free] GLM-4.7",
|
|
33577
33581
|
version: "4.7",
|
|
33578
33582
|
inputPrice: 0,
|
|
@@ -33582,7 +33586,7 @@ var BLOCKRUN_MODELS = [
|
|
|
33582
33586
|
reasoning: true
|
|
33583
33587
|
},
|
|
33584
33588
|
{
|
|
33585
|
-
id: "
|
|
33589
|
+
id: "free/llama-4-maverick",
|
|
33586
33590
|
name: "[Free] Llama 4 Maverick",
|
|
33587
33591
|
version: "4-maverick",
|
|
33588
33592
|
inputPrice: 0,
|
|
@@ -43717,11 +43721,7 @@ var RulesStrategy = class {
|
|
|
43717
43721
|
let tierConfigs;
|
|
43718
43722
|
let profileSuffix;
|
|
43719
43723
|
let profile;
|
|
43720
|
-
if (routingProfile === "
|
|
43721
|
-
tierConfigs = config.freeTiers;
|
|
43722
|
-
profileSuffix = " | free";
|
|
43723
|
-
profile = "free";
|
|
43724
|
-
} else if (routingProfile === "eco" && config.ecoTiers) {
|
|
43724
|
+
if (routingProfile === "eco" && config.ecoTiers) {
|
|
43725
43725
|
tierConfigs = config.ecoTiers;
|
|
43726
43726
|
profileSuffix = " | eco";
|
|
43727
43727
|
profile = "eco";
|
|
@@ -44849,7 +44849,7 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
44849
44849
|
// $0.20/$1.25, 1M context
|
|
44850
44850
|
"xai/grok-4-fast-non-reasoning",
|
|
44851
44851
|
// 1,143ms, $0.20/$0.50 — fast fallback
|
|
44852
|
-
"
|
|
44852
|
+
"free/gpt-oss-120b"
|
|
44853
44853
|
// 1,252ms, FREE fallback
|
|
44854
44854
|
]
|
|
44855
44855
|
},
|
|
@@ -44910,13 +44910,13 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
44910
44910
|
]
|
|
44911
44911
|
}
|
|
44912
44912
|
},
|
|
44913
|
-
// Eco tier configs - absolute cheapest
|
|
44913
|
+
// Eco tier configs - absolute cheapest (blockrun/eco)
|
|
44914
44914
|
ecoTiers: {
|
|
44915
44915
|
SIMPLE: {
|
|
44916
|
-
primary: "
|
|
44916
|
+
primary: "free/gpt-oss-120b",
|
|
44917
44917
|
// FREE! $0.00/$0.00
|
|
44918
44918
|
fallback: [
|
|
44919
|
-
"
|
|
44919
|
+
"free/gpt-oss-20b",
|
|
44920
44920
|
// FREE — smaller, faster
|
|
44921
44921
|
"google/gemini-3.1-flash-lite",
|
|
44922
44922
|
// $0.25/$1.50 — newest flash-lite
|
|
@@ -44929,13 +44929,9 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
44929
44929
|
]
|
|
44930
44930
|
},
|
|
44931
44931
|
MEDIUM: {
|
|
44932
|
-
primary: "
|
|
44933
|
-
//
|
|
44932
|
+
primary: "google/gemini-3.1-flash-lite",
|
|
44933
|
+
// $0.25/$1.50 — newest flash-lite
|
|
44934
44934
|
fallback: [
|
|
44935
|
-
"nvidia/gpt-oss-120b",
|
|
44936
|
-
// FREE fallback
|
|
44937
|
-
"google/gemini-3.1-flash-lite",
|
|
44938
|
-
// $0.25/$1.50
|
|
44939
44935
|
"openai/gpt-5.4-nano",
|
|
44940
44936
|
// $0.20/$1.25
|
|
44941
44937
|
"google/gemini-2.5-flash-lite",
|
|
@@ -44945,15 +44941,9 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
44945
44941
|
]
|
|
44946
44942
|
},
|
|
44947
44943
|
COMPLEX: {
|
|
44948
|
-
primary: "
|
|
44949
|
-
//
|
|
44944
|
+
primary: "google/gemini-3.1-flash-lite",
|
|
44945
|
+
// $0.25/$1.50
|
|
44950
44946
|
fallback: [
|
|
44951
|
-
"nvidia/mistral-large-3-675b",
|
|
44952
|
-
// FREE — 675B brute-force
|
|
44953
|
-
"nvidia/deepseek-v3.2",
|
|
44954
|
-
// FREE
|
|
44955
|
-
"google/gemini-3.1-flash-lite",
|
|
44956
|
-
// $0.25/$1.50
|
|
44957
44947
|
"google/gemini-2.5-flash-lite",
|
|
44958
44948
|
"xai/grok-4-0709",
|
|
44959
44949
|
"google/gemini-2.5-flash",
|
|
@@ -44963,12 +44953,7 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
44963
44953
|
REASONING: {
|
|
44964
44954
|
primary: "xai/grok-4-1-fast-reasoning",
|
|
44965
44955
|
// $0.20/$0.50
|
|
44966
|
-
fallback: [
|
|
44967
|
-
"xai/grok-4-fast-reasoning",
|
|
44968
|
-
"nvidia/nemotron-ultra-253b",
|
|
44969
|
-
// FREE reasoning fallback
|
|
44970
|
-
"deepseek/deepseek-reasoner"
|
|
44971
|
-
]
|
|
44956
|
+
fallback: ["xai/grok-4-fast-reasoning", "deepseek/deepseek-reasoner"]
|
|
44972
44957
|
}
|
|
44973
44958
|
},
|
|
44974
44959
|
// Premium tier configs - best quality (blockrun/premium)
|
|
@@ -45082,73 +45067,6 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
45082
45067
|
]
|
|
45083
45068
|
}
|
|
45084
45069
|
},
|
|
45085
|
-
// Free tier configs - NVIDIA free models, smart-routed by task type (blockrun/free)
|
|
45086
|
-
freeTiers: {
|
|
45087
|
-
SIMPLE: {
|
|
45088
|
-
primary: "nvidia/gpt-oss-20b",
|
|
45089
|
-
// Fastest: small 20B for simple tasks
|
|
45090
|
-
fallback: [
|
|
45091
|
-
"nvidia/gpt-oss-120b",
|
|
45092
|
-
// Solid general-purpose
|
|
45093
|
-
"nvidia/nemotron-super-49b",
|
|
45094
|
-
// Thinking mode
|
|
45095
|
-
"nvidia/llama-4-maverick",
|
|
45096
|
-
// MoE broad coverage
|
|
45097
|
-
"nvidia/glm-4.7"
|
|
45098
|
-
// Thinking mode
|
|
45099
|
-
]
|
|
45100
|
-
},
|
|
45101
|
-
MEDIUM: {
|
|
45102
|
-
primary: "nvidia/deepseek-v3.2",
|
|
45103
|
-
// DeepSeek V3.2 quality, zero cost
|
|
45104
|
-
fallback: [
|
|
45105
|
-
"nvidia/gpt-oss-120b",
|
|
45106
|
-
// Strong 120B general-purpose
|
|
45107
|
-
"nvidia/nemotron-super-49b",
|
|
45108
|
-
// Thinking mode
|
|
45109
|
-
"nvidia/mistral-large-3-675b",
|
|
45110
|
-
// Largest Mistral
|
|
45111
|
-
"nvidia/llama-4-maverick",
|
|
45112
|
-
// MoE breadth
|
|
45113
|
-
"nvidia/glm-4.7"
|
|
45114
|
-
// Thinking mode
|
|
45115
|
-
]
|
|
45116
|
-
},
|
|
45117
|
-
COMPLEX: {
|
|
45118
|
-
primary: "nvidia/nemotron-ultra-253b",
|
|
45119
|
-
// Strongest free: 253B reasoning
|
|
45120
|
-
fallback: [
|
|
45121
|
-
"nvidia/mistral-large-3-675b",
|
|
45122
|
-
// 675B massive params
|
|
45123
|
-
"nvidia/deepseek-v3.2",
|
|
45124
|
-
// V3.2 quality
|
|
45125
|
-
"nvidia/nemotron-3-super-120b",
|
|
45126
|
-
// Thinking mode MoE
|
|
45127
|
-
"nvidia/qwen3-coder-480b",
|
|
45128
|
-
// 480B MoE for code-heavy tasks
|
|
45129
|
-
"nvidia/devstral-2-123b",
|
|
45130
|
-
// Coding-focused
|
|
45131
|
-
"nvidia/gpt-oss-120b"
|
|
45132
|
-
// Last resort
|
|
45133
|
-
]
|
|
45134
|
-
},
|
|
45135
|
-
REASONING: {
|
|
45136
|
-
primary: "nvidia/nemotron-ultra-253b",
|
|
45137
|
-
// Best free reasoning: 253B
|
|
45138
|
-
fallback: [
|
|
45139
|
-
"nvidia/nemotron-3-super-120b",
|
|
45140
|
-
// Thinking mode MoE
|
|
45141
|
-
"nvidia/nemotron-super-49b",
|
|
45142
|
-
// Thinking mode
|
|
45143
|
-
"nvidia/deepseek-v3.2",
|
|
45144
|
-
// DeepSeek reasoning
|
|
45145
|
-
"nvidia/mistral-large-3-675b",
|
|
45146
|
-
// Brute-force params
|
|
45147
|
-
"nvidia/glm-4.7"
|
|
45148
|
-
// GLM thinking mode
|
|
45149
|
-
]
|
|
45150
|
-
}
|
|
45151
|
-
},
|
|
45152
45070
|
overrides: {
|
|
45153
45071
|
maxTokensForceComplex: 1e5,
|
|
45154
45072
|
structuredOutputMinTier: "MEDIUM",
|
|
@@ -47369,8 +47287,6 @@ var BLOCKRUN_SOLANA_API = "https://sol.blockrun.ai/api";
|
|
|
47369
47287
|
var IMAGE_DIR = join8(homedir5(), ".openclaw", "blockrun", "images");
|
|
47370
47288
|
var AUTO_MODEL = "blockrun/auto";
|
|
47371
47289
|
var ROUTING_PROFILES = /* @__PURE__ */ new Set([
|
|
47372
|
-
"blockrun/free",
|
|
47373
|
-
"free",
|
|
47374
47290
|
"blockrun/eco",
|
|
47375
47291
|
"eco",
|
|
47376
47292
|
"blockrun/auto",
|
|
@@ -47378,39 +47294,26 @@ var ROUTING_PROFILES = /* @__PURE__ */ new Set([
|
|
|
47378
47294
|
"blockrun/premium",
|
|
47379
47295
|
"premium"
|
|
47380
47296
|
]);
|
|
47381
|
-
var FREE_MODEL = "
|
|
47297
|
+
var FREE_MODEL = "free/gpt-oss-120b";
|
|
47382
47298
|
var FREE_MODELS = /* @__PURE__ */ new Set([
|
|
47383
|
-
"
|
|
47384
|
-
"
|
|
47385
|
-
"
|
|
47386
|
-
"
|
|
47387
|
-
"
|
|
47388
|
-
"
|
|
47389
|
-
"
|
|
47390
|
-
"
|
|
47391
|
-
"
|
|
47392
|
-
"
|
|
47393
|
-
"
|
|
47299
|
+
"free/gpt-oss-120b",
|
|
47300
|
+
"free/gpt-oss-20b",
|
|
47301
|
+
"free/nemotron-ultra-253b",
|
|
47302
|
+
"free/nemotron-3-super-120b",
|
|
47303
|
+
"free/nemotron-super-49b",
|
|
47304
|
+
"free/deepseek-v3.2",
|
|
47305
|
+
"free/mistral-large-3-675b",
|
|
47306
|
+
"free/qwen3-coder-480b",
|
|
47307
|
+
"free/devstral-2-123b",
|
|
47308
|
+
"free/glm-4.7",
|
|
47309
|
+
"free/llama-4-maverick"
|
|
47394
47310
|
]);
|
|
47395
|
-
|
|
47396
|
-
|
|
47397
|
-
|
|
47398
|
-
fallback: ["nvidia/gpt-oss-120b", "nvidia/nemotron-super-49b"]
|
|
47399
|
-
},
|
|
47400
|
-
MEDIUM: {
|
|
47401
|
-
primary: "nvidia/deepseek-v3.2",
|
|
47402
|
-
fallback: ["nvidia/gpt-oss-120b", "nvidia/nemotron-super-49b"]
|
|
47403
|
-
},
|
|
47404
|
-
COMPLEX: {
|
|
47405
|
-
primary: "nvidia/nemotron-ultra-253b",
|
|
47406
|
-
fallback: ["nvidia/mistral-large-3-675b", "nvidia/deepseek-v3.2", "nvidia/gpt-oss-120b"]
|
|
47407
|
-
},
|
|
47408
|
-
REASONING: {
|
|
47409
|
-
primary: "nvidia/nemotron-ultra-253b",
|
|
47410
|
-
fallback: ["nvidia/nemotron-3-super-120b", "nvidia/deepseek-v3.2"]
|
|
47311
|
+
function toUpstreamModelId(modelId) {
|
|
47312
|
+
if (modelId.startsWith("free/")) {
|
|
47313
|
+
return "nvidia/" + modelId.slice("free/".length);
|
|
47411
47314
|
}
|
|
47412
|
-
|
|
47413
|
-
|
|
47315
|
+
return modelId;
|
|
47316
|
+
}
|
|
47414
47317
|
var MAX_MESSAGES = 200;
|
|
47415
47318
|
var CONTEXT_LIMIT_KB = 5120;
|
|
47416
47319
|
var HEARTBEAT_INTERVAL_MS = 2e3;
|
|
@@ -48772,7 +48675,7 @@ async function tryModelRequest(upstreamUrl, method, headers, body, modelId, maxT
|
|
|
48772
48675
|
let requestBody = body;
|
|
48773
48676
|
try {
|
|
48774
48677
|
const parsed = JSON.parse(body.toString());
|
|
48775
|
-
parsed.model = modelId;
|
|
48678
|
+
parsed.model = toUpstreamModelId(modelId);
|
|
48776
48679
|
if (Array.isArray(parsed.messages)) {
|
|
48777
48680
|
parsed.messages = normalizeMessageRoles(parsed.messages);
|
|
48778
48681
|
}
|
|
@@ -48916,7 +48819,7 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
48916
48819
|
const estimatedTokens = Math.ceil(fullText.length / 4);
|
|
48917
48820
|
const normalizedModel2 = typeof parsed.model === "string" ? parsed.model.trim().toLowerCase() : "";
|
|
48918
48821
|
const profileName = normalizedModel2.replace("blockrun/", "");
|
|
48919
|
-
const debugProfile = ["
|
|
48822
|
+
const debugProfile = ["eco", "auto", "premium"].includes(profileName) ? profileName : "auto";
|
|
48920
48823
|
const scoring = classifyByRules(
|
|
48921
48824
|
debugPrompt,
|
|
48922
48825
|
systemPrompt,
|
|
@@ -49536,20 +49439,15 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
49536
49439
|
}
|
|
49537
49440
|
}
|
|
49538
49441
|
options.onRouted?.(routingDecision);
|
|
49539
|
-
if (routingProfile === "free") {
|
|
49540
|
-
freeRequestCount++;
|
|
49541
|
-
if (freeRequestCount % 5 === 0) {
|
|
49542
|
-
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.
|
|
49543
|
-
|
|
49544
|
-
`;
|
|
49545
|
-
}
|
|
49546
|
-
}
|
|
49547
49442
|
}
|
|
49548
49443
|
}
|
|
49549
49444
|
if (!effectiveSessionId && parsedMessages.length > 0) {
|
|
49550
49445
|
effectiveSessionId = deriveSessionId(parsedMessages);
|
|
49551
49446
|
}
|
|
49552
49447
|
if (bodyModified) {
|
|
49448
|
+
if (parsed.model && typeof parsed.model === "string") {
|
|
49449
|
+
parsed.model = toUpstreamModelId(parsed.model);
|
|
49450
|
+
}
|
|
49553
49451
|
body = Buffer.from(JSON.stringify(parsed));
|
|
49554
49452
|
}
|
|
49555
49453
|
} catch (err) {
|
|
@@ -49648,28 +49546,19 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
49648
49546
|
const sufficiency = await balanceMonitor.checkSufficient(bufferedCostMicros);
|
|
49649
49547
|
if (sufficiency.info.isEmpty || !sufficiency.sufficient) {
|
|
49650
49548
|
const originalModel = modelId;
|
|
49651
|
-
const fallbackTier = routingDecision?.tier ?? "SIMPLE";
|
|
49652
|
-
const freeTierConfig = FREE_TIER_CONFIGS[fallbackTier];
|
|
49653
|
-
const freeModel = freeTierConfig.primary;
|
|
49654
49549
|
console.log(
|
|
49655
|
-
`[ClawRouter] Wallet ${sufficiency.info.isEmpty ? "empty" : "insufficient"} (${sufficiency.info.balanceUSD}), falling back to free model: ${
|
|
49550
|
+
`[ClawRouter] Wallet ${sufficiency.info.isEmpty ? "empty" : "insufficient"} (${sufficiency.info.balanceUSD}), falling back to free model: ${FREE_MODEL} (requested: ${originalModel})`
|
|
49656
49551
|
);
|
|
49657
|
-
modelId =
|
|
49552
|
+
modelId = FREE_MODEL;
|
|
49658
49553
|
isFreeModel = true;
|
|
49659
49554
|
const parsed = JSON.parse(body.toString());
|
|
49660
|
-
parsed.model =
|
|
49555
|
+
parsed.model = toUpstreamModelId(FREE_MODEL);
|
|
49661
49556
|
body = Buffer.from(JSON.stringify(parsed));
|
|
49662
49557
|
balanceFallbackNotice = sufficiency.info.isEmpty ? `> **\u26A0\uFE0F Wallet empty** \u2014 using free model. Fund your wallet to use ${originalModel}.
|
|
49663
49558
|
|
|
49664
49559
|
` : `> **\u26A0\uFE0F Insufficient balance** (${sufficiency.info.balanceUSD}) \u2014 using free model instead of ${originalModel}.
|
|
49665
49560
|
|
|
49666
49561
|
`;
|
|
49667
|
-
freeRequestCount++;
|
|
49668
|
-
if (freeRequestCount % 5 === 0) {
|
|
49669
|
-
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.
|
|
49670
|
-
|
|
49671
|
-
`;
|
|
49672
|
-
}
|
|
49673
49562
|
options.onLowBalance?.({
|
|
49674
49563
|
balanceUSD: sufficiency.info.balanceUSD,
|
|
49675
49564
|
walletAddress: sufficiency.info.walletAddress
|
|
@@ -51117,7 +51006,6 @@ function injectModelsConfig(logger) {
|
|
|
51117
51006
|
}
|
|
51118
51007
|
const TOP_MODELS = [
|
|
51119
51008
|
"auto",
|
|
51120
|
-
"free",
|
|
51121
51009
|
"eco",
|
|
51122
51010
|
"premium",
|
|
51123
51011
|
"anthropic/claude-sonnet-4.6",
|
|
@@ -51134,18 +51022,18 @@ function injectModelsConfig(logger) {
|
|
|
51134
51022
|
"moonshot/kimi-k2.5",
|
|
51135
51023
|
"xai/grok-3",
|
|
51136
51024
|
"minimax/minimax-m2.5",
|
|
51137
|
-
// Free
|
|
51138
|
-
"
|
|
51139
|
-
"
|
|
51140
|
-
"
|
|
51141
|
-
"
|
|
51142
|
-
"
|
|
51143
|
-
"
|
|
51144
|
-
"
|
|
51145
|
-
"
|
|
51146
|
-
"
|
|
51147
|
-
"
|
|
51148
|
-
"
|
|
51025
|
+
// Free models (free/ prefix so users see "free" in picker)
|
|
51026
|
+
"free/gpt-oss-120b",
|
|
51027
|
+
"free/gpt-oss-20b",
|
|
51028
|
+
"free/nemotron-ultra-253b",
|
|
51029
|
+
"free/deepseek-v3.2",
|
|
51030
|
+
"free/mistral-large-3-675b",
|
|
51031
|
+
"free/qwen3-coder-480b",
|
|
51032
|
+
"free/devstral-2-123b",
|
|
51033
|
+
"free/llama-4-maverick",
|
|
51034
|
+
"free/nemotron-3-super-120b",
|
|
51035
|
+
"free/nemotron-super-49b",
|
|
51036
|
+
"free/glm-4.7"
|
|
51149
51037
|
];
|
|
51150
51038
|
if (!defaults.models || typeof defaults.models !== "object" || Array.isArray(defaults.models)) {
|
|
51151
51039
|
defaults.models = {};
|