@blockrun/clawrouter 0.9.38 → 0.10.0

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 CHANGED
@@ -1199,10 +1199,10 @@ var DEFAULT_ROUTING_CONFIG = {
1199
1199
  tiers: {
1200
1200
  SIMPLE: {
1201
1201
  primary: "moonshot/kimi-k2.5",
1202
- // $0.50/$2.40 - best quality/price for simple tasks
1202
+ // $0.60/$3.00 - best quality/price for simple tasks
1203
1203
  fallback: [
1204
- "google/gemini-2.5-flash",
1205
- // 1M context, cost-effective
1204
+ "google/gemini-2.5-flash-lite",
1205
+ // 1M context, ultra cheap ($0.10/$0.40)
1206
1206
  "nvidia/gpt-oss-120b",
1207
1207
  // FREE fallback
1208
1208
  "deepseek/deepseek-chat"
@@ -1212,26 +1212,28 @@ var DEFAULT_ROUTING_CONFIG = {
1212
1212
  primary: "xai/grok-code-fast-1",
1213
1213
  // Code specialist, $0.20/$1.50
1214
1214
  fallback: [
1215
- "google/gemini-2.5-flash",
1216
- // 1M context, cost-effective
1215
+ "google/gemini-2.5-flash-lite",
1216
+ // 1M context, ultra cheap ($0.10/$0.40)
1217
1217
  "deepseek/deepseek-chat",
1218
1218
  "xai/grok-4-1-fast-non-reasoning"
1219
1219
  // Upgraded Grok 4.1
1220
1220
  ]
1221
1221
  },
1222
1222
  COMPLEX: {
1223
- primary: "google/gemini-3-pro-preview",
1224
- // Latest Gemini - upgraded from 2.5
1223
+ primary: "google/gemini-3.1-pro-preview",
1224
+ // Newest Gemini 3.1 - upgraded from 3.0
1225
1225
  fallback: [
1226
- "google/gemini-2.5-flash",
1227
- // CRITICAL: 1M context, cheap failsafe before expensive models
1226
+ "google/gemini-2.5-flash-lite",
1227
+ // CRITICAL: 1M context, ultra-cheap failsafe ($0.10/$0.40)
1228
+ "google/gemini-3-pro-preview",
1229
+ // 3.0 fallback
1228
1230
  "google/gemini-2.5-pro",
1229
1231
  "deepseek/deepseek-chat",
1230
1232
  "xai/grok-4-0709",
1231
1233
  "openai/gpt-5.2",
1232
1234
  // Newer and cheaper input than gpt-4o
1233
1235
  "openai/gpt-4o",
1234
- "claude-sonnet-4"
1236
+ "anthropic/claude-sonnet-4.6"
1235
1237
  ]
1236
1238
  },
1237
1239
  REASONING: {
@@ -1251,17 +1253,17 @@ var DEFAULT_ROUTING_CONFIG = {
1251
1253
  SIMPLE: {
1252
1254
  primary: "nvidia/gpt-oss-120b",
1253
1255
  // FREE! $0.00/$0.00
1254
- fallback: ["google/gemini-2.5-flash", "deepseek/deepseek-chat"]
1256
+ fallback: ["google/gemini-2.5-flash-lite", "deepseek/deepseek-chat"]
1255
1257
  },
1256
1258
  MEDIUM: {
1257
- primary: "google/gemini-2.5-flash",
1258
- // $0.15/$0.60 - cheapest capable
1259
+ primary: "google/gemini-2.5-flash-lite",
1260
+ // $0.10/$0.40 - cheapest capable with 1M context
1259
1261
  fallback: ["deepseek/deepseek-chat", "nvidia/gpt-oss-120b"]
1260
1262
  },
1261
1263
  COMPLEX: {
1262
- primary: "google/gemini-2.5-flash",
1263
- // $0.15/$0.60 - 1M context handles complexity
1264
- fallback: ["deepseek/deepseek-chat", "xai/grok-4-0709"]
1264
+ primary: "google/gemini-2.5-flash-lite",
1265
+ // $0.10/$0.40 - 1M context handles complexity
1266
+ fallback: ["google/gemini-2.5-flash", "deepseek/deepseek-chat", "xai/grok-4-0709"]
1265
1267
  },
1266
1268
  REASONING: {
1267
1269
  primary: "xai/grok-4-1-fast-reasoning",
@@ -1274,8 +1276,8 @@ var DEFAULT_ROUTING_CONFIG = {
1274
1276
  premiumTiers: {
1275
1277
  SIMPLE: {
1276
1278
  primary: "moonshot/kimi-k2.5",
1277
- // $0.50/$2.40 - good for simple coding
1278
- fallback: ["claude-haiku-4.5", "google/gemini-2.5-flash", "xai/grok-code-fast-1"]
1279
+ // $0.60/$3.00 - good for simple coding
1280
+ fallback: ["anthropic/claude-haiku-4.5", "google/gemini-2.5-flash-lite", "xai/grok-code-fast-1"]
1279
1281
  },
1280
1282
  MEDIUM: {
1281
1283
  primary: "openai/gpt-5.2-codex",
@@ -1284,26 +1286,28 @@ var DEFAULT_ROUTING_CONFIG = {
1284
1286
  "moonshot/kimi-k2.5",
1285
1287
  "google/gemini-2.5-pro",
1286
1288
  "xai/grok-4-0709",
1287
- "claude-sonnet-4"
1289
+ "anthropic/claude-sonnet-4.6"
1288
1290
  ]
1289
1291
  },
1290
1292
  COMPLEX: {
1291
- primary: "claude-opus-4",
1293
+ primary: "anthropic/claude-opus-4.6",
1292
1294
  // Best quality for complex tasks
1293
1295
  fallback: [
1294
1296
  "openai/gpt-5.2-codex",
1295
- "claude-opus-4",
1296
- "claude-sonnet-4",
1297
+ "anthropic/claude-opus-4.6",
1298
+ "anthropic/claude-sonnet-4.6",
1299
+ "google/gemini-3.1-pro-preview",
1300
+ // Newest Gemini
1297
1301
  "google/gemini-3-pro-preview",
1298
1302
  "moonshot/kimi-k2.5"
1299
1303
  ]
1300
1304
  },
1301
1305
  REASONING: {
1302
- primary: "claude-sonnet-4",
1306
+ primary: "anthropic/claude-sonnet-4.6",
1303
1307
  // $3/$15 - best for reasoning/instructions
1304
1308
  fallback: [
1305
- "claude-opus-4",
1306
- "claude-opus-4",
1309
+ "anthropic/claude-opus-4.6",
1310
+ "anthropic/claude-opus-4.6",
1307
1311
  "openai/o4-mini",
1308
1312
  // Newer and cheaper than o3 ($1.10 vs $2.00)
1309
1313
  "openai/o3",
@@ -1316,39 +1320,29 @@ var DEFAULT_ROUTING_CONFIG = {
1316
1320
  SIMPLE: {
1317
1321
  primary: "moonshot/kimi-k2.5",
1318
1322
  // Cheaper than Haiku ($0.5/$2.4 vs $1/$5), larger context
1319
- fallback: [
1320
- "claude-haiku-4.5",
1321
- "xai/grok-4-1-fast-non-reasoning",
1322
- "openai/gpt-4o-mini"
1323
- ]
1323
+ fallback: ["anthropic/claude-haiku-4.5", "xai/grok-4-1-fast-non-reasoning", "openai/gpt-4o-mini"]
1324
1324
  },
1325
1325
  MEDIUM: {
1326
1326
  primary: "xai/grok-code-fast-1",
1327
1327
  // Code specialist for agentic coding
1328
- fallback: [
1329
- "moonshot/kimi-k2.5",
1330
- "claude-haiku-4.5",
1331
- "claude-sonnet-4"
1332
- ]
1328
+ fallback: ["moonshot/kimi-k2.5", "anthropic/claude-haiku-4.5", "claude-sonnet-4"]
1333
1329
  },
1334
1330
  COMPLEX: {
1335
- primary: "claude-sonnet-4",
1331
+ primary: "anthropic/claude-sonnet-4.6",
1336
1332
  fallback: [
1337
- "claude-opus-4",
1333
+ "anthropic/claude-opus-4.6",
1338
1334
  // Latest Opus - best agentic
1339
1335
  "openai/gpt-5.2",
1336
+ "google/gemini-3.1-pro-preview",
1337
+ // Newest Gemini
1340
1338
  "google/gemini-3-pro-preview",
1341
1339
  "xai/grok-4-0709"
1342
1340
  ]
1343
1341
  },
1344
1342
  REASONING: {
1345
- primary: "claude-sonnet-4",
1343
+ primary: "anthropic/claude-sonnet-4.6",
1346
1344
  // Strong tool use + reasoning for agentic tasks
1347
- fallback: [
1348
- "claude-opus-4",
1349
- "xai/grok-4-1-fast-reasoning",
1350
- "deepseek/deepseek-reasoner"
1351
- ]
1345
+ fallback: ["anthropic/claude-opus-4.6", "xai/grok-4-1-fast-reasoning", "deepseek/deepseek-reasoner"]
1352
1346
  }
1353
1347
  },
1354
1348
  overrides: {
@@ -1432,35 +1426,37 @@ function route(prompt, systemPrompt, maxOutputTokens, options) {
1432
1426
 
1433
1427
  // src/models.ts
1434
1428
  var MODEL_ALIASES = {
1435
- // Claude - short names (backend uses bare model names without anthropic/ prefix)
1436
- claude: "claude-sonnet-4",
1437
- sonnet: "claude-sonnet-4",
1438
- "sonnet-4.6": "claude-sonnet-4",
1439
- "sonnet-4-6": "claude-sonnet-4",
1440
- opus: "claude-opus-4",
1441
- "opus-4": "claude-opus-4",
1442
- haiku: "claude-haiku-4.5",
1429
+ // Claude - use newest versions (4.6)
1430
+ claude: "anthropic/claude-sonnet-4.6",
1431
+ sonnet: "anthropic/claude-sonnet-4.6",
1432
+ "sonnet-4": "anthropic/claude-sonnet-4.6",
1433
+ "sonnet-4.6": "anthropic/claude-sonnet-4.6",
1434
+ "sonnet-4-6": "anthropic/claude-sonnet-4.6",
1435
+ opus: "anthropic/claude-opus-4.6",
1436
+ "opus-4": "anthropic/claude-opus-4.6",
1437
+ "opus-4.6": "anthropic/claude-opus-4.6",
1438
+ "opus-4-6": "anthropic/claude-opus-4.6",
1439
+ haiku: "anthropic/claude-haiku-4.5",
1443
1440
  // Claude - provider/shortname patterns (common in agent frameworks)
1444
- "anthropic/sonnet": "claude-sonnet-4",
1445
- "anthropic/opus": "claude-opus-4",
1446
- "anthropic/haiku": "claude-haiku-4.5",
1447
- "anthropic/claude": "claude-sonnet-4",
1448
- // Backward compatibility - various formats all route to backend names
1449
- "anthropic/claude-sonnet-4": "claude-sonnet-4",
1450
- "anthropic/claude-sonnet-4-6": "claude-sonnet-4",
1451
- "anthropic/claude-sonnet-4.6": "claude-sonnet-4",
1452
- "anthropic/claude-opus-4": "claude-opus-4",
1453
- "anthropic/claude-opus-4-6": "claude-opus-4",
1454
- "anthropic/claude-opus-4.6": "claude-opus-4",
1455
- "anthropic/claude-haiku-4": "claude-haiku-4.5",
1456
- "anthropic/claude-haiku-4-5": "claude-haiku-4.5",
1457
- "anthropic/claude-haiku-4.5": "claude-haiku-4.5",
1441
+ "anthropic/sonnet": "anthropic/claude-sonnet-4.6",
1442
+ "anthropic/opus": "anthropic/claude-opus-4.6",
1443
+ "anthropic/haiku": "anthropic/claude-haiku-4.5",
1444
+ "anthropic/claude": "anthropic/claude-sonnet-4.6",
1445
+ // Backward compatibility - map all variants to 4.6
1446
+ "anthropic/claude-sonnet-4": "anthropic/claude-sonnet-4.6",
1447
+ "anthropic/claude-sonnet-4-6": "anthropic/claude-sonnet-4.6",
1448
+ "anthropic/claude-opus-4": "anthropic/claude-opus-4.6",
1449
+ "anthropic/claude-opus-4-6": "anthropic/claude-opus-4.6",
1450
+ "anthropic/claude-opus-4.5": "anthropic/claude-opus-4.6",
1451
+ "anthropic/claude-haiku-4": "anthropic/claude-haiku-4.5",
1452
+ "anthropic/claude-haiku-4-5": "anthropic/claude-haiku-4.5",
1458
1453
  // OpenAI
1459
1454
  gpt: "openai/gpt-4o",
1460
1455
  gpt4: "openai/gpt-4o",
1461
1456
  gpt5: "openai/gpt-5.2",
1462
1457
  codex: "openai/gpt-5.2-codex",
1463
1458
  mini: "openai/gpt-4o-mini",
1459
+ o1: "openai/o1",
1464
1460
  o3: "openai/o3",
1465
1461
  // DeepSeek
1466
1462
  deepseek: "deepseek/deepseek-chat",
@@ -1536,6 +1532,7 @@ var BLOCKRUN_MODELS = [
1536
1532
  {
1537
1533
  id: "openai/gpt-5.2",
1538
1534
  name: "GPT-5.2",
1535
+ version: "5.2",
1539
1536
  inputPrice: 1.75,
1540
1537
  outputPrice: 14,
1541
1538
  contextWindow: 4e5,
@@ -1547,6 +1544,7 @@ var BLOCKRUN_MODELS = [
1547
1544
  {
1548
1545
  id: "openai/gpt-5-mini",
1549
1546
  name: "GPT-5 Mini",
1547
+ version: "5.0",
1550
1548
  inputPrice: 0.25,
1551
1549
  outputPrice: 2,
1552
1550
  contextWindow: 2e5,
@@ -1555,6 +1553,7 @@ var BLOCKRUN_MODELS = [
1555
1553
  {
1556
1554
  id: "openai/gpt-5-nano",
1557
1555
  name: "GPT-5 Nano",
1556
+ version: "5.0",
1558
1557
  inputPrice: 0.05,
1559
1558
  outputPrice: 0.4,
1560
1559
  contextWindow: 128e3,
@@ -1563,6 +1562,7 @@ var BLOCKRUN_MODELS = [
1563
1562
  {
1564
1563
  id: "openai/gpt-5.2-pro",
1565
1564
  name: "GPT-5.2 Pro",
1565
+ version: "5.2",
1566
1566
  inputPrice: 21,
1567
1567
  outputPrice: 168,
1568
1568
  contextWindow: 4e5,
@@ -1573,8 +1573,9 @@ var BLOCKRUN_MODELS = [
1573
1573
  {
1574
1574
  id: "openai/gpt-5.2-codex",
1575
1575
  name: "GPT-5.2 Codex",
1576
- inputPrice: 2.5,
1577
- outputPrice: 12,
1576
+ version: "5.2",
1577
+ inputPrice: 1.75,
1578
+ outputPrice: 14,
1578
1579
  contextWindow: 128e3,
1579
1580
  maxOutput: 32e3,
1580
1581
  agentic: true
@@ -1583,6 +1584,7 @@ var BLOCKRUN_MODELS = [
1583
1584
  {
1584
1585
  id: "openai/gpt-4.1",
1585
1586
  name: "GPT-4.1",
1587
+ version: "4.1",
1586
1588
  inputPrice: 2,
1587
1589
  outputPrice: 8,
1588
1590
  contextWindow: 128e3,
@@ -1592,15 +1594,25 @@ var BLOCKRUN_MODELS = [
1592
1594
  {
1593
1595
  id: "openai/gpt-4.1-mini",
1594
1596
  name: "GPT-4.1 Mini",
1597
+ version: "4.1",
1595
1598
  inputPrice: 0.4,
1596
1599
  outputPrice: 1.6,
1597
1600
  contextWindow: 128e3,
1598
1601
  maxOutput: 16384
1599
1602
  },
1600
- // gpt-4.1-nano removed - replaced by gpt-5-nano
1603
+ {
1604
+ id: "openai/gpt-4.1-nano",
1605
+ name: "GPT-4.1 Nano",
1606
+ version: "4.1",
1607
+ inputPrice: 0.1,
1608
+ outputPrice: 0.4,
1609
+ contextWindow: 128e3,
1610
+ maxOutput: 16384
1611
+ },
1601
1612
  {
1602
1613
  id: "openai/gpt-4o",
1603
1614
  name: "GPT-4o",
1615
+ version: "4o",
1604
1616
  inputPrice: 2.5,
1605
1617
  outputPrice: 10,
1606
1618
  contextWindow: 128e3,
@@ -1611,15 +1623,37 @@ var BLOCKRUN_MODELS = [
1611
1623
  {
1612
1624
  id: "openai/gpt-4o-mini",
1613
1625
  name: "GPT-4o Mini",
1626
+ version: "4o-mini",
1614
1627
  inputPrice: 0.15,
1615
1628
  outputPrice: 0.6,
1616
1629
  contextWindow: 128e3,
1617
1630
  maxOutput: 16384
1618
1631
  },
1619
- // OpenAI O-series (Reasoning) - o1/o1-mini removed, replaced by o3/o4
1632
+ // OpenAI O-series (Reasoning)
1633
+ {
1634
+ id: "openai/o1",
1635
+ name: "o1",
1636
+ version: "1",
1637
+ inputPrice: 15,
1638
+ outputPrice: 60,
1639
+ contextWindow: 2e5,
1640
+ maxOutput: 1e5,
1641
+ reasoning: true
1642
+ },
1643
+ {
1644
+ id: "openai/o1-mini",
1645
+ name: "o1-mini",
1646
+ version: "1-mini",
1647
+ inputPrice: 1.1,
1648
+ outputPrice: 4.4,
1649
+ contextWindow: 128e3,
1650
+ maxOutput: 65536,
1651
+ reasoning: true
1652
+ },
1620
1653
  {
1621
1654
  id: "openai/o3",
1622
1655
  name: "o3",
1656
+ version: "3",
1623
1657
  inputPrice: 2,
1624
1658
  outputPrice: 8,
1625
1659
  contextWindow: 2e5,
@@ -1629,6 +1663,7 @@ var BLOCKRUN_MODELS = [
1629
1663
  {
1630
1664
  id: "openai/o3-mini",
1631
1665
  name: "o3-mini",
1666
+ version: "3-mini",
1632
1667
  inputPrice: 1.1,
1633
1668
  outputPrice: 4.4,
1634
1669
  contextWindow: 128e3,
@@ -1638,6 +1673,7 @@ var BLOCKRUN_MODELS = [
1638
1673
  {
1639
1674
  id: "openai/o4-mini",
1640
1675
  name: "o4-mini",
1676
+ version: "4-mini",
1641
1677
  inputPrice: 1.1,
1642
1678
  outputPrice: 4.4,
1643
1679
  contextWindow: 128e3,
@@ -1645,10 +1681,11 @@ var BLOCKRUN_MODELS = [
1645
1681
  reasoning: true
1646
1682
  },
1647
1683
  // Anthropic - all Claude models excel at agentic workflows
1648
- // Backend uses bare model names (claude-sonnet-4, not anthropic/claude-sonnet-4-6)
1684
+ // Use newest versions (4.6) with full provider prefix
1649
1685
  {
1650
- id: "claude-haiku-4.5",
1686
+ id: "anthropic/claude-haiku-4.5",
1651
1687
  name: "Claude Haiku 4.5",
1688
+ version: "4.5",
1652
1689
  inputPrice: 1,
1653
1690
  outputPrice: 5,
1654
1691
  contextWindow: 2e5,
@@ -1656,8 +1693,9 @@ var BLOCKRUN_MODELS = [
1656
1693
  agentic: true
1657
1694
  },
1658
1695
  {
1659
- id: "claude-sonnet-4",
1696
+ id: "anthropic/claude-sonnet-4.6",
1660
1697
  name: "Claude Sonnet 4.6",
1698
+ version: "4.6",
1661
1699
  inputPrice: 3,
1662
1700
  outputPrice: 15,
1663
1701
  contextWindow: 2e5,
@@ -1666,19 +1704,32 @@ var BLOCKRUN_MODELS = [
1666
1704
  agentic: true
1667
1705
  },
1668
1706
  {
1669
- id: "claude-opus-4",
1707
+ id: "anthropic/claude-opus-4.6",
1670
1708
  name: "Claude Opus 4.6",
1671
- inputPrice: 15,
1672
- outputPrice: 75,
1709
+ version: "4.6",
1710
+ inputPrice: 5,
1711
+ outputPrice: 25,
1673
1712
  contextWindow: 2e5,
1674
1713
  maxOutput: 32e3,
1675
1714
  reasoning: true,
1676
1715
  agentic: true
1677
1716
  },
1678
1717
  // Google
1718
+ {
1719
+ id: "google/gemini-3.1-pro-preview",
1720
+ name: "Gemini 3.1 Pro Preview",
1721
+ version: "3.1",
1722
+ inputPrice: 2,
1723
+ outputPrice: 12,
1724
+ contextWindow: 105e4,
1725
+ maxOutput: 65536,
1726
+ reasoning: true,
1727
+ vision: true
1728
+ },
1679
1729
  {
1680
1730
  id: "google/gemini-3-pro-preview",
1681
1731
  name: "Gemini 3 Pro Preview",
1732
+ version: "3.0",
1682
1733
  inputPrice: 2,
1683
1734
  outputPrice: 12,
1684
1735
  contextWindow: 105e4,
@@ -1686,9 +1737,20 @@ var BLOCKRUN_MODELS = [
1686
1737
  reasoning: true,
1687
1738
  vision: true
1688
1739
  },
1740
+ {
1741
+ id: "google/gemini-3-flash-preview",
1742
+ name: "Gemini 3 Flash Preview",
1743
+ version: "3.0",
1744
+ inputPrice: 0.5,
1745
+ outputPrice: 3,
1746
+ contextWindow: 1e6,
1747
+ maxOutput: 65536,
1748
+ vision: true
1749
+ },
1689
1750
  {
1690
1751
  id: "google/gemini-2.5-pro",
1691
1752
  name: "Gemini 2.5 Pro",
1753
+ version: "2.5",
1692
1754
  inputPrice: 1.25,
1693
1755
  outputPrice: 10,
1694
1756
  contextWindow: 105e4,
@@ -1699,8 +1761,18 @@ var BLOCKRUN_MODELS = [
1699
1761
  {
1700
1762
  id: "google/gemini-2.5-flash",
1701
1763
  name: "Gemini 2.5 Flash",
1702
- inputPrice: 0.15,
1703
- outputPrice: 0.6,
1764
+ version: "2.5",
1765
+ inputPrice: 0.3,
1766
+ outputPrice: 2.5,
1767
+ contextWindow: 1e6,
1768
+ maxOutput: 65536
1769
+ },
1770
+ {
1771
+ id: "google/gemini-2.5-flash-lite",
1772
+ name: "Gemini 2.5 Flash Lite",
1773
+ version: "2.5",
1774
+ inputPrice: 0.1,
1775
+ outputPrice: 0.4,
1704
1776
  contextWindow: 1e6,
1705
1777
  maxOutput: 65536
1706
1778
  },
@@ -1708,6 +1780,7 @@ var BLOCKRUN_MODELS = [
1708
1780
  {
1709
1781
  id: "deepseek/deepseek-chat",
1710
1782
  name: "DeepSeek V3.2 Chat",
1783
+ version: "3.2",
1711
1784
  inputPrice: 0.28,
1712
1785
  outputPrice: 0.42,
1713
1786
  contextWindow: 128e3,
@@ -1716,6 +1789,7 @@ var BLOCKRUN_MODELS = [
1716
1789
  {
1717
1790
  id: "deepseek/deepseek-reasoner",
1718
1791
  name: "DeepSeek V3.2 Reasoner",
1792
+ version: "3.2",
1719
1793
  inputPrice: 0.28,
1720
1794
  outputPrice: 0.42,
1721
1795
  contextWindow: 128e3,
@@ -1726,8 +1800,9 @@ var BLOCKRUN_MODELS = [
1726
1800
  {
1727
1801
  id: "moonshot/kimi-k2.5",
1728
1802
  name: "Kimi K2.5",
1729
- inputPrice: 0.5,
1730
- outputPrice: 2.4,
1803
+ version: "k2.5",
1804
+ inputPrice: 0.6,
1805
+ outputPrice: 3,
1731
1806
  contextWindow: 262144,
1732
1807
  maxOutput: 8192,
1733
1808
  reasoning: true,
@@ -1738,6 +1813,7 @@ var BLOCKRUN_MODELS = [
1738
1813
  {
1739
1814
  id: "xai/grok-3",
1740
1815
  name: "Grok 3",
1816
+ version: "3",
1741
1817
  inputPrice: 3,
1742
1818
  outputPrice: 15,
1743
1819
  contextWindow: 131072,
@@ -1748,6 +1824,7 @@ var BLOCKRUN_MODELS = [
1748
1824
  {
1749
1825
  id: "xai/grok-3-mini",
1750
1826
  name: "Grok 3 Mini",
1827
+ version: "3-mini",
1751
1828
  inputPrice: 0.3,
1752
1829
  outputPrice: 0.5,
1753
1830
  contextWindow: 131072,
@@ -1757,6 +1834,7 @@ var BLOCKRUN_MODELS = [
1757
1834
  {
1758
1835
  id: "xai/grok-4-fast-reasoning",
1759
1836
  name: "Grok 4 Fast Reasoning",
1837
+ version: "4",
1760
1838
  inputPrice: 0.2,
1761
1839
  outputPrice: 0.5,
1762
1840
  contextWindow: 131072,
@@ -1766,6 +1844,7 @@ var BLOCKRUN_MODELS = [
1766
1844
  {
1767
1845
  id: "xai/grok-4-fast-non-reasoning",
1768
1846
  name: "Grok 4 Fast",
1847
+ version: "4",
1769
1848
  inputPrice: 0.2,
1770
1849
  outputPrice: 0.5,
1771
1850
  contextWindow: 131072,
@@ -1774,6 +1853,7 @@ var BLOCKRUN_MODELS = [
1774
1853
  {
1775
1854
  id: "xai/grok-4-1-fast-reasoning",
1776
1855
  name: "Grok 4.1 Fast Reasoning",
1856
+ version: "4.1",
1777
1857
  inputPrice: 0.2,
1778
1858
  outputPrice: 0.5,
1779
1859
  contextWindow: 131072,
@@ -1783,6 +1863,7 @@ var BLOCKRUN_MODELS = [
1783
1863
  {
1784
1864
  id: "xai/grok-4-1-fast-non-reasoning",
1785
1865
  name: "Grok 4.1 Fast",
1866
+ version: "4.1",
1786
1867
  inputPrice: 0.2,
1787
1868
  outputPrice: 0.5,
1788
1869
  contextWindow: 131072,
@@ -1791,6 +1872,7 @@ var BLOCKRUN_MODELS = [
1791
1872
  {
1792
1873
  id: "xai/grok-code-fast-1",
1793
1874
  name: "Grok Code Fast",
1875
+ version: "1",
1794
1876
  inputPrice: 0.2,
1795
1877
  outputPrice: 1.5,
1796
1878
  contextWindow: 131072,
@@ -1801,17 +1883,28 @@ var BLOCKRUN_MODELS = [
1801
1883
  {
1802
1884
  id: "xai/grok-4-0709",
1803
1885
  name: "Grok 4 (0709)",
1886
+ version: "4-0709",
1804
1887
  inputPrice: 0.2,
1805
1888
  outputPrice: 1.5,
1806
1889
  contextWindow: 131072,
1807
1890
  maxOutput: 16384,
1808
1891
  reasoning: true
1809
1892
  },
1810
- // grok-2-vision removed - old, 0 transactions
1893
+ {
1894
+ id: "xai/grok-2-vision",
1895
+ name: "Grok 2 Vision",
1896
+ version: "2",
1897
+ inputPrice: 2,
1898
+ outputPrice: 10,
1899
+ contextWindow: 131072,
1900
+ maxOutput: 16384,
1901
+ vision: true
1902
+ },
1811
1903
  // MiniMax
1812
1904
  {
1813
1905
  id: "minimax/minimax-m2.5",
1814
1906
  name: "MiniMax M2.5",
1907
+ version: "m2.5",
1815
1908
  inputPrice: 0.3,
1816
1909
  outputPrice: 1.2,
1817
1910
  contextWindow: 204800,
@@ -1823,6 +1916,7 @@ var BLOCKRUN_MODELS = [
1823
1916
  {
1824
1917
  id: "nvidia/gpt-oss-120b",
1825
1918
  name: "NVIDIA GPT-OSS 120B",
1919
+ version: "120b",
1826
1920
  inputPrice: 0,
1827
1921
  outputPrice: 0,
1828
1922
  contextWindow: 128e3,
@@ -1831,6 +1925,7 @@ var BLOCKRUN_MODELS = [
1831
1925
  {
1832
1926
  id: "nvidia/kimi-k2.5",
1833
1927
  name: "NVIDIA Kimi K2.5",
1928
+ version: "k2.5",
1834
1929
  inputPrice: 0.55,
1835
1930
  outputPrice: 2.5,
1836
1931
  contextWindow: 262144,
@@ -1896,7 +1991,23 @@ async function logUsage(entry) {
1896
1991
  }
1897
1992
 
1898
1993
  // src/stats.ts
1899
- import { readFile, readdir } from "fs/promises";
1994
+ import { readdir } from "fs/promises";
1995
+
1996
+ // src/fs-read.ts
1997
+ import { open } from "fs/promises";
1998
+ import { openSync, readSync, closeSync, fstatSync } from "fs";
1999
+ async function readTextFile(filePath) {
2000
+ const fh = await open(filePath, "r");
2001
+ try {
2002
+ const buf = Buffer.alloc((await fh.stat()).size);
2003
+ await fh.read(buf, 0, buf.length, 0);
2004
+ return buf.toString("utf-8");
2005
+ } finally {
2006
+ await fh.close();
2007
+ }
2008
+ }
2009
+
2010
+ // src/stats.ts
1900
2011
  import { join as join3 } from "path";
1901
2012
  import { homedir as homedir2 } from "os";
1902
2013
 
@@ -1915,7 +2026,7 @@ var USER_AGENT = `clawrouter/${VERSION}`;
1915
2026
  var LOG_DIR2 = join3(homedir2(), ".openclaw", "blockrun", "logs");
1916
2027
  async function parseLogFile(filePath) {
1917
2028
  try {
1918
- const content = await readFile(filePath, "utf-8");
2029
+ const content = await readTextFile(filePath);
1919
2030
  const lines = content.trim().split("\n").filter(Boolean);
1920
2031
  return lines.map((line) => {
1921
2032
  const entry = JSON.parse(line);
@@ -5064,7 +5175,7 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
5064
5175
  }
5065
5176
 
5066
5177
  // src/auth.ts
5067
- import { writeFile, readFile as readFile2, mkdir as mkdir2 } from "fs/promises";
5178
+ import { writeFile, mkdir as mkdir2 } from "fs/promises";
5068
5179
  import { join as join4 } from "path";
5069
5180
  import { homedir as homedir3 } from "os";
5070
5181
  import { generatePrivateKey, privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
@@ -5072,7 +5183,7 @@ var WALLET_DIR = join4(homedir3(), ".openclaw", "blockrun");
5072
5183
  var WALLET_FILE = join4(WALLET_DIR, "wallet.key");
5073
5184
  async function loadSavedWallet() {
5074
5185
  try {
5075
- const key = (await readFile2(WALLET_FILE, "utf-8")).trim();
5186
+ const key = (await readTextFile(WALLET_FILE)).trim();
5076
5187
  if (key.startsWith("0x") && key.length === 66) {
5077
5188
  console.log(`[ClawRouter] \u2713 Loaded existing wallet from ${WALLET_FILE}`);
5078
5189
  return key;
@@ -5093,7 +5204,7 @@ async function generateAndSaveWallet() {
5093
5204
  await mkdir2(WALLET_DIR, { recursive: true });
5094
5205
  await writeFile(WALLET_FILE, key + "\n", { mode: 384 });
5095
5206
  try {
5096
- const verification = (await readFile2(WALLET_FILE, "utf-8")).trim();
5207
+ const verification = (await readTextFile(WALLET_FILE)).trim();
5097
5208
  if (verification !== key) {
5098
5209
  throw new Error("Wallet file verification failed - content mismatch");
5099
5210
  }