@blockrun/clawrouter 0.8.22 → 0.8.24
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 +51 -19
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +59 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -478,7 +478,8 @@ declare function getSessionId(headers: Record<string, string | string[] | undefi
|
|
|
478
478
|
*/
|
|
479
479
|
|
|
480
480
|
/**
|
|
481
|
-
* Get the proxy port from
|
|
481
|
+
* Get the proxy port from pre-loaded configuration.
|
|
482
|
+
* Port is validated at module load time, this just returns the cached value.
|
|
482
483
|
*/
|
|
483
484
|
declare function getProxyPort(): number;
|
|
484
485
|
/** Callback info for low balance warning */
|
package/dist/index.js
CHANGED
|
@@ -1642,9 +1642,15 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1642
1642
|
]
|
|
1643
1643
|
},
|
|
1644
1644
|
COMPLEX: {
|
|
1645
|
-
primary: "google/gemini-
|
|
1646
|
-
|
|
1647
|
-
|
|
1645
|
+
primary: "google/gemini-3-pro-preview",
|
|
1646
|
+
// Latest Gemini - upgraded from 2.5
|
|
1647
|
+
fallback: [
|
|
1648
|
+
"google/gemini-2.5-pro",
|
|
1649
|
+
"xai/grok-4-0709",
|
|
1650
|
+
"openai/gpt-4o",
|
|
1651
|
+
"openai/gpt-5.2",
|
|
1652
|
+
"anthropic/claude-sonnet-4"
|
|
1653
|
+
]
|
|
1648
1654
|
},
|
|
1649
1655
|
REASONING: {
|
|
1650
1656
|
primary: "xai/grok-4-1-fast-reasoning",
|
|
@@ -1652,7 +1658,8 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1652
1658
|
fallback: [
|
|
1653
1659
|
"xai/grok-4-fast-reasoning",
|
|
1654
1660
|
"openai/o3",
|
|
1655
|
-
|
|
1661
|
+
"openai/o4-mini",
|
|
1662
|
+
// Latest o-series mini
|
|
1656
1663
|
"deepseek/deepseek-reasoner",
|
|
1657
1664
|
"moonshot/kimi-k2.5"
|
|
1658
1665
|
]
|
|
@@ -1695,13 +1702,25 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1695
1702
|
},
|
|
1696
1703
|
COMPLEX: {
|
|
1697
1704
|
primary: "anthropic/claude-opus-4.5",
|
|
1698
|
-
// $
|
|
1699
|
-
fallback: [
|
|
1705
|
+
// $5/$25 - Latest Opus
|
|
1706
|
+
fallback: [
|
|
1707
|
+
"openai/gpt-5.2-pro",
|
|
1708
|
+
// $21/$168 - Latest GPT pro
|
|
1709
|
+
"google/gemini-3-pro-preview",
|
|
1710
|
+
// Latest Gemini
|
|
1711
|
+
"openai/gpt-5.2",
|
|
1712
|
+
"anthropic/claude-sonnet-4"
|
|
1713
|
+
]
|
|
1700
1714
|
},
|
|
1701
1715
|
REASONING: {
|
|
1702
1716
|
primary: "openai/o3",
|
|
1703
|
-
// $
|
|
1704
|
-
fallback: [
|
|
1717
|
+
// $2/$8 - Best value reasoning
|
|
1718
|
+
fallback: [
|
|
1719
|
+
"openai/o4-mini",
|
|
1720
|
+
// Latest o-series
|
|
1721
|
+
"anthropic/claude-opus-4.5",
|
|
1722
|
+
"google/gemini-3-pro-preview"
|
|
1723
|
+
]
|
|
1705
1724
|
}
|
|
1706
1725
|
},
|
|
1707
1726
|
// Agentic tier configs - models that excel at multi-step autonomous tasks
|
|
@@ -1722,13 +1741,23 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1722
1741
|
},
|
|
1723
1742
|
COMPLEX: {
|
|
1724
1743
|
primary: "anthropic/claude-sonnet-4",
|
|
1725
|
-
fallback: [
|
|
1726
|
-
|
|
1744
|
+
fallback: [
|
|
1745
|
+
"anthropic/claude-opus-4.5",
|
|
1746
|
+
// Latest Opus - best agentic
|
|
1747
|
+
"openai/gpt-5.2",
|
|
1748
|
+
"google/gemini-3-pro-preview",
|
|
1749
|
+
"xai/grok-4-0709"
|
|
1750
|
+
]
|
|
1727
1751
|
},
|
|
1728
1752
|
REASONING: {
|
|
1729
1753
|
primary: "anthropic/claude-sonnet-4",
|
|
1730
1754
|
// Strong tool use + reasoning for agentic tasks
|
|
1731
|
-
fallback: [
|
|
1755
|
+
fallback: [
|
|
1756
|
+
"anthropic/claude-opus-4.5",
|
|
1757
|
+
"xai/grok-4-fast-reasoning",
|
|
1758
|
+
"moonshot/kimi-k2.5",
|
|
1759
|
+
"deepseek/deepseek-reasoner"
|
|
1760
|
+
]
|
|
1732
1761
|
}
|
|
1733
1762
|
},
|
|
1734
1763
|
overrides: {
|
|
@@ -2512,6 +2541,16 @@ var FREE_MODEL = "nvidia/gpt-oss-120b";
|
|
|
2512
2541
|
var HEARTBEAT_INTERVAL_MS = 2e3;
|
|
2513
2542
|
var DEFAULT_REQUEST_TIMEOUT_MS = 18e4;
|
|
2514
2543
|
var DEFAULT_PORT = 8402;
|
|
2544
|
+
var PROXY_PORT = (() => {
|
|
2545
|
+
const envPort = process.env.BLOCKRUN_PROXY_PORT;
|
|
2546
|
+
if (envPort) {
|
|
2547
|
+
const parsed = parseInt(envPort, 10);
|
|
2548
|
+
if (!isNaN(parsed) && parsed > 0 && parsed < 65536) {
|
|
2549
|
+
return parsed;
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
return DEFAULT_PORT;
|
|
2553
|
+
})();
|
|
2515
2554
|
var MAX_FALLBACK_ATTEMPTS = 3;
|
|
2516
2555
|
var HEALTH_CHECK_TIMEOUT_MS = 2e3;
|
|
2517
2556
|
var RATE_LIMIT_COOLDOWN_MS = 6e4;
|
|
@@ -2611,14 +2650,7 @@ function safeWrite(res, data) {
|
|
|
2611
2650
|
}
|
|
2612
2651
|
var BALANCE_CHECK_BUFFER = 1.5;
|
|
2613
2652
|
function getProxyPort() {
|
|
2614
|
-
|
|
2615
|
-
if (envPort) {
|
|
2616
|
-
const parsed = parseInt(envPort, 10);
|
|
2617
|
-
if (!isNaN(parsed) && parsed > 0 && parsed < 65536) {
|
|
2618
|
-
return parsed;
|
|
2619
|
-
}
|
|
2620
|
-
}
|
|
2621
|
-
return DEFAULT_PORT;
|
|
2653
|
+
return PROXY_PORT;
|
|
2622
2654
|
}
|
|
2623
2655
|
async function checkExistingProxy(port) {
|
|
2624
2656
|
const controller = new AbortController();
|
|
@@ -3920,17 +3952,21 @@ function injectModelsConfig(logger) {
|
|
|
3920
3952
|
}
|
|
3921
3953
|
const KEY_MODEL_ALIASES = [
|
|
3922
3954
|
{ id: "auto", alias: "auto" },
|
|
3955
|
+
{ id: "eco", alias: "eco" },
|
|
3956
|
+
{ id: "premium", alias: "premium" },
|
|
3923
3957
|
{ id: "free", alias: "free" },
|
|
3924
3958
|
{ id: "sonnet", alias: "sonnet" },
|
|
3925
3959
|
{ id: "opus", alias: "opus" },
|
|
3926
3960
|
{ id: "haiku", alias: "haiku" },
|
|
3927
|
-
{ id: "
|
|
3961
|
+
{ id: "gpt5", alias: "gpt5" },
|
|
3962
|
+
{ id: "mini", alias: "mini" },
|
|
3963
|
+
{ id: "grok-fast", alias: "grok-fast" },
|
|
3964
|
+
{ id: "grok-code", alias: "grok-code" },
|
|
3928
3965
|
{ id: "deepseek", alias: "deepseek" },
|
|
3966
|
+
{ id: "reasoner", alias: "reasoner" },
|
|
3929
3967
|
{ id: "kimi", alias: "kimi" },
|
|
3930
3968
|
{ id: "gemini", alias: "gemini" },
|
|
3931
|
-
{ id: "flash", alias: "flash" }
|
|
3932
|
-
{ id: "gpt", alias: "gpt" },
|
|
3933
|
-
{ id: "reasoner", alias: "reasoner" }
|
|
3969
|
+
{ id: "flash", alias: "flash" }
|
|
3934
3970
|
];
|
|
3935
3971
|
if (!defaults.models) {
|
|
3936
3972
|
defaults.models = {};
|