@blockrun/clawrouter 0.9.19 → 0.9.21
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 +2 -2
- package/dist/cli.js +178 -53
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.js +185 -54
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/reinstall.sh +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -667,16 +667,16 @@ declare const blockrunProvider: ProviderPlugin;
|
|
|
667
667
|
|
|
668
668
|
/**
|
|
669
669
|
* Model aliases for convenient shorthand access.
|
|
670
|
-
* Users can type `/model claude` instead of `/model blockrun/anthropic/claude-sonnet-4`.
|
|
670
|
+
* Users can type `/model claude` instead of `/model blockrun/anthropic/claude-sonnet-4.6`.
|
|
671
671
|
*/
|
|
672
672
|
declare const MODEL_ALIASES: Record<string, string>;
|
|
673
673
|
/**
|
|
674
674
|
* Resolve a model alias to its full model ID.
|
|
675
675
|
* Also strips "blockrun/" prefix for direct model paths.
|
|
676
676
|
* Examples:
|
|
677
|
-
* - "claude" -> "anthropic/claude-sonnet-4" (alias)
|
|
678
|
-
* - "blockrun/claude" -> "anthropic/claude-sonnet-4" (alias with prefix)
|
|
679
|
-
* - "blockrun/anthropic/claude-sonnet-4" -> "anthropic/claude-sonnet-4" (prefix stripped)
|
|
677
|
+
* - "claude" -> "anthropic/claude-sonnet-4.6" (alias)
|
|
678
|
+
* - "blockrun/claude" -> "anthropic/claude-sonnet-4.6" (alias with prefix)
|
|
679
|
+
* - "blockrun/anthropic/claude-sonnet-4.6" -> "anthropic/claude-sonnet-4.6" (prefix stripped)
|
|
680
680
|
* - "openai/gpt-4o" -> "openai/gpt-4o" (unchanged)
|
|
681
681
|
*/
|
|
682
682
|
declare function resolveModelAlias(model: string): string;
|
|
@@ -793,6 +793,8 @@ type CachedPaymentParams = {
|
|
|
793
793
|
version?: string;
|
|
794
794
|
};
|
|
795
795
|
maxTimeoutSeconds?: number;
|
|
796
|
+
resourceUrl?: string;
|
|
797
|
+
resourceDescription?: string;
|
|
796
798
|
cachedAt: number;
|
|
797
799
|
};
|
|
798
800
|
declare class PaymentCache {
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
// src/models.ts
|
|
2
2
|
var MODEL_ALIASES = {
|
|
3
3
|
// Claude - short names
|
|
4
|
-
claude: "anthropic/claude-sonnet-4",
|
|
5
|
-
sonnet: "anthropic/claude-sonnet-4",
|
|
4
|
+
claude: "anthropic/claude-sonnet-4.6",
|
|
5
|
+
sonnet: "anthropic/claude-sonnet-4.6",
|
|
6
6
|
opus: "anthropic/claude-opus-4.6",
|
|
7
7
|
// Updated to latest Opus 4.6
|
|
8
8
|
"opus-46": "anthropic/claude-opus-4.6",
|
|
9
9
|
"opus-45": "anthropic/claude-opus-4.5",
|
|
10
10
|
haiku: "anthropic/claude-haiku-4.5",
|
|
11
11
|
// Claude - provider/shortname patterns (common in agent frameworks)
|
|
12
|
-
"anthropic/sonnet": "anthropic/claude-sonnet-4",
|
|
12
|
+
"anthropic/sonnet": "anthropic/claude-sonnet-4.6",
|
|
13
13
|
"anthropic/opus": "anthropic/claude-opus-4.6",
|
|
14
14
|
"anthropic/haiku": "anthropic/claude-haiku-4.5",
|
|
15
|
-
"anthropic/claude": "anthropic/claude-sonnet-4",
|
|
15
|
+
"anthropic/claude": "anthropic/claude-sonnet-4.6",
|
|
16
16
|
// OpenAI
|
|
17
17
|
gpt: "openai/gpt-4o",
|
|
18
18
|
gpt4: "openai/gpt-4o",
|
|
@@ -34,7 +34,9 @@ var MODEL_ALIASES = {
|
|
|
34
34
|
"grok-code": "xai/grok-code-fast-1",
|
|
35
35
|
// NVIDIA
|
|
36
36
|
nvidia: "nvidia/gpt-oss-120b",
|
|
37
|
-
"gpt-120b": "nvidia/gpt-oss-120b"
|
|
37
|
+
"gpt-120b": "nvidia/gpt-oss-120b",
|
|
38
|
+
// MiniMax
|
|
39
|
+
minimax: "minimax/minimax-m2.5"
|
|
38
40
|
// Note: auto, free, eco, premium are virtual routing profiles registered in BLOCKRUN_MODELS
|
|
39
41
|
// They don't need aliases since they're already top-level model IDs
|
|
40
42
|
};
|
|
@@ -208,8 +210,8 @@ var BLOCKRUN_MODELS = [
|
|
|
208
210
|
agentic: true
|
|
209
211
|
},
|
|
210
212
|
{
|
|
211
|
-
id: "anthropic/claude-sonnet-4",
|
|
212
|
-
name: "Claude Sonnet 4",
|
|
213
|
+
id: "anthropic/claude-sonnet-4.6",
|
|
214
|
+
name: "Claude Sonnet 4.6",
|
|
213
215
|
inputPrice: 3,
|
|
214
216
|
outputPrice: 15,
|
|
215
217
|
contextWindow: 2e5,
|
|
@@ -381,6 +383,17 @@ var BLOCKRUN_MODELS = [
|
|
|
381
383
|
reasoning: true
|
|
382
384
|
},
|
|
383
385
|
// grok-2-vision removed - old, 0 transactions
|
|
386
|
+
// MiniMax
|
|
387
|
+
{
|
|
388
|
+
id: "minimax/minimax-m2.5",
|
|
389
|
+
name: "MiniMax M2.5",
|
|
390
|
+
inputPrice: 0.3,
|
|
391
|
+
outputPrice: 1.2,
|
|
392
|
+
contextWindow: 204800,
|
|
393
|
+
maxOutput: 16384,
|
|
394
|
+
reasoning: true,
|
|
395
|
+
agentic: true
|
|
396
|
+
},
|
|
384
397
|
// NVIDIA - Free/cheap models
|
|
385
398
|
{
|
|
386
399
|
id: "nvidia/gpt-oss-120b",
|
|
@@ -514,13 +527,11 @@ var PaymentCache = class {
|
|
|
514
527
|
|
|
515
528
|
// src/x402.ts
|
|
516
529
|
var BASE_CHAIN_ID = 8453;
|
|
517
|
-
var
|
|
518
|
-
var
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
verifyingContract: USDC_BASE
|
|
523
|
-
};
|
|
530
|
+
var BASE_SEPOLIA_CHAIN_ID = 84532;
|
|
531
|
+
var DEFAULT_TOKEN_NAME = "USD Coin";
|
|
532
|
+
var DEFAULT_TOKEN_VERSION = "2";
|
|
533
|
+
var DEFAULT_NETWORK = "eip155:8453";
|
|
534
|
+
var DEFAULT_MAX_TIMEOUT_SECONDS = 300;
|
|
524
535
|
var TRANSFER_TYPES = {
|
|
525
536
|
TransferWithAuthorization: [
|
|
526
537
|
{ name: "from", type: "address" },
|
|
@@ -536,18 +547,78 @@ function createNonce() {
|
|
|
536
547
|
crypto.getRandomValues(bytes);
|
|
537
548
|
return `0x${Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("")}`;
|
|
538
549
|
}
|
|
539
|
-
function
|
|
540
|
-
const
|
|
550
|
+
function decodeBase64Json(value) {
|
|
551
|
+
const normalized = value.replace(/-/g, "+").replace(/_/g, "/");
|
|
552
|
+
const padding = (4 - normalized.length % 4) % 4;
|
|
553
|
+
const padded = normalized + "=".repeat(padding);
|
|
554
|
+
const decoded = Buffer.from(padded, "base64").toString("utf8");
|
|
541
555
|
return JSON.parse(decoded);
|
|
542
556
|
}
|
|
543
|
-
|
|
557
|
+
function encodeBase64Json(value) {
|
|
558
|
+
return Buffer.from(JSON.stringify(value), "utf8").toString("base64");
|
|
559
|
+
}
|
|
560
|
+
function parsePaymentRequired(headerValue) {
|
|
561
|
+
return decodeBase64Json(headerValue);
|
|
562
|
+
}
|
|
563
|
+
function normalizeNetwork(network) {
|
|
564
|
+
if (!network || network.trim().length === 0) {
|
|
565
|
+
return DEFAULT_NETWORK;
|
|
566
|
+
}
|
|
567
|
+
return network.trim().toLowerCase();
|
|
568
|
+
}
|
|
569
|
+
function resolveChainId(network) {
|
|
570
|
+
const eip155Match = network.match(/^eip155:(\d+)$/i);
|
|
571
|
+
if (eip155Match) {
|
|
572
|
+
const parsed = Number.parseInt(eip155Match[1], 10);
|
|
573
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
574
|
+
return parsed;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
if (network === "base") return BASE_CHAIN_ID;
|
|
578
|
+
if (network === "base-sepolia") return BASE_SEPOLIA_CHAIN_ID;
|
|
579
|
+
return BASE_CHAIN_ID;
|
|
580
|
+
}
|
|
581
|
+
function parseHexAddress(value) {
|
|
582
|
+
if (!value) return void 0;
|
|
583
|
+
const direct = value.match(/^0x[a-fA-F0-9]{40}$/);
|
|
584
|
+
if (direct) {
|
|
585
|
+
return direct[0];
|
|
586
|
+
}
|
|
587
|
+
const caipSuffix = value.match(/0x[a-fA-F0-9]{40}$/);
|
|
588
|
+
if (caipSuffix) {
|
|
589
|
+
return caipSuffix[0];
|
|
590
|
+
}
|
|
591
|
+
return void 0;
|
|
592
|
+
}
|
|
593
|
+
function requireHexAddress(value, field) {
|
|
594
|
+
const parsed = parseHexAddress(value);
|
|
595
|
+
if (!parsed) {
|
|
596
|
+
throw new Error(`Invalid ${field} in payment requirements: ${String(value)}`);
|
|
597
|
+
}
|
|
598
|
+
return parsed;
|
|
599
|
+
}
|
|
600
|
+
function setPaymentHeaders(headers, payload) {
|
|
601
|
+
headers.set("payment-signature", payload);
|
|
602
|
+
headers.set("x-payment", payload);
|
|
603
|
+
}
|
|
604
|
+
async function createPaymentPayload(privateKey, fromAddress, option, amount, requestUrl, resource) {
|
|
605
|
+
const network = normalizeNetwork(option.network);
|
|
606
|
+
const chainId = resolveChainId(network);
|
|
607
|
+
const recipient = requireHexAddress(option.payTo, "payTo");
|
|
608
|
+
const verifyingContract = requireHexAddress(option.asset, "asset");
|
|
609
|
+
const maxTimeoutSeconds = typeof option.maxTimeoutSeconds === "number" && option.maxTimeoutSeconds > 0 ? Math.floor(option.maxTimeoutSeconds) : DEFAULT_MAX_TIMEOUT_SECONDS;
|
|
544
610
|
const now = Math.floor(Date.now() / 1e3);
|
|
545
611
|
const validAfter = now - 600;
|
|
546
|
-
const validBefore = now +
|
|
612
|
+
const validBefore = now + maxTimeoutSeconds;
|
|
547
613
|
const nonce = createNonce();
|
|
548
614
|
const signature = await signTypedData({
|
|
549
615
|
privateKey,
|
|
550
|
-
domain:
|
|
616
|
+
domain: {
|
|
617
|
+
name: option.extra?.name || DEFAULT_TOKEN_NAME,
|
|
618
|
+
version: option.extra?.version || DEFAULT_TOKEN_VERSION,
|
|
619
|
+
chainId,
|
|
620
|
+
verifyingContract
|
|
621
|
+
},
|
|
551
622
|
types: TRANSFER_TYPES,
|
|
552
623
|
primaryType: "TransferWithAuthorization",
|
|
553
624
|
message: {
|
|
@@ -562,18 +633,18 @@ async function createPaymentPayload(privateKey, fromAddress, recipient, amount,
|
|
|
562
633
|
const paymentData = {
|
|
563
634
|
x402Version: 2,
|
|
564
635
|
resource: {
|
|
565
|
-
url:
|
|
566
|
-
description: "BlockRun AI API call",
|
|
636
|
+
url: resource?.url || requestUrl,
|
|
637
|
+
description: resource?.description || "BlockRun AI API call",
|
|
567
638
|
mimeType: "application/json"
|
|
568
639
|
},
|
|
569
640
|
accepted: {
|
|
570
|
-
scheme:
|
|
571
|
-
network
|
|
641
|
+
scheme: option.scheme,
|
|
642
|
+
network,
|
|
572
643
|
amount,
|
|
573
|
-
asset:
|
|
574
|
-
payTo:
|
|
575
|
-
maxTimeoutSeconds:
|
|
576
|
-
extra:
|
|
644
|
+
asset: option.asset,
|
|
645
|
+
payTo: option.payTo,
|
|
646
|
+
maxTimeoutSeconds: option.maxTimeoutSeconds,
|
|
647
|
+
extra: option.extra
|
|
577
648
|
},
|
|
578
649
|
payload: {
|
|
579
650
|
signature,
|
|
@@ -588,7 +659,7 @@ async function createPaymentPayload(privateKey, fromAddress, recipient, amount,
|
|
|
588
659
|
},
|
|
589
660
|
extensions: {}
|
|
590
661
|
};
|
|
591
|
-
return
|
|
662
|
+
return encodeBase64Json(paymentData);
|
|
592
663
|
}
|
|
593
664
|
function createPaymentFetch(privateKey) {
|
|
594
665
|
const account = privateKeyToAccount(privateKey);
|
|
@@ -602,12 +673,23 @@ function createPaymentFetch(privateKey) {
|
|
|
602
673
|
const paymentPayload = await createPaymentPayload(
|
|
603
674
|
privateKey,
|
|
604
675
|
walletAddress,
|
|
605
|
-
|
|
676
|
+
{
|
|
677
|
+
scheme: cached.scheme,
|
|
678
|
+
network: cached.network,
|
|
679
|
+
asset: cached.asset,
|
|
680
|
+
payTo: cached.payTo,
|
|
681
|
+
maxTimeoutSeconds: cached.maxTimeoutSeconds,
|
|
682
|
+
extra: cached.extra
|
|
683
|
+
},
|
|
606
684
|
preAuth.estimatedAmount,
|
|
607
|
-
url
|
|
685
|
+
url,
|
|
686
|
+
{
|
|
687
|
+
url: cached.resourceUrl,
|
|
688
|
+
description: cached.resourceDescription
|
|
689
|
+
}
|
|
608
690
|
);
|
|
609
691
|
const preAuthHeaders = new Headers(init?.headers);
|
|
610
|
-
preAuthHeaders
|
|
692
|
+
setPaymentHeaders(preAuthHeaders, paymentPayload);
|
|
611
693
|
const response2 = await fetch(input, { ...init, headers: preAuthHeaders });
|
|
612
694
|
if (response2.status !== 402) {
|
|
613
695
|
return response2;
|
|
@@ -653,17 +735,20 @@ function createPaymentFetch(privateKey) {
|
|
|
653
735
|
scheme: option.scheme,
|
|
654
736
|
network: option.network,
|
|
655
737
|
extra: option.extra,
|
|
656
|
-
maxTimeoutSeconds: option.maxTimeoutSeconds
|
|
738
|
+
maxTimeoutSeconds: option.maxTimeoutSeconds,
|
|
739
|
+
resourceUrl: paymentRequired.resource?.url,
|
|
740
|
+
resourceDescription: paymentRequired.resource?.description
|
|
657
741
|
});
|
|
658
742
|
const paymentPayload = await createPaymentPayload(
|
|
659
743
|
privateKey,
|
|
660
744
|
walletAddress,
|
|
661
|
-
option
|
|
745
|
+
option,
|
|
662
746
|
amount,
|
|
663
|
-
url
|
|
747
|
+
url,
|
|
748
|
+
paymentRequired.resource
|
|
664
749
|
);
|
|
665
750
|
const retryHeaders = new Headers(init?.headers);
|
|
666
|
-
retryHeaders
|
|
751
|
+
setPaymentHeaders(retryHeaders, paymentPayload);
|
|
667
752
|
return fetch(input, {
|
|
668
753
|
...init,
|
|
669
754
|
headers: retryHeaders
|
|
@@ -1604,6 +1689,8 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1604
1689
|
primary: "moonshot/kimi-k2.5",
|
|
1605
1690
|
// $0.50/$2.40 - best quality/price for simple tasks
|
|
1606
1691
|
fallback: [
|
|
1692
|
+
"minimax/minimax-m2.5",
|
|
1693
|
+
// $0.30/$1.20 - cheap with reasoning
|
|
1607
1694
|
"google/gemini-2.5-flash",
|
|
1608
1695
|
// 1M context, cost-effective
|
|
1609
1696
|
"nvidia/gpt-oss-120b",
|
|
@@ -1615,6 +1702,8 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1615
1702
|
primary: "xai/grok-code-fast-1",
|
|
1616
1703
|
// Code specialist, $0.20/$1.50
|
|
1617
1704
|
fallback: [
|
|
1705
|
+
"minimax/minimax-m2.5",
|
|
1706
|
+
// $0.30/$1.20 - cheap with reasoning
|
|
1618
1707
|
"google/gemini-2.5-flash",
|
|
1619
1708
|
// 1M context, cost-effective
|
|
1620
1709
|
"deepseek/deepseek-chat",
|
|
@@ -1629,21 +1718,25 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1629
1718
|
"google/gemini-2.5-flash",
|
|
1630
1719
|
// CRITICAL: 1M context, cheap failsafe before expensive models
|
|
1631
1720
|
"google/gemini-2.5-pro",
|
|
1721
|
+
"minimax/minimax-m2.5",
|
|
1722
|
+
// $0.30/$1.20 - cheap with reasoning
|
|
1632
1723
|
"deepseek/deepseek-chat",
|
|
1633
1724
|
// Another cheap option
|
|
1634
1725
|
"xai/grok-4-0709",
|
|
1635
1726
|
"openai/gpt-5.2",
|
|
1636
1727
|
// Newer and cheaper input than gpt-4o
|
|
1637
1728
|
"openai/gpt-4o",
|
|
1638
|
-
"anthropic/claude-sonnet-4"
|
|
1729
|
+
"anthropic/claude-sonnet-4.6"
|
|
1639
1730
|
]
|
|
1640
1731
|
},
|
|
1641
1732
|
REASONING: {
|
|
1642
1733
|
primary: "xai/grok-4-1-fast-reasoning",
|
|
1643
1734
|
// Upgraded Grok 4.1 reasoning $0.20/$0.50
|
|
1644
1735
|
fallback: [
|
|
1736
|
+
"minimax/minimax-m2.5",
|
|
1737
|
+
// $0.30/$1.20 - reasoning capable
|
|
1645
1738
|
"deepseek/deepseek-reasoner",
|
|
1646
|
-
// Cheap reasoning model
|
|
1739
|
+
// Cheap reasoning model
|
|
1647
1740
|
"openai/o4-mini",
|
|
1648
1741
|
// Newer and cheaper than o3 ($1.10 vs $2.00)
|
|
1649
1742
|
"openai/o3"
|
|
@@ -1653,24 +1746,44 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1653
1746
|
// Eco tier configs - ultra cost-optimized (blockrun/eco)
|
|
1654
1747
|
ecoTiers: {
|
|
1655
1748
|
SIMPLE: {
|
|
1656
|
-
primary: "
|
|
1657
|
-
// $0.
|
|
1658
|
-
fallback: [
|
|
1749
|
+
primary: "minimax/minimax-m2.5",
|
|
1750
|
+
// $0.30/$1.20 - cheapest with reasoning
|
|
1751
|
+
fallback: [
|
|
1752
|
+
"moonshot/kimi-k2.5",
|
|
1753
|
+
"nvidia/gpt-oss-120b",
|
|
1754
|
+
"deepseek/deepseek-chat",
|
|
1755
|
+
"google/gemini-2.5-flash"
|
|
1756
|
+
]
|
|
1659
1757
|
},
|
|
1660
1758
|
MEDIUM: {
|
|
1661
1759
|
primary: "deepseek/deepseek-chat",
|
|
1662
1760
|
// $0.14/$0.28
|
|
1663
|
-
fallback: [
|
|
1761
|
+
fallback: [
|
|
1762
|
+
"minimax/minimax-m2.5",
|
|
1763
|
+
// $0.30/$1.20 - cheap with reasoning
|
|
1764
|
+
"xai/grok-code-fast-1",
|
|
1765
|
+
"google/gemini-2.5-flash",
|
|
1766
|
+
"moonshot/kimi-k2.5"
|
|
1767
|
+
]
|
|
1664
1768
|
},
|
|
1665
1769
|
COMPLEX: {
|
|
1666
1770
|
primary: "xai/grok-4-0709",
|
|
1667
1771
|
// $0.20/$1.50
|
|
1668
|
-
fallback: [
|
|
1772
|
+
fallback: [
|
|
1773
|
+
"minimax/minimax-m2.5",
|
|
1774
|
+
// $0.30/$1.20 - cheap with reasoning
|
|
1775
|
+
"deepseek/deepseek-chat",
|
|
1776
|
+
"google/gemini-2.5-flash",
|
|
1777
|
+
"openai/gpt-4o-mini"
|
|
1778
|
+
]
|
|
1669
1779
|
},
|
|
1670
1780
|
REASONING: {
|
|
1671
|
-
primary: "
|
|
1672
|
-
// $0.
|
|
1673
|
-
fallback: [
|
|
1781
|
+
primary: "minimax/minimax-m2.5",
|
|
1782
|
+
// $0.30/$1.20 - cheapest reasoning model
|
|
1783
|
+
fallback: [
|
|
1784
|
+
"deepseek/deepseek-reasoner",
|
|
1785
|
+
"xai/grok-4-1-fast-reasoning"
|
|
1786
|
+
]
|
|
1674
1787
|
}
|
|
1675
1788
|
},
|
|
1676
1789
|
// Premium tier configs - best quality (blockrun/premium)
|
|
@@ -1688,7 +1801,7 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1688
1801
|
"moonshot/kimi-k2.5",
|
|
1689
1802
|
"google/gemini-2.5-pro",
|
|
1690
1803
|
"xai/grok-4-0709",
|
|
1691
|
-
"anthropic/claude-sonnet-4"
|
|
1804
|
+
"anthropic/claude-sonnet-4.6"
|
|
1692
1805
|
]
|
|
1693
1806
|
},
|
|
1694
1807
|
COMPLEX: {
|
|
@@ -1697,13 +1810,13 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1697
1810
|
fallback: [
|
|
1698
1811
|
"openai/gpt-5.2-codex",
|
|
1699
1812
|
"anthropic/claude-opus-4.5",
|
|
1700
|
-
"anthropic/claude-sonnet-4",
|
|
1813
|
+
"anthropic/claude-sonnet-4.6",
|
|
1701
1814
|
"google/gemini-3-pro-preview",
|
|
1702
1815
|
"moonshot/kimi-k2.5"
|
|
1703
1816
|
]
|
|
1704
1817
|
},
|
|
1705
1818
|
REASONING: {
|
|
1706
|
-
primary: "anthropic/claude-sonnet-4",
|
|
1819
|
+
primary: "anthropic/claude-sonnet-4.6",
|
|
1707
1820
|
// $3/$15 - best for reasoning/instructions
|
|
1708
1821
|
fallback: [
|
|
1709
1822
|
"anthropic/claude-opus-4.6",
|
|
@@ -1721,6 +1834,8 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1721
1834
|
primary: "moonshot/kimi-k2.5",
|
|
1722
1835
|
// Cheaper than Haiku ($0.5/$2.4 vs $1/$5), larger context
|
|
1723
1836
|
fallback: [
|
|
1837
|
+
"minimax/minimax-m2.5",
|
|
1838
|
+
// $0.30/$1.20 - agentic capable, cheaper than kimi
|
|
1724
1839
|
"anthropic/claude-haiku-4.5",
|
|
1725
1840
|
"xai/grok-4-1-fast-non-reasoning",
|
|
1726
1841
|
"openai/gpt-4o-mini"
|
|
@@ -1729,23 +1844,33 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1729
1844
|
MEDIUM: {
|
|
1730
1845
|
primary: "xai/grok-code-fast-1",
|
|
1731
1846
|
// Code specialist for agentic coding
|
|
1732
|
-
fallback: [
|
|
1847
|
+
fallback: [
|
|
1848
|
+
"minimax/minimax-m2.5",
|
|
1849
|
+
// $0.30/$1.20 - agentic capable
|
|
1850
|
+
"moonshot/kimi-k2.5",
|
|
1851
|
+
"anthropic/claude-haiku-4.5",
|
|
1852
|
+
"anthropic/claude-sonnet-4.6"
|
|
1853
|
+
]
|
|
1733
1854
|
},
|
|
1734
1855
|
COMPLEX: {
|
|
1735
|
-
primary: "anthropic/claude-sonnet-4",
|
|
1856
|
+
primary: "anthropic/claude-sonnet-4.6",
|
|
1736
1857
|
fallback: [
|
|
1737
1858
|
"anthropic/claude-opus-4.6",
|
|
1738
1859
|
// Latest Opus - best agentic
|
|
1860
|
+
"minimax/minimax-m2.5",
|
|
1861
|
+
// $0.30/$1.20 - cheap agentic fallback
|
|
1739
1862
|
"openai/gpt-5.2",
|
|
1740
1863
|
"google/gemini-3-pro-preview",
|
|
1741
1864
|
"xai/grok-4-0709"
|
|
1742
1865
|
]
|
|
1743
1866
|
},
|
|
1744
1867
|
REASONING: {
|
|
1745
|
-
primary: "anthropic/claude-sonnet-4",
|
|
1868
|
+
primary: "anthropic/claude-sonnet-4.6",
|
|
1746
1869
|
// Strong tool use + reasoning for agentic tasks
|
|
1747
1870
|
fallback: [
|
|
1748
1871
|
"anthropic/claude-opus-4.6",
|
|
1872
|
+
"minimax/minimax-m2.5",
|
|
1873
|
+
// $0.30/$1.20 - reasoning + agentic
|
|
1749
1874
|
"xai/grok-4-1-fast-reasoning",
|
|
1750
1875
|
"deepseek/deepseek-reasoner"
|
|
1751
1876
|
]
|
|
@@ -2434,7 +2559,7 @@ function isRpcError(error) {
|
|
|
2434
2559
|
}
|
|
2435
2560
|
|
|
2436
2561
|
// src/balance.ts
|
|
2437
|
-
var
|
|
2562
|
+
var USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
2438
2563
|
var CACHE_TTL_MS = 3e4;
|
|
2439
2564
|
var BALANCE_THRESHOLDS = {
|
|
2440
2565
|
/** Low balance warning threshold: $1.00 */
|
|
@@ -2533,7 +2658,7 @@ var BalanceMonitor = class {
|
|
|
2533
2658
|
async fetchBalance() {
|
|
2534
2659
|
try {
|
|
2535
2660
|
const balance = await this.client.readContract({
|
|
2536
|
-
address:
|
|
2661
|
+
address: USDC_BASE,
|
|
2537
2662
|
abi: erc20Abi,
|
|
2538
2663
|
functionName: "balanceOf",
|
|
2539
2664
|
args: [this.walletAddress]
|
|
@@ -5268,7 +5393,13 @@ function injectModelsConfig(logger) {
|
|
|
5268
5393
|
{ id: "gemini", alias: "gemini" },
|
|
5269
5394
|
{ id: "flash", alias: "flash" }
|
|
5270
5395
|
];
|
|
5271
|
-
const DEPRECATED_ALIASES = [
|
|
5396
|
+
const DEPRECATED_ALIASES = [
|
|
5397
|
+
"blockrun/nvidia",
|
|
5398
|
+
"blockrun/gpt",
|
|
5399
|
+
"blockrun/o3",
|
|
5400
|
+
"blockrun/grok",
|
|
5401
|
+
"blockrun/mini"
|
|
5402
|
+
];
|
|
5272
5403
|
if (!defaults.models) {
|
|
5273
5404
|
defaults.models = {};
|
|
5274
5405
|
needsWrite = true;
|