@blockrun/clawrouter 0.9.32 → 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/index.js CHANGED
@@ -3,6 +3,8 @@ var MODEL_ALIASES = {
3
3
  // Claude - short names (backend uses bare model names without anthropic/ prefix)
4
4
  claude: "claude-sonnet-4",
5
5
  sonnet: "claude-sonnet-4",
6
+ "sonnet-4.6": "claude-sonnet-4",
7
+ "sonnet-4-6": "claude-sonnet-4",
6
8
  opus: "claude-opus-4",
7
9
  "opus-4": "claude-opus-4",
8
10
  haiku: "claude-haiku-4.5",
@@ -1735,44 +1737,27 @@ var DEFAULT_ROUTING_CONFIG = {
1735
1737
  ]
1736
1738
  }
1737
1739
  },
1738
- // Eco tier configs - ultra cost-optimized (blockrun/eco)
1740
+ // Eco tier configs - absolute cheapest (blockrun/eco)
1739
1741
  ecoTiers: {
1740
1742
  SIMPLE: {
1741
- primary: "minimax/minimax-m2.5",
1742
- // $0.30/$1.20 - cheapest with reasoning
1743
- fallback: [
1744
- "moonshot/kimi-k2.5",
1745
- "nvidia/gpt-oss-120b",
1746
- "deepseek/deepseek-chat",
1747
- "google/gemini-2.5-flash"
1748
- ]
1743
+ primary: "nvidia/gpt-oss-120b",
1744
+ // FREE! $0.00/$0.00
1745
+ fallback: ["google/gemini-2.5-flash", "deepseek/deepseek-chat", "minimax/minimax-m2.5"]
1749
1746
  },
1750
1747
  MEDIUM: {
1751
- primary: "deepseek/deepseek-chat",
1752
- // $0.14/$0.28
1753
- fallback: [
1754
- "minimax/minimax-m2.5",
1755
- // $0.30/$1.20 - cheap with reasoning
1756
- "xai/grok-code-fast-1",
1757
- "google/gemini-2.5-flash",
1758
- "moonshot/kimi-k2.5"
1759
- ]
1748
+ primary: "google/gemini-2.5-flash",
1749
+ // $0.15/$0.60 - cheapest capable
1750
+ fallback: ["deepseek/deepseek-chat", "nvidia/gpt-oss-120b", "minimax/minimax-m2.5"]
1760
1751
  },
1761
1752
  COMPLEX: {
1762
- primary: "xai/grok-4-0709",
1763
- // $0.20/$1.50
1764
- fallback: [
1765
- "minimax/minimax-m2.5",
1766
- // $0.30/$1.20 - cheap with reasoning
1767
- "deepseek/deepseek-chat",
1768
- "google/gemini-2.5-flash",
1769
- "openai/gpt-4o-mini"
1770
- ]
1753
+ primary: "google/gemini-2.5-flash",
1754
+ // $0.15/$0.60 - 1M context handles complexity
1755
+ fallback: ["deepseek/deepseek-chat", "xai/grok-4-0709", "minimax/minimax-m2.5"]
1771
1756
  },
1772
1757
  REASONING: {
1773
- primary: "minimax/minimax-m2.5",
1774
- // $0.30/$1.20 - cheapest reasoning model
1775
- fallback: ["deepseek/deepseek-reasoner", "xai/grok-4-1-fast-reasoning"]
1758
+ primary: "xai/grok-4-1-fast-reasoning",
1759
+ // $0.20/$0.50 - was MORE expensive than AUTO!
1760
+ fallback: ["deepseek/deepseek-reasoner", "minimax/minimax-m2.5"]
1776
1761
  }
1777
1762
  },
1778
1763
  // Premium tier configs - best quality (blockrun/premium)
@@ -4631,10 +4616,12 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
4631
4616
  console.log(
4632
4617
  `[ClawRouter] Received model: "${parsed.model}" -> normalized: "${normalizedModel}"${wasAlias ? ` -> alias: "${resolvedModel}"` : ""}${routingProfile ? `, profile: ${routingProfile}` : ""}`
4633
4618
  );
4634
- if (wasAlias && !isRoutingProfile) {
4635
- parsed.model = resolvedModel;
4619
+ if (!isRoutingProfile) {
4620
+ if (parsed.model !== resolvedModel) {
4621
+ parsed.model = resolvedModel;
4622
+ bodyModified = true;
4623
+ }
4636
4624
  modelId = resolvedModel;
4637
- bodyModified = true;
4638
4625
  }
4639
4626
  if (isRoutingProfile) {
4640
4627
  if (routingProfile === "free") {
@@ -5144,9 +5131,11 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
5144
5131
  body: responseBody,
5145
5132
  status: upstream.status,
5146
5133
  headers: responseHeaders,
5147
- model: modelId
5134
+ model: actualModelUsed
5148
5135
  });
5149
- console.log(`[ClawRouter] Cached response for ${modelId} (${responseBody.length} bytes)`);
5136
+ console.log(
5137
+ `[ClawRouter] Cached response for ${actualModelUsed} (${responseBody.length} bytes)`
5138
+ );
5150
5139
  }
5151
5140
  try {
5152
5141
  const rspJson = JSON.parse(responseBody.toString());
@@ -5476,7 +5465,7 @@ function injectModelsConfig(logger) {
5476
5465
  { id: "eco", alias: "eco" },
5477
5466
  { id: "premium", alias: "premium" },
5478
5467
  { id: "free", alias: "free" },
5479
- { id: "sonnet", alias: "sonnet" },
5468
+ { id: "sonnet", alias: "sonnet-4.6" },
5480
5469
  { id: "opus", alias: "opus" },
5481
5470
  { id: "haiku", alias: "haiku" },
5482
5471
  { id: "gpt5", alias: "gpt5" },