@blockrun/clawrouter 0.12.310 → 0.12.311

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.
Files changed (4) hide show
  1. package/dist/cli.js +2199 -2162
  2. package/dist/index.js +3407 -3370
  3. package/dist/router/index.js +2612 -2572
  4. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -61651,7 +61651,7 @@ function scoreKeywordMatch(text, keywords, name, signalLabel, thresholds, scores
61651
61651
  return { name, score: scores.none, signal: null };
61652
61652
  }
61653
61653
  function scoreMultiStep(text) {
61654
- const patterns = [/first.*then/i, /step \d/i, /\d\.\s/];
61654
+ const patterns = [/first.*then/i, /step \d/i, /(?:^|\n)\s*\d+[.)]\s/];
61655
61655
  const hits = patterns.filter((p) => p.test(text));
61656
61656
  if (hits.length > 0) {
61657
61657
  return { name: "multiStepPatterns", score: 0.5, signal: "multi-step" };
@@ -61659,7 +61659,7 @@ function scoreMultiStep(text) {
61659
61659
  return { name: "multiStepPatterns", score: 0, signal: null };
61660
61660
  }
61661
61661
  function scoreQuestionComplexity(prompt) {
61662
- const count = (prompt.match(/\?/g) || []).length;
61662
+ const count = (prompt.match(/[??]/g) || []).length;
61663
61663
  if (count > 3) {
61664
61664
  return { name: "questionComplexity", score: 0.5, signal: `${count} questions` };
61665
61665
  }
@@ -61711,6 +61711,14 @@ function scoreAgenticTask(text, keywords) {
61711
61711
  }
61712
61712
  function classifyByRules(prompt, systemPrompt, estimatedTokens, config2) {
61713
61713
  const userText = prompt.toLowerCase();
61714
+ const reasoningDimension = scoreKeywordMatch(
61715
+ userText,
61716
+ config2.reasoningKeywords,
61717
+ "reasoningMarkers",
61718
+ "reasoning",
61719
+ { low: 1, high: 2 },
61720
+ { none: 0, low: 0.7, high: 1 }
61721
+ );
61714
61722
  const dimensions = [
61715
61723
  // Token count uses total estimated tokens (system + user) — context size matters for model selection
61716
61724
  scoreTokenCount(estimatedTokens, config2.tokenCountThresholds),
@@ -61722,14 +61730,7 @@ function classifyByRules(prompt, systemPrompt, estimatedTokens, config2) {
61722
61730
  { low: 1, high: 2 },
61723
61731
  { none: 0, low: 0.5, high: 1 }
61724
61732
  ),
61725
- scoreKeywordMatch(
61726
- userText,
61727
- config2.reasoningKeywords,
61728
- "reasoningMarkers",
61729
- "reasoning",
61730
- { low: 1, high: 2 },
61731
- { none: 0, low: 0.7, high: 1 }
61732
- ),
61733
+ reasoningDimension,
61733
61734
  scoreKeywordMatch(
61734
61735
  userText,
61735
61736
  config2.technicalKeywords,
@@ -61816,8 +61817,7 @@ function classifyByRules(prompt, systemPrompt, estimatedTokens, config2) {
61816
61817
  const w = weights[d.name] ?? 0;
61817
61818
  weightedScore += d.score * w;
61818
61819
  }
61819
- const reasoningMatches = config2.reasoningKeywords.filter((kw) => matchesKeyword(userText, kw));
61820
- if (reasoningMatches.length >= 2) {
61820
+ if (reasoningDimension.score === 1) {
61821
61821
  const confidence2 = calibrateConfidence(
61822
61822
  Math.max(weightedScore, 0.3),
61823
61823
  // ensure positive for confidence calc
@@ -61860,25 +61860,35 @@ function classifyByRules(prompt, systemPrompt, estimatedTokens, config2) {
61860
61860
  function calibrateConfidence(distance, steepness) {
61861
61861
  return 1 / (1 + Math.exp(-steepness * distance));
61862
61862
  }
61863
+ function usablePricing(pricing) {
61864
+ if (!pricing) return void 0;
61865
+ const ok = (value) => value === void 0 || Number.isFinite(value) && value >= 0;
61866
+ if (pricing.flatPrice !== void 0) return ok(pricing.flatPrice) ? pricing : void 0;
61867
+ return ok(pricing.inputPrice) && ok(pricing.outputPrice) ? pricing : void 0;
61868
+ }
61869
+ function rawCost(pricing, estimatedInputTokens, maxOutputTokens) {
61870
+ if (pricing?.flatPrice !== void 0) return pricing.flatPrice;
61871
+ const inputPrice = pricing?.inputPrice ?? 0;
61872
+ const outputPrice = pricing?.outputPrice ?? 0;
61873
+ return estimatedInputTokens / 1e6 * inputPrice + maxOutputTokens / 1e6 * outputPrice;
61874
+ }
61875
+ function baselineCostFor(modelPricing, estimatedInputTokens, maxOutputTokens) {
61876
+ const opusPricing = usablePricing(modelPricing.get(BASELINE_MODEL_ID));
61877
+ const inputPrice = opusPricing?.inputPrice ?? BASELINE_INPUT_PRICE;
61878
+ const outputPrice = opusPricing?.outputPrice ?? BASELINE_OUTPUT_PRICE;
61879
+ return estimatedInputTokens / 1e6 * inputPrice + maxOutputTokens / 1e6 * outputPrice;
61880
+ }
61881
+ function savingsFor(costEstimate, baselineCost, pricing, routingProfile) {
61882
+ if (routingProfile === "premium" || pricing === void 0 || !(baselineCost > 0)) return 0;
61883
+ return Math.max(0, (baselineCost - costEstimate) / baselineCost);
61884
+ }
61863
61885
  function selectModel(tier, confidence, method, reasoning, tierConfigs, modelPricing, estimatedInputTokens, maxOutputTokens, routingProfile, agenticScore) {
61864
61886
  const tierConfig = tierConfigs[tier];
61865
61887
  const model = tierConfig.primary;
61866
- const pricing = modelPricing.get(model);
61867
- let costEstimate;
61868
- if (pricing?.flatPrice !== void 0) {
61869
- costEstimate = pricing.flatPrice;
61870
- } else {
61871
- const inputPrice = pricing?.inputPrice ?? 0;
61872
- const outputPrice = pricing?.outputPrice ?? 0;
61873
- costEstimate = estimatedInputTokens / 1e6 * inputPrice + maxOutputTokens / 1e6 * outputPrice;
61874
- }
61875
- const opusPricing = modelPricing.get(BASELINE_MODEL_ID);
61876
- const opusInputPrice = opusPricing?.inputPrice ?? BASELINE_INPUT_PRICE;
61877
- const opusOutputPrice = opusPricing?.outputPrice ?? BASELINE_OUTPUT_PRICE;
61878
- const baselineInput = estimatedInputTokens / 1e6 * opusInputPrice;
61879
- const baselineOutput = maxOutputTokens / 1e6 * opusOutputPrice;
61880
- const baselineCost = baselineInput + baselineOutput;
61881
- const savings = routingProfile === "premium" || pricing === void 0 ? 0 : baselineCost > 0 ? Math.max(0, (baselineCost - costEstimate) / baselineCost) : 0;
61888
+ const pricing = usablePricing(modelPricing.get(model));
61889
+ const costEstimate = rawCost(pricing, estimatedInputTokens, maxOutputTokens);
61890
+ const baselineCost = baselineCostFor(modelPricing, estimatedInputTokens, maxOutputTokens);
61891
+ const savings = savingsFor(costEstimate, baselineCost, pricing, routingProfile);
61882
61892
  return {
61883
61893
  model,
61884
61894
  tier,
@@ -61896,43 +61906,28 @@ function getFallbackChain(tier, tierConfigs) {
61896
61906
  return [config2.primary, ...config2.fallback];
61897
61907
  }
61898
61908
  function calculateModelCost(model, modelPricing, estimatedInputTokens, maxOutputTokens, routingProfile) {
61899
- const pricing = modelPricing.get(model);
61900
- let costEstimate;
61901
- if (pricing?.flatPrice !== void 0) {
61902
- costEstimate = Math.max(pricing.flatPrice * (1 + SERVER_MARGIN_PERCENT / 100), MIN_PAYMENT_USD);
61903
- } else {
61904
- const inputPrice = pricing?.inputPrice ?? 0;
61905
- const outputPrice = pricing?.outputPrice ?? 0;
61906
- const inputCost = estimatedInputTokens / 1e6 * inputPrice;
61907
- const outputCost = maxOutputTokens / 1e6 * outputPrice;
61908
- costEstimate = Math.max(
61909
- (inputCost + outputCost) * (1 + SERVER_MARGIN_PERCENT / 100),
61910
- MIN_PAYMENT_USD
61911
- );
61912
- }
61913
- const opusPricing = modelPricing.get(BASELINE_MODEL_ID);
61914
- const opusInputPrice = opusPricing?.inputPrice ?? BASELINE_INPUT_PRICE;
61915
- const opusOutputPrice = opusPricing?.outputPrice ?? BASELINE_OUTPUT_PRICE;
61916
- const baselineInput = estimatedInputTokens / 1e6 * opusInputPrice;
61917
- const baselineOutput = maxOutputTokens / 1e6 * opusOutputPrice;
61918
- const baselineCost = baselineInput + baselineOutput;
61919
- const savings = routingProfile === "premium" ? 0 : baselineCost > 0 ? Math.max(0, (baselineCost - costEstimate) / baselineCost) : 0;
61909
+ const pricing = usablePricing(modelPricing.get(model));
61910
+ const costEstimate = Math.max(
61911
+ rawCost(pricing, estimatedInputTokens, maxOutputTokens) * (1 + SERVER_MARGIN_PERCENT / 100),
61912
+ MIN_PAYMENT_USD
61913
+ );
61914
+ const baselineCost = baselineCostFor(modelPricing, estimatedInputTokens, maxOutputTokens);
61915
+ const savings = savingsFor(costEstimate, baselineCost, pricing, routingProfile);
61920
61916
  return { costEstimate, baselineCost, savings };
61921
61917
  }
61922
- function filterByToolCalling(models, hasTools, supportsToolCalling) {
61923
- if (!hasTools) return models;
61924
- const filtered = models.filter(supportsToolCalling);
61918
+ function keepOrFailOpen(models, keep) {
61919
+ const filtered = models.filter(keep);
61925
61920
  return filtered.length > 0 ? filtered : models;
61926
61921
  }
61922
+ function filterByToolCalling(models, hasTools, supportsToolCalling) {
61923
+ return hasTools ? keepOrFailOpen(models, supportsToolCalling) : models;
61924
+ }
61927
61925
  function filterByVision(models, hasVision, supportsVision) {
61928
- if (!hasVision) return models;
61929
- const filtered = models.filter(supportsVision);
61930
- return filtered.length > 0 ? filtered : models;
61926
+ return hasVision ? keepOrFailOpen(models, supportsVision) : models;
61931
61927
  }
61932
61928
  function filterByExcludeList(models, excludeList) {
61933
61929
  if (excludeList.size === 0) return models;
61934
- const filtered = models.filter((m) => !excludeList.has(m));
61935
- return filtered.length > 0 ? filtered : models;
61930
+ return keepOrFailOpen(models, (m) => !excludeList.has(m));
61936
61931
  }
61937
61932
  function getFallbackChainFiltered(tier, tierConfigs, estimatedTotalTokens, getContextWindow) {
61938
61933
  const fullChain = getFallbackChain(tier, tierConfigs);
@@ -61962,21 +61957,25 @@ function estimateTokens(text) {
61962
61957
  return cjk + Math.ceil((text.length - cjk) / 4);
61963
61958
  }
61964
61959
  function scanLimit(promptTruncationChars) {
61965
- return Math.max(1, Math.min(8e3, promptTruncationChars));
61960
+ if (!Number.isFinite(promptTruncationChars)) return MAX_SCAN_CHARS;
61961
+ return Math.max(1, Math.min(MAX_SCAN_CHARS, Math.floor(promptTruncationChars)));
61966
61962
  }
61967
61963
  function sampleForScan(value, limit) {
61968
61964
  if (value.length <= limit) return value;
61969
61965
  const prefixLength = Math.ceil(limit / 2);
61966
+ const suffixLength = limit - prefixLength;
61967
+ if (suffixLength <= 0) return value.slice(0, prefixLength);
61970
61968
  return `${value.slice(0, prefixLength)}
61971
- ${value.slice(-(limit - prefixLength))}`;
61969
+ ${value.slice(-suffixLength)}`;
61972
61970
  }
61973
61971
  function applyPromotions(tierConfigs, promotions, profile, now2 = /* @__PURE__ */ new Date()) {
61974
61972
  if (!promotions || promotions.length === 0) return tierConfigs;
61975
61973
  let result = tierConfigs;
61976
61974
  for (const promo of promotions) {
61977
- const start = new Date(promo.startDate);
61978
- const end = new Date(promo.endDate);
61979
- if (now2 < start || now2 >= end) continue;
61975
+ const start = Date.parse(promo.startDate);
61976
+ const end = Date.parse(promo.endDate);
61977
+ if (!Number.isFinite(start) || !Number.isFinite(end)) continue;
61978
+ if (now2.getTime() < start || now2.getTime() >= end) continue;
61980
61979
  if (promo.profiles && !promo.profiles.includes(profile)) continue;
61981
61980
  if (result === tierConfigs) {
61982
61981
  result = { ...tierConfigs };
@@ -62062,7 +62061,9 @@ function likelyNeedsParallelToolCalls(prompt, needsTools, toolCount, toolNames)
62062
62061
  ]);
62063
62062
  const lowered = text.toLowerCase();
62064
62063
  const matchedOperationTokens = new Set(
62065
- (toolNames ?? []).flatMap((name) => name.toLowerCase().split(/[^a-z0-9\u3400-\u9fff]+/)).filter((token) => operationTokens.has(token) && lowered.includes(token))
62064
+ (toolNames ?? []).flatMap((name) => name.toLowerCase().split(/[^a-z0-9\u3400-\u9fff]+/)).filter(
62065
+ (token) => operationTokens.has(token) && new RegExp(`\\b${token}(?:s|es|d|ed|ing)?\\b`).test(lowered)
62066
+ )
62066
62067
  );
62067
62068
  if (matchedOperationTokens.size >= 2) return true;
62068
62069
  const nonEmptyLines = text.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
@@ -62073,7 +62074,7 @@ function likelyNeedsParallelToolCalls(prompt, needsTools, toolCount, toolNames)
62073
62074
  const repeatedLookup = /\b(?:weather|climate|clima|tiempo|temperature|snow|news|report)\b|天气|气象|温度|降雪|新闻|报告/i.test(
62074
62075
  text
62075
62076
  );
62076
- const multiLocationConnector = /\b(?:and also|both|y|e)\b|还有|以及|和|、/i.test(text);
62077
+ const multiLocationConnector = /\b(?:and also|both)\b|\s(?:y|e)\s|还有|以及|和|、/i.test(text);
62077
62078
  const commaSeparatedLocations = (text.match(/[,,]/g) ?? []).length >= 2;
62078
62079
  if (repeatedLookup && (multiLocationConnector || commaSeparatedLocations)) return true;
62079
62080
  const distinctOrderParts = /\b(?:food|meal)\b[\s\S]*\bdrink\b|\bdrink\b[\s\S]*\b(?:food|meal)\b/i.test(text);
@@ -62099,6 +62100,9 @@ function classifyTask(prompt, systemPrompt, options) {
62099
62100
  );
62100
62101
  const errorClassSignal = /\b[A-Z][A-Za-z]*(?:Error|Exception)\b/.test(scannedPrompt);
62101
62102
  const hasCode = explicitCodeSignal || codeConstructSignal || nativeCodeSignal || errorClassSignal;
62103
+ const codingAction = /\b(?:write|implement|refactor|debug|fix|patch|compile|build|run|test|script|program|code|function|class|module|repo(?:sitory)?)\b|编写|实现|重构|调试|修复|编译|脚本|代码/i.test(
62104
+ scannedPrompt
62105
+ );
62102
62106
  const codeArtifact = /```|\b(?:stack trace|traceback)\b|\.(?:ts|tsx|js|py|go|rs)\b/i.test(scannedPrompt) || codeConstructSignal || nativeCodeSignal || errorClassSignal;
62103
62107
  const toolsAvailable = options.hasTools ?? false;
62104
62108
  const needsTools = options.requiresTools ?? (toolsAvailable && inferToolRequirement(scannedPrompt, scannedSystemPrompt));
@@ -62139,7 +62143,7 @@ function classifyTask(prompt, systemPrompt, options) {
62139
62143
  const crossRecordSignal = /\b(?:another|other|different|previous)\s+(?:order|reservation|booking|account|address)\b|另一(?:个)?(?:订单|预订|账户|地址)|其他(?:订单|预订|账户|地址)/i.test(
62140
62144
  scannedPrompt
62141
62145
  );
62142
- const reservationIds = scannedPrompt.match(/\b[A-Z0-9]{6}\b/g) ?? [];
62146
+ const reservationIds = scannedPrompt.match(/\b(?=[A-Z0-9]*\d)(?=[A-Z0-9]*[A-Z])[A-Z0-9]{6}\b/g) ?? [];
62143
62147
  const crossReservationBatchSignal = agentDomain === "airline" && (/\b(?:two|three|multiple|several)(?:\s+of\s+(?:my|our|the))?\s+(?:upcoming\s+)?(?:reservations?|bookings?)\b|\b(?:a\s+)?(?:second|third)\s+(?:reservation|booking)\b/i.test(
62144
62148
  scannedPrompt
62145
62149
  ) || new Set(reservationIds).size >= 2);
@@ -62210,7 +62214,7 @@ function classifyTask(prompt, systemPrompt, options) {
62210
62214
  );
62211
62215
  const terminalSafetySensitive = terminalToolSignal && (highStakes || terminalCredentialSignal);
62212
62216
  const implicitTerminalCode = needsTools && terminalToolSignal && agentRisk === "standard" && !highStakes && !complexTerminalOperation && numberedSteps < 3 && prompt.length <= 1e3 && simpleTerminalArtifact;
62213
- const language = /[\u3400-\u9fff]/.test(scannedPrompt) ? "zh" : "other";
62217
+ const language = /[\u3400-\u9fff]/.test(scannedPrompt) && !/[\u3040-\u30ff]/.test(scannedPrompt) ? "zh" : "other";
62214
62218
  const multipleChoiceSignals = (scannedPrompt.match(/(?:^|\n)\s*[A-D][.)]\s+/gim) ?? []).length;
62215
62219
  const numericSignals = (scannedPrompt.match(/-?\d+(?:[.,]\d+)?/g) ?? []).length;
62216
62220
  const compactMathProblem = !hasCode && prompt.length < 2500 && numericSignals >= 2 && (/[+×÷=%$€£¥]|\b(?:total|each|per|times|half|twice|percent|how many|how much|calculate)\b/i.test(
@@ -62219,19 +62223,20 @@ function classifyTask(prompt, systemPrompt, options) {
62219
62223
  let taskType = "chat";
62220
62224
  if (needsVision) taskType = "vision";
62221
62225
  else if (estimatedInputTokens > 8e4) taskType = "long_context";
62222
- else if (needsTools && (hasCode || implicitTerminalCode)) taskType = "code_agent";
62226
+ else if (needsTools && (codeArtifact || hasCode && codingAction || implicitTerminalCode))
62227
+ taskType = "code_agent";
62223
62228
  else if (needsTools && likelyParallelToolCalls && !complexMultiToolPlan)
62224
62229
  taskType = "tool_agent_parallel";
62225
62230
  else if (needsTools) taskType = "tool_agent";
62226
62231
  else if (multipleChoiceSignals >= 3) taskType = "reasoning_mcq";
62227
62232
  else if (compactMathProblem) taskType = "reasoning_math";
62228
- else if (errorClassSignal || /\b(?:bug|debug|error|failure|failing|regression|crash|修复|报错|错误|调试)\b/i.test(text))
62233
+ else if (errorClassSignal || /\b(?:bug|debug|error|failure|failing|regression|crash)\b|修复|报错|错误|调试/i.test(text))
62229
62234
  taskType = "debug";
62230
- else if (hasCode || /\b(?:refactor|implement|patch|edit|rewrite|重构|实现|修改)\b/i.test(text))
62235
+ else if (hasCode || /\b(?:refactor|implement|patch|edit|rewrite)\b|重构|实现|修改/i.test(text))
62231
62236
  taskType = "code_edit";
62232
- else if (needsStructuredOutput || /\b(?:extract|json|schema|csv|字段|提取)\b/i.test(text))
62237
+ else if (needsStructuredOutput || /\b(?:extract|json|schema|csv)\b|字段|提取/i.test(text))
62233
62238
  taskType = "extraction";
62234
- else if (/\b(?:prove|derive|theorem|formal|mathematical|reasoning|证明|推导|定理|数学)\b/i.test(text))
62239
+ else if (/\b(?:prove|derive|theorem|formal|mathematical|reasoning)\b|证明|推导|定理|数学/i.test(text))
62235
62240
  taskType = "reasoning";
62236
62241
  return {
62237
62242
  taskType,
@@ -62255,290 +62260,63 @@ function classifyTask(prompt, systemPrompt, options) {
62255
62260
  codeArtifact
62256
62261
  };
62257
62262
  }
62258
- function affinity(modelId, task, language = "other", agentDomain = "other", deepWebResearch = false, agentRisk = "standard", terminalToolSignal = false, terminalSafetySensitive = false) {
62259
- const id2 = modelId.toLowerCase();
62260
- const modelName = id2.slice(id2.indexOf("/") + 1);
62261
- const match = (values, score) => values.some((value) => modelName === value) ? score : 0;
62262
- const base4 = 0.68;
62263
- switch (task) {
62263
+ function affinityBand(features) {
62264
+ const { taskType, agentDomain, agentRisk, deepWebResearch, terminalToolSignal } = features;
62265
+ const terminalSafety = features.terminalSafetySensitive;
62266
+ switch (taskType) {
62264
62267
  case "code_agent":
62265
- if (terminalToolSignal && agentRisk === "complex_high") {
62266
- return Math.max(
62267
- base4,
62268
- match(["claude-sonnet-5"], 1),
62269
- match(["gpt-5.3-codex"], 0.87),
62270
- match(["gpt-5-mini"], 0.78),
62271
- match(["gemini-3.5-flash"], 0.76)
62272
- );
62273
- }
62274
- return Math.max(
62275
- base4,
62276
- match(["gpt-5.3-codex"], 1),
62277
- match(["claude-sonnet-5"], 0.98),
62278
- match(["gpt-5-mini"], 0.96),
62279
- match(["gemini-3.5-flash"], 0.92),
62280
- match(["kimi-k3"], 0.9),
62281
- match(["deepseek-v4-pro", "glm-5.2"], 0.88)
62282
- );
62268
+ return terminalToolSignal && agentRisk === "complex_high" ? TERMINAL_COMPLEX_HIGH : AFFINITY.codeAgent;
62283
62269
  case "tool_agent":
62284
- if (terminalToolSignal && agentRisk === "complex_high") {
62285
- return Math.max(
62286
- base4,
62287
- match(["claude-sonnet-5"], 1),
62288
- match(["gpt-5.3-codex"], 0.87),
62289
- match(["gpt-5-mini"], 0.78),
62290
- match(["gemini-3.5-flash"], 0.76)
62291
- );
62292
- }
62293
- if (terminalToolSignal && !terminalSafetySensitive) {
62294
- return Math.max(
62295
- base4,
62296
- match(["gpt-5-mini"], 1),
62297
- match(["gpt-5.3-codex"], 0.98),
62298
- match(["claude-sonnet-5"], 0.9),
62299
- match(["gemini-3.5-flash"], 0.89)
62300
- );
62301
- }
62302
- if (terminalToolSignal && terminalSafetySensitive) {
62303
- return Math.max(
62304
- base4,
62305
- match(["claude-sonnet-5"], 1),
62306
- match(["claude-opus-4.8"], 0.9),
62307
- match(["gpt-5.3-codex"], 0.84)
62308
- );
62309
- }
62310
- if (agentDomain === "web_research") {
62311
- return deepWebResearch ? Math.max(
62312
- base4,
62313
- match(["claude-sonnet-5"], 1),
62314
- match(["gpt-5-mini"], 0.88),
62315
- match(["gemini-3.5-flash"], 0.84),
62316
- match(["claude-opus-5"], 0.8),
62317
- match(["claude-opus-4.8"], 0.78)
62318
- ) : Math.max(
62319
- base4,
62320
- match(["claude-sonnet-5"], 1),
62321
- match(["gpt-5-mini"], 0.88),
62322
- match(["gemini-3.5-flash"], 0.86),
62323
- match(["claude-opus-5"], 0.84),
62324
- match(["claude-opus-4.8"], 0.82)
62325
- );
62326
- }
62270
+ if (terminalToolSignal && agentRisk === "complex_high") return TERMINAL_COMPLEX_HIGH;
62271
+ if (terminalToolSignal) return terminalSafety ? AFFINITY.terminalToolSafety : AFFINITY.terminalTool;
62272
+ if (agentDomain === "web_research") return deepWebResearch ? WEB_RESEARCH_DEEP : WEB_RESEARCH;
62327
62273
  if (agentDomain === "retail") {
62328
- if (agentRisk === "standard") {
62329
- return Math.max(
62330
- base4,
62331
- match(["gpt-5-mini"], 1),
62332
- match(["claude-sonnet-5"], 0.88),
62333
- match(["gemini-3.5-flash"], 0.82),
62334
- match(["gpt-5.3-codex"], 0.81),
62335
- match(["kimi-k3"], 0.78),
62336
- match(["deepseek-v4-pro"], 0.76)
62337
- );
62338
- }
62339
- if (agentRisk === "policy_exception") {
62340
- return Math.max(
62341
- base4,
62342
- match(["gpt-4.1"], 1),
62343
- match(["claude-sonnet-5"], 0.9),
62344
- match(["deepseek-v4-pro"], 0.82),
62345
- match(["gpt-5-mini"], 0.8),
62346
- match(["gpt-4o-mini"], 0.76)
62347
- );
62348
- }
62349
- if (agentRisk === "policy_exception_simple") {
62350
- return Math.max(
62351
- base4,
62352
- match(["gpt-5-mini"], 1),
62353
- match(["gpt-4.1"], 0.86),
62354
- match(["deepseek-v4-pro"], 0.82),
62355
- match(["gpt-4o-mini"], 0.8)
62356
- );
62357
- }
62358
- return Math.max(
62359
- base4,
62360
- match(["deepseek-v4-pro"], 1),
62361
- match(["claude-sonnet-5"], 0.88),
62362
- match(["gemini-3.5-flash"], 0.82),
62363
- match(["gpt-5.3-codex"], 0.81),
62364
- match(["kimi-k3"], 0.78),
62365
- match(["gpt-5-mini"], 0.76)
62366
- );
62274
+ if (agentRisk === "standard") return AFFINITY.retailStandard;
62275
+ if (agentRisk === "policy_exception") return RETAIL_POLICY_EXCEPTION;
62276
+ if (agentRisk === "policy_exception_simple") return RETAIL_POLICY_EXCEPTION_SIMPLE;
62277
+ return AFFINITY.retailHigh;
62367
62278
  }
62368
62279
  if (agentDomain === "airline") {
62369
- if (agentRisk === "complex_high") {
62370
- return Math.max(
62371
- base4,
62372
- match(["claude-sonnet-5"], 1),
62373
- match(["gpt-5-mini"], 0.78),
62374
- match(["gemini-3.5-flash"], 0.76),
62375
- match(["deepseek-v4-pro"], 0.74)
62376
- );
62377
- }
62378
- return Math.max(
62379
- base4,
62380
- match(["gpt-5-mini"], 1),
62381
- match(["claude-sonnet-5"], 0.9),
62382
- match(["gemini-3.5-flash"], 0.8),
62383
- match(["deepseek-v4-pro"], 0.76)
62384
- );
62280
+ return agentRisk === "complex_high" ? AFFINITY.airlineComplex : AFFINITY.airlineStandard;
62385
62281
  }
62386
- return Math.max(
62387
- base4,
62388
- match(["claude-sonnet-5"], 1),
62389
- match(["gemini-3.5-flash"], 0.88),
62390
- match(["gpt-5.3-codex"], 0.87),
62391
- match(["gpt-5-mini"], 0.84),
62392
- match(["kimi-k3"], 0.85),
62393
- match(["deepseek-v4-pro"], 0.82)
62394
- );
62282
+ return AFFINITY.toolAgent;
62395
62283
  case "tool_agent_parallel":
62396
62284
  if (terminalToolSignal) {
62397
- return terminalSafetySensitive ? Math.max(
62398
- base4,
62399
- match(["claude-sonnet-5"], 1),
62400
- match(["claude-opus-4.8"], 0.9),
62401
- match(["gpt-5.3-codex"], 0.86)
62402
- ) : Math.max(
62403
- base4,
62404
- match(["gpt-5-mini"], 1),
62405
- match(["gpt-5.3-codex"], 0.98),
62406
- match(["claude-sonnet-5"], 0.92),
62407
- match(["gemini-3.5-flash"], 0.88)
62408
- );
62409
- }
62410
- if (agentDomain === "web_research") {
62411
- return deepWebResearch ? Math.max(
62412
- base4,
62413
- match(["claude-sonnet-5"], 1),
62414
- match(["gpt-5-mini"], 0.88),
62415
- match(["gemini-3.5-flash"], 0.84),
62416
- match(["claude-opus-5"], 0.8),
62417
- match(["claude-opus-4.8"], 0.78)
62418
- ) : Math.max(
62419
- base4,
62420
- match(["claude-sonnet-5"], 1),
62421
- match(["gpt-5-mini"], 0.88),
62422
- match(["gemini-3.5-flash"], 0.86),
62423
- match(["claude-opus-5"], 0.84),
62424
- match(["claude-opus-4.8"], 0.82)
62425
- );
62285
+ return terminalSafety ? AFFINITY.parallelTerminalSafety : AFFINITY.parallelTerminal;
62426
62286
  }
62287
+ if (agentDomain === "web_research") return deepWebResearch ? WEB_RESEARCH_DEEP : WEB_RESEARCH;
62427
62288
  if (agentDomain === "retail") {
62428
- if (agentRisk === "policy_exception") {
62429
- return Math.max(
62430
- base4,
62431
- match(["gpt-4.1"], 1),
62432
- match(["claude-sonnet-5"], 0.9),
62433
- match(["deepseek-v4-pro"], 0.82),
62434
- match(["gpt-5-mini"], 0.8),
62435
- match(["gpt-4o-mini"], 0.76)
62436
- );
62437
- }
62438
- if (agentRisk === "policy_exception_simple") {
62439
- return Math.max(
62440
- base4,
62441
- match(["gpt-5-mini"], 1),
62442
- match(["gpt-4.1"], 0.86),
62443
- match(["deepseek-v4-pro"], 0.82),
62444
- match(["gpt-4o-mini"], 0.8)
62445
- );
62446
- }
62447
- return Math.max(
62448
- base4,
62449
- match(["deepseek-v4-pro"], 1),
62450
- match(["claude-sonnet-5"], 0.88),
62451
- match(["claude-opus-4.8"], 0.84),
62452
- match(["gpt-5-mini"], 0.78),
62453
- match(["gemini-3.5-flash"], 0.76)
62454
- );
62289
+ if (agentRisk === "policy_exception") return RETAIL_POLICY_EXCEPTION;
62290
+ if (agentRisk === "policy_exception_simple") return RETAIL_POLICY_EXCEPTION_SIMPLE;
62291
+ return AFFINITY.parallelRetail;
62455
62292
  }
62456
62293
  if (agentDomain === "airline") {
62457
- return agentRisk === "complex_high" ? Math.max(
62458
- base4,
62459
- match(["claude-sonnet-5"], 1),
62460
- match(["gpt-5-mini"], 0.78),
62461
- match(["claude-opus-4.8"], 0.76),
62462
- match(["gemini-3.5-flash"], 0.74)
62463
- ) : Math.max(
62464
- base4,
62465
- match(["gpt-5-mini"], 1),
62466
- match(["claude-sonnet-5"], 0.9),
62467
- match(["gemini-3.5-flash"], 0.8)
62468
- );
62294
+ return agentRisk === "complex_high" ? AFFINITY.parallelAirlineComplex : AFFINITY.parallelAirline;
62469
62295
  }
62470
- return Math.max(
62471
- base4,
62472
- match(["claude-opus-4.8"], 1),
62473
- match(["claude-sonnet-5"], 0.84),
62474
- match(["grok-4.5"], 0.82),
62475
- match(["gemini-3.5-flash"], 0.8),
62476
- match(["deepseek-v4-pro"], 0.78)
62477
- );
62296
+ return AFFINITY.parallel;
62478
62297
  case "code_edit":
62479
62298
  case "debug":
62480
- return Math.max(
62481
- base4,
62482
- match(["gpt-5.3-codex"], 1),
62483
- match(["claude-sonnet-4.6"], 0.94),
62484
- match(["glm-5.2"], 0.9),
62485
- match(["deepseek-v4-pro"], 0.86)
62486
- );
62299
+ return AFFINITY.codeEdit;
62487
62300
  case "reasoning":
62488
- return Math.max(
62489
- base4,
62490
- match(["claude-sonnet-5", "claude-sonnet-4.6"], 0.98),
62491
- match(["deepseek-v4-pro"], 0.95),
62492
- match(["grok-4.5"], 0.94),
62493
- match(["gemini-3.1-pro", "gemini-3.5-flash"], 0.92)
62494
- );
62301
+ return AFFINITY.reasoning;
62495
62302
  case "reasoning_mcq":
62496
- return Math.max(
62497
- base4,
62498
- match(["gemini-3-flash-preview"], 1),
62499
- match(["gemini-3.5-flash"], 0.91),
62500
- match(["grok-4.5"], 0.9),
62501
- match(["claude-sonnet-5"], 0.88),
62502
- match(["deepseek-v4-pro"], 0.84)
62503
- );
62303
+ return AFFINITY.reasoningMcq;
62504
62304
  case "reasoning_math":
62505
- return Math.max(
62506
- base4,
62507
- match(["gemini-3.5-flash"], 1),
62508
- match(["grok-4.5"], 0.93),
62509
- match(["claude-sonnet-5", "deepseek-v4-pro", "kimi-k3"], 0.9)
62510
- );
62305
+ return AFFINITY.reasoningMath;
62511
62306
  case "vision":
62512
- return Math.max(
62513
- base4,
62514
- match(["gemini-3.1-pro"], 0.96),
62515
- match(["qwen3.7-max", "claude-sonnet-4.6", "kimi-k3", "grok-4.3"], 0.9)
62516
- );
62307
+ return AFFINITY.vision;
62517
62308
  case "long_context":
62518
- return Math.max(
62519
- base4,
62520
- match(["gemini-3.1-pro"], 1),
62521
- match(["qwen3.7-max", "glm-5.2"], 0.89),
62522
- match(["gemini-3.5-flash"], 0.88),
62523
- match(["deepseek-v4-pro"], 0.85)
62524
- );
62525
- case "extraction": {
62526
- const kimiExtractionAffinity = language === "zh" ? 1 : 0.9;
62527
- const otherExtractionAffinity = language === "zh" ? 0.88 : 0.9;
62528
- return Math.max(
62529
- base4,
62530
- match(["gemini-3.5-flash", "gemini-2.5-flash", "gpt-4o-mini"], otherExtractionAffinity),
62531
- match(["claude-sonnet-5", "claude-sonnet-4.6"], otherExtractionAffinity),
62532
- match(["kimi-k3"], kimiExtractionAffinity)
62533
- );
62534
- }
62535
- default:
62536
- return Math.max(
62537
- base4,
62538
- match(["gemini-3.5-flash", "gemini-2.5-flash", "kimi-k3"], 0.86)
62539
- );
62309
+ return AFFINITY.longContext;
62310
+ case "extraction":
62311
+ return features.language === "zh" ? AFFINITY.extractionZh : AFFINITY.extraction;
62312
+ case "chat":
62313
+ return AFFINITY.chat;
62540
62314
  }
62541
62315
  }
62316
+ function affinityIn(band, modelId) {
62317
+ const name = modelId.toLowerCase().slice(modelId.indexOf("/") + 1);
62318
+ return Math.max(NEUTRAL_AFFINITY, band[name] ?? 0);
62319
+ }
62542
62320
  function evidenceCandidates(task) {
62543
62321
  if (task === "code_agent") {
62544
62322
  return [
@@ -62618,7 +62396,7 @@ function isEligible(modelId, features, maxOutputTokens, options) {
62618
62396
  return model.contextWindow >= (features.estimatedInputTokens + maxOutputTokens) * 1.1;
62619
62397
  }
62620
62398
  function estimatedCost(modelId, options, inputTokens, outputTokens) {
62621
- const price2 = options.modelPricing.get(modelId);
62399
+ const price2 = usablePricing(options.modelPricing.get(modelId));
62622
62400
  if (!price2) return Number.POSITIVE_INFINITY;
62623
62401
  if (price2.flatPrice !== void 0) return price2.flatPrice;
62624
62402
  return (inputTokens * price2.inputPrice + outputTokens * price2.outputPrice) / 1e6;
@@ -62628,6 +62406,10 @@ function profileScore(modelId, options, now2) {
62628
62406
  if (!profile) return void 0;
62629
62407
  const measuredAt = Date.parse(profile.measuredAt);
62630
62408
  if (!Number.isFinite(measuredAt)) return void 0;
62409
+ const finite = (value, optional2) => value === void 0 ? optional2 : Number.isFinite(value) && value >= 0;
62410
+ if (!finite(profile.latencyMs, false) || !finite(profile.outputTokensPerSecond, false) || !finite(profile.p95LatencyMs, true) || !finite(profile.intelligenceIndex, true) || !finite(profile.errorRate, true) || !finite(profile.samples, true)) {
62411
+ return void 0;
62412
+ }
62631
62413
  const ageDays = Math.max(0, (now2.getTime() - measuredAt) / 864e5);
62632
62414
  const sampleConfidence = profile.samples === void 0 ? 1 : Math.min(1, Math.max(0, profile.samples) / 10);
62633
62415
  const freshness = Math.pow(0.5, ageDays / 30) * sampleConfidence;
@@ -62644,7 +62426,7 @@ function route(prompt, systemPrompt, maxOutputTokens, options) {
62644
62426
  const strategy = getStrategy(options.config.strategy ?? "portfolio");
62645
62427
  return strategy.route(prompt, systemPrompt, maxOutputTokens, options);
62646
62428
  }
62647
- var UNSEGMENTED_SCRIPT, WORD_CHAR, ASCII_PHRASE, SEGMENTED_WORD_CHAR, BOUNDARY_BEFORE, BOUNDARY_AFTER, BOUNDED_LAST_WORD_LENGTH, SHORT_SUFFIXES, SIBILANT_PLURAL, MID_SUFFIXES, DROPPED_E_SUFFIXES, DOUBLED_CONSONANT_SUFFIXES, matcherCache, BASELINE_MODEL_ID, BASELINE_INPUT_PRICE, BASELINE_OUTPUT_PRICE, SERVER_MARGIN_PERCENT, MIN_PAYMENT_USD, CJK_CHARS, RulesStrategy, registry2, DEFAULT_MODEL_CAPABILITIES, model_profiles_generated_default, LIVE_MODEL_PROFILES, HISTORICAL_MODEL_PROFILES, DEFAULT_PORTFOLIO_WEIGHTS, VERIFIED_TOOL_FALLBACKS, PortfolioStrategy, DEFAULT_ROUTING_CONFIG;
62429
+ var UNSEGMENTED_SCRIPT, WORD_CHAR, ASCII_PHRASE, SEGMENTED_WORD_CHAR, BOUNDARY_BEFORE, BOUNDARY_AFTER, BOUNDED_LAST_WORD_LENGTH, SHORT_SUFFIXES, SIBILANT_PLURAL, MID_SUFFIXES, DROPPED_E_SUFFIXES, DOUBLED_CONSONANT_SUFFIXES, matcherCache, BASELINE_MODEL_ID, BASELINE_INPUT_PRICE, BASELINE_OUTPUT_PRICE, SERVER_MARGIN_PERCENT, MIN_PAYMENT_USD, CJK_CHARS, MAX_SCAN_CHARS, RulesStrategy, registry2, DEFAULT_ROUTING_CONFIG, DEFAULT_MODEL_CAPABILITIES, model_profiles_generated_default, LIVE_MODEL_PROFILES, HISTORICAL_MODEL_PROFILES, DEFAULT_PORTFOLIO_WEIGHTS, NEUTRAL_AFFINITY, TERMINAL_COMPLEX_HIGH, WEB_RESEARCH_DEEP, WEB_RESEARCH, RETAIL_POLICY_EXCEPTION, RETAIL_POLICY_EXCEPTION_SIMPLE, AFFINITY, VERIFIED_TOOL_FALLBACKS, PortfolioStrategy;
62648
62430
  var init_dist = __esm({
62649
62431
  "node_modules/@blockrun/router-core/dist/index.js"() {
62650
62432
  "use strict";
@@ -62667,6 +62449,7 @@ var init_dist = __esm({
62667
62449
  SERVER_MARGIN_PERCENT = 5;
62668
62450
  MIN_PAYMENT_USD = 1e-3;
62669
62451
  CJK_CHARS = /[ -ヿ㐀-䶿一-鿿가-힯豈-﫿＀-￯]/g;
62452
+ MAX_SCAN_CHARS = 8e3;
62670
62453
  RulesStrategy = class {
62671
62454
  name = "rules";
62672
62455
  route(prompt, systemPrompt, maxOutputTokens, options) {
@@ -62768,1383 +62551,45 @@ var init_dist = __esm({
62768
62551
  };
62769
62552
  registry2 = /* @__PURE__ */ new Map();
62770
62553
  registry2.set("rules", new RulesStrategy());
62771
- DEFAULT_MODEL_CAPABILITIES = Object.freeze({
62772
- "anthropic/claude-fable-5": {
62773
- contextWindow: 1e6,
62774
- maxOutputTokens: 128e3,
62775
- supportsTools: true,
62776
- supportsVision: true
62777
- },
62778
- "anthropic/claude-fable-5.1": {
62779
- contextWindow: 1e6,
62780
- maxOutputTokens: 128e3,
62781
- supportsTools: true,
62782
- supportsVision: true
62783
- },
62784
- "anthropic/claude-haiku-4.5": {
62785
- // override: The public catalog's `categories` omit "vision" for this Anthropic model even though the gateway accepts image input for it (the prior hand-maintained snapshot had it, and Anthropic's model card lists it). Without this the vision filter would silently drop it — reported against the catalog; remove once the categories carry vision.
62786
- contextWindow: 2e5,
62787
- maxOutputTokens: 64e3,
62788
- supportsTools: true,
62789
- supportsVision: true
62790
- },
62791
- "anthropic/claude-opus-4.5": {
62792
- contextWindow: 2e5,
62793
- maxOutputTokens: 64e3,
62794
- supportsTools: true,
62795
- supportsVision: true
62796
- },
62797
- "anthropic/claude-opus-4.7": {
62798
- contextWindow: 1e6,
62799
- maxOutputTokens: 128e3,
62800
- supportsTools: true,
62801
- supportsVision: true
62802
- },
62803
- "anthropic/claude-opus-4.8": {
62804
- contextWindow: 1e6,
62805
- maxOutputTokens: 128e3,
62806
- supportsTools: true,
62807
- supportsVision: true
62808
- },
62809
- "anthropic/claude-opus-5": {
62810
- contextWindow: 1e6,
62811
- maxOutputTokens: 128e3,
62812
- supportsTools: true,
62813
- supportsVision: true
62814
- },
62815
- "anthropic/claude-opus-5.5": {
62816
- contextWindow: 1e6,
62817
- maxOutputTokens: 128e3,
62818
- supportsTools: true,
62819
- supportsVision: true
62820
- },
62821
- "anthropic/claude-sonnet-4.5": {
62822
- contextWindow: 2e5,
62823
- maxOutputTokens: 64e3,
62824
- supportsTools: true,
62825
- supportsVision: true
62826
- },
62827
- "anthropic/claude-sonnet-4.6": {
62828
- // override: The public catalog's `categories` omit "vision" for this Anthropic model even though the gateway accepts image input for it (the prior hand-maintained snapshot had it, and Anthropic's model card lists it). Without this the vision filter would silently drop it — reported against the catalog; remove once the categories carry vision.
62829
- contextWindow: 1e6,
62830
- maxOutputTokens: 128e3,
62831
- supportsTools: true,
62832
- supportsVision: true
62833
- },
62834
- "anthropic/claude-sonnet-5": {
62835
- contextWindow: 1e6,
62836
- maxOutputTokens: 128e3,
62837
- supportsTools: true,
62838
- supportsVision: true
62839
- },
62840
- "anthropic/claude-sonnet-5.5": {
62841
- contextWindow: 1e6,
62842
- maxOutputTokens: 128e3,
62843
- supportsTools: true,
62844
- supportsVision: true
62845
- },
62846
- "cohere/north-mini-code": {
62847
- // supportsTools: not probed — fails closed
62848
- contextWindow: 256e3,
62849
- maxOutputTokens: 16384,
62850
- supportsTools: false,
62851
- supportsVision: false
62852
- },
62853
- "deepseek/deepseek-chat": {
62854
- contextWindow: 1048576,
62855
- maxOutputTokens: 65536,
62856
- supportsTools: true,
62857
- supportsVision: false
62858
- },
62859
- "deepseek/deepseek-reasoner": {
62860
- contextWindow: 1048576,
62861
- maxOutputTokens: 65536,
62862
- supportsTools: true,
62863
- supportsVision: false
62864
- },
62865
- "deepseek/deepseek-v4-flash-vision-exp": {
62866
- contextWindow: 1048576,
62867
- maxOutputTokens: 65536,
62868
- supportsTools: false,
62869
- supportsVision: true
62870
- },
62871
- "deepseek/deepseek-v4-pro": {
62872
- contextWindow: 1048576,
62873
- maxOutputTokens: 65536,
62874
- supportsTools: true,
62875
- supportsVision: false
62876
- },
62877
- "deepseek/deepseek-v4.1-flash": {
62878
- contextWindow: 1048576,
62879
- maxOutputTokens: 65536,
62880
- supportsTools: true,
62881
- supportsVision: false
62882
- },
62883
- "google/gemini-2.5-flash": {
62884
- contextWindow: 1048576,
62885
- maxOutputTokens: 65536,
62886
- supportsTools: true,
62887
- supportsVision: true
62888
- },
62889
- "google/gemini-2.5-flash-lite": {
62890
- contextWindow: 1048576,
62891
- maxOutputTokens: 65536,
62892
- supportsTools: true,
62893
- supportsVision: false
62894
- },
62895
- "google/gemini-2.5-pro": {
62896
- contextWindow: 1048576,
62897
- maxOutputTokens: 65536,
62898
- supportsTools: true,
62899
- supportsVision: true
62900
- },
62901
- "google/gemini-3-flash-preview": {
62902
- contextWindow: 1048576,
62903
- maxOutputTokens: 65536,
62904
- supportsTools: true,
62905
- supportsVision: true
62906
- },
62907
- "google/gemini-3.1-flash-lite": {
62908
- contextWindow: 1048576,
62909
- maxOutputTokens: 65536,
62910
- supportsTools: true,
62911
- supportsVision: false
62912
- },
62913
- "google/gemini-3.1-pro": {
62914
- contextWindow: 1048576,
62915
- maxOutputTokens: 65536,
62916
- supportsTools: true,
62917
- supportsVision: true
62918
- },
62919
- "google/gemini-3.5-flash": {
62920
- contextWindow: 1048576,
62921
- maxOutputTokens: 65536,
62922
- supportsTools: true,
62923
- supportsVision: true
62924
- },
62925
- "google/gemini-3.5-flash-lite": {
62926
- contextWindow: 1048576,
62927
- maxOutputTokens: 65536,
62928
- supportsTools: true,
62929
- supportsVision: false
62930
- },
62931
- "google/gemini-3.6-flash": {
62932
- contextWindow: 1048576,
62933
- maxOutputTokens: 65536,
62934
- supportsTools: true,
62935
- supportsVision: true
62936
- },
62937
- "google/gemini-3.8-flash": {
62938
- contextWindow: 1048576,
62939
- maxOutputTokens: 65536,
62940
- supportsTools: true,
62941
- supportsVision: true
62942
- },
62943
- "google/gemini-4-argon": {
62944
- // supportsTools: not probed — fails closed
62945
- contextWindow: 1048576,
62946
- maxOutputTokens: 65536,
62947
- supportsTools: false,
62948
- supportsVision: true
62949
- },
62950
- "minimax/minimax-m2.7": {
62951
- contextWindow: 204800,
62952
- maxOutputTokens: 16384,
62953
- supportsTools: true,
62954
- supportsVision: false
62955
- },
62956
- "minimax/minimax-m3": {
62957
- contextWindow: 1048576,
62958
- maxOutputTokens: 65536,
62959
- supportsTools: true,
62960
- supportsVision: false
62961
- },
62962
- "mistral/mistral-large-4": {
62963
- // supportsTools: not probed — fails closed
62964
- contextWindow: 524288,
62965
- maxOutputTokens: 262144,
62966
- supportsTools: false,
62967
- supportsVision: true
62968
- },
62969
- "moonshot/kimi-k3": {
62970
- contextWindow: 1048576,
62971
- maxOutputTokens: 65536,
62972
- supportsTools: true,
62973
- supportsVision: true
62974
- },
62975
- "nvidia/llama-3.2-11b-vision": {
62976
- // supportsTools: not probed — fails closed
62977
- contextWindow: 128e3,
62978
- maxOutputTokens: 16384,
62979
- supportsTools: false,
62980
- supportsVision: true
62981
- },
62982
- "nvidia/muse-glimmer-30b": {
62983
- // supportsTools: not probed — fails closed
62984
- contextWindow: 131072,
62985
- maxOutputTokens: 16384,
62986
- supportsTools: false,
62987
- supportsVision: false
62988
- },
62989
- "nvidia/nemotron-3-nano-omni-30b-a3b-reasoning": {
62990
- // override: The catalog tags this model "vision", but a correctly sized probe does not hold up (ClawRouter, 2026-08-31): a 64x64 solid-red PNG was named correctly 1 of 4 times on Base, and on Solana the image was silently dropped and a text model answered "white". An HTTP 200 with a confident wrong answer gives the caller nothing to branch on, so image turns must not be routed here. It is ecoTiers.SIMPLE.fallback[0] since nemotron-3-nano-30b was delisted (2026-09-08); remove once a probe of this size comes back right on both chains.
62991
- contextWindow: 256e3,
62992
- maxOutputTokens: 16384,
62993
- supportsTools: false,
62994
- supportsVision: false
62995
- },
62996
- "nvidia/nemotron-3-ultra-550b": {
62997
- // supportsTools: not probed — fails closed
62998
- contextWindow: 1e6,
62999
- maxOutputTokens: 16384,
63000
- supportsTools: false,
63001
- supportsVision: false
63002
- },
63003
- "nvidia/nemotron-3.5-lightning": {
63004
- // supportsTools: not probed — fails closed
63005
- contextWindow: 1e6,
63006
- maxOutputTokens: 16384,
63007
- supportsTools: false,
63008
- supportsVision: false
63009
- },
63010
- "openai/chat-latest": {
63011
- contextWindow: 128e3,
63012
- maxOutputTokens: 128e3,
63013
- supportsTools: true,
63014
- supportsVision: true
63015
- },
63016
- "openai/gpt-4.1": {
63017
- contextWindow: 128e3,
63018
- maxOutputTokens: 32768,
63019
- supportsTools: true,
63020
- supportsVision: true
63021
- },
63022
- "openai/gpt-4.1-mini": {
63023
- contextWindow: 128e3,
63024
- maxOutputTokens: 32768,
63025
- supportsTools: true,
63026
- supportsVision: false
63027
- },
63028
- "openai/gpt-4.1-nano": {
63029
- contextWindow: 128e3,
63030
- maxOutputTokens: 32768,
63031
- supportsTools: true,
63032
- supportsVision: false
63033
- },
63034
- "openai/gpt-4o": {
63035
- contextWindow: 128e3,
63036
- maxOutputTokens: 16384,
63037
- supportsTools: true,
63038
- supportsVision: true
63039
- },
63040
- "openai/gpt-4o-mini": {
63041
- contextWindow: 128e3,
63042
- maxOutputTokens: 16384,
63043
- supportsTools: true,
63044
- supportsVision: false
63045
- },
63046
- "openai/gpt-5-mini": {
63047
- contextWindow: 2e5,
63048
- maxOutputTokens: 128e3,
63049
- supportsTools: true,
63050
- supportsVision: false
63051
- },
63052
- "openai/gpt-5.1": {
63053
- contextWindow: 4e5,
63054
- maxOutputTokens: 128e3,
63055
- supportsTools: true,
63056
- supportsVision: true
63057
- },
63058
- "openai/gpt-5.2": {
63059
- contextWindow: 4e5,
63060
- maxOutputTokens: 128e3,
63061
- supportsTools: true,
63062
- supportsVision: true
63063
- },
63064
- "openai/gpt-5.2-pro": {
63065
- // supportsTools: not probed — fails closed
63066
- contextWindow: 4e5,
63067
- maxOutputTokens: 128e3,
63068
- supportsTools: false,
63069
- supportsVision: true
63070
- },
63071
- "openai/gpt-5.3-codex": {
63072
- // supportsTools: gateway unavailable at probe time — fails closed; override: 2026-08-29 probe: every request (6 plain + 3 tool attempts) returned a gateway 500, so the probe measured an incident, not the model. Codex's function calling is established by the 2026-07 Terminal-Bench / tau2 calibration trajectories in portfolio.ts. Hosts observing the 500s should drop it with RouterOptions.unavailableModels rather than this snapshot claiming the model cannot call tools.
63073
- contextWindow: 4e5,
63074
- maxOutputTokens: 128e3,
63075
- supportsTools: true,
63076
- supportsVision: false
63077
- },
63078
- "openai/gpt-5.4": {
63079
- contextWindow: 105e4,
63080
- maxOutputTokens: 128e3,
63081
- supportsTools: true,
63082
- supportsVision: true
63083
- },
63084
- "openai/gpt-5.4-mini": {
63085
- contextWindow: 4e5,
63086
- maxOutputTokens: 128e3,
63087
- supportsTools: true,
63088
- supportsVision: true
63089
- },
63090
- "openai/gpt-5.4-nano": {
63091
- contextWindow: 105e4,
63092
- maxOutputTokens: 128e3,
63093
- supportsTools: true,
63094
- supportsVision: false
63095
- },
63096
- "openai/gpt-5.4-pro": {
63097
- // supportsTools: not probed — fails closed
63098
- contextWindow: 105e4,
63099
- maxOutputTokens: 128e3,
63100
- supportsTools: false,
63101
- supportsVision: true
63102
- },
63103
- "openai/gpt-5.5": {
63104
- contextWindow: 105e4,
63105
- maxOutputTokens: 128e3,
63106
- supportsTools: true,
63107
- supportsVision: true
63108
- },
63109
- "openai/gpt-5.5-pro": {
63110
- // supportsTools: not probed — fails closed
63111
- contextWindow: 105e4,
63112
- maxOutputTokens: 128e3,
63113
- supportsTools: false,
63114
- supportsVision: true
63115
- },
63116
- "openai/gpt-5.6-luna": {
63117
- contextWindow: 105e4,
63118
- maxOutputTokens: 128e3,
63119
- supportsTools: true,
63120
- supportsVision: true
63121
- },
63122
- "openai/gpt-5.6-luna-pro": {
63123
- contextWindow: 105e4,
63124
- maxOutputTokens: 128e3,
63125
- supportsTools: false,
63126
- supportsVision: true
63127
- },
63128
- "openai/gpt-5.6-sol": {
63129
- contextWindow: 105e4,
63130
- maxOutputTokens: 128e3,
63131
- supportsTools: true,
63132
- supportsVision: true
63133
- },
63134
- "openai/gpt-5.6-sol-pro": {
63135
- contextWindow: 105e4,
63136
- maxOutputTokens: 128e3,
63137
- supportsTools: true,
63138
- supportsVision: true
63139
- },
63140
- "openai/gpt-5.6-terra": {
63141
- contextWindow: 105e4,
63142
- maxOutputTokens: 128e3,
63143
- supportsTools: true,
63144
- supportsVision: true
63145
- },
63146
- "openai/gpt-5.6-terra-pro": {
63147
- contextWindow: 105e4,
63148
- maxOutputTokens: 128e3,
63149
- supportsTools: true,
63150
- supportsVision: true
63151
- },
63152
- "openai/gpt-6-astra": {
63153
- contextWindow: 105e4,
63154
- maxOutputTokens: 128e3,
63155
- supportsTools: true,
63156
- supportsVision: true
63157
- },
63158
- "openai/gpt-6-luna": {
63159
- contextWindow: 105e4,
63160
- maxOutputTokens: 128e3,
63161
- supportsTools: true,
63162
- supportsVision: true
63163
- },
63164
- "openai/gpt-6-sol": {
63165
- contextWindow: 105e4,
63166
- maxOutputTokens: 128e3,
63167
- supportsTools: true,
63168
- supportsVision: true
63169
- },
63170
- "openai/gpt-6.1-sol": {
63171
- contextWindow: 105e4,
63172
- maxOutputTokens: 128e3,
63173
- supportsTools: true,
63174
- supportsVision: true
63175
- },
63176
- "openai/o1": {
63177
- contextWindow: 2e5,
63178
- maxOutputTokens: 1e5,
63179
- supportsTools: true,
63180
- supportsVision: false
63181
- },
63182
- "openai/o3": {
63183
- contextWindow: 2e5,
63184
- maxOutputTokens: 1e5,
63185
- supportsTools: true,
63186
- supportsVision: false
63187
- },
63188
- "openai/o3-mini": {
63189
- contextWindow: 128e3,
63190
- maxOutputTokens: 1e5,
63191
- supportsTools: true,
63192
- supportsVision: false
63193
- },
63194
- "openai/o4-mini": {
63195
- contextWindow: 128e3,
63196
- maxOutputTokens: 1e5,
63197
- supportsTools: true,
63198
- supportsVision: false
63199
- },
63200
- "poolside/laguna-s-2.1": {
63201
- // supportsTools: not probed — fails closed
63202
- contextWindow: 1048576,
63203
- maxOutputTokens: 131072,
63204
- supportsTools: false,
63205
- supportsVision: false
63206
- },
63207
- "poolside/laguna-xs-2.1": {
63208
- // supportsTools: not probed — fails closed
63209
- contextWindow: 131072,
63210
- maxOutputTokens: 16384,
63211
- supportsTools: false,
63212
- supportsVision: false
63213
- },
63214
- "qwen/qwen3.7-flash": {
63215
- contextWindow: 1e6,
63216
- maxOutputTokens: 65536,
63217
- supportsTools: true,
63218
- supportsVision: false
63219
- },
63220
- "qwen/qwen3.7-max": {
63221
- contextWindow: 1e6,
63222
- maxOutputTokens: 65536,
63223
- supportsTools: true,
63224
- supportsVision: false
63225
- },
63226
- "qwen/qwen3.7-plus": {
63227
- contextWindow: 1e6,
63228
- maxOutputTokens: 131072,
63229
- supportsTools: true,
63230
- supportsVision: false
63231
- },
63232
- "qwen/qwen3.8-flash": {
63233
- contextWindow: 1e6,
63234
- maxOutputTokens: 131072,
63235
- supportsTools: false,
63236
- supportsVision: true
62554
+ DEFAULT_ROUTING_CONFIG = {
62555
+ version: "3.5",
62556
+ strategy: "portfolio",
62557
+ portfolio: {
62558
+ auto: {
62559
+ quality: 0.47,
62560
+ capability: 0.2,
62561
+ cost: 0.18,
62562
+ speed: 0.07,
62563
+ reliability: 0.03,
62564
+ legacy: 0.05
62565
+ },
62566
+ eco: {
62567
+ quality: 0.36,
62568
+ capability: 0.2,
62569
+ cost: 0.28,
62570
+ speed: 0.1,
62571
+ reliability: 0.04,
62572
+ legacy: 0.02
62573
+ },
62574
+ premium: {
62575
+ quality: 0.58,
62576
+ capability: 0.2,
62577
+ cost: 0.08,
62578
+ speed: 0.06,
62579
+ reliability: 0.06,
62580
+ legacy: 0.02
62581
+ },
62582
+ highStakesBoost: { quality: 0.08, reliability: 0.05 },
62583
+ latencySensitiveSpeedBoost: 0.08,
62584
+ affinityFloorGap: { auto: 0.1, eco: 0.22, premium: 0.05 }
63237
62585
  },
63238
- "qwen/qwen3.8-max": {
63239
- // supportsTools: not probed — fails closed
63240
- contextWindow: 1e6,
63241
- maxOutputTokens: 131072,
63242
- supportsTools: false,
63243
- supportsVision: false
63244
- },
63245
- "tencent/hy4-preview": {
63246
- // supportsTools: not probed — fails closed
63247
- contextWindow: 1048576,
63248
- maxOutputTokens: 64e3,
63249
- supportsTools: false,
63250
- supportsVision: false
63251
- },
63252
- "xai/grok-4.3": {
63253
- contextWindow: 1e6,
63254
- maxOutputTokens: 16384,
63255
- supportsTools: true,
63256
- supportsVision: true
63257
- },
63258
- "xai/grok-4.5": {
63259
- contextWindow: 5e5,
63260
- maxOutputTokens: 16384,
63261
- supportsTools: true,
63262
- supportsVision: true
63263
- },
63264
- "xai/grok-4.6": {
63265
- contextWindow: 5e5,
63266
- maxOutputTokens: 16384,
63267
- supportsTools: true,
63268
- supportsVision: true
63269
- },
63270
- "xai/grok-4.7": {
63271
- contextWindow: 5e5,
63272
- maxOutputTokens: 16384,
63273
- supportsTools: true,
63274
- supportsVision: true
63275
- },
63276
- "xai/grok-build-0.1": {
63277
- contextWindow: 256e3,
63278
- maxOutputTokens: 16384,
63279
- supportsTools: true,
63280
- supportsVision: false
63281
- },
63282
- "xiaomi/mimo-v2.5": {
63283
- contextWindow: 1048576,
63284
- maxOutputTokens: 131072,
63285
- supportsTools: true,
63286
- supportsVision: true
63287
- },
63288
- "xiaomi/mimo-v2.5-pro": {
63289
- contextWindow: 1048576,
63290
- maxOutputTokens: 131072,
63291
- supportsTools: true,
63292
- supportsVision: false
63293
- },
63294
- "zai/glm-5": {
63295
- contextWindow: 2e5,
63296
- maxOutputTokens: 128e3,
63297
- supportsTools: true,
63298
- supportsVision: false
63299
- },
63300
- "zai/glm-5-turbo": {
63301
- contextWindow: 2e5,
63302
- maxOutputTokens: 128e3,
63303
- supportsTools: true,
63304
- supportsVision: false
63305
- },
63306
- "zai/glm-5.1": {
63307
- contextWindow: 2e5,
63308
- maxOutputTokens: 128e3,
63309
- supportsTools: true,
63310
- supportsVision: false
63311
- },
63312
- "zai/glm-5.2": {
63313
- contextWindow: 1e6,
63314
- maxOutputTokens: 131072,
63315
- supportsTools: true,
63316
- supportsVision: false
63317
- },
63318
- "zai/glm-5.3": {
63319
- contextWindow: 1e6,
63320
- maxOutputTokens: 131072,
63321
- supportsTools: true,
63322
- supportsVision: false
63323
- },
63324
- "zai/glm-5.3-flash": {
63325
- contextWindow: 1e6,
63326
- maxOutputTokens: 131072,
63327
- supportsTools: true,
63328
- supportsVision: true
63329
- }
63330
- });
63331
- model_profiles_generated_default = {
63332
- "anthropic/claude-fable-5": {
63333
- measuredAt: "2026-08-29T16:51:33Z",
63334
- latencyMs: 9298.5,
63335
- p95LatencyMs: 9873.4,
63336
- outputTokensPerSecond: 55.17,
63337
- errorRate: 0,
63338
- samples: 3
63339
- },
63340
- "anthropic/claude-haiku-4.5": {
63341
- measuredAt: "2026-08-29T16:51:33Z",
63342
- latencyMs: 3157.4,
63343
- p95LatencyMs: 3170.7,
63344
- outputTokensPerSecond: 162.16,
63345
- errorRate: 0,
63346
- samples: 3
63347
- },
63348
- "anthropic/claude-opus-4.5": {
63349
- measuredAt: "2026-08-29T16:51:33Z",
63350
- latencyMs: 6497.7,
63351
- p95LatencyMs: 6953.7,
63352
- outputTokensPerSecond: 78.99,
63353
- errorRate: 0,
63354
- samples: 3
63355
- },
63356
- "anthropic/claude-opus-4.7": {
63357
- measuredAt: "2026-08-29T16:51:33Z",
63358
- latencyMs: 5316.5,
63359
- p95LatencyMs: 6121.5,
63360
- outputTokensPerSecond: 97.34,
63361
- errorRate: 0,
63362
- samples: 3
63363
- },
63364
- "anthropic/claude-opus-4.8": {
63365
- measuredAt: "2026-08-29T16:51:33Z",
63366
- latencyMs: 6216.1,
63367
- p95LatencyMs: 6847.7,
63368
- outputTokensPerSecond: 82.81,
63369
- errorRate: 0,
63370
- samples: 3
63371
- },
63372
- "anthropic/claude-opus-5": {
63373
- measuredAt: "2026-08-29T16:51:33Z",
63374
- latencyMs: 7309,
63375
- p95LatencyMs: 7745.2,
63376
- outputTokensPerSecond: 70.17,
63377
- errorRate: 0,
63378
- samples: 3
63379
- },
63380
- "anthropic/claude-sonnet-4.5": {
63381
- measuredAt: "2026-08-29T16:51:33Z",
63382
- latencyMs: 6330.4,
63383
- p95LatencyMs: 6631.6,
63384
- outputTokensPerSecond: 81.03,
63385
- errorRate: 0,
63386
- samples: 3
63387
- },
63388
- "anthropic/claude-sonnet-4.6": {
63389
- measuredAt: "2026-08-29T16:51:33Z",
63390
- latencyMs: 6508,
63391
- p95LatencyMs: 6698.3,
63392
- outputTokensPerSecond: 78.6,
63393
- errorRate: 0,
63394
- samples: 3
63395
- },
63396
- "anthropic/claude-sonnet-5": {
63397
- measuredAt: "2026-08-29T16:51:33Z",
63398
- latencyMs: 6165.4,
63399
- p95LatencyMs: 6582.9,
63400
- outputTokensPerSecond: 83.62,
63401
- errorRate: 0,
63402
- samples: 3
63403
- },
63404
- "deepseek/deepseek-chat": {
63405
- measuredAt: "2026-08-29T16:51:33Z",
63406
- latencyMs: 4351.4,
63407
- p95LatencyMs: 4543.7,
63408
- outputTokensPerSecond: 117.78,
63409
- errorRate: 0,
63410
- samples: 3
63411
- },
63412
- "deepseek/deepseek-reasoner": {
63413
- measuredAt: "2026-08-29T16:51:33Z",
63414
- latencyMs: 5201.2,
63415
- p95LatencyMs: 6079.6,
63416
- outputTokensPerSecond: 99.77,
63417
- errorRate: 0,
63418
- samples: 3
63419
- },
63420
- "deepseek/deepseek-v4-pro": {
63421
- measuredAt: "2026-08-29T16:51:33Z",
63422
- latencyMs: 8781.2,
63423
- p95LatencyMs: 9881.1,
63424
- outputTokensPerSecond: 58.98,
63425
- errorRate: 0,
63426
- samples: 3
63427
- },
63428
- "deepseek/deepseek-v4.1-flash": {
63429
- measuredAt: "2026-10-20T18:12:51Z",
63430
- latencyMs: 2383.5,
63431
- p95LatencyMs: 2547.8,
63432
- outputTokensPerSecond: 216.53,
63433
- errorRate: 0,
63434
- samples: 3
63435
- },
63436
- "google/gemini-2.5-flash": {
63437
- measuredAt: "2026-08-29T16:51:33Z",
63438
- latencyMs: 5416.4,
63439
- p95LatencyMs: 6442.8,
63440
- outputTokensPerSecond: 213.07,
63441
- errorRate: 0,
63442
- samples: 3
63443
- },
63444
- "google/gemini-2.5-flash-lite": {
63445
- measuredAt: "2026-08-29T16:51:33Z",
63446
- latencyMs: 5002.6,
63447
- p95LatencyMs: 5780.3,
63448
- outputTokensPerSecond: 408.43,
63449
- errorRate: 0,
63450
- samples: 3
63451
- },
63452
- "google/gemini-2.5-pro": {
63453
- measuredAt: "2026-08-29T16:51:33Z",
63454
- latencyMs: 28169.5,
63455
- p95LatencyMs: 29491.4,
63456
- outputTokensPerSecond: 147.3,
63457
- errorRate: 0,
63458
- samples: 3
63459
- },
63460
- "google/gemini-3-flash-preview": {
63461
- measuredAt: "2026-08-29T16:51:33Z",
63462
- latencyMs: 4717.1,
63463
- p95LatencyMs: 5037.1,
63464
- outputTokensPerSecond: 198.71,
63465
- errorRate: 0,
63466
- samples: 3
63467
- },
63468
- "google/gemini-3.1-flash-lite": {
63469
- measuredAt: "2026-08-29T16:51:33Z",
63470
- latencyMs: 2855.8,
63471
- p95LatencyMs: 3172.7,
63472
- outputTokensPerSecond: 286.91,
63473
- errorRate: 0,
63474
- samples: 3
63475
- },
63476
- "google/gemini-3.1-pro": {
63477
- measuredAt: "2026-08-29T16:59:54Z",
63478
- latencyMs: 24194.1,
63479
- p95LatencyMs: 27269.6,
63480
- outputTokensPerSecond: 109.47,
63481
- errorRate: 0,
63482
- samples: 3
63483
- },
63484
- "google/gemini-3.5-flash": {
63485
- measuredAt: "2026-08-29T16:51:33Z",
63486
- latencyMs: 5320.6,
63487
- p95LatencyMs: 5429.8,
63488
- outputTokensPerSecond: 226.21,
63489
- errorRate: 0,
63490
- samples: 3
63491
- },
63492
- "google/gemini-3.5-flash-lite": {
63493
- measuredAt: "2026-08-29T16:51:33Z",
63494
- latencyMs: 3515.8,
63495
- p95LatencyMs: 4363.4,
63496
- outputTokensPerSecond: 248.9,
63497
- errorRate: 0,
63498
- samples: 3
63499
- },
63500
- "google/gemini-3.6-flash": {
63501
- measuredAt: "2026-08-29T16:51:33Z",
63502
- latencyMs: 13020,
63503
- p95LatencyMs: 15383.1,
63504
- outputTokensPerSecond: 187.87,
63505
- errorRate: 0,
63506
- samples: 3
63507
- },
63508
- "minimax/minimax-m2.7": {
63509
- measuredAt: "2026-08-29T16:51:33Z",
63510
- latencyMs: 8761.1,
63511
- p95LatencyMs: 10199.3,
63512
- outputTokensPerSecond: 59.18,
63513
- errorRate: 0,
63514
- samples: 3
63515
- },
63516
- "minimax/minimax-m3": {
63517
- measuredAt: "2026-08-29T16:51:33Z",
63518
- latencyMs: 11101.9,
63519
- p95LatencyMs: 26087.1,
63520
- outputTokensPerSecond: 101.12,
63521
- errorRate: 0,
63522
- samples: 3
63523
- },
63524
- "moonshot/kimi-k3": {
63525
- measuredAt: "2026-08-29T16:51:33Z",
63526
- latencyMs: 24498.9,
63527
- p95LatencyMs: 40365.3,
63528
- outputTokensPerSecond: 25.11,
63529
- errorRate: 0,
63530
- samples: 3
63531
- },
63532
- "nvidia/mistral-nemotron": {
63533
- measuredAt: "2026-08-29T16:51:33Z",
63534
- latencyMs: 7349.6,
63535
- p95LatencyMs: 9932.3,
63536
- outputTokensPerSecond: 79.48,
63537
- errorRate: 0.3333,
63538
- samples: 3
63539
- },
63540
- "nvidia/nemotron-3-nano-omni-30b-a3b-reasoning": {
63541
- measuredAt: "2026-08-29T16:59:54Z",
63542
- latencyMs: 9324.6,
63543
- p95LatencyMs: 12992,
63544
- outputTokensPerSecond: 64.96,
63545
- errorRate: 0.3333,
63546
- samples: 3
63547
- },
63548
- "nvidia/nemotron-nano-12b-v2-vl": {
63549
- measuredAt: "2026-08-29T16:51:33Z",
63550
- latencyMs: 5846.9,
63551
- p95LatencyMs: 5846.9,
63552
- outputTokensPerSecond: 87.57,
63553
- errorRate: 0.6667,
63554
- samples: 3
63555
- },
63556
- "nvidia/nemotron-nano-9b-v2": {
63557
- measuredAt: "2026-08-29T16:51:33Z",
63558
- latencyMs: 5282.5,
63559
- p95LatencyMs: 5282.5,
63560
- outputTokensPerSecond: 96.92,
63561
- errorRate: 0.6667,
63562
- samples: 3
63563
- },
63564
- "nvidia/step-3.7-flash": {
63565
- measuredAt: "2026-08-29T16:51:33Z",
63566
- latencyMs: 4617.4,
63567
- p95LatencyMs: 5237.4,
63568
- outputTokensPerSecond: 112.92,
63569
- errorRate: 0.3333,
63570
- samples: 3
63571
- },
63572
- "openai/chat-latest": {
63573
- measuredAt: "2026-08-29T16:51:33Z",
63574
- latencyMs: 3690.9,
63575
- p95LatencyMs: 4344,
63576
- outputTokensPerSecond: 111.85,
63577
- errorRate: 0,
63578
- samples: 3
63579
- },
63580
- "openai/gpt-4.1": {
63581
- measuredAt: "2026-08-29T16:51:33Z",
63582
- latencyMs: 3527.9,
63583
- p95LatencyMs: 3831.7,
63584
- outputTokensPerSecond: 141.27,
63585
- errorRate: 0,
63586
- samples: 3
63587
- },
63588
- "openai/gpt-4.1-mini": {
63589
- measuredAt: "2026-08-29T16:51:33Z",
63590
- latencyMs: 4268.2,
63591
- p95LatencyMs: 5101.5,
63592
- outputTokensPerSecond: 103.42,
63593
- errorRate: 0,
63594
- samples: 3
63595
- },
63596
- "openai/gpt-4.1-nano": {
63597
- measuredAt: "2026-08-29T16:51:33Z",
63598
- latencyMs: 3088.3,
63599
- p95LatencyMs: 3369.2,
63600
- outputTokensPerSecond: 150.31,
63601
- errorRate: 0,
63602
- samples: 3
63603
- },
63604
- "openai/gpt-4o": {
63605
- measuredAt: "2026-08-29T16:51:33Z",
63606
- latencyMs: 2995.2,
63607
- p95LatencyMs: 3174.2,
63608
- outputTokensPerSecond: 171.32,
63609
- errorRate: 0,
63610
- samples: 3
63611
- },
63612
- "openai/gpt-4o-mini": {
63613
- measuredAt: "2026-08-29T16:51:33Z",
63614
- latencyMs: 4751.5,
63615
- p95LatencyMs: 4930.4,
63616
- outputTokensPerSecond: 107.84,
63617
- errorRate: 0,
63618
- samples: 3
63619
- },
63620
- "openai/gpt-5-mini": {
63621
- measuredAt: "2026-08-29T16:51:33Z",
63622
- latencyMs: 4558.1,
63623
- p95LatencyMs: 5081.9,
63624
- outputTokensPerSecond: 113.25,
63625
- errorRate: 0,
63626
- samples: 3
63627
- },
63628
- "openai/gpt-5.2": {
63629
- measuredAt: "2026-08-29T16:51:33Z",
63630
- latencyMs: 5436.6,
63631
- p95LatencyMs: 5928.8,
63632
- outputTokensPerSecond: 95.47,
63633
- errorRate: 0,
63634
- samples: 3
63635
- },
63636
- "openai/gpt-5.3-codex": {
63637
- measuredAt: "2026-08-29T16:59:54Z",
63638
- latencyMs: 15290.4,
63639
- p95LatencyMs: 15290.4,
63640
- outputTokensPerSecond: 33.49,
63641
- errorRate: 0.6667,
63642
- samples: 3
63643
- },
63644
- "openai/gpt-5.4": {
63645
- measuredAt: "2026-08-29T16:51:33Z",
63646
- latencyMs: 5596,
63647
- p95LatencyMs: 5919.4,
63648
- outputTokensPerSecond: 91.67,
63649
- errorRate: 0,
63650
- samples: 3
63651
- },
63652
- "openai/gpt-5.4-mini": {
63653
- measuredAt: "2026-08-29T16:51:33Z",
63654
- latencyMs: 3377.8,
63655
- p95LatencyMs: 3646.8,
63656
- outputTokensPerSecond: 138.08,
63657
- errorRate: 0,
63658
- samples: 3
63659
- },
63660
- "openai/gpt-5.4-nano": {
63661
- measuredAt: "2026-08-29T16:51:33Z",
63662
- latencyMs: 4040.4,
63663
- p95LatencyMs: 4205.9,
63664
- outputTokensPerSecond: 118.52,
63665
- errorRate: 0,
63666
- samples: 3
63667
- },
63668
- "openai/gpt-5.5": {
63669
- measuredAt: "2026-08-29T16:51:33Z",
63670
- latencyMs: 6367.8,
63671
- p95LatencyMs: 7330.7,
63672
- outputTokensPerSecond: 81.29,
63673
- errorRate: 0,
63674
- samples: 3
63675
- },
63676
- "openai/gpt-5.6-luna": {
63677
- measuredAt: "2026-08-29T16:51:33Z",
63678
- latencyMs: 6064.5,
63679
- p95LatencyMs: 7347.3,
63680
- outputTokensPerSecond: 87.93,
63681
- errorRate: 0,
63682
- samples: 3
63683
- },
63684
- "openai/gpt-5.6-luna-pro": {
63685
- measuredAt: "2026-08-29T16:59:54Z",
63686
- latencyMs: 13914.9,
63687
- p95LatencyMs: 13914.9,
63688
- outputTokensPerSecond: 36.79,
63689
- errorRate: 0.6667,
63690
- samples: 3
63691
- },
63692
- "openai/gpt-5.6-sol": {
63693
- measuredAt: "2026-08-29T16:51:33Z",
63694
- latencyMs: 7720.2,
63695
- p95LatencyMs: 9108.2,
63696
- outputTokensPerSecond: 67.47,
63697
- errorRate: 0,
63698
- samples: 3
63699
- },
63700
- "openai/gpt-5.6-sol-pro": {
63701
- measuredAt: "2026-08-29T16:51:33Z",
63702
- latencyMs: 11442.7,
63703
- p95LatencyMs: 13363.1,
63704
- outputTokensPerSecond: 148.75,
63705
- errorRate: 0,
63706
- samples: 3
63707
- },
63708
- "openai/gpt-5.6-terra": {
63709
- measuredAt: "2026-08-29T16:51:33Z",
63710
- latencyMs: 4941,
63711
- p95LatencyMs: 5095.3,
63712
- outputTokensPerSecond: 103.69,
63713
- errorRate: 0,
63714
- samples: 3
63715
- },
63716
- "openai/gpt-5.6-terra-pro": {
63717
- measuredAt: "2026-08-29T16:51:33Z",
63718
- latencyMs: 3574.1,
63719
- p95LatencyMs: 4126.3,
63720
- outputTokensPerSecond: 133.59,
63721
- errorRate: 0,
63722
- samples: 3
63723
- },
63724
- "openai/gpt-6.1-sol": {
63725
- measuredAt: "2026-10-20T18:12:51Z",
63726
- latencyMs: 11324,
63727
- p95LatencyMs: 12747.6,
63728
- outputTokensPerSecond: 45.11,
63729
- errorRate: 0,
63730
- samples: 3
63731
- },
63732
- "openai/o1": {
63733
- measuredAt: "2026-08-29T16:51:33Z",
63734
- latencyMs: 4324.9,
63735
- p95LatencyMs: 5838.1,
63736
- outputTokensPerSecond: 125.86,
63737
- errorRate: 0,
63738
- samples: 3
63739
- },
63740
- "openai/o3": {
63741
- measuredAt: "2026-08-29T16:51:33Z",
63742
- latencyMs: 5463.4,
63743
- p95LatencyMs: 5613.1,
63744
- outputTokensPerSecond: 93.8,
63745
- errorRate: 0,
63746
- samples: 3
63747
- },
63748
- "openai/o3-mini": {
63749
- measuredAt: "2026-08-29T16:51:33Z",
63750
- latencyMs: 2912.7,
63751
- p95LatencyMs: 3092.1,
63752
- outputTokensPerSecond: 176.49,
63753
- errorRate: 0,
63754
- samples: 3
63755
- },
63756
- "openai/o4-mini": {
63757
- measuredAt: "2026-08-29T16:51:33Z",
63758
- latencyMs: 4958.7,
63759
- p95LatencyMs: 5313,
63760
- outputTokensPerSecond: 103.81,
63761
- errorRate: 0,
63762
- samples: 3
63763
- },
63764
- "qwen/qwen3.7-flash": {
63765
- measuredAt: "2026-08-29T16:51:33Z",
63766
- latencyMs: 3385.5,
63767
- p95LatencyMs: 4042.7,
63768
- outputTokensPerSecond: 153.94,
63769
- errorRate: 0,
63770
- samples: 3
63771
- },
63772
- "qwen/qwen3.7-max": {
63773
- measuredAt: "2026-08-29T16:51:33Z",
63774
- latencyMs: 9387.1,
63775
- p95LatencyMs: 10490.2,
63776
- outputTokensPerSecond: 54.92,
63777
- errorRate: 0,
63778
- samples: 3
63779
- },
63780
- "qwen/qwen3.7-plus": {
63781
- measuredAt: "2026-08-29T16:51:33Z",
63782
- latencyMs: 9766.6,
63783
- p95LatencyMs: 9798.2,
63784
- outputTokensPerSecond: 52.42,
63785
- errorRate: 0,
63786
- samples: 3
63787
- },
63788
- "tencent/hy3": {
63789
- measuredAt: "2026-08-29T16:51:33Z",
63790
- latencyMs: 6062.3,
63791
- p95LatencyMs: 7070.2,
63792
- outputTokensPerSecond: 87.3,
63793
- errorRate: 0,
63794
- samples: 3
63795
- },
63796
- "xai/grok-4.3": {
63797
- measuredAt: "2026-08-29T16:51:33Z",
63798
- latencyMs: 9467.7,
63799
- p95LatencyMs: 10087.9,
63800
- outputTokensPerSecond: 48.36,
63801
- errorRate: 0,
63802
- samples: 3
63803
- },
63804
- "xai/grok-4.5": {
63805
- measuredAt: "2026-08-29T16:51:33Z",
63806
- latencyMs: 13564.8,
63807
- p95LatencyMs: 17351.9,
63808
- outputTokensPerSecond: 60.71,
63809
- errorRate: 0,
63810
- samples: 3
63811
- },
63812
- "xai/grok-build-0.1": {
63813
- measuredAt: "2026-08-29T16:51:33Z",
63814
- latencyMs: 16394.8,
63815
- p95LatencyMs: 18035.4,
63816
- outputTokensPerSecond: 96.86,
63817
- errorRate: 0,
63818
- samples: 3
63819
- },
63820
- "xiaomi/mimo-v2.5-pro": {
63821
- measuredAt: "2026-08-29T16:51:33Z",
63822
- latencyMs: 12070.7,
63823
- p95LatencyMs: 12386.8,
63824
- outputTokensPerSecond: 42.44,
63825
- errorRate: 0,
63826
- samples: 3
63827
- },
63828
- "zai/glm-5": {
63829
- measuredAt: "2026-08-29T16:51:33Z",
63830
- latencyMs: 6839.7,
63831
- p95LatencyMs: 7261.4,
63832
- outputTokensPerSecond: 75.16,
63833
- errorRate: 0,
63834
- samples: 3
63835
- },
63836
- "zai/glm-5-turbo": {
63837
- measuredAt: "2026-08-29T16:51:33Z",
63838
- latencyMs: 55348.5,
63839
- p95LatencyMs: 114086.6,
63840
- outputTokensPerSecond: 14.64,
63841
- errorRate: 0,
63842
- samples: 3
63843
- },
63844
- "zai/glm-5.1": {
63845
- measuredAt: "2026-08-29T16:51:33Z",
63846
- latencyMs: 15658.4,
63847
- p95LatencyMs: 17307.1,
63848
- outputTokensPerSecond: 32.9,
63849
- errorRate: 0,
63850
- samples: 3
63851
- },
63852
- "zai/glm-5.2": {
63853
- measuredAt: "2026-08-29T16:51:33Z",
63854
- latencyMs: 10308.5,
63855
- p95LatencyMs: 15127.6,
63856
- outputTokensPerSecond: 54.87,
63857
- errorRate: 0,
63858
- samples: 3
63859
- },
63860
- "zai/glm-5.3": {
63861
- measuredAt: "2026-08-29T16:51:33Z",
63862
- latencyMs: 7272.4,
63863
- p95LatencyMs: 7998.1,
63864
- outputTokensPerSecond: 71.09,
63865
- errorRate: 0,
63866
- samples: 3
63867
- },
63868
- "zai/glm-5.3-flash": {
63869
- measuredAt: "2026-08-29T16:51:33Z",
63870
- latencyMs: 10545.3,
63871
- p95LatencyMs: 11672.4,
63872
- outputTokensPerSecond: 49.01,
63873
- errorRate: 0,
63874
- samples: 3
63875
- }
63876
- };
63877
- LIVE_MODEL_PROFILES = Object.freeze(
63878
- model_profiles_generated_default
63879
- );
63880
- HISTORICAL_MODEL_PROFILES = Object.freeze({
63881
- "anthropic/claude-haiku-4.5": {
63882
- measuredAt: "2026-03-16T13:50:48Z",
63883
- latencyMs: 2305,
63884
- outputTokensPerSecond: 140.6
63885
- },
63886
- "anthropic/claude-sonnet-4.6": {
63887
- measuredAt: "2026-03-16T13:50:48Z",
63888
- latencyMs: 2110,
63889
- outputTokensPerSecond: 121.3
63890
- },
63891
- "deepseek/deepseek-chat": {
63892
- measuredAt: "2026-03-16T13:50:48Z",
63893
- latencyMs: 1431,
63894
- outputTokensPerSecond: 179.2,
63895
- intelligenceIndex: 32
63896
- },
63897
- "google/gemini-2.5-flash": {
63898
- measuredAt: "2026-03-16T13:50:48Z",
63899
- latencyMs: 1238,
63900
- outputTokensPerSecond: 207.6,
63901
- intelligenceIndex: 20
63902
- },
63903
- "google/gemini-2.5-flash-lite": {
63904
- measuredAt: "2026-03-16T13:50:48Z",
63905
- latencyMs: 1353,
63906
- outputTokensPerSecond: 192.5,
63907
- intelligenceIndex: 20
63908
- },
63909
- "google/gemini-2.5-pro": {
63910
- measuredAt: "2026-03-16T13:50:48Z",
63911
- latencyMs: 1294,
63912
- outputTokensPerSecond: 197.8
63913
- },
63914
- "google/gemini-3.1-pro": {
63915
- measuredAt: "2026-03-16T13:50:48Z",
63916
- latencyMs: 1609,
63917
- outputTokensPerSecond: 167.2
63918
- },
63919
- "openai/gpt-4o-mini": {
63920
- measuredAt: "2026-03-16T13:50:48Z",
63921
- latencyMs: 2764,
63922
- outputTokensPerSecond: 92.8
63923
- },
63924
- "openai/gpt-5.3-codex": {
63925
- measuredAt: "2026-03-16T13:50:48Z",
63926
- latencyMs: 7935,
63927
- outputTokensPerSecond: 32.3
63928
- }
63929
- });
63930
- DEFAULT_PORTFOLIO_WEIGHTS = {
63931
- auto: {
63932
- quality: 0.47,
63933
- capability: 0.2,
63934
- cost: 0.18,
63935
- speed: 0.07,
63936
- reliability: 0.03,
63937
- legacy: 0.05
63938
- },
63939
- eco: { quality: 0.36, capability: 0.2, cost: 0.28, speed: 0.1, reliability: 0.04, legacy: 0.02 },
63940
- premium: {
63941
- quality: 0.58,
63942
- capability: 0.2,
63943
- cost: 0.08,
63944
- speed: 0.06,
63945
- reliability: 0.06,
63946
- legacy: 0.02
63947
- },
63948
- highStakesBoost: { quality: 0.08, reliability: 0.05 },
63949
- latencySensitiveSpeedBoost: 0.08,
63950
- affinityFloorGap: { auto: 0.1, eco: 0.22, premium: 0.05 }
63951
- };
63952
- VERIFIED_TOOL_FALLBACKS = [
63953
- "anthropic/claude-fable-5.1",
63954
- "anthropic/claude-opus-5.5",
63955
- "anthropic/claude-sonnet-5.5",
63956
- "deepseek/deepseek-v4.1-flash",
63957
- "google/gemini-3.8-flash",
63958
- "openai/gpt-5.1",
63959
- "openai/gpt-6-astra",
63960
- "openai/gpt-6-luna",
63961
- "openai/gpt-6-sol",
63962
- "openai/gpt-6.1-sol",
63963
- "xai/grok-4.6",
63964
- "xai/grok-4.7",
63965
- "xiaomi/mimo-v2.5"
63966
- ];
63967
- PortfolioStrategy = class {
63968
- name = "portfolio";
63969
- // Rules set the capability tier; the strategy is stateless, so one instance serves every request.
63970
- rules = new RulesStrategy();
63971
- route(prompt, systemPrompt, maxOutputTokens, options) {
63972
- const features = classifyTask(prompt, systemPrompt, options);
63973
- const base4 = this.rules.route(prompt, systemPrompt, maxOutputTokens, {
63974
- ...options,
63975
- requiresTools: features.needsTools
63976
- });
63977
- const tierConfigs = base4.tierConfigs;
63978
- if (!tierConfigs) return base4;
63979
- const targetTier = (features.taskType === "reasoning_mcq" || features.taskType === "reasoning_math") && (base4.tier === "SIMPLE" || base4.tier === "MEDIUM") ? "REASONING" : (features.taskType === "debug" || features.taskType === "code_edit") && features.codeArtifact && base4.tier === "SIMPLE" ? "MEDIUM" : base4.tier;
63980
- const tierConfig = tierConfigs[targetTier];
63981
- const configuredCandidates = tierConfig ? getFallbackChain(targetTier, tierConfigs) : [];
63982
- const unavailable = new Set(options.unavailableModels ?? []);
63983
- const verifiedToolFallbacks = features.needsTools ? VERIFIED_TOOL_FALLBACKS.filter((model2) => options.modelPricing.has(model2)) : [];
63984
- if (options.routingProfile !== "premium") {
63985
- const fallbackCost = (model2) => estimatedCost(model2, options, features.estimatedInputTokens, maxOutputTokens);
63986
- verifiedToolFallbacks.sort((a, b) => fallbackCost(a) - fallbackCost(b));
63987
- }
63988
- const chain3 = [
63989
- .../* @__PURE__ */ new Set([
63990
- ...configuredCandidates,
63991
- ...evidenceCandidates(features.taskType),
63992
- ...verifiedToolFallbacks
63993
- ])
63994
- ].filter(
63995
- (model2) => typeof model2 === "string" && model2.length > 0 && !unavailable.has(model2)
63996
- );
63997
- const eligible = new Set(
63998
- chain3.filter((model2) => isEligible(model2, features, maxOutputTokens, options))
63999
- );
64000
- const eligibleCandidates = eligible.size > 0 ? [...eligible] : chain3;
64001
- if (eligibleCandidates.length === 0) return base4;
64002
- const profileName = options.routingProfile === "eco" ? "eco" : options.routingProfile === "premium" ? "premium" : "auto";
64003
- const portfolio = options.config.portfolio ?? DEFAULT_PORTFOLIO_WEIGHTS;
64004
- const getAffinity = (model2) => affinity(
64005
- model2,
64006
- features.taskType,
64007
- features.language,
64008
- features.agentDomain,
64009
- features.deepWebResearch,
64010
- features.agentRisk,
64011
- features.terminalToolSignal,
64012
- features.terminalSafetySensitive
64013
- );
64014
- const bestAffinity = Math.max(...eligibleCandidates.map(getAffinity));
64015
- const specificAffinity = eligibleCandidates.filter((model2) => getAffinity(model2) > 0.68);
64016
- const affinityPool = specificAffinity.length > 0 ? specificAffinity : [eligibleCandidates[0]];
64017
- const affinityFloorGap = features.terminalToolSignal ? Math.max(
64018
- portfolio.affinityFloorGap[profileName],
64019
- features.terminalSafetySensitive ? 0.15 : 0.12
64020
- ) : portfolio.affinityFloorGap[profileName];
64021
- const candidates = affinityPool.filter(
64022
- (model2) => getAffinity(model2) >= bestAffinity - affinityFloorGap
64023
- );
64024
- const costs = candidates.map(
64025
- (model2) => estimatedCost(model2, options, features.estimatedInputTokens, maxOutputTokens)
64026
- );
64027
- const finiteCosts = costs.filter(Number.isFinite);
64028
- const minCost = finiteCosts.length > 0 ? Math.min(...finiteCosts) : 0;
64029
- const maxCost = finiteCosts.length > 0 ? Math.max(...finiteCosts) : 1;
64030
- const now2 = options.now ?? /* @__PURE__ */ new Date();
64031
- const profileWeights = portfolio[profileName];
64032
- const rankedEntries = candidates.map((model2, index2) => {
64033
- const cost = estimatedCost(model2, options, features.estimatedInputTokens, maxOutputTokens);
64034
- const costScore = Number.isFinite(cost) && maxCost > minCost ? 1 - (cost - minCost) / (maxCost - minCost) : 0.5;
64035
- const capabilityScore = eligible.has(model2) ? 1 : 0;
64036
- const profile = profileScore(model2, options, now2);
64037
- const observedQuality = profile?.quality === void 0 ? getAffinity(model2) : getAffinity(model2) * (1 - profile.freshness) + profile.quality * profile.freshness;
64038
- const observedSpeed = profile ? profile.speed * profile.freshness + 0.5 * (1 - profile.freshness) : 0.5;
64039
- const observedTailSpeed = profile ? profile.tailSpeed * profile.freshness + 0.5 * (1 - profile.freshness) : 0.5;
64040
- const observedReliability = profile ? profile.reliability * profile.freshness + (1 - profile.freshness) : 1;
64041
- const legacyScore = 1 - index2 / Math.max(1, candidates.length - 1);
64042
- const qualityWeight = profileWeights.quality + (features.highStakes ? portfolio.highStakesBoost.quality : 0);
64043
- const speedScore = features.latencySensitive ? observedTailSpeed : observedSpeed;
64044
- const speedWeight = profileWeights.speed + (features.latencySensitive ? portfolio.latencySensitiveSpeedBoost : 0);
64045
- const reliabilityWeight = profileWeights.reliability + (features.highStakes ? portfolio.highStakesBoost.reliability : 0);
64046
- const score = observedQuality * qualityWeight + capabilityScore * profileWeights.capability + costScore * profileWeights.cost + speedScore * speedWeight + observedReliability * reliabilityWeight + legacyScore * profileWeights.legacy;
64047
- return {
64048
- model: model2,
64049
- score,
64050
- quality: observedQuality,
64051
- cost: costScore,
64052
- speed: speedScore,
64053
- reliability: observedReliability
64054
- };
64055
- }).sort((a, b) => b.score - a.score);
64056
- const scoredModels = rankedEntries.map((item) => item.model);
64057
- const webResearchFallbackOrder = [
64058
- "anthropic/claude-sonnet-5",
64059
- "openai/gpt-5-mini",
64060
- "google/gemini-3.5-flash",
64061
- "anthropic/claude-opus-5",
64062
- "anthropic/claude-opus-4.8",
64063
- "openai/gpt-5.3-codex"
64064
- ];
64065
- const ranked = features.agentDomain === "web_research" ? [
64066
- ...scoredModels,
64067
- ...webResearchFallbackOrder.filter(
64068
- (model2) => eligibleCandidates.includes(model2) && !scoredModels.includes(model2)
64069
- ),
64070
- ...eligibleCandidates.filter(
64071
- (model2) => !scoredModels.includes(model2) && !webResearchFallbackOrder.includes(model2)
64072
- )
64073
- ] : [...scoredModels, ...eligibleCandidates.filter((model2) => !scoredModels.includes(model2))];
64074
- const model = ranked[0] ?? base4.model;
64075
- const selectedTierConfigs = {
64076
- ...tierConfigs,
64077
- [targetTier]: { primary: model, fallback: ranked.slice(1) }
64078
- };
64079
- const decision = selectModel(
64080
- targetTier,
64081
- base4.confidence,
64082
- "portfolio",
64083
- `${base4.reasoning} | v3 task=${features.taskType} agentRisk=${features.agentRisk} deepWebResearch=${features.deepWebResearch} terminalCode=${features.implicitTerminalCode} terminalSafety=${features.terminalSafetySensitive} candidates=${ranked.length}`,
64084
- selectedTierConfigs,
64085
- options.modelPricing,
64086
- features.estimatedInputTokens,
64087
- maxOutputTokens,
64088
- options.routingProfile,
64089
- base4.agenticScore
64090
- );
64091
- return {
64092
- ...decision,
64093
- tierConfigs: selectedTierConfigs,
64094
- profile: base4.profile,
64095
- candidates: ranked,
64096
- candidateScores: rankedEntries.map(({ model: model2, score, quality, cost, speed, reliability }) => ({
64097
- model: model2,
64098
- score,
64099
- quality,
64100
- cost,
64101
- speed,
64102
- reliability
64103
- })),
64104
- taskType: features.taskType,
64105
- routerVersion: "v3-portfolio"
64106
- };
64107
- }
64108
- };
64109
- DEFAULT_ROUTING_CONFIG = {
64110
- version: "3.5",
64111
- strategy: "portfolio",
64112
- portfolio: {
64113
- auto: {
64114
- quality: 0.47,
64115
- capability: 0.2,
64116
- cost: 0.18,
64117
- speed: 0.07,
64118
- reliability: 0.03,
64119
- legacy: 0.05
64120
- },
64121
- eco: {
64122
- quality: 0.36,
64123
- capability: 0.2,
64124
- cost: 0.28,
64125
- speed: 0.1,
64126
- reliability: 0.04,
64127
- legacy: 0.02
64128
- },
64129
- premium: {
64130
- quality: 0.58,
64131
- capability: 0.2,
64132
- cost: 0.08,
64133
- speed: 0.06,
64134
- reliability: 0.06,
64135
- legacy: 0.02
64136
- },
64137
- highStakesBoost: { quality: 0.08, reliability: 0.05 },
64138
- latencySensitiveSpeedBoost: 0.08,
64139
- affinityFloorGap: { auto: 0.1, eco: 0.22, premium: 0.05 }
64140
- },
64141
- classifier: {
64142
- llmModel: "google/gemini-2.5-flash",
64143
- llmMaxTokens: 10,
64144
- llmTemperature: 0,
64145
- promptTruncationChars: 500,
64146
- cacheTtlMs: 36e5
64147
- // 1 hour
62586
+ classifier: {
62587
+ llmModel: "google/gemini-2.5-flash",
62588
+ llmMaxTokens: 10,
62589
+ llmTemperature: 0,
62590
+ promptTruncationChars: 500,
62591
+ cacheTtlMs: 36e5
62592
+ // 1 hour
64148
62593
  },
64149
62594
  scoring: {
64150
62595
  tokenCountThresholds: { simple: 50, complex: 500 },
@@ -65148,448 +63593,2040 @@ var init_dist = __esm({
65148
63593
  agenticTask: 0.04
65149
63594
  // Reduced - agentic signals influence tier selection, not dominate it
65150
63595
  },
65151
- // Tier boundaries on weighted score axis
65152
- tierBoundaries: {
65153
- simpleMedium: 0,
65154
- mediumComplex: 0.3,
65155
- // Raised from 0.18 - prevent simple tasks from reaching expensive COMPLEX tier
65156
- complexReasoning: 0.5
65157
- // Raised from 0.4 - reserve for true reasoning tasks
63596
+ // Tier boundaries on weighted score axis
63597
+ tierBoundaries: {
63598
+ simpleMedium: 0,
63599
+ mediumComplex: 0.3,
63600
+ // Raised from 0.18 - prevent simple tasks from reaching expensive COMPLEX tier
63601
+ complexReasoning: 0.5
63602
+ // Raised from 0.4 - reserve for true reasoning tasks
63603
+ },
63604
+ // Sigmoid steepness for confidence calibration
63605
+ confidenceSteepness: 12,
63606
+ // Below this confidence → ambiguous (null tier)
63607
+ confidenceThreshold: 0.7
63608
+ },
63609
+ // ─── Tier chains ───
63610
+ //
63611
+ // Catalog refresh 2026-08-29 (V3.5). Every chain below names only models
63612
+ // the public catalog lists (GET https://blockrun.ai/api/v1/models). Ids the
63613
+ // gateway withholds (`hidden: true`) — kimi-k2.5/k2.6/k2.7, the grok-4-fast
63614
+ // and grok-4-1-fast pairs, grok-4-0709, claude-opus-4.6, gemini-3-pro-preview,
63615
+ // the whole `free/*` namespace — were removed everywhere, including fallback
63616
+ // rungs, so a routed model is always one a user can find on blockrun.ai/models.
63617
+ //
63618
+ // Primaries moved only where portfolio.ts already carries calibration
63619
+ // evidence for the successor (Sonnet 5 over Sonnet 4.6, GPT-5 Mini for
63620
+ // agentic MEDIUM, Gemini 3.5 Flash where Kimi K2.7 was). Newcomers with no
63621
+ // trajectory evidence yet (gemini-3.6-flash, glm-5.3, glm-5.3-flash,
63622
+ // gpt-5.6-luna, grok-4.3, minimax-m3, qwen3.7-plus) enter as fallback rungs;
63623
+ // promotion waits for a calibration run, because version recency is not a
63624
+ // quality signal.
63625
+ //
63626
+ // Latency figures in comments are the 2026-08-29 gateway probe
63627
+ // (model-profiles.generated.json); prices are the catalog list.
63628
+ // Auto (balanced) tier configs - current default smart routing
63629
+ tiers: {
63630
+ SIMPLE: {
63631
+ primary: "google/gemini-2.5-flash",
63632
+ // $0.30/$2.50 — 60% retention (best) in the 2026-03 run; still the fastest quality answer
63633
+ fallback: [
63634
+ "google/gemini-3-flash-preview",
63635
+ // $0.50/$3 — GPQA 5/6 in the 2026-07 calibration
63636
+ "google/gemini-3.5-flash-lite",
63637
+ // $0.30/$2.50, 1M ctx, thinking mode — same price as 2.5 Flash, newer generation
63638
+ "deepseek/deepseek-chat",
63639
+ // $0.14/$0.28, 1M ctx
63640
+ "google/gemini-3.1-flash-lite",
63641
+ // $0.25/$1.50, 1M ctx
63642
+ "openai/gpt-5.6-luna",
63643
+ // $0.20/$1.20, 1M ctx — GPT-5.6 cost tier (cut 2026-07-30)
63644
+ "openai/gpt-5.4-nano",
63645
+ // $0.20/$1.25, 1M ctx
63646
+ "google/gemini-2.5-flash-lite",
63647
+ // $0.10/$0.40
63648
+ "nvidia/nemotron-3.5-lightning"
63649
+ // FREE backstop — NVIDIA free tier (probed 2026-08-30)
63650
+ ]
63651
+ },
63652
+ MEDIUM: {
63653
+ // Was moonshot/kimi-k2.7 (hidden 2026-08). Gemini 3.5 Flash is the
63654
+ // calibrated successor: MGSM 5/5, GPQA 4/6, extraction band (portfolio.ts).
63655
+ primary: "google/gemini-3.5-flash",
63656
+ // $1.50/$9, 1M ctx, vision + tools
63657
+ fallback: [
63658
+ "google/gemini-3.6-flash",
63659
+ // $1.50/$7.50 — newest Flash, output 17% cheaper than 3.5; awaiting calibration
63660
+ "zai/glm-5.3-flash",
63661
+ // $0.15/$0.50, 1M ctx, vision + tools verified live 2026-08-27
63662
+ "openai/gpt-5.6-terra",
63663
+ // $2/$12, 1M ctx — GPT-5.6 balanced tier
63664
+ "google/gemini-3-flash-preview",
63665
+ // $0.50/$3
63666
+ "deepseek/deepseek-chat",
63667
+ // $0.14/$0.28
63668
+ "google/gemini-2.5-flash",
63669
+ // $0.30/$2.50
63670
+ "minimax/minimax-m3",
63671
+ // $0.30/$1.20, 1M ctx
63672
+ "google/gemini-3.1-flash-lite",
63673
+ // $0.25/$1.50
63674
+ "openai/gpt-5.6-luna",
63675
+ // $0.20/$1.20
63676
+ "google/gemini-2.5-flash-lite"
63677
+ // $0.10/$0.40
63678
+ ]
63679
+ },
63680
+ COMPLEX: {
63681
+ primary: "google/gemini-3.1-pro",
63682
+ // $2/$12 — proven long-context flagship (portfolio.ts long_context lead)
63683
+ fallback: [
63684
+ "google/gemini-3.6-flash",
63685
+ // $1.50/$7.50 — Pro-level quality at Flash price (Google's claim; uncalibrated here)
63686
+ "google/gemini-3.5-flash",
63687
+ // $1.50/$9 — calibrated
63688
+ "anthropic/claude-sonnet-5",
63689
+ // $3/$15 — near-Opus quality, tau2 + Terminal-Bench calibrated
63690
+ "xai/grok-4.5",
63691
+ // $2.50/$9 — 503-resistant, independent infra (was grok-4-0709, now hidden)
63692
+ "google/gemini-2.5-pro",
63693
+ // $1.25/$10
63694
+ "anthropic/claude-sonnet-4.6",
63695
+ // $3/$15
63696
+ "openai/gpt-5.6-terra",
63697
+ // $2/$12 — GPT-5.6 balanced tier (Sol excluded: #202)
63698
+ "openai/gpt-5.5",
63699
+ // $5/$30 — prior OpenAI flagship
63700
+ "openai/gpt-5.4",
63701
+ // $2.50/$15 — previous flagship, benchmarked
63702
+ "zai/glm-5.3",
63703
+ // $1.40/$4.40, 1M ctx, always-on thinking — verified live 2026-08-19
63704
+ "moonshot/kimi-k3",
63705
+ // $3/$15, 1M ctx — Moonshot flagship (K2.7 successor)
63706
+ "deepseek/deepseek-v4-pro",
63707
+ // $0.435/$0.87 — strongest open-weight reasoner
63708
+ "deepseek/deepseek-chat",
63709
+ // $0.14/$0.28 — cheap last resort
63710
+ "google/gemini-2.5-flash"
63711
+ // $0.30/$2.50
63712
+ ]
63713
+ },
63714
+ REASONING: {
63715
+ // Was xai/grok-4-1-fast-reasoning ($0.20/$0.50, hidden 2026-08). DeepSeek
63716
+ // Reasoner is the cheapest listed reasoner at the same 1M context.
63717
+ primary: "deepseek/deepseek-reasoner",
63718
+ // $0.14/$0.28, 1M ctx
63719
+ fallback: [
63720
+ "deepseek/deepseek-v4-pro",
63721
+ // $0.435/$0.87 — calibrated reasoning band 0.95
63722
+ "xai/grok-4.3",
63723
+ // $1.50/$4, 1M ctx — xAI reasoning model, vision
63724
+ "qwen/qwen3.7-plus",
63725
+ // $0.32/$1.28, 1M ctx — reasoning; needs a generous max_tokens (thinking is billed)
63726
+ "google/gemini-3.5-flash",
63727
+ // $1.50/$9 — MGSM 5/5
63728
+ "openai/o4-mini",
63729
+ // $1.10/$4.40
63730
+ "openai/o3"
63731
+ // $2/$8
63732
+ ]
63733
+ }
63734
+ },
63735
+ // Eco tier configs - absolute cheapest (blockrun/eco)
63736
+ ecoTiers: {
63737
+ SIMPLE: {
63738
+ primary: "nvidia/nemotron-3.5-lightning",
63739
+ // FREE — NVIDIA free tier flagship, 1M ctx
63740
+ fallback: [
63741
+ // Was nvidia/nemotron-3-nano-30b until blockrun delisted it on 2026-09-08
63742
+ // (NVIDIA deprovisioned it for the account — a structured per-account
63743
+ // 404). nano-omni is blockrun's own redirect target for that id, so this
63744
+ // follows the same rule as the head: the router and the gateway name the
63745
+ // same model.
63746
+ "nvidia/nemotron-3-nano-omni-30b-a3b-reasoning",
63747
+ // FREE — nano-30b's successor, 256K ctx
63748
+ // The free head keeps rotting with NVIDIA's hosting (deepseek-v4-flash
63749
+ // 410 2026-08-12, seed-oss-36b 410 2026-08-03, gpt-oss-120b/20b 400
63750
+ // 2026-08-21, and on 2026-08-30 FOUR of the five visible free models at
63751
+ // once — step-3.7-flash, nemotron-nano-9b-v2 and nemotron-nano-12b-v2-vl
63752
+ // all 410, mistral-nemotron hung). Each retirement retargets the two
63753
+ // free rungs to the current free tier; the paid rungs below never move.
63754
+ // The head follows blockrun's own redirect of the model it replaces, so
63755
+ // the router and the gateway never name different models.
63756
+ "google/gemini-2.5-flash-lite",
63757
+ // $0.10/$0.40 — cheapest paid rung
63758
+ "zai/glm-5.3-flash",
63759
+ // $0.15/$0.50, 1M ctx, vision + tools
63760
+ "openai/gpt-5.6-luna",
63761
+ // $0.20/$1.20, 1M ctx
63762
+ "openai/gpt-5.4-nano",
63763
+ // $0.20/$1.25
63764
+ "google/gemini-3.1-flash-lite"
63765
+ // $0.25/$1.50
63766
+ ]
63767
+ },
63768
+ MEDIUM: {
63769
+ primary: "zai/glm-5.3-flash",
63770
+ // $0.15/$0.50, 1M ctx, vision + tools verified live — cheapest full-capability model
63771
+ fallback: [
63772
+ "deepseek/deepseek-chat",
63773
+ // $0.14/$0.28
63774
+ "google/gemini-3.1-flash-lite",
63775
+ // $0.25/$1.50
63776
+ "openai/gpt-5.6-luna",
63777
+ // $0.20/$1.20
63778
+ "openai/gpt-5.4-nano",
63779
+ // $0.20/$1.25
63780
+ "google/gemini-2.5-flash-lite",
63781
+ // $0.10/$0.40
63782
+ "google/gemini-2.5-flash"
63783
+ // $0.30/$2.50
63784
+ ]
65158
63785
  },
65159
- // Sigmoid steepness for confidence calibration
65160
- confidenceSteepness: 12,
65161
- // Below this confidence → ambiguous (null tier)
65162
- confidenceThreshold: 0.7
63786
+ COMPLEX: {
63787
+ primary: "zai/glm-5.3-flash",
63788
+ // $0.15/$0.50, 1M ctx
63789
+ fallback: [
63790
+ "deepseek/deepseek-chat",
63791
+ // $0.14/$0.28, 1M ctx
63792
+ "minimax/minimax-m3",
63793
+ // $0.30/$1.20, 1M ctx
63794
+ "deepseek/deepseek-v4-pro",
63795
+ // $0.435/$0.87
63796
+ "google/gemini-3.1-flash-lite",
63797
+ // $0.25/$1.50
63798
+ "google/gemini-2.5-flash"
63799
+ // $0.30/$2.50
63800
+ ]
63801
+ },
63802
+ REASONING: {
63803
+ primary: "deepseek/deepseek-reasoner",
63804
+ // $0.14/$0.28, 1M ctx — cheapest listed reasoner
63805
+ fallback: [
63806
+ "deepseek/deepseek-v4-pro",
63807
+ // $0.435/$0.87
63808
+ "qwen/qwen3.7-plus",
63809
+ // $0.32/$1.28 — reasoning
63810
+ "minimax/minimax-m3",
63811
+ // $0.30/$1.20 — reasoning + coding
63812
+ "zai/glm-5.3-flash"
63813
+ // $0.15/$0.50 — reasoning tokens alongside content
63814
+ ]
63815
+ }
63816
+ },
63817
+ // Premium tier configs - best quality (blockrun/premium)
63818
+ // codex=complex coding, flash=simple coding, sonnet=reasoning/instructions, fable/opus=architecture/PM/audits
63819
+ premiumTiers: {
63820
+ SIMPLE: {
63821
+ // Was moonshot/kimi-k2.7 (hidden 2026-08).
63822
+ primary: "google/gemini-3.5-flash",
63823
+ // $1.50/$9, 1M ctx, vision + tools — calibrated
63824
+ fallback: [
63825
+ "google/gemini-3.6-flash",
63826
+ // $1.50/$7.50 — newest Flash
63827
+ "anthropic/claude-haiku-4.5",
63828
+ // $1/$5
63829
+ "zai/glm-5.3",
63830
+ // $1.40/$4.40, 1M ctx
63831
+ "google/gemini-2.5-flash",
63832
+ // $0.30/$2.50
63833
+ "google/gemini-3.5-flash-lite",
63834
+ // $0.30/$2.50
63835
+ "deepseek/deepseek-chat"
63836
+ // $0.14/$0.28
63837
+ ]
63838
+ },
63839
+ MEDIUM: {
63840
+ primary: "openai/gpt-5.3-codex",
63841
+ // $1.75/$14 - 400K context, 128K output — code_edit/debug lead (portfolio.ts)
63842
+ fallback: [
63843
+ "anthropic/claude-sonnet-5",
63844
+ // $3/$15 — code_agent band 0.98
63845
+ "moonshot/kimi-k3",
63846
+ // $3/$15, 1M ctx — Moonshot flagship
63847
+ "zai/glm-5.3",
63848
+ // $1.40/$4.40 — long-horizon coding
63849
+ "google/gemini-3.6-flash",
63850
+ // $1.50/$7.50
63851
+ "google/gemini-3.5-flash",
63852
+ // $1.50/$9
63853
+ "google/gemini-2.5-pro",
63854
+ // $1.25/$10
63855
+ "xai/grok-4.5",
63856
+ // $2.50/$9
63857
+ "anthropic/claude-sonnet-4.6",
63858
+ // $3/$15
63859
+ "openai/gpt-5.6-terra"
63860
+ // $2/$12
63861
+ ]
63862
+ },
63863
+ COMPLEX: {
63864
+ // fable-5 was promoted here 2026-06-11, force-reverted 2026-06-13 when Anthropic
63865
+ // withdrew the offer, and restored 2026-07-14 now that BlockRun has relisted it.
63866
+ primary: "anthropic/claude-fable-5",
63867
+ // Best quality for complex tasks — Mythos-class flagship above Opus ($10/$50, 1M ctx, always-on thinking)
63868
+ // Fallback chain de-Gemini'd 2026-04-22: when Anthropic 503s, Gemini is
63869
+ // also prone to "high demand" 503s (correlated failure — everyone falls
63870
+ // back to Google at the same time). Prefer in-family → xAI → Moonshot →
63871
+ // OpenAI flagship → Z.AI → DeepSeek → NVIDIA free instead.
63872
+ fallback: [
63873
+ "anthropic/claude-opus-5",
63874
+ // in-family hot swap first (half the price, 1M ctx + adaptive thinking)
63875
+ "anthropic/claude-opus-4.8",
63876
+ // in-family hot swap (identical cost to 5)
63877
+ "anthropic/claude-opus-4.7",
63878
+ // in-family hot swap (identical cost to 4.8)
63879
+ "anthropic/claude-sonnet-5",
63880
+ // Sonnet-tier drop-down, near-Opus quality
63881
+ "anthropic/claude-sonnet-4.6",
63882
+ "xai/grok-4.5",
63883
+ // xAI flagship — 503-resistant, direct-xAI SKU
63884
+ "moonshot/kimi-k3",
63885
+ // Moonshot flagship, independent infra
63886
+ "openai/gpt-5.6-terra",
63887
+ // GPT-5.6 balanced tier — stable (Sol excluded: #202)
63888
+ "openai/gpt-5.5",
63889
+ // Prior OpenAI flagship — 1M+ ctx, native agent + computer use
63890
+ "openai/gpt-5.4",
63891
+ // Previous flagship (slow but stable, benchmarked at 6,213ms)
63892
+ "openai/gpt-5.3-codex",
63893
+ "zai/glm-5.3",
63894
+ // Z.AI flagship, 1M ctx
63895
+ "deepseek/deepseek-v4-pro",
63896
+ // strongest open-weight reasoner
63897
+ "deepseek/deepseek-chat",
63898
+ // Cheap, reliable
63899
+ "nvidia/nemotron-3.5-lightning"
63900
+ // NVIDIA free ultimate backstop
63901
+ ]
63902
+ },
63903
+ REASONING: {
63904
+ // Sonnet 5 promoted over Sonnet 4.6 (same price; reasoning band 0.98 for both,
63905
+ // plus Sonnet 5's tau2/BrowseComp trajectory evidence).
63906
+ primary: "anthropic/claude-sonnet-5",
63907
+ // $3/$15, 1M ctx, adaptive thinking
63908
+ fallback: [
63909
+ "anthropic/claude-sonnet-4.6",
63910
+ // in-family hot swap — same cost
63911
+ "anthropic/claude-opus-5",
63912
+ // Newest flagship Opus w/ adaptive thinking
63913
+ "anthropic/claude-opus-4.8",
63914
+ // Prior flagship Opus — identical cost to 5
63915
+ "anthropic/claude-opus-4.7",
63916
+ // Flagship Opus w/ adaptive thinking
63917
+ "xai/grok-4.5",
63918
+ // reasoning band 0.94
63919
+ "deepseek/deepseek-v4-pro",
63920
+ // reasoning band 0.95
63921
+ "xai/grok-4.3",
63922
+ // $1.50/$4 — xAI reasoning model
63923
+ "openai/o4-mini",
63924
+ // $1.10/$4.40
63925
+ "openai/o3"
63926
+ // $2/$8
63927
+ ]
63928
+ }
63929
+ },
63930
+ // Agentic tier configs - models that excel at multi-step autonomous tasks
63931
+ agenticTiers: {
63932
+ SIMPLE: {
63933
+ primary: "openai/gpt-4o-mini",
63934
+ // $0.15/$0.60 - best tool compliance at lowest cost
63935
+ fallback: [
63936
+ "openai/gpt-5.6-luna",
63937
+ // $0.20/$1.20 — lightweight agentic tier of GPT-5.6
63938
+ "zai/glm-5.3-flash",
63939
+ // $0.15/$0.50 — tool calls verified live 2026-08-27
63940
+ "anthropic/claude-haiku-4.5",
63941
+ // $1/$5
63942
+ "google/gemini-2.5-flash"
63943
+ // $0.30/$2.50
63944
+ ]
63945
+ },
63946
+ MEDIUM: {
63947
+ // Was moonshot/kimi-k2.7 (hidden 2026-08). GPT-5 Mini carries the
63948
+ // Terminal-Bench and tau2 trajectory evidence in portfolio.ts.
63949
+ primary: "openai/gpt-5-mini",
63950
+ // $0.25/$2 — 4/7 Terminal-Bench, 5/6 tau2 airline
63951
+ fallback: [
63952
+ "google/gemini-3.5-flash",
63953
+ // $1.50/$9 — tool_agent band 0.88
63954
+ "zai/glm-5.3-flash",
63955
+ // $0.15/$0.50 — tools verified
63956
+ "openai/gpt-5.6-terra",
63957
+ // $2/$12
63958
+ "openai/gpt-4o-mini",
63959
+ // $0.15/$0.60 — reliable tool calling
63960
+ "anthropic/claude-haiku-4.5",
63961
+ // $1/$5
63962
+ "deepseek/deepseek-chat",
63963
+ // $0.14/$0.28
63964
+ "moonshot/kimi-k3"
63965
+ // $3/$15 — tool_agent band 0.85
63966
+ ]
63967
+ },
63968
+ COMPLEX: {
63969
+ // Sonnet 5 promoted over Sonnet 4.6: tau2 airline + retail reward 1.0,
63970
+ // Terminal-Bench safety band lead (portfolio.ts).
63971
+ primary: "anthropic/claude-sonnet-5",
63972
+ // $3/$15 — best agentic quality per trajectory evidence
63973
+ // Fallback chain de-Gemini'd 2026-04-22: Gemini's "high demand" 503s
63974
+ // correlate with Anthropic outages (everyone falls back together).
63975
+ // Prefer 503-resistant providers first.
63976
+ fallback: [
63977
+ "anthropic/claude-sonnet-4.6",
63978
+ // in-family hot swap — same cost
63979
+ "anthropic/claude-opus-5",
63980
+ // Newest flagship Opus — in-family hot swap
63981
+ "anthropic/claude-opus-4.8",
63982
+ // Prior flagship Opus — identical cost to 5
63983
+ "anthropic/claude-opus-4.7",
63984
+ // Flagship Opus — in-family hot swap
63985
+ "xai/grok-4.5",
63986
+ // xAI flagship — strong tool use, independent infra
63987
+ "moonshot/kimi-k3",
63988
+ // Moonshot flagship — independent infra
63989
+ "openai/gpt-5.6-terra",
63990
+ // GPT-5.6 balanced tier — stable (Sol excluded: #202)
63991
+ "openai/gpt-5.5",
63992
+ // Prior flagship — native agent + computer use (exactly the agentic-tier use case)
63993
+ "openai/gpt-5.4",
63994
+ // Previous flagship — reliable
63995
+ "openai/gpt-5.3-codex",
63996
+ // code_agent lead
63997
+ "zai/glm-5.3",
63998
+ // long-horizon coding
63999
+ "deepseek/deepseek-v4-pro",
64000
+ // retail high-risk 3/3
64001
+ "deepseek/deepseek-chat",
64002
+ // cheap, reliable
64003
+ "nvidia/nemotron-3.5-lightning"
64004
+ // NVIDIA free ultimate backstop
64005
+ ]
64006
+ },
64007
+ REASONING: {
64008
+ primary: "anthropic/claude-sonnet-5",
64009
+ // $3/$15 — strong tool use + adaptive thinking
64010
+ fallback: [
64011
+ "anthropic/claude-sonnet-4.6",
64012
+ // in-family hot swap — same cost
64013
+ "anthropic/claude-opus-5",
64014
+ // Newest flagship Opus w/ adaptive thinking
64015
+ "anthropic/claude-opus-4.8",
64016
+ // Prior flagship Opus — identical cost to 5
64017
+ "anthropic/claude-opus-4.7",
64018
+ // Flagship Opus w/ adaptive thinking
64019
+ "xai/grok-4.5",
64020
+ // reasoning band 0.94
64021
+ "deepseek/deepseek-v4-pro",
64022
+ // reasoning band 0.95
64023
+ "deepseek/deepseek-reasoner"
64024
+ // $0.14/$0.28
64025
+ ]
64026
+ }
64027
+ },
64028
+ // Time-windowed promotions — auto-applied when active, ignored when expired.
64029
+ // The GLM-5.1 launch promo (2026-04-01 → 2026-05-01) was the last entry and
64030
+ // has expired; the list is kept empty so the mechanism stays wired.
64031
+ promotions: [],
64032
+ overrides: {
64033
+ maxTokensForceComplex: 1e5,
64034
+ structuredOutputMinTier: "MEDIUM",
64035
+ ambiguousDefaultTier: "MEDIUM"
64036
+ // agenticMode left undefined → auto-detect via tools/agenticScore.
64037
+ // Set to `true` to force agentic tiers; `false` to disable them entirely.
64038
+ }
64039
+ };
64040
+ DEFAULT_MODEL_CAPABILITIES = Object.freeze({
64041
+ "anthropic/claude-fable-5": {
64042
+ contextWindow: 1e6,
64043
+ maxOutputTokens: 128e3,
64044
+ supportsTools: true,
64045
+ supportsVision: true
64046
+ },
64047
+ "anthropic/claude-fable-5.1": {
64048
+ contextWindow: 1e6,
64049
+ maxOutputTokens: 128e3,
64050
+ supportsTools: true,
64051
+ supportsVision: true
64052
+ },
64053
+ "anthropic/claude-haiku-4.5": {
64054
+ // override: The public catalog's `categories` omit "vision" for this Anthropic model even though the gateway accepts image input for it (the prior hand-maintained snapshot had it, and Anthropic's model card lists it). Without this the vision filter would silently drop it — reported against the catalog; remove once the categories carry vision.
64055
+ contextWindow: 2e5,
64056
+ maxOutputTokens: 64e3,
64057
+ supportsTools: true,
64058
+ supportsVision: true
64059
+ },
64060
+ "anthropic/claude-opus-4.5": {
64061
+ contextWindow: 2e5,
64062
+ maxOutputTokens: 64e3,
64063
+ supportsTools: true,
64064
+ supportsVision: true
64065
+ },
64066
+ "anthropic/claude-opus-4.7": {
64067
+ contextWindow: 1e6,
64068
+ maxOutputTokens: 128e3,
64069
+ supportsTools: true,
64070
+ supportsVision: true
64071
+ },
64072
+ "anthropic/claude-opus-4.8": {
64073
+ contextWindow: 1e6,
64074
+ maxOutputTokens: 128e3,
64075
+ supportsTools: true,
64076
+ supportsVision: true
64077
+ },
64078
+ "anthropic/claude-opus-5": {
64079
+ contextWindow: 1e6,
64080
+ maxOutputTokens: 128e3,
64081
+ supportsTools: true,
64082
+ supportsVision: true
64083
+ },
64084
+ "anthropic/claude-opus-5.5": {
64085
+ contextWindow: 1e6,
64086
+ maxOutputTokens: 128e3,
64087
+ supportsTools: true,
64088
+ supportsVision: true
64089
+ },
64090
+ "anthropic/claude-sonnet-4.5": {
64091
+ contextWindow: 2e5,
64092
+ maxOutputTokens: 64e3,
64093
+ supportsTools: true,
64094
+ supportsVision: true
64095
+ },
64096
+ "anthropic/claude-sonnet-4.6": {
64097
+ // override: The public catalog's `categories` omit "vision" for this Anthropic model even though the gateway accepts image input for it (the prior hand-maintained snapshot had it, and Anthropic's model card lists it). Without this the vision filter would silently drop it — reported against the catalog; remove once the categories carry vision.
64098
+ contextWindow: 1e6,
64099
+ maxOutputTokens: 128e3,
64100
+ supportsTools: true,
64101
+ supportsVision: true
64102
+ },
64103
+ "anthropic/claude-sonnet-5": {
64104
+ contextWindow: 1e6,
64105
+ maxOutputTokens: 128e3,
64106
+ supportsTools: true,
64107
+ supportsVision: true
64108
+ },
64109
+ "anthropic/claude-sonnet-5.5": {
64110
+ contextWindow: 1e6,
64111
+ maxOutputTokens: 128e3,
64112
+ supportsTools: true,
64113
+ supportsVision: true
64114
+ },
64115
+ "cohere/north-mini-code": {
64116
+ // supportsTools: not probed — fails closed
64117
+ contextWindow: 256e3,
64118
+ maxOutputTokens: 16384,
64119
+ supportsTools: false,
64120
+ supportsVision: false
64121
+ },
64122
+ "deepseek/deepseek-chat": {
64123
+ // override: The 2026-11-08 catalog began tagging deepseek/deepseek-chat "vision" (it was text-only through 2026-10-20), and DeepSeek still ships image input as a separate experimental id (deepseek/deepseek-v4-flash-vision-exp). No image probe has confirmed the tag. Routing an image turn to a model that silently drops the image returns a confident 200 the caller cannot branch on, so this fails closed until a correctly sized image probe passes on both chains; then remove this entry.
64124
+ contextWindow: 1048576,
64125
+ maxOutputTokens: 65536,
64126
+ supportsTools: true,
64127
+ supportsVision: false
64128
+ },
64129
+ "deepseek/deepseek-reasoner": {
64130
+ // override: The 2026-11-08 catalog began tagging deepseek/deepseek-reasoner "vision" (it was text-only through 2026-10-20), and DeepSeek still ships image input as a separate experimental id (deepseek/deepseek-v4-flash-vision-exp). No image probe has confirmed the tag. Routing an image turn to a model that silently drops the image returns a confident 200 the caller cannot branch on, so this fails closed until a correctly sized image probe passes on both chains; then remove this entry.
64131
+ contextWindow: 1048576,
64132
+ maxOutputTokens: 65536,
64133
+ supportsTools: true,
64134
+ supportsVision: false
64135
+ },
64136
+ "deepseek/deepseek-v4-flash-vision-exp": {
64137
+ contextWindow: 1048576,
64138
+ maxOutputTokens: 65536,
64139
+ supportsTools: false,
64140
+ supportsVision: true
64141
+ },
64142
+ "deepseek/deepseek-v4-pro": {
64143
+ contextWindow: 1048576,
64144
+ maxOutputTokens: 65536,
64145
+ supportsTools: true,
64146
+ supportsVision: false
64147
+ },
64148
+ "deepseek/deepseek-v4.1-flash": {
64149
+ // override: The 2026-11-08 catalog began tagging deepseek/deepseek-v4.1-flash "vision" (it was text-only through 2026-10-20), and DeepSeek still ships image input as a separate experimental id (deepseek/deepseek-v4-flash-vision-exp). No image probe has confirmed the tag. Routing an image turn to a model that silently drops the image returns a confident 200 the caller cannot branch on, so this fails closed until a correctly sized image probe passes on both chains; then remove this entry.
64150
+ contextWindow: 1048576,
64151
+ maxOutputTokens: 65536,
64152
+ supportsTools: true,
64153
+ supportsVision: false
64154
+ },
64155
+ "google/gemini-2.5-flash": {
64156
+ contextWindow: 1048576,
64157
+ maxOutputTokens: 65536,
64158
+ supportsTools: true,
64159
+ supportsVision: true
64160
+ },
64161
+ "google/gemini-2.5-flash-lite": {
64162
+ contextWindow: 1048576,
64163
+ maxOutputTokens: 65536,
64164
+ supportsTools: true,
64165
+ supportsVision: false
64166
+ },
64167
+ "google/gemini-2.5-pro": {
64168
+ contextWindow: 1048576,
64169
+ maxOutputTokens: 65536,
64170
+ supportsTools: true,
64171
+ supportsVision: true
64172
+ },
64173
+ "google/gemini-3-flash-preview": {
64174
+ contextWindow: 1048576,
64175
+ maxOutputTokens: 65536,
64176
+ supportsTools: true,
64177
+ supportsVision: true
64178
+ },
64179
+ "google/gemini-3.1-flash-lite": {
64180
+ contextWindow: 1048576,
64181
+ maxOutputTokens: 65536,
64182
+ supportsTools: true,
64183
+ supportsVision: false
64184
+ },
64185
+ "google/gemini-3.1-pro": {
64186
+ contextWindow: 1048576,
64187
+ maxOutputTokens: 65536,
64188
+ supportsTools: true,
64189
+ supportsVision: true
64190
+ },
64191
+ "google/gemini-3.5-flash": {
64192
+ contextWindow: 1048576,
64193
+ maxOutputTokens: 65536,
64194
+ supportsTools: true,
64195
+ supportsVision: true
64196
+ },
64197
+ "google/gemini-3.5-flash-lite": {
64198
+ contextWindow: 1048576,
64199
+ maxOutputTokens: 65536,
64200
+ supportsTools: true,
64201
+ supportsVision: false
64202
+ },
64203
+ "google/gemini-3.6-flash": {
64204
+ contextWindow: 1048576,
64205
+ maxOutputTokens: 65536,
64206
+ supportsTools: true,
64207
+ supportsVision: true
64208
+ },
64209
+ "google/gemini-3.8-flash": {
64210
+ contextWindow: 1048576,
64211
+ maxOutputTokens: 65536,
64212
+ supportsTools: true,
64213
+ supportsVision: true
64214
+ },
64215
+ "google/gemini-4-argon": {
64216
+ // supportsTools: not probed — fails closed
64217
+ contextWindow: 1048576,
64218
+ maxOutputTokens: 65536,
64219
+ supportsTools: false,
64220
+ supportsVision: true
64221
+ },
64222
+ "minimax/minimax-m2.7": {
64223
+ contextWindow: 204800,
64224
+ maxOutputTokens: 16384,
64225
+ supportsTools: true,
64226
+ supportsVision: false
64227
+ },
64228
+ "minimax/minimax-m3": {
64229
+ contextWindow: 1048576,
64230
+ maxOutputTokens: 65536,
64231
+ supportsTools: true,
64232
+ supportsVision: false
64233
+ },
64234
+ "mistral/mistral-large-4": {
64235
+ // supportsTools: not probed — fails closed
64236
+ contextWindow: 524288,
64237
+ maxOutputTokens: 262144,
64238
+ supportsTools: false,
64239
+ supportsVision: true
64240
+ },
64241
+ "moonshot/kimi-k3": {
64242
+ // absent from the 2026-11-08 listing but still routed — previous entry retained; probe before removing
64243
+ contextWindow: 1048576,
64244
+ maxOutputTokens: 65536,
64245
+ supportsTools: true,
64246
+ supportsVision: true
64247
+ },
64248
+ "moonshot/kimi-k3.1-pro": {
64249
+ // supportsTools: not probed — fails closed
64250
+ contextWindow: 1048576,
64251
+ maxOutputTokens: 65536,
64252
+ supportsTools: false,
64253
+ supportsVision: true
64254
+ },
64255
+ "nvidia/minimax-m3.1-flash": {
64256
+ // supportsTools: not probed — fails closed
64257
+ contextWindow: 1048576,
64258
+ maxOutputTokens: 16384,
64259
+ supportsTools: false,
64260
+ supportsVision: false
64261
+ },
64262
+ "nvidia/muse-glimmer-30b": {
64263
+ // supportsTools: not probed — fails closed
64264
+ contextWindow: 131072,
64265
+ maxOutputTokens: 16384,
64266
+ supportsTools: false,
64267
+ supportsVision: false
64268
+ },
64269
+ "nvidia/nemotron-3-nano-omni-30b-a3b-reasoning": {
64270
+ // override: The catalog tags this model "vision", but a correctly sized probe does not hold up (ClawRouter, 2026-08-31): a 64x64 solid-red PNG was named correctly 1 of 4 times on Base, and on Solana the image was silently dropped and a text model answered "white". An HTTP 200 with a confident wrong answer gives the caller nothing to branch on, so image turns must not be routed here. It is ecoTiers.SIMPLE.fallback[0] since nemotron-3-nano-30b was delisted (2026-09-08); remove once a probe of this size comes back right on both chains.
64271
+ contextWindow: 256e3,
64272
+ maxOutputTokens: 16384,
64273
+ supportsTools: false,
64274
+ supportsVision: false
64275
+ },
64276
+ "nvidia/nemotron-3-super-120b": {
64277
+ // supportsTools: not probed — fails closed
64278
+ contextWindow: 131072,
64279
+ maxOutputTokens: 16384,
64280
+ supportsTools: false,
64281
+ supportsVision: true
64282
+ },
64283
+ "nvidia/nemotron-3-ultra-550b": {
64284
+ // supportsTools: not probed — fails closed
64285
+ contextWindow: 1e6,
64286
+ maxOutputTokens: 16384,
64287
+ supportsTools: false,
64288
+ supportsVision: false
64289
+ },
64290
+ "nvidia/nemotron-3.5-bolt": {
64291
+ // supportsTools: not probed — fails closed
64292
+ contextWindow: 131072,
64293
+ maxOutputTokens: 16384,
64294
+ supportsTools: false,
64295
+ supportsVision: true
64296
+ },
64297
+ "nvidia/nemotron-3.5-lightning": {
64298
+ // supportsTools: not probed — fails closed
64299
+ contextWindow: 1e6,
64300
+ maxOutputTokens: 16384,
64301
+ supportsTools: false,
64302
+ supportsVision: false
64303
+ },
64304
+ "openai/chat-latest": {
64305
+ contextWindow: 128e3,
64306
+ maxOutputTokens: 128e3,
64307
+ supportsTools: true,
64308
+ supportsVision: true
64309
+ },
64310
+ "openai/gpt-4.1": {
64311
+ contextWindow: 128e3,
64312
+ maxOutputTokens: 32768,
64313
+ supportsTools: true,
64314
+ supportsVision: true
64315
+ },
64316
+ "openai/gpt-4.1-mini": {
64317
+ contextWindow: 128e3,
64318
+ maxOutputTokens: 32768,
64319
+ supportsTools: true,
64320
+ supportsVision: false
64321
+ },
64322
+ "openai/gpt-4o": {
64323
+ contextWindow: 128e3,
64324
+ maxOutputTokens: 16384,
64325
+ supportsTools: true,
64326
+ supportsVision: true
64327
+ },
64328
+ "openai/gpt-4o-mini": {
64329
+ contextWindow: 128e3,
64330
+ maxOutputTokens: 16384,
64331
+ supportsTools: true,
64332
+ supportsVision: false
64333
+ },
64334
+ "openai/gpt-5-mini": {
64335
+ contextWindow: 2e5,
64336
+ maxOutputTokens: 128e3,
64337
+ supportsTools: true,
64338
+ supportsVision: false
64339
+ },
64340
+ "openai/gpt-5.1": {
64341
+ contextWindow: 4e5,
64342
+ maxOutputTokens: 128e3,
64343
+ supportsTools: true,
64344
+ supportsVision: true
64345
+ },
64346
+ "openai/gpt-5.2": {
64347
+ contextWindow: 4e5,
64348
+ maxOutputTokens: 128e3,
64349
+ supportsTools: true,
64350
+ supportsVision: true
64351
+ },
64352
+ "openai/gpt-5.2-pro": {
64353
+ // supportsTools: not probed — fails closed
64354
+ contextWindow: 4e5,
64355
+ maxOutputTokens: 128e3,
64356
+ supportsTools: false,
64357
+ supportsVision: true
64358
+ },
64359
+ "openai/gpt-5.3-codex": {
64360
+ // supportsTools: gateway unavailable at probe time — fails closed; override: 2026-08-29 probe: every request (6 plain + 3 tool attempts) returned a gateway 500, so the probe measured an incident, not the model. Codex's function calling is established by the 2026-07 Terminal-Bench / tau2 calibration trajectories in portfolio.ts. Hosts observing the 500s should drop it with RouterOptions.unavailableModels rather than this snapshot claiming the model cannot call tools.
64361
+ contextWindow: 4e5,
64362
+ maxOutputTokens: 128e3,
64363
+ supportsTools: true,
64364
+ supportsVision: false
64365
+ },
64366
+ "openai/gpt-5.4": {
64367
+ contextWindow: 105e4,
64368
+ maxOutputTokens: 128e3,
64369
+ supportsTools: true,
64370
+ supportsVision: true
64371
+ },
64372
+ "openai/gpt-5.4-mini": {
64373
+ contextWindow: 4e5,
64374
+ maxOutputTokens: 128e3,
64375
+ supportsTools: true,
64376
+ supportsVision: true
64377
+ },
64378
+ "openai/gpt-5.4-nano": {
64379
+ contextWindow: 105e4,
64380
+ maxOutputTokens: 128e3,
64381
+ supportsTools: true,
64382
+ supportsVision: false
64383
+ },
64384
+ "openai/gpt-5.4-pro": {
64385
+ // supportsTools: not probed — fails closed
64386
+ contextWindow: 105e4,
64387
+ maxOutputTokens: 128e3,
64388
+ supportsTools: false,
64389
+ supportsVision: true
64390
+ },
64391
+ "openai/gpt-5.5": {
64392
+ contextWindow: 105e4,
64393
+ maxOutputTokens: 128e3,
64394
+ supportsTools: true,
64395
+ supportsVision: true
64396
+ },
64397
+ "openai/gpt-5.5-pro": {
64398
+ // supportsTools: not probed — fails closed
64399
+ contextWindow: 105e4,
64400
+ maxOutputTokens: 128e3,
64401
+ supportsTools: false,
64402
+ supportsVision: true
64403
+ },
64404
+ "openai/gpt-5.6-luna": {
64405
+ contextWindow: 105e4,
64406
+ maxOutputTokens: 128e3,
64407
+ supportsTools: true,
64408
+ supportsVision: true
64409
+ },
64410
+ "openai/gpt-5.6-luna-pro": {
64411
+ contextWindow: 105e4,
64412
+ maxOutputTokens: 128e3,
64413
+ supportsTools: false,
64414
+ supportsVision: true
64415
+ },
64416
+ "openai/gpt-5.6-sol": {
64417
+ contextWindow: 105e4,
64418
+ maxOutputTokens: 128e3,
64419
+ supportsTools: true,
64420
+ supportsVision: true
64421
+ },
64422
+ "openai/gpt-5.6-sol-pro": {
64423
+ contextWindow: 105e4,
64424
+ maxOutputTokens: 128e3,
64425
+ supportsTools: true,
64426
+ supportsVision: true
64427
+ },
64428
+ "openai/gpt-5.6-terra": {
64429
+ contextWindow: 105e4,
64430
+ maxOutputTokens: 128e3,
64431
+ supportsTools: true,
64432
+ supportsVision: true
64433
+ },
64434
+ "openai/gpt-5.6-terra-pro": {
64435
+ contextWindow: 105e4,
64436
+ maxOutputTokens: 128e3,
64437
+ supportsTools: true,
64438
+ supportsVision: true
64439
+ },
64440
+ "openai/gpt-6-astra": {
64441
+ contextWindow: 105e4,
64442
+ maxOutputTokens: 128e3,
64443
+ supportsTools: true,
64444
+ supportsVision: true
64445
+ },
64446
+ "openai/gpt-6-luna": {
64447
+ contextWindow: 105e4,
64448
+ maxOutputTokens: 128e3,
64449
+ supportsTools: true,
64450
+ supportsVision: true
64451
+ },
64452
+ "openai/gpt-6-sol": {
64453
+ contextWindow: 105e4,
64454
+ maxOutputTokens: 128e3,
64455
+ supportsTools: true,
64456
+ supportsVision: true
64457
+ },
64458
+ "openai/gpt-6.1-sol": {
64459
+ contextWindow: 105e4,
64460
+ maxOutputTokens: 128e3,
64461
+ supportsTools: true,
64462
+ supportsVision: true
64463
+ },
64464
+ "openai/o1": {
64465
+ contextWindow: 2e5,
64466
+ maxOutputTokens: 1e5,
64467
+ supportsTools: true,
64468
+ supportsVision: false
64469
+ },
64470
+ "openai/o3": {
64471
+ contextWindow: 2e5,
64472
+ maxOutputTokens: 1e5,
64473
+ supportsTools: true,
64474
+ supportsVision: false
64475
+ },
64476
+ "openai/o3-mini": {
64477
+ contextWindow: 128e3,
64478
+ maxOutputTokens: 1e5,
64479
+ supportsTools: true,
64480
+ supportsVision: false
64481
+ },
64482
+ "openai/o4-mini": {
64483
+ contextWindow: 128e3,
64484
+ maxOutputTokens: 1e5,
64485
+ supportsTools: true,
64486
+ supportsVision: false
64487
+ },
64488
+ "poolside/laguna-s-2.1": {
64489
+ // supportsTools: not probed — fails closed
64490
+ contextWindow: 1048576,
64491
+ maxOutputTokens: 131072,
64492
+ supportsTools: false,
64493
+ supportsVision: false
64494
+ },
64495
+ "poolside/laguna-xs-2.1": {
64496
+ // supportsTools: not probed — fails closed
64497
+ contextWindow: 131072,
64498
+ maxOutputTokens: 16384,
64499
+ supportsTools: false,
64500
+ supportsVision: false
64501
+ },
64502
+ "qwen/qwen3.7-flash": {
64503
+ contextWindow: 1e6,
64504
+ maxOutputTokens: 65536,
64505
+ supportsTools: true,
64506
+ supportsVision: false
64507
+ },
64508
+ "qwen/qwen3.7-max": {
64509
+ contextWindow: 1e6,
64510
+ maxOutputTokens: 65536,
64511
+ supportsTools: true,
64512
+ supportsVision: false
64513
+ },
64514
+ "qwen/qwen3.7-plus": {
64515
+ contextWindow: 1e6,
64516
+ maxOutputTokens: 131072,
64517
+ supportsTools: true,
64518
+ supportsVision: false
64519
+ },
64520
+ "qwen/qwen3.8-flash": {
64521
+ contextWindow: 1e6,
64522
+ maxOutputTokens: 131072,
64523
+ supportsTools: false,
64524
+ supportsVision: true
64525
+ },
64526
+ "qwen/qwen3.8-max": {
64527
+ // supportsTools: not probed — fails closed
64528
+ contextWindow: 1e6,
64529
+ maxOutputTokens: 131072,
64530
+ supportsTools: false,
64531
+ supportsVision: false
64532
+ },
64533
+ "tencent/hy4-preview": {
64534
+ // supportsTools: not probed — fails closed
64535
+ contextWindow: 1048576,
64536
+ maxOutputTokens: 64e3,
64537
+ supportsTools: false,
64538
+ supportsVision: false
64539
+ },
64540
+ "xai/grok-4.3": {
64541
+ contextWindow: 1e6,
64542
+ maxOutputTokens: 16384,
64543
+ supportsTools: true,
64544
+ supportsVision: true
64545
+ },
64546
+ "xai/grok-4.5": {
64547
+ contextWindow: 5e5,
64548
+ maxOutputTokens: 16384,
64549
+ supportsTools: true,
64550
+ supportsVision: true
64551
+ },
64552
+ "xai/grok-4.6": {
64553
+ contextWindow: 5e5,
64554
+ maxOutputTokens: 16384,
64555
+ supportsTools: true,
64556
+ supportsVision: true
64557
+ },
64558
+ "xai/grok-4.7": {
64559
+ contextWindow: 5e5,
64560
+ maxOutputTokens: 16384,
64561
+ supportsTools: true,
64562
+ supportsVision: true
64563
+ },
64564
+ "xai/grok-build-0.1": {
64565
+ contextWindow: 256e3,
64566
+ maxOutputTokens: 16384,
64567
+ supportsTools: true,
64568
+ supportsVision: false
64569
+ },
64570
+ "xiaomi/mimo-v2.5": {
64571
+ contextWindow: 1048576,
64572
+ maxOutputTokens: 131072,
64573
+ supportsTools: true,
64574
+ supportsVision: true
64575
+ },
64576
+ "xiaomi/mimo-v2.5-pro": {
64577
+ contextWindow: 1048576,
64578
+ maxOutputTokens: 131072,
64579
+ supportsTools: true,
64580
+ supportsVision: false
64581
+ },
64582
+ "zai/glm-5": {
64583
+ contextWindow: 2e5,
64584
+ maxOutputTokens: 128e3,
64585
+ supportsTools: true,
64586
+ supportsVision: false
64587
+ },
64588
+ "zai/glm-5-turbo": {
64589
+ contextWindow: 2e5,
64590
+ maxOutputTokens: 128e3,
64591
+ supportsTools: true,
64592
+ supportsVision: false
64593
+ },
64594
+ "zai/glm-5.1": {
64595
+ contextWindow: 2e5,
64596
+ maxOutputTokens: 128e3,
64597
+ supportsTools: true,
64598
+ supportsVision: false
64599
+ },
64600
+ "zai/glm-5.2": {
64601
+ contextWindow: 1e6,
64602
+ maxOutputTokens: 131072,
64603
+ supportsTools: true,
64604
+ supportsVision: false
64605
+ },
64606
+ "zai/glm-5.3": {
64607
+ contextWindow: 1e6,
64608
+ maxOutputTokens: 131072,
64609
+ supportsTools: true,
64610
+ supportsVision: false
64611
+ },
64612
+ "zai/glm-5.3-flash": {
64613
+ contextWindow: 1e6,
64614
+ maxOutputTokens: 131072,
64615
+ supportsTools: true,
64616
+ supportsVision: true
64617
+ }
64618
+ });
64619
+ model_profiles_generated_default = {
64620
+ "anthropic/claude-fable-5": {
64621
+ measuredAt: "2026-08-29T16:51:33Z",
64622
+ latencyMs: 9298.5,
64623
+ p95LatencyMs: 9873.4,
64624
+ outputTokensPerSecond: 55.17,
64625
+ errorRate: 0,
64626
+ samples: 3
64627
+ },
64628
+ "anthropic/claude-haiku-4.5": {
64629
+ measuredAt: "2026-08-29T16:51:33Z",
64630
+ latencyMs: 3157.4,
64631
+ p95LatencyMs: 3170.7,
64632
+ outputTokensPerSecond: 162.16,
64633
+ errorRate: 0,
64634
+ samples: 3
64635
+ },
64636
+ "anthropic/claude-opus-4.5": {
64637
+ measuredAt: "2026-08-29T16:51:33Z",
64638
+ latencyMs: 6497.7,
64639
+ p95LatencyMs: 6953.7,
64640
+ outputTokensPerSecond: 78.99,
64641
+ errorRate: 0,
64642
+ samples: 3
64643
+ },
64644
+ "anthropic/claude-opus-4.7": {
64645
+ measuredAt: "2026-08-29T16:51:33Z",
64646
+ latencyMs: 5316.5,
64647
+ p95LatencyMs: 6121.5,
64648
+ outputTokensPerSecond: 97.34,
64649
+ errorRate: 0,
64650
+ samples: 3
64651
+ },
64652
+ "anthropic/claude-opus-4.8": {
64653
+ measuredAt: "2026-08-29T16:51:33Z",
64654
+ latencyMs: 6216.1,
64655
+ p95LatencyMs: 6847.7,
64656
+ outputTokensPerSecond: 82.81,
64657
+ errorRate: 0,
64658
+ samples: 3
64659
+ },
64660
+ "anthropic/claude-opus-5": {
64661
+ measuredAt: "2026-08-29T16:51:33Z",
64662
+ latencyMs: 7309,
64663
+ p95LatencyMs: 7745.2,
64664
+ outputTokensPerSecond: 70.17,
64665
+ errorRate: 0,
64666
+ samples: 3
64667
+ },
64668
+ "anthropic/claude-sonnet-4.5": {
64669
+ measuredAt: "2026-08-29T16:51:33Z",
64670
+ latencyMs: 6330.4,
64671
+ p95LatencyMs: 6631.6,
64672
+ outputTokensPerSecond: 81.03,
64673
+ errorRate: 0,
64674
+ samples: 3
64675
+ },
64676
+ "anthropic/claude-sonnet-4.6": {
64677
+ measuredAt: "2026-08-29T16:51:33Z",
64678
+ latencyMs: 6508,
64679
+ p95LatencyMs: 6698.3,
64680
+ outputTokensPerSecond: 78.6,
64681
+ errorRate: 0,
64682
+ samples: 3
64683
+ },
64684
+ "anthropic/claude-sonnet-5": {
64685
+ measuredAt: "2026-08-29T16:51:33Z",
64686
+ latencyMs: 6165.4,
64687
+ p95LatencyMs: 6582.9,
64688
+ outputTokensPerSecond: 83.62,
64689
+ errorRate: 0,
64690
+ samples: 3
64691
+ },
64692
+ "deepseek/deepseek-chat": {
64693
+ measuredAt: "2026-08-29T16:51:33Z",
64694
+ latencyMs: 4351.4,
64695
+ p95LatencyMs: 4543.7,
64696
+ outputTokensPerSecond: 117.78,
64697
+ errorRate: 0,
64698
+ samples: 3
64699
+ },
64700
+ "deepseek/deepseek-reasoner": {
64701
+ measuredAt: "2026-08-29T16:51:33Z",
64702
+ latencyMs: 5201.2,
64703
+ p95LatencyMs: 6079.6,
64704
+ outputTokensPerSecond: 99.77,
64705
+ errorRate: 0,
64706
+ samples: 3
64707
+ },
64708
+ "deepseek/deepseek-v4-pro": {
64709
+ measuredAt: "2026-08-29T16:51:33Z",
64710
+ latencyMs: 8781.2,
64711
+ p95LatencyMs: 9881.1,
64712
+ outputTokensPerSecond: 58.98,
64713
+ errorRate: 0,
64714
+ samples: 3
64715
+ },
64716
+ "deepseek/deepseek-v4.1-flash": {
64717
+ measuredAt: "2026-10-20T18:12:51Z",
64718
+ latencyMs: 2383.5,
64719
+ p95LatencyMs: 2547.8,
64720
+ outputTokensPerSecond: 216.53,
64721
+ errorRate: 0,
64722
+ samples: 3
64723
+ },
64724
+ "google/gemini-2.5-flash": {
64725
+ measuredAt: "2026-08-29T16:51:33Z",
64726
+ latencyMs: 5416.4,
64727
+ p95LatencyMs: 6442.8,
64728
+ outputTokensPerSecond: 213.07,
64729
+ errorRate: 0,
64730
+ samples: 3
64731
+ },
64732
+ "google/gemini-2.5-flash-lite": {
64733
+ measuredAt: "2026-08-29T16:51:33Z",
64734
+ latencyMs: 5002.6,
64735
+ p95LatencyMs: 5780.3,
64736
+ outputTokensPerSecond: 408.43,
64737
+ errorRate: 0,
64738
+ samples: 3
64739
+ },
64740
+ "google/gemini-2.5-pro": {
64741
+ measuredAt: "2026-08-29T16:51:33Z",
64742
+ latencyMs: 28169.5,
64743
+ p95LatencyMs: 29491.4,
64744
+ outputTokensPerSecond: 147.3,
64745
+ errorRate: 0,
64746
+ samples: 3
64747
+ },
64748
+ "google/gemini-3-flash-preview": {
64749
+ measuredAt: "2026-08-29T16:51:33Z",
64750
+ latencyMs: 4717.1,
64751
+ p95LatencyMs: 5037.1,
64752
+ outputTokensPerSecond: 198.71,
64753
+ errorRate: 0,
64754
+ samples: 3
64755
+ },
64756
+ "google/gemini-3.1-flash-lite": {
64757
+ measuredAt: "2026-08-29T16:51:33Z",
64758
+ latencyMs: 2855.8,
64759
+ p95LatencyMs: 3172.7,
64760
+ outputTokensPerSecond: 286.91,
64761
+ errorRate: 0,
64762
+ samples: 3
65163
64763
  },
65164
- // ─── Tier chains ───
65165
- //
65166
- // Catalog refresh 2026-08-29 (V3.5). Every chain below names only models
65167
- // the public catalog lists (GET https://blockrun.ai/api/v1/models). Ids the
65168
- // gateway withholds (`hidden: true`) — kimi-k2.5/k2.6/k2.7, the grok-4-fast
65169
- // and grok-4-1-fast pairs, grok-4-0709, claude-opus-4.6, gemini-3-pro-preview,
65170
- // the whole `free/*` namespace — were removed everywhere, including fallback
65171
- // rungs, so a routed model is always one a user can find on blockrun.ai/models.
65172
- //
65173
- // Primaries moved only where portfolio.ts already carries calibration
65174
- // evidence for the successor (Sonnet 5 over Sonnet 4.6, GPT-5 Mini for
65175
- // agentic MEDIUM, Gemini 3.5 Flash where Kimi K2.7 was). Newcomers with no
65176
- // trajectory evidence yet (gemini-3.6-flash, glm-5.3, glm-5.3-flash,
65177
- // gpt-5.6-luna, grok-4.3, minimax-m3, qwen3.7-plus) enter as fallback rungs;
65178
- // promotion waits for a calibration run, because version recency is not a
65179
- // quality signal.
65180
- //
65181
- // Latency figures in comments are the 2026-08-29 gateway probe
65182
- // (model-profiles.generated.json); prices are the catalog list.
65183
- // Auto (balanced) tier configs - current default smart routing
65184
- tiers: {
65185
- SIMPLE: {
65186
- primary: "google/gemini-2.5-flash",
65187
- // $0.30/$2.50 — 60% retention (best) in the 2026-03 run; still the fastest quality answer
65188
- fallback: [
65189
- "google/gemini-3-flash-preview",
65190
- // $0.50/$3 — GPQA 5/6 in the 2026-07 calibration
65191
- "google/gemini-3.5-flash-lite",
65192
- // $0.30/$2.50, 1M ctx, thinking mode — same price as 2.5 Flash, newer generation
65193
- "deepseek/deepseek-chat",
65194
- // $0.14/$0.28, 1M ctx
65195
- "google/gemini-3.1-flash-lite",
65196
- // $0.25/$1.50, 1M ctx
65197
- "openai/gpt-5.6-luna",
65198
- // $0.20/$1.20, 1M ctx — GPT-5.6 cost tier (cut 2026-07-30)
65199
- "openai/gpt-5.4-nano",
65200
- // $0.20/$1.25, 1M ctx
65201
- "google/gemini-2.5-flash-lite",
65202
- // $0.10/$0.40
65203
- "nvidia/nemotron-3.5-lightning"
65204
- // FREE backstop — NVIDIA free tier (probed 2026-08-30)
65205
- ]
65206
- },
65207
- MEDIUM: {
65208
- // Was moonshot/kimi-k2.7 (hidden 2026-08). Gemini 3.5 Flash is the
65209
- // calibrated successor: MGSM 5/5, GPQA 4/6, extraction band (portfolio.ts).
65210
- primary: "google/gemini-3.5-flash",
65211
- // $1.50/$9, 1M ctx, vision + tools
65212
- fallback: [
65213
- "google/gemini-3.6-flash",
65214
- // $1.50/$7.50 — newest Flash, output 17% cheaper than 3.5; awaiting calibration
65215
- "zai/glm-5.3-flash",
65216
- // $0.15/$0.50, 1M ctx, vision + tools verified live 2026-08-27
65217
- "openai/gpt-5.6-terra",
65218
- // $2/$12, 1M ctx — GPT-5.6 balanced tier
65219
- "google/gemini-3-flash-preview",
65220
- // $0.50/$3
65221
- "deepseek/deepseek-chat",
65222
- // $0.14/$0.28
65223
- "google/gemini-2.5-flash",
65224
- // $0.30/$2.50
65225
- "minimax/minimax-m3",
65226
- // $0.30/$1.20, 1M ctx
65227
- "google/gemini-3.1-flash-lite",
65228
- // $0.25/$1.50
65229
- "openai/gpt-5.6-luna",
65230
- // $0.20/$1.20
65231
- "google/gemini-2.5-flash-lite"
65232
- // $0.10/$0.40
65233
- ]
65234
- },
65235
- COMPLEX: {
65236
- primary: "google/gemini-3.1-pro",
65237
- // $2/$12 — proven long-context flagship (portfolio.ts long_context lead)
65238
- fallback: [
65239
- "google/gemini-3.6-flash",
65240
- // $1.50/$7.50 — Pro-level quality at Flash price (Google's claim; uncalibrated here)
65241
- "google/gemini-3.5-flash",
65242
- // $1.50/$9 — calibrated
65243
- "anthropic/claude-sonnet-5",
65244
- // $3/$15 — near-Opus quality, tau2 + Terminal-Bench calibrated
65245
- "xai/grok-4.5",
65246
- // $2.50/$9 — 503-resistant, independent infra (was grok-4-0709, now hidden)
65247
- "google/gemini-2.5-pro",
65248
- // $1.25/$10
65249
- "anthropic/claude-sonnet-4.6",
65250
- // $3/$15
65251
- "openai/gpt-5.6-terra",
65252
- // $2/$12 — GPT-5.6 balanced tier (Sol excluded: #202)
65253
- "openai/gpt-5.5",
65254
- // $5/$30 — prior OpenAI flagship
65255
- "openai/gpt-5.4",
65256
- // $2.50/$15 — previous flagship, benchmarked
65257
- "zai/glm-5.3",
65258
- // $1.40/$4.40, 1M ctx, always-on thinking — verified live 2026-08-19
65259
- "moonshot/kimi-k3",
65260
- // $3/$15, 1M ctx — Moonshot flagship (K2.7 successor)
65261
- "deepseek/deepseek-v4-pro",
65262
- // $0.435/$0.87 — strongest open-weight reasoner
65263
- "deepseek/deepseek-chat",
65264
- // $0.14/$0.28 — cheap last resort
65265
- "google/gemini-2.5-flash"
65266
- // $0.30/$2.50
65267
- ]
65268
- },
65269
- REASONING: {
65270
- // Was xai/grok-4-1-fast-reasoning ($0.20/$0.50, hidden 2026-08). DeepSeek
65271
- // Reasoner is the cheapest listed reasoner at the same 1M context.
65272
- primary: "deepseek/deepseek-reasoner",
65273
- // $0.14/$0.28, 1M ctx
65274
- fallback: [
65275
- "deepseek/deepseek-v4-pro",
65276
- // $0.435/$0.87 — calibrated reasoning band 0.95
65277
- "xai/grok-4.3",
65278
- // $1.50/$4, 1M ctx — xAI reasoning model, vision
65279
- "qwen/qwen3.7-plus",
65280
- // $0.32/$1.28, 1M ctx — reasoning; needs a generous max_tokens (thinking is billed)
65281
- "google/gemini-3.5-flash",
65282
- // $1.50/$9 — MGSM 5/5
65283
- "openai/o4-mini",
65284
- // $1.10/$4.40
65285
- "openai/o3"
65286
- // $2/$8
65287
- ]
65288
- }
64764
+ "google/gemini-3.1-pro": {
64765
+ measuredAt: "2026-08-29T16:59:54Z",
64766
+ latencyMs: 24194.1,
64767
+ p95LatencyMs: 27269.6,
64768
+ outputTokensPerSecond: 109.47,
64769
+ errorRate: 0,
64770
+ samples: 3
64771
+ },
64772
+ "google/gemini-3.5-flash": {
64773
+ measuredAt: "2026-08-29T16:51:33Z",
64774
+ latencyMs: 5320.6,
64775
+ p95LatencyMs: 5429.8,
64776
+ outputTokensPerSecond: 226.21,
64777
+ errorRate: 0,
64778
+ samples: 3
64779
+ },
64780
+ "google/gemini-3.5-flash-lite": {
64781
+ measuredAt: "2026-08-29T16:51:33Z",
64782
+ latencyMs: 3515.8,
64783
+ p95LatencyMs: 4363.4,
64784
+ outputTokensPerSecond: 248.9,
64785
+ errorRate: 0,
64786
+ samples: 3
64787
+ },
64788
+ "google/gemini-3.6-flash": {
64789
+ measuredAt: "2026-08-29T16:51:33Z",
64790
+ latencyMs: 13020,
64791
+ p95LatencyMs: 15383.1,
64792
+ outputTokensPerSecond: 187.87,
64793
+ errorRate: 0,
64794
+ samples: 3
64795
+ },
64796
+ "minimax/minimax-m2.7": {
64797
+ measuredAt: "2026-08-29T16:51:33Z",
64798
+ latencyMs: 8761.1,
64799
+ p95LatencyMs: 10199.3,
64800
+ outputTokensPerSecond: 59.18,
64801
+ errorRate: 0,
64802
+ samples: 3
64803
+ },
64804
+ "minimax/minimax-m3": {
64805
+ measuredAt: "2026-08-29T16:51:33Z",
64806
+ latencyMs: 11101.9,
64807
+ p95LatencyMs: 26087.1,
64808
+ outputTokensPerSecond: 101.12,
64809
+ errorRate: 0,
64810
+ samples: 3
64811
+ },
64812
+ "moonshot/kimi-k3": {
64813
+ measuredAt: "2026-08-29T16:51:33Z",
64814
+ latencyMs: 24498.9,
64815
+ p95LatencyMs: 40365.3,
64816
+ outputTokensPerSecond: 25.11,
64817
+ errorRate: 0,
64818
+ samples: 3
64819
+ },
64820
+ "nvidia/mistral-nemotron": {
64821
+ measuredAt: "2026-08-29T16:51:33Z",
64822
+ latencyMs: 7349.6,
64823
+ p95LatencyMs: 9932.3,
64824
+ outputTokensPerSecond: 79.48,
64825
+ errorRate: 0.3333,
64826
+ samples: 3
64827
+ },
64828
+ "nvidia/nemotron-3-nano-omni-30b-a3b-reasoning": {
64829
+ measuredAt: "2026-08-29T16:59:54Z",
64830
+ latencyMs: 9324.6,
64831
+ p95LatencyMs: 12992,
64832
+ outputTokensPerSecond: 64.96,
64833
+ errorRate: 0.3333,
64834
+ samples: 3
64835
+ },
64836
+ "nvidia/nemotron-nano-12b-v2-vl": {
64837
+ measuredAt: "2026-08-29T16:51:33Z",
64838
+ latencyMs: 5846.9,
64839
+ p95LatencyMs: 5846.9,
64840
+ outputTokensPerSecond: 87.57,
64841
+ errorRate: 0.6667,
64842
+ samples: 3
64843
+ },
64844
+ "nvidia/nemotron-nano-9b-v2": {
64845
+ measuredAt: "2026-08-29T16:51:33Z",
64846
+ latencyMs: 5282.5,
64847
+ p95LatencyMs: 5282.5,
64848
+ outputTokensPerSecond: 96.92,
64849
+ errorRate: 0.6667,
64850
+ samples: 3
64851
+ },
64852
+ "nvidia/step-3.7-flash": {
64853
+ measuredAt: "2026-08-29T16:51:33Z",
64854
+ latencyMs: 4617.4,
64855
+ p95LatencyMs: 5237.4,
64856
+ outputTokensPerSecond: 112.92,
64857
+ errorRate: 0.3333,
64858
+ samples: 3
64859
+ },
64860
+ "openai/chat-latest": {
64861
+ measuredAt: "2026-08-29T16:51:33Z",
64862
+ latencyMs: 3690.9,
64863
+ p95LatencyMs: 4344,
64864
+ outputTokensPerSecond: 111.85,
64865
+ errorRate: 0,
64866
+ samples: 3
64867
+ },
64868
+ "openai/gpt-4.1": {
64869
+ measuredAt: "2026-08-29T16:51:33Z",
64870
+ latencyMs: 3527.9,
64871
+ p95LatencyMs: 3831.7,
64872
+ outputTokensPerSecond: 141.27,
64873
+ errorRate: 0,
64874
+ samples: 3
64875
+ },
64876
+ "openai/gpt-4.1-mini": {
64877
+ measuredAt: "2026-08-29T16:51:33Z",
64878
+ latencyMs: 4268.2,
64879
+ p95LatencyMs: 5101.5,
64880
+ outputTokensPerSecond: 103.42,
64881
+ errorRate: 0,
64882
+ samples: 3
64883
+ },
64884
+ "openai/gpt-4.1-nano": {
64885
+ measuredAt: "2026-08-29T16:51:33Z",
64886
+ latencyMs: 3088.3,
64887
+ p95LatencyMs: 3369.2,
64888
+ outputTokensPerSecond: 150.31,
64889
+ errorRate: 0,
64890
+ samples: 3
64891
+ },
64892
+ "openai/gpt-4o": {
64893
+ measuredAt: "2026-08-29T16:51:33Z",
64894
+ latencyMs: 2995.2,
64895
+ p95LatencyMs: 3174.2,
64896
+ outputTokensPerSecond: 171.32,
64897
+ errorRate: 0,
64898
+ samples: 3
64899
+ },
64900
+ "openai/gpt-4o-mini": {
64901
+ measuredAt: "2026-08-29T16:51:33Z",
64902
+ latencyMs: 4751.5,
64903
+ p95LatencyMs: 4930.4,
64904
+ outputTokensPerSecond: 107.84,
64905
+ errorRate: 0,
64906
+ samples: 3
64907
+ },
64908
+ "openai/gpt-5-mini": {
64909
+ measuredAt: "2026-08-29T16:51:33Z",
64910
+ latencyMs: 4558.1,
64911
+ p95LatencyMs: 5081.9,
64912
+ outputTokensPerSecond: 113.25,
64913
+ errorRate: 0,
64914
+ samples: 3
64915
+ },
64916
+ "openai/gpt-5.2": {
64917
+ measuredAt: "2026-08-29T16:51:33Z",
64918
+ latencyMs: 5436.6,
64919
+ p95LatencyMs: 5928.8,
64920
+ outputTokensPerSecond: 95.47,
64921
+ errorRate: 0,
64922
+ samples: 3
64923
+ },
64924
+ "openai/gpt-5.3-codex": {
64925
+ measuredAt: "2026-08-29T16:59:54Z",
64926
+ latencyMs: 15290.4,
64927
+ p95LatencyMs: 15290.4,
64928
+ outputTokensPerSecond: 33.49,
64929
+ errorRate: 0.6667,
64930
+ samples: 3
64931
+ },
64932
+ "openai/gpt-5.4": {
64933
+ measuredAt: "2026-08-29T16:51:33Z",
64934
+ latencyMs: 5596,
64935
+ p95LatencyMs: 5919.4,
64936
+ outputTokensPerSecond: 91.67,
64937
+ errorRate: 0,
64938
+ samples: 3
64939
+ },
64940
+ "openai/gpt-5.4-mini": {
64941
+ measuredAt: "2026-08-29T16:51:33Z",
64942
+ latencyMs: 3377.8,
64943
+ p95LatencyMs: 3646.8,
64944
+ outputTokensPerSecond: 138.08,
64945
+ errorRate: 0,
64946
+ samples: 3
64947
+ },
64948
+ "openai/gpt-5.4-nano": {
64949
+ measuredAt: "2026-08-29T16:51:33Z",
64950
+ latencyMs: 4040.4,
64951
+ p95LatencyMs: 4205.9,
64952
+ outputTokensPerSecond: 118.52,
64953
+ errorRate: 0,
64954
+ samples: 3
64955
+ },
64956
+ "openai/gpt-5.5": {
64957
+ measuredAt: "2026-08-29T16:51:33Z",
64958
+ latencyMs: 6367.8,
64959
+ p95LatencyMs: 7330.7,
64960
+ outputTokensPerSecond: 81.29,
64961
+ errorRate: 0,
64962
+ samples: 3
64963
+ },
64964
+ "openai/gpt-5.6-luna": {
64965
+ measuredAt: "2026-08-29T16:51:33Z",
64966
+ latencyMs: 6064.5,
64967
+ p95LatencyMs: 7347.3,
64968
+ outputTokensPerSecond: 87.93,
64969
+ errorRate: 0,
64970
+ samples: 3
64971
+ },
64972
+ "openai/gpt-5.6-luna-pro": {
64973
+ measuredAt: "2026-08-29T16:59:54Z",
64974
+ latencyMs: 13914.9,
64975
+ p95LatencyMs: 13914.9,
64976
+ outputTokensPerSecond: 36.79,
64977
+ errorRate: 0.6667,
64978
+ samples: 3
64979
+ },
64980
+ "openai/gpt-5.6-sol": {
64981
+ measuredAt: "2026-08-29T16:51:33Z",
64982
+ latencyMs: 7720.2,
64983
+ p95LatencyMs: 9108.2,
64984
+ outputTokensPerSecond: 67.47,
64985
+ errorRate: 0,
64986
+ samples: 3
64987
+ },
64988
+ "openai/gpt-5.6-sol-pro": {
64989
+ measuredAt: "2026-08-29T16:51:33Z",
64990
+ latencyMs: 11442.7,
64991
+ p95LatencyMs: 13363.1,
64992
+ outputTokensPerSecond: 148.75,
64993
+ errorRate: 0,
64994
+ samples: 3
64995
+ },
64996
+ "openai/gpt-5.6-terra": {
64997
+ measuredAt: "2026-08-29T16:51:33Z",
64998
+ latencyMs: 4941,
64999
+ p95LatencyMs: 5095.3,
65000
+ outputTokensPerSecond: 103.69,
65001
+ errorRate: 0,
65002
+ samples: 3
65003
+ },
65004
+ "openai/gpt-5.6-terra-pro": {
65005
+ measuredAt: "2026-08-29T16:51:33Z",
65006
+ latencyMs: 3574.1,
65007
+ p95LatencyMs: 4126.3,
65008
+ outputTokensPerSecond: 133.59,
65009
+ errorRate: 0,
65010
+ samples: 3
65011
+ },
65012
+ "openai/gpt-6.1-sol": {
65013
+ measuredAt: "2026-10-20T18:12:51Z",
65014
+ latencyMs: 11324,
65015
+ p95LatencyMs: 12747.6,
65016
+ outputTokensPerSecond: 45.11,
65017
+ errorRate: 0,
65018
+ samples: 3
65019
+ },
65020
+ "openai/o1": {
65021
+ measuredAt: "2026-08-29T16:51:33Z",
65022
+ latencyMs: 4324.9,
65023
+ p95LatencyMs: 5838.1,
65024
+ outputTokensPerSecond: 125.86,
65025
+ errorRate: 0,
65026
+ samples: 3
65027
+ },
65028
+ "openai/o3": {
65029
+ measuredAt: "2026-08-29T16:51:33Z",
65030
+ latencyMs: 5463.4,
65031
+ p95LatencyMs: 5613.1,
65032
+ outputTokensPerSecond: 93.8,
65033
+ errorRate: 0,
65034
+ samples: 3
65035
+ },
65036
+ "openai/o3-mini": {
65037
+ measuredAt: "2026-08-29T16:51:33Z",
65038
+ latencyMs: 2912.7,
65039
+ p95LatencyMs: 3092.1,
65040
+ outputTokensPerSecond: 176.49,
65041
+ errorRate: 0,
65042
+ samples: 3
65043
+ },
65044
+ "openai/o4-mini": {
65045
+ measuredAt: "2026-08-29T16:51:33Z",
65046
+ latencyMs: 4958.7,
65047
+ p95LatencyMs: 5313,
65048
+ outputTokensPerSecond: 103.81,
65049
+ errorRate: 0,
65050
+ samples: 3
65051
+ },
65052
+ "qwen/qwen3.7-flash": {
65053
+ measuredAt: "2026-08-29T16:51:33Z",
65054
+ latencyMs: 3385.5,
65055
+ p95LatencyMs: 4042.7,
65056
+ outputTokensPerSecond: 153.94,
65057
+ errorRate: 0,
65058
+ samples: 3
65059
+ },
65060
+ "qwen/qwen3.7-max": {
65061
+ measuredAt: "2026-08-29T16:51:33Z",
65062
+ latencyMs: 9387.1,
65063
+ p95LatencyMs: 10490.2,
65064
+ outputTokensPerSecond: 54.92,
65065
+ errorRate: 0,
65066
+ samples: 3
65067
+ },
65068
+ "qwen/qwen3.7-plus": {
65069
+ measuredAt: "2026-08-29T16:51:33Z",
65070
+ latencyMs: 9766.6,
65071
+ p95LatencyMs: 9798.2,
65072
+ outputTokensPerSecond: 52.42,
65073
+ errorRate: 0,
65074
+ samples: 3
65075
+ },
65076
+ "tencent/hy3": {
65077
+ measuredAt: "2026-08-29T16:51:33Z",
65078
+ latencyMs: 6062.3,
65079
+ p95LatencyMs: 7070.2,
65080
+ outputTokensPerSecond: 87.3,
65081
+ errorRate: 0,
65082
+ samples: 3
65083
+ },
65084
+ "xai/grok-4.3": {
65085
+ measuredAt: "2026-08-29T16:51:33Z",
65086
+ latencyMs: 9467.7,
65087
+ p95LatencyMs: 10087.9,
65088
+ outputTokensPerSecond: 48.36,
65089
+ errorRate: 0,
65090
+ samples: 3
65091
+ },
65092
+ "xai/grok-4.5": {
65093
+ measuredAt: "2026-08-29T16:51:33Z",
65094
+ latencyMs: 13564.8,
65095
+ p95LatencyMs: 17351.9,
65096
+ outputTokensPerSecond: 60.71,
65097
+ errorRate: 0,
65098
+ samples: 3
65099
+ },
65100
+ "xai/grok-build-0.1": {
65101
+ measuredAt: "2026-08-29T16:51:33Z",
65102
+ latencyMs: 16394.8,
65103
+ p95LatencyMs: 18035.4,
65104
+ outputTokensPerSecond: 96.86,
65105
+ errorRate: 0,
65106
+ samples: 3
65107
+ },
65108
+ "xiaomi/mimo-v2.5-pro": {
65109
+ measuredAt: "2026-08-29T16:51:33Z",
65110
+ latencyMs: 12070.7,
65111
+ p95LatencyMs: 12386.8,
65112
+ outputTokensPerSecond: 42.44,
65113
+ errorRate: 0,
65114
+ samples: 3
65115
+ },
65116
+ "zai/glm-5": {
65117
+ measuredAt: "2026-08-29T16:51:33Z",
65118
+ latencyMs: 6839.7,
65119
+ p95LatencyMs: 7261.4,
65120
+ outputTokensPerSecond: 75.16,
65121
+ errorRate: 0,
65122
+ samples: 3
65123
+ },
65124
+ "zai/glm-5-turbo": {
65125
+ measuredAt: "2026-08-29T16:51:33Z",
65126
+ latencyMs: 55348.5,
65127
+ p95LatencyMs: 114086.6,
65128
+ outputTokensPerSecond: 14.64,
65129
+ errorRate: 0,
65130
+ samples: 3
65131
+ },
65132
+ "zai/glm-5.1": {
65133
+ measuredAt: "2026-08-29T16:51:33Z",
65134
+ latencyMs: 15658.4,
65135
+ p95LatencyMs: 17307.1,
65136
+ outputTokensPerSecond: 32.9,
65137
+ errorRate: 0,
65138
+ samples: 3
65139
+ },
65140
+ "zai/glm-5.2": {
65141
+ measuredAt: "2026-08-29T16:51:33Z",
65142
+ latencyMs: 10308.5,
65143
+ p95LatencyMs: 15127.6,
65144
+ outputTokensPerSecond: 54.87,
65145
+ errorRate: 0,
65146
+ samples: 3
65147
+ },
65148
+ "zai/glm-5.3": {
65149
+ measuredAt: "2026-08-29T16:51:33Z",
65150
+ latencyMs: 7272.4,
65151
+ p95LatencyMs: 7998.1,
65152
+ outputTokensPerSecond: 71.09,
65153
+ errorRate: 0,
65154
+ samples: 3
65289
65155
  },
65290
- // Eco tier configs - absolute cheapest (blockrun/eco)
65291
- ecoTiers: {
65292
- SIMPLE: {
65293
- primary: "nvidia/nemotron-3.5-lightning",
65294
- // FREE — NVIDIA free tier flagship, 1M ctx
65295
- fallback: [
65296
- // Was nvidia/nemotron-3-nano-30b until blockrun delisted it on 2026-09-08
65297
- // (NVIDIA deprovisioned it for the account — a structured per-account
65298
- // 404). nano-omni is blockrun's own redirect target for that id, so this
65299
- // follows the same rule as the head: the router and the gateway name the
65300
- // same model.
65301
- "nvidia/nemotron-3-nano-omni-30b-a3b-reasoning",
65302
- // FREE — nano-30b's successor, 256K ctx
65303
- // The free head keeps rotting with NVIDIA's hosting (deepseek-v4-flash
65304
- // 410 2026-08-12, seed-oss-36b 410 2026-08-03, gpt-oss-120b/20b 400
65305
- // 2026-08-21, and on 2026-08-30 FOUR of the five visible free models at
65306
- // once — step-3.7-flash, nemotron-nano-9b-v2 and nemotron-nano-12b-v2-vl
65307
- // all 410, mistral-nemotron hung). Each retirement retargets the two
65308
- // free rungs to the current free tier; the paid rungs below never move.
65309
- // The head follows blockrun's own redirect of the model it replaces, so
65310
- // the router and the gateway never name different models.
65311
- "google/gemini-2.5-flash-lite",
65312
- // $0.10/$0.40 — cheapest paid rung
65313
- "zai/glm-5.3-flash",
65314
- // $0.15/$0.50, 1M ctx, vision + tools
65315
- "openai/gpt-5.6-luna",
65316
- // $0.20/$1.20, 1M ctx
65317
- "openai/gpt-5.4-nano",
65318
- // $0.20/$1.25
65319
- "google/gemini-3.1-flash-lite"
65320
- // $0.25/$1.50
65321
- ]
65322
- },
65323
- MEDIUM: {
65324
- primary: "zai/glm-5.3-flash",
65325
- // $0.15/$0.50, 1M ctx, vision + tools verified live — cheapest full-capability model
65326
- fallback: [
65327
- "deepseek/deepseek-chat",
65328
- // $0.14/$0.28
65329
- "google/gemini-3.1-flash-lite",
65330
- // $0.25/$1.50
65331
- "openai/gpt-5.6-luna",
65332
- // $0.20/$1.20
65333
- "openai/gpt-5.4-nano",
65334
- // $0.20/$1.25
65335
- "google/gemini-2.5-flash-lite",
65336
- // $0.10/$0.40
65337
- "google/gemini-2.5-flash"
65338
- // $0.30/$2.50
65339
- ]
65340
- },
65341
- COMPLEX: {
65342
- primary: "zai/glm-5.3-flash",
65343
- // $0.15/$0.50, 1M ctx
65344
- fallback: [
65345
- "deepseek/deepseek-chat",
65346
- // $0.14/$0.28, 1M ctx
65347
- "minimax/minimax-m3",
65348
- // $0.30/$1.20, 1M ctx
65349
- "deepseek/deepseek-v4-pro",
65350
- // $0.435/$0.87
65351
- "google/gemini-3.1-flash-lite",
65352
- // $0.25/$1.50
65353
- "google/gemini-2.5-flash"
65354
- // $0.30/$2.50
65355
- ]
65356
- },
65357
- REASONING: {
65358
- primary: "deepseek/deepseek-reasoner",
65359
- // $0.14/$0.28, 1M ctx — cheapest listed reasoner
65360
- fallback: [
65361
- "deepseek/deepseek-v4-pro",
65362
- // $0.435/$0.87
65363
- "qwen/qwen3.7-plus",
65364
- // $0.32/$1.28 — reasoning
65365
- "minimax/minimax-m3",
65366
- // $0.30/$1.20 — reasoning + coding
65367
- "zai/glm-5.3-flash"
65368
- // $0.15/$0.50 — reasoning tokens alongside content
65369
- ]
65370
- }
65156
+ "zai/glm-5.3-flash": {
65157
+ measuredAt: "2026-08-29T16:51:33Z",
65158
+ latencyMs: 10545.3,
65159
+ p95LatencyMs: 11672.4,
65160
+ outputTokensPerSecond: 49.01,
65161
+ errorRate: 0,
65162
+ samples: 3
65163
+ }
65164
+ };
65165
+ LIVE_MODEL_PROFILES = Object.freeze(
65166
+ model_profiles_generated_default
65167
+ );
65168
+ HISTORICAL_MODEL_PROFILES = Object.freeze({
65169
+ "anthropic/claude-haiku-4.5": {
65170
+ measuredAt: "2026-03-16T13:50:48Z",
65171
+ latencyMs: 2305,
65172
+ outputTokensPerSecond: 140.6
65371
65173
  },
65372
- // Premium tier configs - best quality (blockrun/premium)
65373
- // codex=complex coding, flash=simple coding, sonnet=reasoning/instructions, fable/opus=architecture/PM/audits
65374
- premiumTiers: {
65375
- SIMPLE: {
65376
- // Was moonshot/kimi-k2.7 (hidden 2026-08).
65377
- primary: "google/gemini-3.5-flash",
65378
- // $1.50/$9, 1M ctx, vision + tools — calibrated
65379
- fallback: [
65380
- "google/gemini-3.6-flash",
65381
- // $1.50/$7.50 — newest Flash
65382
- "anthropic/claude-haiku-4.5",
65383
- // $1/$5
65384
- "zai/glm-5.3",
65385
- // $1.40/$4.40, 1M ctx
65386
- "google/gemini-2.5-flash",
65387
- // $0.30/$2.50
65388
- "google/gemini-3.5-flash-lite",
65389
- // $0.30/$2.50
65390
- "deepseek/deepseek-chat"
65391
- // $0.14/$0.28
65392
- ]
65393
- },
65394
- MEDIUM: {
65395
- primary: "openai/gpt-5.3-codex",
65396
- // $1.75/$14 - 400K context, 128K output — code_edit/debug lead (portfolio.ts)
65397
- fallback: [
65398
- "anthropic/claude-sonnet-5",
65399
- // $3/$15 — code_agent band 0.98
65400
- "moonshot/kimi-k3",
65401
- // $3/$15, 1M ctx — Moonshot flagship
65402
- "zai/glm-5.3",
65403
- // $1.40/$4.40 — long-horizon coding
65404
- "google/gemini-3.6-flash",
65405
- // $1.50/$7.50
65406
- "google/gemini-3.5-flash",
65407
- // $1.50/$9
65408
- "google/gemini-2.5-pro",
65409
- // $1.25/$10
65410
- "xai/grok-4.5",
65411
- // $2.50/$9
65412
- "anthropic/claude-sonnet-4.6",
65413
- // $3/$15
65414
- "openai/gpt-5.6-terra"
65415
- // $2/$12
65416
- ]
65417
- },
65418
- COMPLEX: {
65419
- // fable-5 was promoted here 2026-06-11, force-reverted 2026-06-13 when Anthropic
65420
- // withdrew the offer, and restored 2026-07-14 now that BlockRun has relisted it.
65421
- primary: "anthropic/claude-fable-5",
65422
- // Best quality for complex tasks — Mythos-class flagship above Opus ($10/$50, 1M ctx, always-on thinking)
65423
- // Fallback chain de-Gemini'd 2026-04-22: when Anthropic 503s, Gemini is
65424
- // also prone to "high demand" 503s (correlated failure — everyone falls
65425
- // back to Google at the same time). Prefer in-family → xAI → Moonshot →
65426
- // OpenAI flagship → Z.AI → DeepSeek → NVIDIA free instead.
65427
- fallback: [
65428
- "anthropic/claude-opus-5",
65429
- // in-family hot swap first (half the price, 1M ctx + adaptive thinking)
65430
- "anthropic/claude-opus-4.8",
65431
- // in-family hot swap (identical cost to 5)
65432
- "anthropic/claude-opus-4.7",
65433
- // in-family hot swap (identical cost to 4.8)
65434
- "anthropic/claude-sonnet-5",
65435
- // Sonnet-tier drop-down, near-Opus quality
65436
- "anthropic/claude-sonnet-4.6",
65437
- "xai/grok-4.5",
65438
- // xAI flagship — 503-resistant, direct-xAI SKU
65439
- "moonshot/kimi-k3",
65440
- // Moonshot flagship, independent infra
65441
- "openai/gpt-5.6-terra",
65442
- // GPT-5.6 balanced tier — stable (Sol excluded: #202)
65443
- "openai/gpt-5.5",
65444
- // Prior OpenAI flagship — 1M+ ctx, native agent + computer use
65445
- "openai/gpt-5.4",
65446
- // Previous flagship (slow but stable, benchmarked at 6,213ms)
65447
- "openai/gpt-5.3-codex",
65448
- "zai/glm-5.3",
65449
- // Z.AI flagship, 1M ctx
65450
- "deepseek/deepseek-v4-pro",
65451
- // strongest open-weight reasoner
65452
- "deepseek/deepseek-chat",
65453
- // Cheap, reliable
65454
- "nvidia/nemotron-3.5-lightning"
65455
- // NVIDIA free ultimate backstop
65456
- ]
65457
- },
65458
- REASONING: {
65459
- // Sonnet 5 promoted over Sonnet 4.6 (same price; reasoning band 0.98 for both,
65460
- // plus Sonnet 5's tau2/BrowseComp trajectory evidence).
65461
- primary: "anthropic/claude-sonnet-5",
65462
- // $3/$15, 1M ctx, adaptive thinking
65463
- fallback: [
65464
- "anthropic/claude-sonnet-4.6",
65465
- // in-family hot swap — same cost
65466
- "anthropic/claude-opus-5",
65467
- // Newest flagship Opus w/ adaptive thinking
65468
- "anthropic/claude-opus-4.8",
65469
- // Prior flagship Opus — identical cost to 5
65470
- "anthropic/claude-opus-4.7",
65471
- // Flagship Opus w/ adaptive thinking
65472
- "xai/grok-4.5",
65473
- // reasoning band 0.94
65474
- "deepseek/deepseek-v4-pro",
65475
- // reasoning band 0.95
65476
- "xai/grok-4.3",
65477
- // $1.50/$4 — xAI reasoning model
65478
- "openai/o4-mini",
65479
- // $1.10/$4.40
65480
- "openai/o3"
65481
- // $2/$8
65482
- ]
65483
- }
65174
+ "anthropic/claude-sonnet-4.6": {
65175
+ measuredAt: "2026-03-16T13:50:48Z",
65176
+ latencyMs: 2110,
65177
+ outputTokensPerSecond: 121.3
65484
65178
  },
65485
- // Agentic tier configs - models that excel at multi-step autonomous tasks
65486
- agenticTiers: {
65487
- SIMPLE: {
65488
- primary: "openai/gpt-4o-mini",
65489
- // $0.15/$0.60 - best tool compliance at lowest cost
65490
- fallback: [
65491
- "openai/gpt-5.6-luna",
65492
- // $0.20/$1.20 — lightweight agentic tier of GPT-5.6
65493
- "zai/glm-5.3-flash",
65494
- // $0.15/$0.50 — tool calls verified live 2026-08-27
65495
- "anthropic/claude-haiku-4.5",
65496
- // $1/$5
65497
- "google/gemini-2.5-flash"
65498
- // $0.30/$2.50
65499
- ]
65500
- },
65501
- MEDIUM: {
65502
- // Was moonshot/kimi-k2.7 (hidden 2026-08). GPT-5 Mini carries the
65503
- // Terminal-Bench and tau2 trajectory evidence in portfolio.ts.
65504
- primary: "openai/gpt-5-mini",
65505
- // $0.25/$2 — 4/7 Terminal-Bench, 5/6 tau2 airline
65506
- fallback: [
65507
- "google/gemini-3.5-flash",
65508
- // $1.50/$9 — tool_agent band 0.88
65509
- "zai/glm-5.3-flash",
65510
- // $0.15/$0.50 — tools verified
65511
- "openai/gpt-5.6-terra",
65512
- // $2/$12
65513
- "openai/gpt-4o-mini",
65514
- // $0.15/$0.60 — reliable tool calling
65515
- "anthropic/claude-haiku-4.5",
65516
- // $1/$5
65517
- "deepseek/deepseek-chat",
65518
- // $0.14/$0.28
65519
- "moonshot/kimi-k3"
65520
- // $3/$15 — tool_agent band 0.85
65521
- ]
65522
- },
65523
- COMPLEX: {
65524
- // Sonnet 5 promoted over Sonnet 4.6: tau2 airline + retail reward 1.0,
65525
- // Terminal-Bench safety band lead (portfolio.ts).
65526
- primary: "anthropic/claude-sonnet-5",
65527
- // $3/$15 — best agentic quality per trajectory evidence
65528
- // Fallback chain de-Gemini'd 2026-04-22: Gemini's "high demand" 503s
65529
- // correlate with Anthropic outages (everyone falls back together).
65530
- // Prefer 503-resistant providers first.
65531
- fallback: [
65532
- "anthropic/claude-sonnet-4.6",
65533
- // in-family hot swap — same cost
65534
- "anthropic/claude-opus-5",
65535
- // Newest flagship Opus — in-family hot swap
65536
- "anthropic/claude-opus-4.8",
65537
- // Prior flagship Opus — identical cost to 5
65538
- "anthropic/claude-opus-4.7",
65539
- // Flagship Opus — in-family hot swap
65540
- "xai/grok-4.5",
65541
- // xAI flagship — strong tool use, independent infra
65542
- "moonshot/kimi-k3",
65543
- // Moonshot flagship — independent infra
65544
- "openai/gpt-5.6-terra",
65545
- // GPT-5.6 balanced tier — stable (Sol excluded: #202)
65546
- "openai/gpt-5.5",
65547
- // Prior flagship — native agent + computer use (exactly the agentic-tier use case)
65548
- "openai/gpt-5.4",
65549
- // Previous flagship — reliable
65550
- "openai/gpt-5.3-codex",
65551
- // code_agent lead
65552
- "zai/glm-5.3",
65553
- // long-horizon coding
65554
- "deepseek/deepseek-v4-pro",
65555
- // retail high-risk 3/3
65556
- "deepseek/deepseek-chat",
65557
- // cheap, reliable
65558
- "nvidia/nemotron-3.5-lightning"
65559
- // NVIDIA free ultimate backstop
65560
- ]
65561
- },
65562
- REASONING: {
65563
- primary: "anthropic/claude-sonnet-5",
65564
- // $3/$15 — strong tool use + adaptive thinking
65565
- fallback: [
65566
- "anthropic/claude-sonnet-4.6",
65567
- // in-family hot swap — same cost
65568
- "anthropic/claude-opus-5",
65569
- // Newest flagship Opus w/ adaptive thinking
65570
- "anthropic/claude-opus-4.8",
65571
- // Prior flagship Opus — identical cost to 5
65572
- "anthropic/claude-opus-4.7",
65573
- // Flagship Opus w/ adaptive thinking
65574
- "xai/grok-4.5",
65575
- // reasoning band 0.94
65576
- "deepseek/deepseek-v4-pro",
65577
- // reasoning band 0.95
65578
- "deepseek/deepseek-reasoner"
65579
- // $0.14/$0.28
65580
- ]
65581
- }
65179
+ "deepseek/deepseek-chat": {
65180
+ measuredAt: "2026-03-16T13:50:48Z",
65181
+ latencyMs: 1431,
65182
+ outputTokensPerSecond: 179.2,
65183
+ intelligenceIndex: 32
65582
65184
  },
65583
- // Time-windowed promotions — auto-applied when active, ignored when expired.
65584
- // The GLM-5.1 launch promo (2026-04-01 → 2026-05-01) was the last entry and
65585
- // has expired; the list is kept empty so the mechanism stays wired.
65586
- promotions: [],
65587
- overrides: {
65588
- maxTokensForceComplex: 1e5,
65589
- structuredOutputMinTier: "MEDIUM",
65590
- ambiguousDefaultTier: "MEDIUM"
65591
- // agenticMode left undefined → auto-detect via tools/agenticScore.
65592
- // Set to `true` to force agentic tiers; `false` to disable them entirely.
65185
+ "google/gemini-2.5-flash": {
65186
+ measuredAt: "2026-03-16T13:50:48Z",
65187
+ latencyMs: 1238,
65188
+ outputTokensPerSecond: 207.6,
65189
+ intelligenceIndex: 20
65190
+ },
65191
+ "google/gemini-2.5-flash-lite": {
65192
+ measuredAt: "2026-03-16T13:50:48Z",
65193
+ latencyMs: 1353,
65194
+ outputTokensPerSecond: 192.5,
65195
+ intelligenceIndex: 20
65196
+ },
65197
+ "google/gemini-2.5-pro": {
65198
+ measuredAt: "2026-03-16T13:50:48Z",
65199
+ latencyMs: 1294,
65200
+ outputTokensPerSecond: 197.8
65201
+ },
65202
+ "google/gemini-3.1-pro": {
65203
+ measuredAt: "2026-03-16T13:50:48Z",
65204
+ latencyMs: 1609,
65205
+ outputTokensPerSecond: 167.2
65206
+ },
65207
+ "openai/gpt-4o-mini": {
65208
+ measuredAt: "2026-03-16T13:50:48Z",
65209
+ latencyMs: 2764,
65210
+ outputTokensPerSecond: 92.8
65211
+ },
65212
+ "openai/gpt-5.3-codex": {
65213
+ measuredAt: "2026-03-16T13:50:48Z",
65214
+ latencyMs: 7935,
65215
+ outputTokensPerSecond: 32.3
65216
+ }
65217
+ });
65218
+ DEFAULT_PORTFOLIO_WEIGHTS = DEFAULT_ROUTING_CONFIG.portfolio;
65219
+ NEUTRAL_AFFINITY = 0.68;
65220
+ TERMINAL_COMPLEX_HIGH = {
65221
+ "claude-sonnet-5": 1,
65222
+ "gpt-5.3-codex": 0.87,
65223
+ "gpt-5-mini": 0.78,
65224
+ "gemini-3.5-flash": 0.76
65225
+ };
65226
+ WEB_RESEARCH_DEEP = {
65227
+ "claude-sonnet-5": 1,
65228
+ "gpt-5-mini": 0.88,
65229
+ "gemini-3.5-flash": 0.84,
65230
+ "claude-opus-5": 0.8,
65231
+ "claude-opus-4.8": 0.78
65232
+ };
65233
+ WEB_RESEARCH = {
65234
+ "claude-sonnet-5": 1,
65235
+ "gpt-5-mini": 0.88,
65236
+ "gemini-3.5-flash": 0.86,
65237
+ "claude-opus-5": 0.84,
65238
+ "claude-opus-4.8": 0.82
65239
+ };
65240
+ RETAIL_POLICY_EXCEPTION = {
65241
+ "gpt-4.1": 1,
65242
+ "claude-sonnet-5": 0.9,
65243
+ "deepseek-v4-pro": 0.82,
65244
+ "gpt-5-mini": 0.8,
65245
+ "gpt-4o-mini": 0.76
65246
+ };
65247
+ RETAIL_POLICY_EXCEPTION_SIMPLE = {
65248
+ "gpt-5-mini": 1,
65249
+ "gpt-4.1": 0.86,
65250
+ "deepseek-v4-pro": 0.82,
65251
+ "gpt-4o-mini": 0.8
65252
+ };
65253
+ AFFINITY = {
65254
+ // Seven valid full agent + official Terminal-Bench trajectories (2026-07-28)
65255
+ // gave GPT-5 Mini 4/7 resolved tasks versus 1/7 for the prior dynamic
65256
+ // code-agent choice. Its token-normalized total cost was higher in this small
65257
+ // calibration, so Codex and Sonnet keep quality priors above it; admitting
65258
+ // Mini to the scoring band lets the normal quality/cost profile choose it
65259
+ // without erasing stronger fallbacks. DeepSeek V4 Pro is kept below the
65260
+ // primary band after two consecutive mid-trajectory provider timeouts
65261
+ // contaminated its calibration runs.
65262
+ codeAgent: {
65263
+ "gpt-5.3-codex": 1,
65264
+ "claude-sonnet-5": 0.98,
65265
+ "gpt-5-mini": 0.96,
65266
+ "gemini-3.5-flash": 0.92,
65267
+ "kimi-k3": 0.9,
65268
+ "deepseek-v4-pro": 0.88,
65269
+ "glm-5.2": 0.88
65270
+ },
65271
+ // Seven official Terminal-Bench calibration trajectories favoured GPT-5 Mini
65272
+ // over the prior dynamic choice. Codex/Sonnet are close fallbacks; actual
65273
+ // request cost breaks the tie.
65274
+ terminalTool: {
65275
+ "gpt-5-mini": 1,
65276
+ "gpt-5.3-codex": 0.98,
65277
+ "claude-sonnet-5": 0.9,
65278
+ "gemini-3.5-flash": 0.89
65279
+ },
65280
+ // Two complete agent observations on the public Terminal-Bench
65281
+ // new-encrypt-command task ended in Codex repeating the same TerminalExec
65282
+ // input until the loop guard fired. Codex stays an availability fallback,
65283
+ // below the safety-band affinity floor, until its Responses function-output
65284
+ // path is verified on both gateways.
65285
+ terminalToolSafety: {
65286
+ "claude-sonnet-5": 1,
65287
+ "claude-opus-4.8": 0.9,
65288
+ "gpt-5.3-codex": 0.84
65289
+ },
65290
+ // Full-session calibration: GPT-5 Mini completed two local/single retail
65291
+ // workflows at a fraction of Sonnet's token cost. It stays ineligible for
65292
+ // promotion when the prompt asks for multiple actions, cross-record
65293
+ // discovery or a global optimum; those trajectories exposed unstable write
65294
+ // arguments. DeepSeek V4 Pro completed all three high-risk retail calibration
65295
+ // trajectories (global-choice, cross-record, multi-write); Sonnet one.
65296
+ retailStandard: {
65297
+ "gpt-5-mini": 1,
65298
+ "claude-sonnet-5": 0.88,
65299
+ "gemini-3.5-flash": 0.82,
65300
+ "gpt-5.3-codex": 0.81,
65301
+ "kimi-k3": 0.78,
65302
+ "deepseek-v4-pro": 0.76
65303
+ },
65304
+ retailHigh: {
65305
+ "deepseek-v4-pro": 1,
65306
+ "claude-sonnet-5": 0.88,
65307
+ "gemini-3.5-flash": 0.82,
65308
+ "gpt-5.3-codex": 0.81,
65309
+ "kimi-k3": 0.78,
65310
+ "gpt-5-mini": 0.76
65311
+ },
65312
+ // Standard airline workflows stay on GPT-5 Mini: six full-session
65313
+ // development trajectories gave it the same 5/6 success as Sonnet at roughly
65314
+ // one order of magnitude lower normalized token cost. A held-out high-risk
65315
+ // cabin/date negotiation then produced a persistent empty assistant turn on
65316
+ // Mini even after a semantic retry, while Sonnet 5 completed the identical
65317
+ // official tau2 trajectory with reward 1.0. Only global optimization /
65318
+ // conditional-global work is promoted. A known batch of reservations is
65319
+ // operationally high-risk but still a structured tool workflow: current Tau
65320
+ // evidence has Mini and Sonnet at equal task reward there, while Sonnet costs
65321
+ // roughly two orders of magnitude more on the long-tail case.
65322
+ airlineComplex: {
65323
+ "claude-sonnet-5": 1,
65324
+ "gpt-5-mini": 0.78,
65325
+ "gemini-3.5-flash": 0.76,
65326
+ "deepseek-v4-pro": 0.74
65327
+ },
65328
+ airlineStandard: {
65329
+ "gpt-5-mini": 1,
65330
+ "claude-sonnet-5": 0.9,
65331
+ "gemini-3.5-flash": 0.8,
65332
+ "deepseek-v4-pro": 0.76
65333
+ },
65334
+ // Full-trajectory tau2 calibration (2026-07-28, official gpt-4.1 simulator):
65335
+ // Sonnet 5 completed both an airline policy task and a retail multi-write
65336
+ // task with reward 1.0. Gemini 3.5 Flash emitted function calls as plain text
65337
+ // after the first structured calls and looped to the 100-step ceiling on the
65338
+ // airline task.
65339
+ toolAgent: {
65340
+ "claude-sonnet-5": 1,
65341
+ "gemini-3.5-flash": 0.88,
65342
+ "gpt-5.3-codex": 0.87,
65343
+ "kimi-k3": 0.85,
65344
+ "gpt-5-mini": 0.84,
65345
+ "deepseek-v4-pro": 0.82
65346
+ },
65347
+ // Multi-file Terminal work is not equivalent to a one-turn parallel
65348
+ // function-call benchmark. Sonnet is the strongest trajectory-tested
65349
+ // cost-controlled default; Opus remains a close safety fallback.
65350
+ parallelTerminalSafety: {
65351
+ "claude-sonnet-5": 1,
65352
+ "claude-opus-4.8": 0.9,
65353
+ "gpt-5.3-codex": 0.86
65354
+ },
65355
+ parallelTerminal: {
65356
+ "gpt-5-mini": 1,
65357
+ "gpt-5.3-codex": 0.98,
65358
+ "claude-sonnet-5": 0.92,
65359
+ "gemini-3.5-flash": 0.88
65360
+ },
65361
+ parallelRetail: {
65362
+ "deepseek-v4-pro": 1,
65363
+ "claude-sonnet-5": 0.88,
65364
+ "claude-opus-4.8": 0.84,
65365
+ "gpt-5-mini": 0.78,
65366
+ "gemini-3.5-flash": 0.76
65367
+ },
65368
+ parallelAirlineComplex: {
65369
+ "claude-sonnet-5": 1,
65370
+ "gpt-5-mini": 0.78,
65371
+ "claude-opus-4.8": 0.76,
65372
+ "gemini-3.5-flash": 0.74
65373
+ },
65374
+ parallelAirline: {
65375
+ "gpt-5-mini": 1,
65376
+ "claude-sonnet-5": 0.9,
65377
+ "gemini-3.5-flash": 0.8
65378
+ },
65379
+ // RouterBench calibration, 2026-07-26: Opus 4.8 produced complete multi-call
65380
+ // payloads on 2/3 multilingual BFCL parallel cases. Gemini 3.5 Flash, Sonnet
65381
+ // 5, DeepSeek V4 Pro and Grok 4.5 were 0/3. This narrow prior only applies
65382
+ // after the conservative prompt feature in likelyNeedsParallelToolCalls.
65383
+ parallel: {
65384
+ "claude-opus-4.8": 1,
65385
+ "claude-sonnet-5": 0.84,
65386
+ "grok-4.5": 0.82,
65387
+ "gemini-3.5-flash": 0.8,
65388
+ "deepseek-v4-pro": 0.78
65389
+ },
65390
+ codeEdit: {
65391
+ "gpt-5.3-codex": 1,
65392
+ "claude-sonnet-4.6": 0.94,
65393
+ "glm-5.2": 0.9,
65394
+ "deepseek-v4-pro": 0.86
65395
+ },
65396
+ reasoning: {
65397
+ "claude-sonnet-5": 0.98,
65398
+ "claude-sonnet-4.6": 0.98,
65399
+ "deepseek-v4-pro": 0.95,
65400
+ "grok-4.5": 0.94,
65401
+ "gemini-3.1-pro": 0.92,
65402
+ "gemini-3.5-flash": 0.92
65403
+ },
65404
+ // RouterBench calibration (2026-07-28, six stratified GPQA Diamond tasks,
65405
+ // identical agent adapter and 512-token budget): Gemini 3 Flash Preview
65406
+ // scored 5/6, Gemini 3.5 Flash 4/6, and Gemini 3.1 Pro 3/6 while costing
65407
+ // ~170x more than Flash. The measured winner is the narrow default; version
65408
+ // recency alone is not a quality signal. Unused host tools must not change
65409
+ // this reasoning-only model choice.
65410
+ reasoningMcq: {
65411
+ "gemini-3-flash-preview": 1,
65412
+ "gemini-3.5-flash": 0.91,
65413
+ "grok-4.5": 0.9,
65414
+ "claude-sonnet-5": 0.88,
65415
+ "deepseek-v4-pro": 0.84
65416
+ },
65417
+ // Same calibration, five multilingual MGSM tasks: Gemini 3.5 Flash was 5/5
65418
+ // with the lowest cost and latency; four current flagships were 4/5 and Kimi
65419
+ // K2.7 was 3/5.
65420
+ reasoningMath: {
65421
+ "gemini-3.5-flash": 1,
65422
+ "grok-4.5": 0.93,
65423
+ "claude-sonnet-5": 0.9,
65424
+ "deepseek-v4-pro": 0.9,
65425
+ "kimi-k3": 0.9
65426
+ },
65427
+ vision: {
65428
+ "gemini-3.1-pro": 0.96,
65429
+ "qwen3.7-max": 0.9,
65430
+ "claude-sonnet-4.6": 0.9,
65431
+ "kimi-k3": 0.9,
65432
+ "grok-4.3": 0.9
65433
+ },
65434
+ // Long-context eligibility is necessary but not sufficient: a provider can
65435
+ // advertise a 1M window yet return an empty completion near that boundary.
65436
+ // The proven long-context flagship leads, and less-established alternatives
65437
+ // sit in a separate band so price alone cannot displace it.
65438
+ longContext: {
65439
+ "gemini-3.1-pro": 1,
65440
+ "qwen3.7-max": 0.89,
65441
+ "glm-5.2": 0.89,
65442
+ "gemini-3.5-flash": 0.88,
65443
+ "deepseek-v4-pro": 0.85
65444
+ },
65445
+ // A structured extraction must preserve both the output contract and the
65446
+ // source-language fields. For Mandarin input the language-native Kimi
65447
+ // candidate gets a distinct band — a candidate-pool decision, not a post-hoc
65448
+ // override, so it still falls back normally when Kimi is unavailable. Kimi
65449
+ // K3 costs ~5x its retired sibling K2.7, so the band must be wider than the
65450
+ // auto affinityFloorGap (0.10) or price alone re-selects a non-native model
65451
+ // for Mandarin input; 0.12 keeps K3 alone in the primary band for zh and
65452
+ // leaves every other language untouched.
65453
+ extractionZh: {
65454
+ "kimi-k3": 1,
65455
+ "gemini-3.5-flash": 0.88,
65456
+ "gemini-2.5-flash": 0.88,
65457
+ "gpt-4o-mini": 0.88,
65458
+ "claude-sonnet-5": 0.88,
65459
+ "claude-sonnet-4.6": 0.88
65460
+ },
65461
+ extraction: {
65462
+ "kimi-k3": 0.9,
65463
+ "gemini-3.5-flash": 0.9,
65464
+ "gemini-2.5-flash": 0.9,
65465
+ "gpt-4o-mini": 0.9,
65466
+ "claude-sonnet-5": 0.9,
65467
+ "claude-sonnet-4.6": 0.9
65468
+ },
65469
+ chat: {
65470
+ "gemini-3.5-flash": 0.86,
65471
+ "gemini-2.5-flash": 0.86,
65472
+ "kimi-k3": 0.86
65473
+ }
65474
+ };
65475
+ VERIFIED_TOOL_FALLBACKS = [
65476
+ "anthropic/claude-fable-5.1",
65477
+ "anthropic/claude-opus-5.5",
65478
+ "anthropic/claude-sonnet-5.5",
65479
+ "deepseek/deepseek-v4.1-flash",
65480
+ "google/gemini-3.8-flash",
65481
+ "openai/gpt-5.1",
65482
+ "openai/gpt-6-astra",
65483
+ "openai/gpt-6-luna",
65484
+ "openai/gpt-6-sol",
65485
+ "openai/gpt-6.1-sol",
65486
+ "xai/grok-4.6",
65487
+ "xai/grok-4.7",
65488
+ "xiaomi/mimo-v2.5"
65489
+ ];
65490
+ PortfolioStrategy = class {
65491
+ name = "portfolio";
65492
+ // Rules set the capability tier; the strategy is stateless, so one instance serves every request.
65493
+ rules = new RulesStrategy();
65494
+ route(prompt, systemPrompt, maxOutputTokens, options) {
65495
+ const features = classifyTask(prompt, systemPrompt, options);
65496
+ const base4 = this.rules.route(prompt, systemPrompt, maxOutputTokens, {
65497
+ ...options,
65498
+ requiresTools: features.needsTools
65499
+ });
65500
+ const tierConfigs = base4.tierConfigs;
65501
+ if (!tierConfigs) return base4;
65502
+ const targetTier = (features.taskType === "reasoning_mcq" || features.taskType === "reasoning_math") && (base4.tier === "SIMPLE" || base4.tier === "MEDIUM") ? "REASONING" : (features.taskType === "debug" || features.taskType === "code_edit") && features.codeArtifact && base4.tier === "SIMPLE" ? "MEDIUM" : base4.tier;
65503
+ const tierConfig = tierConfigs[targetTier];
65504
+ const configuredCandidates = tierConfig ? getFallbackChain(targetTier, tierConfigs) : [];
65505
+ const unavailable = new Set(options.unavailableModels ?? []);
65506
+ const verifiedToolFallbacks = features.needsTools ? VERIFIED_TOOL_FALLBACKS.filter((model2) => options.modelPricing.has(model2)) : [];
65507
+ if (options.routingProfile !== "premium") {
65508
+ const fallbackCost = (model2) => estimatedCost(model2, options, features.estimatedInputTokens, maxOutputTokens);
65509
+ verifiedToolFallbacks.sort((a, b) => fallbackCost(a) - fallbackCost(b));
65510
+ }
65511
+ const chain3 = [
65512
+ .../* @__PURE__ */ new Set([
65513
+ ...configuredCandidates,
65514
+ ...evidenceCandidates(features.taskType),
65515
+ ...verifiedToolFallbacks
65516
+ ])
65517
+ ].filter(
65518
+ (model2) => typeof model2 === "string" && model2.length > 0 && !unavailable.has(model2)
65519
+ );
65520
+ const eligible = new Set(
65521
+ chain3.filter((model2) => isEligible(model2, features, maxOutputTokens, options))
65522
+ );
65523
+ const eligibleCandidates = eligible.size > 0 ? [...eligible] : chain3;
65524
+ if (eligibleCandidates.length === 0) return base4;
65525
+ const profileName = options.routingProfile === "eco" ? "eco" : options.routingProfile === "premium" ? "premium" : "auto";
65526
+ const portfolio = options.config.portfolio ?? DEFAULT_PORTFOLIO_WEIGHTS;
65527
+ const band = affinityBand(features);
65528
+ const affinityCache = /* @__PURE__ */ new Map();
65529
+ const getAffinity = (model2) => {
65530
+ let value = affinityCache.get(model2);
65531
+ if (value === void 0) {
65532
+ value = affinityIn(band, model2);
65533
+ affinityCache.set(model2, value);
65534
+ }
65535
+ return value;
65536
+ };
65537
+ const bestAffinity = Math.max(...eligibleCandidates.map(getAffinity));
65538
+ const specificAffinity = eligibleCandidates.filter((model2) => getAffinity(model2) > NEUTRAL_AFFINITY);
65539
+ const affinityPool = specificAffinity.length > 0 ? specificAffinity : [eligibleCandidates[0]];
65540
+ const affinityFloorGap = features.terminalToolSignal ? Math.max(
65541
+ portfolio.affinityFloorGap[profileName],
65542
+ features.terminalSafetySensitive ? 0.15 : 0.12
65543
+ ) : portfolio.affinityFloorGap[profileName];
65544
+ const candidates = affinityPool.filter(
65545
+ (model2) => getAffinity(model2) >= bestAffinity - affinityFloorGap
65546
+ );
65547
+ const costs = candidates.map(
65548
+ (model2) => estimatedCost(model2, options, features.estimatedInputTokens, maxOutputTokens)
65549
+ );
65550
+ const finiteCosts = costs.filter(Number.isFinite);
65551
+ const minCost = finiteCosts.length > 0 ? Math.min(...finiteCosts) : 0;
65552
+ const maxCost = finiteCosts.length > 0 ? Math.max(...finiteCosts) : 1;
65553
+ const now2 = options.now ?? /* @__PURE__ */ new Date();
65554
+ const profileWeights = portfolio[profileName];
65555
+ const rankedEntries = candidates.map((model2, index2) => {
65556
+ const cost = costs[index2];
65557
+ const costScore = !Number.isFinite(cost) ? 0 : maxCost > minCost ? 1 - (cost - minCost) / (maxCost - minCost) : 0.5;
65558
+ const capabilityScore = eligible.has(model2) ? 1 : 0;
65559
+ const profile = profileScore(model2, options, now2);
65560
+ const observedQuality = profile?.quality === void 0 ? getAffinity(model2) : getAffinity(model2) * (1 - profile.freshness) + profile.quality * profile.freshness;
65561
+ const observedSpeed = profile ? profile.speed * profile.freshness + 0.5 * (1 - profile.freshness) : 0.5;
65562
+ const observedTailSpeed = profile ? profile.tailSpeed * profile.freshness + 0.5 * (1 - profile.freshness) : 0.5;
65563
+ const observedReliability = profile ? profile.reliability * profile.freshness + (1 - profile.freshness) : 1;
65564
+ const legacyScore = 1 - index2 / Math.max(1, candidates.length - 1);
65565
+ const qualityWeight = profileWeights.quality + (features.highStakes ? portfolio.highStakesBoost.quality : 0);
65566
+ const speedScore = features.latencySensitive ? observedTailSpeed : observedSpeed;
65567
+ const speedWeight = profileWeights.speed + (features.latencySensitive ? portfolio.latencySensitiveSpeedBoost : 0);
65568
+ const reliabilityWeight = profileWeights.reliability + (features.highStakes ? portfolio.highStakesBoost.reliability : 0);
65569
+ const score = observedQuality * qualityWeight + capabilityScore * profileWeights.capability + costScore * profileWeights.cost + speedScore * speedWeight + observedReliability * reliabilityWeight + legacyScore * profileWeights.legacy;
65570
+ return {
65571
+ model: model2,
65572
+ score,
65573
+ quality: observedQuality,
65574
+ cost: costScore,
65575
+ speed: speedScore,
65576
+ reliability: observedReliability
65577
+ };
65578
+ }).sort((a, b) => b.score - a.score);
65579
+ const scoredModels = rankedEntries.map((item) => item.model);
65580
+ const webResearchFallbackOrder = [
65581
+ "anthropic/claude-sonnet-5",
65582
+ "openai/gpt-5-mini",
65583
+ "google/gemini-3.5-flash",
65584
+ "anthropic/claude-opus-5",
65585
+ "anthropic/claude-opus-4.8",
65586
+ "openai/gpt-5.3-codex"
65587
+ ];
65588
+ const ranked = features.agentDomain === "web_research" ? [
65589
+ ...scoredModels,
65590
+ ...webResearchFallbackOrder.filter(
65591
+ (model2) => eligibleCandidates.includes(model2) && !scoredModels.includes(model2)
65592
+ ),
65593
+ ...eligibleCandidates.filter(
65594
+ (model2) => !scoredModels.includes(model2) && !webResearchFallbackOrder.includes(model2)
65595
+ )
65596
+ ] : [...scoredModels, ...eligibleCandidates.filter((model2) => !scoredModels.includes(model2))];
65597
+ const model = ranked[0] ?? base4.model;
65598
+ const selectedTierConfigs = {
65599
+ ...tierConfigs,
65600
+ [targetTier]: { primary: model, fallback: ranked.slice(1) }
65601
+ };
65602
+ const decision = selectModel(
65603
+ targetTier,
65604
+ base4.confidence,
65605
+ "portfolio",
65606
+ `${base4.reasoning} | v3 task=${features.taskType} agentRisk=${features.agentRisk} deepWebResearch=${features.deepWebResearch} terminalCode=${features.implicitTerminalCode} terminalSafety=${features.terminalSafetySensitive} candidates=${ranked.length}`,
65607
+ selectedTierConfigs,
65608
+ options.modelPricing,
65609
+ features.estimatedInputTokens,
65610
+ maxOutputTokens,
65611
+ options.routingProfile,
65612
+ base4.agenticScore
65613
+ );
65614
+ return {
65615
+ ...decision,
65616
+ tierConfigs: selectedTierConfigs,
65617
+ profile: base4.profile,
65618
+ candidates: ranked,
65619
+ candidateScores: rankedEntries.map(({ model: model2, score, quality, cost, speed, reliability }) => ({
65620
+ model: model2,
65621
+ score,
65622
+ quality,
65623
+ cost,
65624
+ speed,
65625
+ reliability
65626
+ })),
65627
+ taskType: features.taskType,
65628
+ routerVersion: "v3-portfolio"
65629
+ };
65593
65630
  }
65594
65631
  };
65595
65632
  registerStrategy(new PortfolioStrategy());
@@ -108459,7 +108496,7 @@ function classifyTask2(prompt, systemPrompt, options) {
108459
108496
  codeArtifact
108460
108497
  };
108461
108498
  }
108462
- function affinity2(modelId, task, language = "other", agentDomain = "other", deepWebResearch = false, agentRisk = "standard", terminalToolSignal = false, terminalSafetySensitive = false) {
108499
+ function affinity(modelId, task, language = "other", agentDomain = "other", deepWebResearch = false, agentRisk = "standard", terminalToolSignal = false, terminalSafetySensitive = false) {
108463
108500
  const id2 = modelId.toLowerCase();
108464
108501
  const modelName = id2.slice(id2.indexOf("/") + 1);
108465
108502
  const match = (values, score) => values.some((value) => modelName === value) ? score : 0;
@@ -112422,7 +112459,7 @@ var init_dist2 = __esm({
112422
112459
  if (eligibleCandidates.length === 0) return base4;
112423
112460
  const profileName = options.routingProfile === "eco" ? "eco" : options.routingProfile === "premium" ? "premium" : "auto";
112424
112461
  const portfolio = options.config.portfolio ?? DEFAULT_PORTFOLIO_WEIGHTS2;
112425
- const getAffinity = (model2) => affinity2(
112462
+ const getAffinity = (model2) => affinity(
112426
112463
  model2,
112427
112464
  features.taskType,
112428
112465
  features.language,
@@ -142113,27 +142150,27 @@ var require_dns = __commonJS({
142113
142150
  }
142114
142151
  );
142115
142152
  }
142116
- #defaultPick(origin2, hostnameRecords, affinity3) {
142153
+ #defaultPick(origin2, hostnameRecords, affinity2) {
142117
142154
  let ip = null;
142118
142155
  const { records, offset } = hostnameRecords;
142119
142156
  let family;
142120
142157
  if (this.dualStack) {
142121
- if (affinity3 == null) {
142158
+ if (affinity2 == null) {
142122
142159
  if (offset == null || offset === maxInt) {
142123
142160
  hostnameRecords.offset = 0;
142124
- affinity3 = 4;
142161
+ affinity2 = 4;
142125
142162
  } else {
142126
142163
  hostnameRecords.offset++;
142127
- affinity3 = (hostnameRecords.offset & 1) === 1 ? 6 : 4;
142164
+ affinity2 = (hostnameRecords.offset & 1) === 1 ? 6 : 4;
142128
142165
  }
142129
142166
  }
142130
- if (records[affinity3] != null && records[affinity3].ips.length > 0) {
142131
- family = records[affinity3];
142167
+ if (records[affinity2] != null && records[affinity2].ips.length > 0) {
142168
+ family = records[affinity2];
142132
142169
  } else {
142133
- family = records[affinity3 === 4 ? 6 : 4];
142170
+ family = records[affinity2 === 4 ? 6 : 4];
142134
142171
  }
142135
142172
  } else {
142136
- family = records[affinity3];
142173
+ family = records[affinity2];
142137
142174
  }
142138
142175
  if (family == null || family.ips.length === 0) {
142139
142176
  return ip;
@@ -142150,7 +142187,7 @@ var require_dns = __commonJS({
142150
142187
  }
142151
142188
  if (Date.now() - ip.timestamp > ip.ttl) {
142152
142189
  family.ips.splice(position, 1);
142153
- return this.pick(origin2, hostnameRecords, affinity3);
142190
+ return this.pick(origin2, hostnameRecords, affinity2);
142154
142191
  }
142155
142192
  return ip;
142156
142193
  }
@@ -142291,11 +142328,11 @@ var require_dns = __commonJS({
142291
142328
  throw new InvalidArgumentError("Invalid storage. Must be a object with methods: { get, set, full, delete }");
142292
142329
  }
142293
142330
  const dualStack = interceptorOpts?.dualStack ?? true;
142294
- let affinity3;
142331
+ let affinity2;
142295
142332
  if (dualStack) {
142296
- affinity3 = interceptorOpts?.affinity ?? null;
142333
+ affinity2 = interceptorOpts?.affinity ?? null;
142297
142334
  } else {
142298
- affinity3 = interceptorOpts?.affinity ?? 4;
142335
+ affinity2 = interceptorOpts?.affinity ?? 4;
142299
142336
  }
142300
142337
  const opts = {
142301
142338
  maxTTL: interceptorOpts?.maxTTL ?? 1e4,
@@ -142303,7 +142340,7 @@ var require_dns = __commonJS({
142303
142340
  lookup: interceptorOpts?.lookup ?? null,
142304
142341
  pick: interceptorOpts?.pick ?? null,
142305
142342
  dualStack,
142306
- affinity: affinity3,
142343
+ affinity: affinity2,
142307
142344
  maxItems: interceptorOpts?.maxItems ?? Infinity,
142308
142345
  storage: interceptorOpts?.storage
142309
142346
  };