@blockrun/clawrouter 0.9.31 → 0.9.33
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/dist/cli.js +40 -43
- package/dist/cli.js.map +1 -1
- package/dist/index.js +41 -44
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/reinstall.sh +23 -1
- package/scripts/uninstall.sh +23 -1
package/dist/cli.js
CHANGED
|
@@ -1255,44 +1255,27 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1255
1255
|
]
|
|
1256
1256
|
}
|
|
1257
1257
|
},
|
|
1258
|
-
// Eco tier configs -
|
|
1258
|
+
// Eco tier configs - absolute cheapest (blockrun/eco)
|
|
1259
1259
|
ecoTiers: {
|
|
1260
1260
|
SIMPLE: {
|
|
1261
|
-
primary: "
|
|
1262
|
-
// $0.
|
|
1263
|
-
fallback: [
|
|
1264
|
-
"moonshot/kimi-k2.5",
|
|
1265
|
-
"nvidia/gpt-oss-120b",
|
|
1266
|
-
"deepseek/deepseek-chat",
|
|
1267
|
-
"google/gemini-2.5-flash"
|
|
1268
|
-
]
|
|
1261
|
+
primary: "nvidia/gpt-oss-120b",
|
|
1262
|
+
// FREE! $0.00/$0.00
|
|
1263
|
+
fallback: ["google/gemini-2.5-flash", "deepseek/deepseek-chat", "minimax/minimax-m2.5"]
|
|
1269
1264
|
},
|
|
1270
1265
|
MEDIUM: {
|
|
1271
|
-
primary: "
|
|
1272
|
-
// $0.
|
|
1273
|
-
fallback: [
|
|
1274
|
-
"minimax/minimax-m2.5",
|
|
1275
|
-
// $0.30/$1.20 - cheap with reasoning
|
|
1276
|
-
"xai/grok-code-fast-1",
|
|
1277
|
-
"google/gemini-2.5-flash",
|
|
1278
|
-
"moonshot/kimi-k2.5"
|
|
1279
|
-
]
|
|
1266
|
+
primary: "google/gemini-2.5-flash",
|
|
1267
|
+
// $0.15/$0.60 - cheapest capable
|
|
1268
|
+
fallback: ["deepseek/deepseek-chat", "nvidia/gpt-oss-120b", "minimax/minimax-m2.5"]
|
|
1280
1269
|
},
|
|
1281
1270
|
COMPLEX: {
|
|
1282
|
-
primary: "
|
|
1283
|
-
// $0.
|
|
1284
|
-
fallback: [
|
|
1285
|
-
"minimax/minimax-m2.5",
|
|
1286
|
-
// $0.30/$1.20 - cheap with reasoning
|
|
1287
|
-
"deepseek/deepseek-chat",
|
|
1288
|
-
"google/gemini-2.5-flash",
|
|
1289
|
-
"openai/gpt-4o-mini"
|
|
1290
|
-
]
|
|
1271
|
+
primary: "google/gemini-2.5-flash",
|
|
1272
|
+
// $0.15/$0.60 - 1M context handles complexity
|
|
1273
|
+
fallback: ["deepseek/deepseek-chat", "xai/grok-4-0709", "minimax/minimax-m2.5"]
|
|
1291
1274
|
},
|
|
1292
1275
|
REASONING: {
|
|
1293
|
-
primary: "
|
|
1294
|
-
// $0.
|
|
1295
|
-
fallback: ["deepseek/deepseek-reasoner", "
|
|
1276
|
+
primary: "xai/grok-4-1-fast-reasoning",
|
|
1277
|
+
// $0.20/$0.50 - was MORE expensive than AUTO!
|
|
1278
|
+
fallback: ["deepseek/deepseek-reasoner", "minimax/minimax-m2.5"]
|
|
1296
1279
|
}
|
|
1297
1280
|
},
|
|
1298
1281
|
// Premium tier configs - best quality (blockrun/premium)
|
|
@@ -1469,6 +1452,8 @@ var MODEL_ALIASES = {
|
|
|
1469
1452
|
// Claude - short names (backend uses bare model names without anthropic/ prefix)
|
|
1470
1453
|
claude: "claude-sonnet-4",
|
|
1471
1454
|
sonnet: "claude-sonnet-4",
|
|
1455
|
+
"sonnet-4.6": "claude-sonnet-4",
|
|
1456
|
+
"sonnet-4-6": "claude-sonnet-4",
|
|
1472
1457
|
opus: "claude-opus-4",
|
|
1473
1458
|
"opus-4": "claude-opus-4",
|
|
1474
1459
|
haiku: "claude-haiku-4.5",
|
|
@@ -1689,7 +1674,7 @@ var BLOCKRUN_MODELS = [
|
|
|
1689
1674
|
},
|
|
1690
1675
|
{
|
|
1691
1676
|
id: "claude-sonnet-4",
|
|
1692
|
-
name: "Claude Sonnet 4",
|
|
1677
|
+
name: "Claude Sonnet 4.6",
|
|
1693
1678
|
inputPrice: 3,
|
|
1694
1679
|
outputPrice: 15,
|
|
1695
1680
|
contextWindow: 2e5,
|
|
@@ -1699,7 +1684,7 @@ var BLOCKRUN_MODELS = [
|
|
|
1699
1684
|
},
|
|
1700
1685
|
{
|
|
1701
1686
|
id: "claude-opus-4",
|
|
1702
|
-
name: "Claude Opus 4",
|
|
1687
|
+
name: "Claude Opus 4.6",
|
|
1703
1688
|
inputPrice: 15,
|
|
1704
1689
|
outputPrice: 75,
|
|
1705
1690
|
contextWindow: 2e5,
|
|
@@ -4052,6 +4037,19 @@ function buildModelPricing() {
|
|
|
4052
4037
|
}
|
|
4053
4038
|
return map;
|
|
4054
4039
|
}
|
|
4040
|
+
function buildProxyModelList(createdAt = Math.floor(Date.now() / 1e3)) {
|
|
4041
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4042
|
+
return OPENCLAW_MODELS.filter((model) => {
|
|
4043
|
+
if (seen.has(model.id)) return false;
|
|
4044
|
+
seen.add(model.id);
|
|
4045
|
+
return true;
|
|
4046
|
+
}).map((model) => ({
|
|
4047
|
+
id: model.id,
|
|
4048
|
+
object: "model",
|
|
4049
|
+
created: createdAt,
|
|
4050
|
+
owned_by: model.id.includes("/") ? model.id.split("/")[0] ?? "blockrun" : "blockrun"
|
|
4051
|
+
}));
|
|
4052
|
+
}
|
|
4055
4053
|
function mergeRoutingConfig(overrides) {
|
|
4056
4054
|
if (!overrides) return DEFAULT_ROUTING_CONFIG;
|
|
4057
4055
|
return {
|
|
@@ -4177,12 +4175,7 @@ async function startProxy(options) {
|
|
|
4177
4175
|
return;
|
|
4178
4176
|
}
|
|
4179
4177
|
if (req.url === "/v1/models" && req.method === "GET") {
|
|
4180
|
-
const models =
|
|
4181
|
-
id: m.id,
|
|
4182
|
-
object: "model",
|
|
4183
|
-
created: Math.floor(Date.now() / 1e3),
|
|
4184
|
-
owned_by: m.id.split("/")[0] || "unknown"
|
|
4185
|
-
}));
|
|
4178
|
+
const models = buildProxyModelList();
|
|
4186
4179
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
4187
4180
|
res.end(JSON.stringify({ object: "list", data: models }));
|
|
4188
4181
|
return;
|
|
@@ -4483,10 +4476,12 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
4483
4476
|
console.log(
|
|
4484
4477
|
`[ClawRouter] Received model: "${parsed.model}" -> normalized: "${normalizedModel}"${wasAlias ? ` -> alias: "${resolvedModel}"` : ""}${routingProfile ? `, profile: ${routingProfile}` : ""}`
|
|
4485
4478
|
);
|
|
4486
|
-
if (
|
|
4487
|
-
parsed.model
|
|
4479
|
+
if (!isRoutingProfile) {
|
|
4480
|
+
if (parsed.model !== resolvedModel) {
|
|
4481
|
+
parsed.model = resolvedModel;
|
|
4482
|
+
bodyModified = true;
|
|
4483
|
+
}
|
|
4488
4484
|
modelId = resolvedModel;
|
|
4489
|
-
bodyModified = true;
|
|
4490
4485
|
}
|
|
4491
4486
|
if (isRoutingProfile) {
|
|
4492
4487
|
if (routingProfile === "free") {
|
|
@@ -4996,9 +4991,11 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
4996
4991
|
body: responseBody,
|
|
4997
4992
|
status: upstream.status,
|
|
4998
4993
|
headers: responseHeaders,
|
|
4999
|
-
model:
|
|
4994
|
+
model: actualModelUsed
|
|
5000
4995
|
});
|
|
5001
|
-
console.log(
|
|
4996
|
+
console.log(
|
|
4997
|
+
`[ClawRouter] Cached response for ${actualModelUsed} (${responseBody.length} bytes)`
|
|
4998
|
+
);
|
|
5002
4999
|
}
|
|
5003
5000
|
try {
|
|
5004
5001
|
const rspJson = JSON.parse(responseBody.toString());
|