@blockrun/clawrouter 0.8.23 → 0.8.25
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 +36 -6
- package/dist/cli.js +64 -84
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +78 -89
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@ _The world's first hackathon run entirely by AI agents, powered by USDC_
|
|
|
30
30
|
|
|
31
31
|
## Why ClawRouter?
|
|
32
32
|
|
|
33
|
+
- **4 routing profiles** — auto (balanced), eco (95.9-100% savings), premium (best quality), free (zero cost)
|
|
33
34
|
- **100% local routing** — 15-dimension weighted scoring runs on your machine in <1ms
|
|
34
35
|
- **Zero external calls** — no API calls for routing decisions, ever
|
|
35
36
|
- **30+ models** — OpenAI, Anthropic, Google, DeepSeek, xAI, Moonshot through one wallet
|
|
@@ -73,13 +74,21 @@ Done! Smart routing (`blockrun/auto`) is now your default model.
|
|
|
73
74
|
|
|
74
75
|
**For advanced users:** See the [complete manual installation guide](docs/windows-installation.md) with step-by-step PowerShell instructions.
|
|
75
76
|
|
|
76
|
-
###
|
|
77
|
+
### Routing Profiles
|
|
77
78
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
Choose your routing strategy with `/model <profile>`:
|
|
80
|
+
|
|
81
|
+
| Profile | Strategy | Savings | Use Case |
|
|
82
|
+
|---------|----------|---------|----------|
|
|
83
|
+
| `/model auto` | Balanced (default) | 74-100% | Best overall balance |
|
|
84
|
+
| `/model eco` | Cost optimized | 95.9-100% | Maximum savings |
|
|
85
|
+
| `/model premium` | Quality focused | 0% | Best quality (Opus 4.5) |
|
|
86
|
+
| `/model free` | Free tier only | 100% | Zero cost |
|
|
87
|
+
|
|
88
|
+
**Other shortcuts:**
|
|
89
|
+
- **Model aliases:** `/model sonnet`, `/model grok`, `/model gpt5`, `/model o3`
|
|
90
|
+
- **Specific models:** `blockrun/openai/gpt-4o` or `blockrun/anthropic/claude-sonnet-4`
|
|
91
|
+
- **Bring your wallet:** `export BLOCKRUN_WALLET_KEY=0x...`
|
|
83
92
|
|
|
84
93
|
---
|
|
85
94
|
|
|
@@ -116,6 +125,27 @@ No external classifier calls. Ambiguous queries default to the MEDIUM tier (Grok
|
|
|
116
125
|
|
|
117
126
|
**Deep dive:** [15-dimension scoring weights](docs/configuration.md#scoring-weights) | [Architecture](docs/architecture.md)
|
|
118
127
|
|
|
128
|
+
### Routing Profiles (NEW in v0.8.21)
|
|
129
|
+
|
|
130
|
+
ClawRouter now offers 4 routing profiles to match different priorities:
|
|
131
|
+
|
|
132
|
+
| Profile | Strategy | Savings vs Opus 4.5 | When to Use |
|
|
133
|
+
|---------|----------|---------------------|-------------|
|
|
134
|
+
| **auto** (default) | Balanced quality + cost | 74-100% | General use, best overall |
|
|
135
|
+
| **eco** | Maximum cost savings | 95.9-100% | Budget-conscious, high volume |
|
|
136
|
+
| **premium** | Best quality only | 0% | Mission-critical tasks |
|
|
137
|
+
| **free** | Free tier only | 100% | Testing, empty wallet |
|
|
138
|
+
|
|
139
|
+
Switch profiles anytime: `/model eco`, `/model premium`, `/model auto`
|
|
140
|
+
|
|
141
|
+
**Example:**
|
|
142
|
+
```
|
|
143
|
+
/model eco # Switch to cost-optimized routing
|
|
144
|
+
"Write a React component" # Routes to DeepSeek ($0.28/$0.42)
|
|
145
|
+
# vs Auto → Grok ($0.20/$1.50)
|
|
146
|
+
# 98.3% savings vs Opus 4.5
|
|
147
|
+
```
|
|
148
|
+
|
|
119
149
|
### Tier → Model Mapping
|
|
120
150
|
|
|
121
151
|
| Tier | Primary Model | Cost/M | Savings vs Opus |
|
package/dist/cli.js
CHANGED
|
@@ -1126,14 +1126,12 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1126
1126
|
tiers: {
|
|
1127
1127
|
SIMPLE: {
|
|
1128
1128
|
primary: "nvidia/kimi-k2.5",
|
|
1129
|
-
//
|
|
1129
|
+
// $0.55/$2.5 - best quality/price for simple tasks
|
|
1130
1130
|
fallback: [
|
|
1131
|
-
"google/gemini-2.5-flash",
|
|
1132
1131
|
"nvidia/gpt-oss-120b",
|
|
1133
|
-
|
|
1134
|
-
"
|
|
1135
|
-
"
|
|
1136
|
-
// Added for better quality fallback
|
|
1132
|
+
// FREE fallback
|
|
1133
|
+
"google/gemini-2.5-flash",
|
|
1134
|
+
"deepseek/deepseek-chat"
|
|
1137
1135
|
]
|
|
1138
1136
|
},
|
|
1139
1137
|
MEDIUM: {
|
|
@@ -1147,9 +1145,15 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1147
1145
|
]
|
|
1148
1146
|
},
|
|
1149
1147
|
COMPLEX: {
|
|
1150
|
-
primary: "google/gemini-
|
|
1151
|
-
|
|
1152
|
-
|
|
1148
|
+
primary: "google/gemini-3-pro-preview",
|
|
1149
|
+
// Latest Gemini - upgraded from 2.5
|
|
1150
|
+
fallback: [
|
|
1151
|
+
"google/gemini-2.5-pro",
|
|
1152
|
+
"xai/grok-4-0709",
|
|
1153
|
+
"openai/gpt-4o",
|
|
1154
|
+
"openai/gpt-5.2",
|
|
1155
|
+
"anthropic/claude-sonnet-4"
|
|
1156
|
+
]
|
|
1153
1157
|
},
|
|
1154
1158
|
REASONING: {
|
|
1155
1159
|
primary: "xai/grok-4-1-fast-reasoning",
|
|
@@ -1157,7 +1161,8 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1157
1161
|
fallback: [
|
|
1158
1162
|
"xai/grok-4-fast-reasoning",
|
|
1159
1163
|
"openai/o3",
|
|
1160
|
-
|
|
1164
|
+
"openai/o4-mini",
|
|
1165
|
+
// Latest o-series mini
|
|
1161
1166
|
"deepseek/deepseek-reasoner",
|
|
1162
1167
|
"moonshot/kimi-k2.5"
|
|
1163
1168
|
]
|
|
@@ -1167,8 +1172,8 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1167
1172
|
ecoTiers: {
|
|
1168
1173
|
SIMPLE: {
|
|
1169
1174
|
primary: "nvidia/kimi-k2.5",
|
|
1170
|
-
// $0.
|
|
1171
|
-
fallback: ["
|
|
1175
|
+
// $0.55/$2.5
|
|
1176
|
+
fallback: ["nvidia/gpt-oss-120b", "deepseek/deepseek-chat", "google/gemini-2.5-flash"]
|
|
1172
1177
|
},
|
|
1173
1178
|
MEDIUM: {
|
|
1174
1179
|
primary: "deepseek/deepseek-chat",
|
|
@@ -1200,13 +1205,25 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1200
1205
|
},
|
|
1201
1206
|
COMPLEX: {
|
|
1202
1207
|
primary: "anthropic/claude-opus-4.5",
|
|
1203
|
-
// $
|
|
1204
|
-
fallback: [
|
|
1208
|
+
// $5/$25 - Latest Opus
|
|
1209
|
+
fallback: [
|
|
1210
|
+
"openai/gpt-5.2-pro",
|
|
1211
|
+
// $21/$168 - Latest GPT pro
|
|
1212
|
+
"google/gemini-3-pro-preview",
|
|
1213
|
+
// Latest Gemini
|
|
1214
|
+
"openai/gpt-5.2",
|
|
1215
|
+
"anthropic/claude-sonnet-4"
|
|
1216
|
+
]
|
|
1205
1217
|
},
|
|
1206
1218
|
REASONING: {
|
|
1207
1219
|
primary: "openai/o3",
|
|
1208
|
-
// $
|
|
1209
|
-
fallback: [
|
|
1220
|
+
// $2/$8 - Best value reasoning
|
|
1221
|
+
fallback: [
|
|
1222
|
+
"openai/o4-mini",
|
|
1223
|
+
// Latest o-series
|
|
1224
|
+
"anthropic/claude-opus-4.5",
|
|
1225
|
+
"google/gemini-3-pro-preview"
|
|
1226
|
+
]
|
|
1210
1227
|
}
|
|
1211
1228
|
},
|
|
1212
1229
|
// Agentic tier configs - models that excel at multi-step autonomous tasks
|
|
@@ -1227,13 +1244,23 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1227
1244
|
},
|
|
1228
1245
|
COMPLEX: {
|
|
1229
1246
|
primary: "anthropic/claude-sonnet-4",
|
|
1230
|
-
fallback: [
|
|
1231
|
-
|
|
1247
|
+
fallback: [
|
|
1248
|
+
"anthropic/claude-opus-4.5",
|
|
1249
|
+
// Latest Opus - best agentic
|
|
1250
|
+
"openai/gpt-5.2",
|
|
1251
|
+
"google/gemini-3-pro-preview",
|
|
1252
|
+
"xai/grok-4-0709"
|
|
1253
|
+
]
|
|
1232
1254
|
},
|
|
1233
1255
|
REASONING: {
|
|
1234
1256
|
primary: "anthropic/claude-sonnet-4",
|
|
1235
1257
|
// Strong tool use + reasoning for agentic tasks
|
|
1236
|
-
fallback: [
|
|
1258
|
+
fallback: [
|
|
1259
|
+
"anthropic/claude-opus-4.5",
|
|
1260
|
+
"xai/grok-4-fast-reasoning",
|
|
1261
|
+
"moonshot/kimi-k2.5",
|
|
1262
|
+
"deepseek/deepseek-reasoner"
|
|
1263
|
+
]
|
|
1237
1264
|
}
|
|
1238
1265
|
},
|
|
1239
1266
|
overrides: {
|
|
@@ -1342,8 +1369,7 @@ var MODEL_ALIASES = {
|
|
|
1342
1369
|
"grok-code": "xai/grok-code-fast-1",
|
|
1343
1370
|
// NVIDIA
|
|
1344
1371
|
nvidia: "nvidia/gpt-oss-120b",
|
|
1345
|
-
"gpt-120b": "nvidia/gpt-oss-120b"
|
|
1346
|
-
"gpt-20b": "nvidia/gpt-oss-20b"
|
|
1372
|
+
"gpt-120b": "nvidia/gpt-oss-120b"
|
|
1347
1373
|
// Note: auto, free, eco, premium are virtual routing profiles registered in BLOCKRUN_MODELS
|
|
1348
1374
|
// They don't need aliases since they're already top-level model IDs
|
|
1349
1375
|
};
|
|
@@ -1448,14 +1474,7 @@ var BLOCKRUN_MODELS = [
|
|
|
1448
1474
|
contextWindow: 128e3,
|
|
1449
1475
|
maxOutput: 16384
|
|
1450
1476
|
},
|
|
1451
|
-
|
|
1452
|
-
id: "openai/gpt-4.1-nano",
|
|
1453
|
-
name: "GPT-4.1 Nano",
|
|
1454
|
-
inputPrice: 0.1,
|
|
1455
|
-
outputPrice: 0.4,
|
|
1456
|
-
contextWindow: 128e3,
|
|
1457
|
-
maxOutput: 16384
|
|
1458
|
-
},
|
|
1477
|
+
// gpt-4.1-nano removed - replaced by gpt-5-nano
|
|
1459
1478
|
{
|
|
1460
1479
|
id: "openai/gpt-4o",
|
|
1461
1480
|
name: "GPT-4o",
|
|
@@ -1474,25 +1493,7 @@ var BLOCKRUN_MODELS = [
|
|
|
1474
1493
|
contextWindow: 128e3,
|
|
1475
1494
|
maxOutput: 16384
|
|
1476
1495
|
},
|
|
1477
|
-
// OpenAI O-series (Reasoning)
|
|
1478
|
-
{
|
|
1479
|
-
id: "openai/o1",
|
|
1480
|
-
name: "o1",
|
|
1481
|
-
inputPrice: 15,
|
|
1482
|
-
outputPrice: 60,
|
|
1483
|
-
contextWindow: 2e5,
|
|
1484
|
-
maxOutput: 1e5,
|
|
1485
|
-
reasoning: true
|
|
1486
|
-
},
|
|
1487
|
-
{
|
|
1488
|
-
id: "openai/o1-mini",
|
|
1489
|
-
name: "o1-mini",
|
|
1490
|
-
inputPrice: 1.1,
|
|
1491
|
-
outputPrice: 4.4,
|
|
1492
|
-
contextWindow: 128e3,
|
|
1493
|
-
maxOutput: 65536,
|
|
1494
|
-
reasoning: true
|
|
1495
|
-
},
|
|
1496
|
+
// OpenAI O-series (Reasoning) - o1/o1-mini removed, replaced by o3/o4
|
|
1496
1497
|
{
|
|
1497
1498
|
id: "openai/o3",
|
|
1498
1499
|
name: "o3",
|
|
@@ -1629,15 +1630,7 @@ var BLOCKRUN_MODELS = [
|
|
|
1629
1630
|
maxOutput: 16384,
|
|
1630
1631
|
reasoning: true
|
|
1631
1632
|
},
|
|
1632
|
-
|
|
1633
|
-
id: "xai/grok-3-fast",
|
|
1634
|
-
name: "Grok 3 Fast",
|
|
1635
|
-
inputPrice: 5,
|
|
1636
|
-
outputPrice: 25,
|
|
1637
|
-
contextWindow: 131072,
|
|
1638
|
-
maxOutput: 16384,
|
|
1639
|
-
reasoning: true
|
|
1640
|
-
},
|
|
1633
|
+
// grok-3-fast removed - too expensive ($5/$25), use grok-4-fast instead
|
|
1641
1634
|
{
|
|
1642
1635
|
id: "xai/grok-3-mini",
|
|
1643
1636
|
name: "Grok 3 Mini",
|
|
@@ -1700,15 +1693,7 @@ var BLOCKRUN_MODELS = [
|
|
|
1700
1693
|
maxOutput: 16384,
|
|
1701
1694
|
reasoning: true
|
|
1702
1695
|
},
|
|
1703
|
-
|
|
1704
|
-
id: "xai/grok-2-vision",
|
|
1705
|
-
name: "Grok 2 Vision",
|
|
1706
|
-
inputPrice: 2,
|
|
1707
|
-
outputPrice: 10,
|
|
1708
|
-
contextWindow: 131072,
|
|
1709
|
-
maxOutput: 16384,
|
|
1710
|
-
vision: true
|
|
1711
|
-
},
|
|
1696
|
+
// grok-2-vision removed - old, 0 transactions
|
|
1712
1697
|
// NVIDIA - Free/cheap models
|
|
1713
1698
|
{
|
|
1714
1699
|
id: "nvidia/gpt-oss-120b",
|
|
@@ -1718,19 +1703,11 @@ var BLOCKRUN_MODELS = [
|
|
|
1718
1703
|
contextWindow: 128e3,
|
|
1719
1704
|
maxOutput: 16384
|
|
1720
1705
|
},
|
|
1721
|
-
{
|
|
1722
|
-
id: "nvidia/gpt-oss-20b",
|
|
1723
|
-
name: "NVIDIA GPT-OSS 20B",
|
|
1724
|
-
inputPrice: 0,
|
|
1725
|
-
outputPrice: 0,
|
|
1726
|
-
contextWindow: 128e3,
|
|
1727
|
-
maxOutput: 16384
|
|
1728
|
-
},
|
|
1729
1706
|
{
|
|
1730
1707
|
id: "nvidia/kimi-k2.5",
|
|
1731
1708
|
name: "NVIDIA Kimi K2.5",
|
|
1732
|
-
inputPrice:
|
|
1733
|
-
outputPrice:
|
|
1709
|
+
inputPrice: 0.55,
|
|
1710
|
+
outputPrice: 2.5,
|
|
1734
1711
|
contextWindow: 262144,
|
|
1735
1712
|
maxOutput: 16384
|
|
1736
1713
|
}
|
|
@@ -2372,6 +2349,16 @@ var FREE_MODEL = "nvidia/gpt-oss-120b";
|
|
|
2372
2349
|
var HEARTBEAT_INTERVAL_MS = 2e3;
|
|
2373
2350
|
var DEFAULT_REQUEST_TIMEOUT_MS = 18e4;
|
|
2374
2351
|
var DEFAULT_PORT = 8402;
|
|
2352
|
+
var PROXY_PORT = (() => {
|
|
2353
|
+
const envPort = process.env.BLOCKRUN_PROXY_PORT;
|
|
2354
|
+
if (envPort) {
|
|
2355
|
+
const parsed = parseInt(envPort, 10);
|
|
2356
|
+
if (!isNaN(parsed) && parsed > 0 && parsed < 65536) {
|
|
2357
|
+
return parsed;
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
return DEFAULT_PORT;
|
|
2361
|
+
})();
|
|
2375
2362
|
var MAX_FALLBACK_ATTEMPTS = 3;
|
|
2376
2363
|
var HEALTH_CHECK_TIMEOUT_MS = 2e3;
|
|
2377
2364
|
var RATE_LIMIT_COOLDOWN_MS = 6e4;
|
|
@@ -2471,14 +2458,7 @@ function safeWrite(res, data) {
|
|
|
2471
2458
|
}
|
|
2472
2459
|
var BALANCE_CHECK_BUFFER = 1.5;
|
|
2473
2460
|
function getProxyPort() {
|
|
2474
|
-
|
|
2475
|
-
if (envPort) {
|
|
2476
|
-
const parsed = parseInt(envPort, 10);
|
|
2477
|
-
if (!isNaN(parsed) && parsed > 0 && parsed < 65536) {
|
|
2478
|
-
return parsed;
|
|
2479
|
-
}
|
|
2480
|
-
}
|
|
2481
|
-
return DEFAULT_PORT;
|
|
2461
|
+
return PROXY_PORT;
|
|
2482
2462
|
}
|
|
2483
2463
|
async function checkExistingProxy(port) {
|
|
2484
2464
|
const controller = new AbortController();
|