@blockrun/llm 4.3.1 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -89,6 +89,7 @@ __export(index_exports, {
89
89
  createSolanaWallet: () => createSolanaWallet,
90
90
  createWallet: () => createWallet,
91
91
  default: () => client_default,
92
+ estimateChatCostUsd: () => estimateChatCostUsd,
92
93
  evmNetwork: () => evmNetwork,
93
94
  extractPaymentDetails: () => extractPaymentDetails,
94
95
  formatFundingMessageCompact: () => formatFundingMessageCompact,
@@ -115,6 +116,7 @@ __export(index_exports, {
115
116
  logCost: () => logCost,
116
117
  parsePaymentRequired: () => parsePaymentRequired,
117
118
  paymentRejectedErrorFromBody: () => paymentRejectedErrorFromBody,
119
+ platformFeePercentOf: () => platformFeePercentOf,
118
120
  readSettlement: () => readSettlement,
119
121
  retryDisposition: () => retryDisposition,
120
122
  saveSolanaWallet: () => saveSolanaWallet,
@@ -782,7 +784,7 @@ function buildDecisionsBody(request) {
782
784
  // src/client.ts
783
785
  var import_accounts2 = require("viem/accounts");
784
786
 
785
- // node_modules/.pnpm/@blockrun+router-core@https+++codeload.github.com+BlockRunAI+router-core+tar.gz+273c2af0a9abe_i6wf3ulsaatbgbpu4f3nxzqhhm/node_modules/@blockrun/router-core/dist/index.js
787
+ // node_modules/.pnpm/@blockrun+router-core@https+++codeload.github.com+BlockRunAI+router-core+tar.gz+53fe78353e1b3_omdfyyg7rrspxbl65mdwmbpkkm/node_modules/@blockrun/router-core/dist/index.js
786
788
  var UNSEGMENTED_SCRIPT = /[؀-ۿ -ヿ㐀-䶿一-鿿가-힯豈-﫿＀-￯]/;
787
789
  var WORD_CHAR = /[\p{L}\p{N}]/u;
788
790
  var ASCII_PHRASE = /^[a-z0-9' -]+$/;
@@ -1351,7 +1353,12 @@ var DEFAULT_ROUTING_CONFIG = {
1351
1353
  affinityFloorGap: { auto: 0.1, eco: 0.22, premium: 0.05 }
1352
1354
  },
1353
1355
  classifier: {
1354
- llmModel: "google/gemini-2.5-flash",
1356
+ // gemini-2.5-flash until Google retired it on 2026-12-01 (the gateways
1357
+ // redirect it to 3.5 Flash-Lite). Nothing in this package or ClawRouter
1358
+ // reads llmModel today. Before wiring it, note that 3.5 Flash-Lite always
1359
+ // thinks (it rejects a thinking budget of 0), so llmMaxTokens 10 may be
1360
+ // spent on reasoning before any label is emitted.
1361
+ llmModel: "google/gemini-3.5-flash-lite",
1355
1362
  llmMaxTokens: 10,
1356
1363
  llmTemperature: 0,
1357
1364
  promptTruncationChars: 500,
@@ -2392,24 +2399,84 @@ var DEFAULT_ROUTING_CONFIG = {
2392
2399
  //
2393
2400
  // Latency figures in comments are the 2026-08-29 gateway probe
2394
2401
  // (model-profiles.generated.json); prices are the catalog list.
2402
+ //
2403
+ // Retirements 2026-11-24 (owner-approved; the gateways redirect each id
2404
+ // before pricing, so a stale name here is a silent model swap, not an error):
2405
+ // - google/gemini-3.5-flash -> google/gemini-3.6-flash. Google has served
2406
+ // 3.6 Flash under the 3.5 name since ~2026-10-10. Each 3.5 rung now names
2407
+ // 3.6 at the same position; where 3.6 already sat in the same chain, the
2408
+ // later of the two is dropped, so the order of the models actually served
2409
+ // is unchanged. 3.6 inherits 3.5's affinity values, carried, not measured
2410
+ // (portfolio.ts).
2411
+ // - openai/o4-mini (and o1, o3-mini) -> openai/gpt-5.4-mini, at the same
2412
+ // position. Dead at OpenAI since 2026-10-23 and on Azure since 2026-11-19.
2413
+ //
2414
+ // Retirements 2026-12-01 (Google retires Gemini 2.5; the gateways redirect):
2415
+ // - google/gemini-2.5-flash -> google/gemini-3.5-flash-lite (same
2416
+ // $0.30/$2.50), in place, with the same dedupe rule. 3.5 Flash-Lite has
2417
+ // no vision tag where 2.5 Flash had one, so a SIMPLE vision turn now
2418
+ // falls past it to the next vision-capable rung instead of reaching a
2419
+ // redirected model that would drop the image.
2420
+ // - google/gemini-2.5-pro -> google/gemini-3.8-flash ($0.75/$3.75), in
2421
+ // place.
2422
+ //
2423
+ // Retirements 2026-12-11 (OpenAI shuts down o3, gpt-5-mini and gpt-5-nano —
2424
+ // developers.openai.com/api/docs/deprecations, notice 2026-06-11; the
2425
+ // gateways redirect each and quote the successor):
2426
+ // - openai/o3 -> openai/gpt-5.4-mini ($2/$8 -> $0.75/$4.50). Both o3 rungs
2427
+ // (auto and premium REASONING) sat directly behind gpt-5.4-mini, so they
2428
+ // are dropped by the dedupe rule; the order actually served is unchanged.
2429
+ // - openai/gpt-5-mini -> openai/gpt-5.6-luna ($0.25/$2 -> $0.20/$1.20), in
2430
+ // place as the agentic MEDIUM primary. Luna inherits gpt-5-mini's
2431
+ // affinity values, CARRIED, not measured (portfolio.ts) — gpt-5-mini is a
2432
+ // reasoning model and luna runs without reasoning, so those values are a
2433
+ // placeholder until a Terminal-Bench/tau2 run on luna.
2434
+ // - openai/gpt-5-nano is NOT redirected (owner decision 2026-11-24): the
2435
+ // gateways keep serving it from Azure at its own $0.05/$0.40 until
2436
+ // 2027-02-09. It is hidden and in no chain, and none is added.
2437
+ //
2438
+ // Generation refresh 2026-11-27 (owner-approved). Nothing below is retired
2439
+ // at the gateway — every id it replaces still answers on both chains. The
2440
+ // rule: a fallback rung, or a primary with no calibration behind it, moves
2441
+ // to the same family's newer model when that model costs the same or less
2442
+ // and is tool-verified. Primaries carrying measured trajectory evidence
2443
+ // (Sonnet 5, GPT-4o Mini, Gemini 3.1 Pro's long-context lead) stay until a
2444
+ // calibration run says otherwise, and so do the measured values in
2445
+ // portfolio.ts (BFCL parallel, GPQA, MGSM, BrowseComp, tau2, Terminal-Bench)
2446
+ // and the evidence pools that reach them.
2447
+ // - claude-opus-5 / -4.8 / -4.7 ($5/$25) -> claude-opus-5.5 ($4/$20), with
2448
+ // opus-5 kept directly behind it as the in-family hot swap; 4.8 and 4.7
2449
+ // leave the chains.
2450
+ // - claude-sonnet-4.6 ($3/$15) -> claude-sonnet-5.5 ($2/$10), in place.
2451
+ // - grok-4.5 -> grok-4.7 (both $2/$6), in place.
2452
+ // - gpt-5.4-nano ($0.20/$1.25) -> gpt-6-luna ($0.10/$0.50), in place.
2453
+ // - gpt-5.5 ($5/$30) and gpt-5.4 ($2.50/$15), adjacent in three COMPLEX
2454
+ // chains -> one gpt-6.2-sol rung ($2/$10; tool call, 3/3 completions,
2455
+ // 6.3s mean on the 2026-11-27 probe). gpt-5.6-terra stays where it is.
2456
+ // - premiumTiers.COMPLEX primary: claude-fable-5 ($10/$50) ->
2457
+ // claude-opus-5.5 ($4/$20), owner decision. Fable 5.2 ($8/$40) is served
2458
+ // on Base only (Solana answers 503 and does not list it), so it is in no
2459
+ // chain; Fable 5 leaves the chains.
2395
2460
  // Auto (balanced) tier configs - current default smart routing
2396
2461
  tiers: {
2397
2462
  SIMPLE: {
2398
- primary: "google/gemini-2.5-flash",
2399
- // $0.30/$2.50 — 60% retention (best) in the 2026-03 run; still the fastest quality answer
2463
+ // Was google/gemini-2.5-flash (60% retention, best, in the 2026-03 run)
2464
+ // until its 2026-12-01 retirement. 3.5 Flash-Lite is what the gateways
2465
+ // serve under that name from then on; it was this chain's second
2466
+ // fallback and is dropped there.
2467
+ primary: "google/gemini-3.5-flash-lite",
2468
+ // $0.30/$2.50, 1M ctx, thinking mode, no vision
2400
2469
  fallback: [
2401
2470
  "google/gemini-3-flash-preview",
2402
2471
  // $0.50/$3 — GPQA 5/6 in the 2026-07 calibration
2403
- "google/gemini-3.5-flash-lite",
2404
- // $0.30/$2.50, 1M ctx, thinking mode — same price as 2.5 Flash, newer generation
2405
2472
  "deepseek/deepseek-chat",
2406
2473
  // $0.14/$0.28, 1M ctx
2407
2474
  "google/gemini-3.1-flash-lite",
2408
2475
  // $0.25/$1.50, 1M ctx
2409
2476
  "openai/gpt-5.6-luna",
2410
2477
  // $0.20/$1.20, 1M ctx — GPT-5.6 cost tier (cut 2026-07-30)
2411
- "openai/gpt-5.4-nano",
2412
- // $0.20/$1.25, 1M ctx
2478
+ "openai/gpt-6-luna",
2479
+ // $0.10/$0.50, 1M ctx, vision + tools — gpt-5.4-nano's successor (2026-11-27)
2413
2480
  "google/gemini-2.5-flash-lite",
2414
2481
  // $0.10/$0.40
2415
2482
  "nvidia/nemotron-3.5-lightning"
@@ -2417,13 +2484,13 @@ var DEFAULT_ROUTING_CONFIG = {
2417
2484
  ]
2418
2485
  },
2419
2486
  MEDIUM: {
2420
- // Was moonshot/kimi-k2.7 (hidden 2026-08). Gemini 3.5 Flash is the
2421
- // calibrated successor: MGSM 5/5, GPQA 4/6, extraction band (portfolio.ts).
2422
- primary: "google/gemini-3.5-flash",
2423
- // $1.50/$9, 1M ctx, vision + tools
2487
+ // Was moonshot/kimi-k2.7 (hidden 2026-08), then Gemini 3.5 Flash — the
2488
+ // calibrated successor (MGSM 5/5, GPQA 4/6, extraction band) — until its
2489
+ // 2026-11-24 retirement. 3.6 Flash is what Google served under that name
2490
+ // since ~10-10; it was this chain's first fallback and is dropped there.
2491
+ primary: "google/gemini-3.6-flash",
2492
+ // $0.75/$3.75, 1M ctx, vision + tools — 3.5's affinity, carried
2424
2493
  fallback: [
2425
- "google/gemini-3.6-flash",
2426
- // $1.50/$7.50 — newest Flash, output 17% cheaper than 3.5; awaiting calibration
2427
2494
  "zai/glm-5.3-flash",
2428
2495
  // $0.15/$0.50, 1M ctx, vision + tools verified live 2026-08-27
2429
2496
  "openai/gpt-5.6-terra",
@@ -2432,8 +2499,8 @@ var DEFAULT_ROUTING_CONFIG = {
2432
2499
  // $0.50/$3
2433
2500
  "deepseek/deepseek-chat",
2434
2501
  // $0.14/$0.28
2435
- "google/gemini-2.5-flash",
2436
- // $0.30/$2.50
2502
+ "google/gemini-3.5-flash-lite",
2503
+ // $0.30/$2.50 — 2.5 Flash's successor (retired 2026-12-01)
2437
2504
  "minimax/minimax-m3",
2438
2505
  // $0.30/$1.20, 1M ctx
2439
2506
  "google/gemini-3.1-flash-lite",
@@ -2449,33 +2516,29 @@ var DEFAULT_ROUTING_CONFIG = {
2449
2516
  // $2/$12 — proven long-context flagship (portfolio.ts long_context lead)
2450
2517
  fallback: [
2451
2518
  "google/gemini-3.6-flash",
2452
- // $1.50/$7.50 — Pro-level quality at Flash price (Google's claim; uncalibrated here)
2453
- "google/gemini-3.5-flash",
2454
- // $1.50/$9 — calibrated
2519
+ // $0.75/$3.75 — Pro-level quality at Flash price (Google's claim); also 3.5 Flash's successor (3.5 retired 2026-11-24 and was the next rung)
2455
2520
  "anthropic/claude-sonnet-5",
2456
- // $3/$15 — near-Opus quality, tau2 + Terminal-Bench calibrated
2457
- "xai/grok-4.5",
2458
- // $2.50/$9 — 503-resistant, independent infra (was grok-4-0709, now hidden)
2459
- "google/gemini-2.5-pro",
2460
- // $1.25/$10
2461
- "anthropic/claude-sonnet-4.6",
2462
- // $3/$15
2521
+ // $2/$10 — near-Opus quality, tau2 + Terminal-Bench calibrated
2522
+ "xai/grok-4.7",
2523
+ // $2/$6 — 503-resistant, independent infra (grok-4.5's successor, 2026-11-27)
2524
+ "google/gemini-3.8-flash",
2525
+ // $0.75/$3.75 — 2.5 Pro's successor (retired 2026-12-01)
2526
+ "anthropic/claude-sonnet-5.5",
2527
+ // $2/$10 — sonnet-4.6's successor (2026-11-27)
2463
2528
  "openai/gpt-5.6-terra",
2464
2529
  // $2/$12 — GPT-5.6 balanced tier (Sol excluded: #202)
2465
- "openai/gpt-5.5",
2466
- // $5/$30 — prior OpenAI flagship
2467
- "openai/gpt-5.4",
2468
- // $2.50/$15 — previous flagship, benchmarked
2530
+ "openai/gpt-6.2-sol",
2531
+ // $2/$10, vision + tools (probed 2026-11-27) — replaces gpt-5.5 ($5/$30) and gpt-5.4 ($2.50/$15)
2469
2532
  "zai/glm-5.3",
2470
2533
  // $1.40/$4.40, 1M ctx, always-on thinking — verified live 2026-08-19
2471
- "moonshot/kimi-k3",
2472
- // $3/$15, 1M ctx — Moonshot flagship (K2.7 successor)
2534
+ "moonshot/kimi-k3.1-pro",
2535
+ // $2/$10, 1M ctx — Moonshot flagship (K3 successor)
2473
2536
  "deepseek/deepseek-v4-pro",
2474
- // $0.435/$0.87 — strongest open-weight reasoner
2537
+ // $1.32/$3.96 — strongest open-weight reasoner
2475
2538
  "deepseek/deepseek-chat",
2476
2539
  // $0.14/$0.28 — cheap last resort
2477
- "google/gemini-2.5-flash"
2478
- // $0.30/$2.50
2540
+ "google/gemini-3.5-flash-lite"
2541
+ // $0.30/$2.50 — 2.5 Flash's successor (retired 2026-12-01)
2479
2542
  ]
2480
2543
  },
2481
2544
  REASONING: {
@@ -2485,17 +2548,15 @@ var DEFAULT_ROUTING_CONFIG = {
2485
2548
  // $0.14/$0.28, 1M ctx
2486
2549
  fallback: [
2487
2550
  "deepseek/deepseek-v4-pro",
2488
- // $0.435/$0.87 — calibrated reasoning band 0.95
2551
+ // $1.32/$3.96 — calibrated reasoning band 0.95
2489
2552
  "xai/grok-4.3",
2490
- // $1.50/$4, 1M ctx — xAI reasoning model, vision
2553
+ // $1.25/$2.50, 1M ctx — xAI reasoning model, vision
2491
2554
  "qwen/qwen3.7-plus",
2492
2555
  // $0.32/$1.28, 1M ctx — reasoning; needs a generous max_tokens (thinking is billed)
2493
- "google/gemini-3.5-flash",
2494
- // $1.50/$9 — MGSM 5/5
2495
- "openai/o4-mini",
2496
- // $1.10/$4.40
2497
- "openai/o3"
2498
- // $2/$8
2556
+ "google/gemini-3.6-flash",
2557
+ // $0.75/$3.75 — 3.5 Flash's successor (MGSM 5/5 on 3.5, carried)
2558
+ "openai/gpt-5.4-mini"
2559
+ // $0.75/$4.50 — o4-mini's and o3's successor (retired 2026-11-24 and 2026-12-11; o3 was the next rung)
2499
2560
  ]
2500
2561
  }
2501
2562
  },
@@ -2526,8 +2587,8 @@ var DEFAULT_ROUTING_CONFIG = {
2526
2587
  // $0.15/$0.50, 1M ctx, vision + tools
2527
2588
  "openai/gpt-5.6-luna",
2528
2589
  // $0.20/$1.20, 1M ctx
2529
- "openai/gpt-5.4-nano",
2530
- // $0.20/$1.25
2590
+ "openai/gpt-6-luna",
2591
+ // $0.10/$0.50 — gpt-5.4-nano's successor (2026-11-27)
2531
2592
  "google/gemini-3.1-flash-lite"
2532
2593
  // $0.25/$1.50
2533
2594
  ]
@@ -2542,12 +2603,12 @@ var DEFAULT_ROUTING_CONFIG = {
2542
2603
  // $0.25/$1.50
2543
2604
  "openai/gpt-5.6-luna",
2544
2605
  // $0.20/$1.20
2545
- "openai/gpt-5.4-nano",
2546
- // $0.20/$1.25
2606
+ "openai/gpt-6-luna",
2607
+ // $0.10/$0.50 — gpt-5.4-nano's successor (2026-11-27)
2547
2608
  "google/gemini-2.5-flash-lite",
2548
2609
  // $0.10/$0.40
2549
- "google/gemini-2.5-flash"
2550
- // $0.30/$2.50
2610
+ "google/gemini-3.5-flash-lite"
2611
+ // $0.30/$2.50 — 2.5 Flash's successor (retired 2026-12-01)
2551
2612
  ]
2552
2613
  },
2553
2614
  COMPLEX: {
@@ -2559,11 +2620,11 @@ var DEFAULT_ROUTING_CONFIG = {
2559
2620
  "minimax/minimax-m3",
2560
2621
  // $0.30/$1.20, 1M ctx
2561
2622
  "deepseek/deepseek-v4-pro",
2562
- // $0.435/$0.87
2623
+ // $1.32/$3.96
2563
2624
  "google/gemini-3.1-flash-lite",
2564
2625
  // $0.25/$1.50
2565
- "google/gemini-2.5-flash"
2566
- // $0.30/$2.50
2626
+ "google/gemini-3.5-flash-lite"
2627
+ // $0.30/$2.50 — 2.5 Flash's successor (retired 2026-12-01)
2567
2628
  ]
2568
2629
  },
2569
2630
  REASONING: {
@@ -2571,7 +2632,7 @@ var DEFAULT_ROUTING_CONFIG = {
2571
2632
  // $0.14/$0.28, 1M ctx — cheapest listed reasoner
2572
2633
  fallback: [
2573
2634
  "deepseek/deepseek-v4-pro",
2574
- // $0.435/$0.87
2635
+ // $1.32/$3.96
2575
2636
  "qwen/qwen3.7-plus",
2576
2637
  // $0.32/$1.28 — reasoning
2577
2638
  "minimax/minimax-m3",
@@ -2582,23 +2643,21 @@ var DEFAULT_ROUTING_CONFIG = {
2582
2643
  }
2583
2644
  },
2584
2645
  // Premium tier configs - best quality (blockrun/premium)
2585
- // codex=complex coding, flash=simple coding, sonnet=reasoning/instructions, fable/opus=architecture/PM/audits
2646
+ // codex=complex coding, flash=simple coding, sonnet=reasoning/instructions, opus=architecture/PM/audits
2586
2647
  premiumTiers: {
2587
2648
  SIMPLE: {
2588
- // Was moonshot/kimi-k2.7 (hidden 2026-08).
2589
- primary: "google/gemini-3.5-flash",
2590
- // $1.50/$9, 1M ctx, vision + tools — calibrated
2649
+ // Was moonshot/kimi-k2.7 (hidden 2026-08), then Gemini 3.5 Flash until
2650
+ // its 2026-11-24 retirement; 3.6 Flash was the first fallback and is
2651
+ // dropped there.
2652
+ primary: "google/gemini-3.6-flash",
2653
+ // $0.75/$3.75, 1M ctx, vision + tools — 3.5's affinity, carried
2591
2654
  fallback: [
2592
- "google/gemini-3.6-flash",
2593
- // $1.50/$7.50 — newest Flash
2594
2655
  "anthropic/claude-haiku-4.5",
2595
2656
  // $1/$5
2596
2657
  "zai/glm-5.3",
2597
2658
  // $1.40/$4.40, 1M ctx
2598
- "google/gemini-2.5-flash",
2599
- // $0.30/$2.50
2600
2659
  "google/gemini-3.5-flash-lite",
2601
- // $0.30/$2.50
2660
+ // $0.30/$2.50 — written where 2.5 Flash sat (retired 2026-12-01); the duplicate after it is dropped
2602
2661
  "deepseek/deepseek-chat"
2603
2662
  // $0.14/$0.28
2604
2663
  ]
@@ -2608,54 +2667,49 @@ var DEFAULT_ROUTING_CONFIG = {
2608
2667
  // $1.75/$14 - 400K context, 128K output — code_edit/debug lead (portfolio.ts)
2609
2668
  fallback: [
2610
2669
  "anthropic/claude-sonnet-5",
2611
- // $3/$15 — code_agent band 0.98
2612
- "moonshot/kimi-k3",
2613
- // $3/$15, 1M ctx — Moonshot flagship
2670
+ // $2/$10 — code_agent band 0.98
2671
+ "moonshot/kimi-k3.1-pro",
2672
+ // $2/$10, 1M ctx — Moonshot flagship
2614
2673
  "zai/glm-5.3",
2615
2674
  // $1.40/$4.40 — long-horizon coding
2616
2675
  "google/gemini-3.6-flash",
2617
- // $1.50/$7.50
2618
- "google/gemini-3.5-flash",
2619
- // $1.50/$9
2620
- "google/gemini-2.5-pro",
2621
- // $1.25/$10
2622
- "xai/grok-4.5",
2623
- // $2.50/$9
2624
- "anthropic/claude-sonnet-4.6",
2625
- // $3/$15
2676
+ // $0.75/$3.75 (3.5 Flash, the next rung, retired 2026-11-24)
2677
+ "google/gemini-3.8-flash",
2678
+ // $0.75/$3.75 — 2.5 Pro's successor (retired 2026-12-01)
2679
+ "xai/grok-4.7",
2680
+ // $2/$6 — grok-4.5's successor (2026-11-27)
2681
+ "anthropic/claude-sonnet-5.5",
2682
+ // $2/$10 — sonnet-4.6's successor (2026-11-27)
2626
2683
  "openai/gpt-5.6-terra"
2627
2684
  // $2/$12
2628
2685
  ]
2629
2686
  },
2630
2687
  COMPLEX: {
2631
2688
  // fable-5 was promoted here 2026-06-11, force-reverted 2026-06-13 when Anthropic
2632
- // withdrew the offer, and restored 2026-07-14 now that BlockRun has relisted it.
2633
- primary: "anthropic/claude-fable-5",
2634
- // Best quality for complex tasks — Mythos-class flagship above Opus ($10/$50, 1M ctx, always-on thinking)
2689
+ // withdrew the offer, and restored 2026-07-14 when BlockRun relisted it.
2690
+ // 2026-11-27 (owner decision): Opus 5.5 takes the slot. Fable 5.2 is
2691
+ // Base-only (Solana 503s it), and Fable 5 / 5.1 cost 2.5x Opus 5.5.
2692
+ primary: "anthropic/claude-opus-5.5",
2693
+ // $4/$20, 1M ctx, adaptive thinking, vision + tools (probed 2026-11-27)
2635
2694
  // Fallback chain de-Gemini'd 2026-04-22: when Anthropic 503s, Gemini is
2636
2695
  // also prone to "high demand" 503s (correlated failure — everyone falls
2637
2696
  // back to Google at the same time). Prefer in-family → xAI → Moonshot →
2638
2697
  // OpenAI flagship → Z.AI → DeepSeek → NVIDIA free instead.
2639
2698
  fallback: [
2640
2699
  "anthropic/claude-opus-5",
2641
- // in-family hot swap first (half the price, 1M ctx + adaptive thinking)
2642
- "anthropic/claude-opus-4.8",
2643
- // in-family hot swap (identical cost to 5)
2644
- "anthropic/claude-opus-4.7",
2645
- // in-family hot swap (identical cost to 4.8)
2700
+ // in-family hot swap first ($5/$25, 1M ctx + adaptive thinking); 4.8 and 4.7 left 2026-11-27
2646
2701
  "anthropic/claude-sonnet-5",
2647
2702
  // Sonnet-tier drop-down, near-Opus quality
2648
- "anthropic/claude-sonnet-4.6",
2649
- "xai/grok-4.5",
2703
+ "anthropic/claude-sonnet-5.5",
2704
+ // $2/$10 — sonnet-4.6's successor (2026-11-27)
2705
+ "xai/grok-4.7",
2650
2706
  // xAI flagship — 503-resistant, direct-xAI SKU
2651
- "moonshot/kimi-k3",
2707
+ "moonshot/kimi-k3.1-pro",
2652
2708
  // Moonshot flagship, independent infra
2653
2709
  "openai/gpt-5.6-terra",
2654
2710
  // GPT-5.6 balanced tier — stable (Sol excluded: #202)
2655
- "openai/gpt-5.5",
2656
- // Prior OpenAI flagship — 1M+ ctx, native agent + computer use
2657
- "openai/gpt-5.4",
2658
- // Previous flagship (slow but stable, benchmarked at 6,213ms)
2711
+ "openai/gpt-6.2-sol",
2712
+ // OpenAI flagship tier, $2/$10 — replaces gpt-5.5 and gpt-5.4 (2026-11-27)
2659
2713
  "openai/gpt-5.3-codex",
2660
2714
  "zai/glm-5.3",
2661
2715
  // Z.AI flagship, 1M ctx
@@ -2671,26 +2725,22 @@ var DEFAULT_ROUTING_CONFIG = {
2671
2725
  // Sonnet 5 promoted over Sonnet 4.6 (same price; reasoning band 0.98 for both,
2672
2726
  // plus Sonnet 5's tau2/BrowseComp trajectory evidence).
2673
2727
  primary: "anthropic/claude-sonnet-5",
2674
- // $3/$15, 1M ctx, adaptive thinking
2728
+ // $2/$10, 1M ctx, adaptive thinking
2675
2729
  fallback: [
2676
- "anthropic/claude-sonnet-4.6",
2677
- // in-family hot swap — same cost
2730
+ "anthropic/claude-sonnet-5.5",
2731
+ // in-family hot swap — same cost (sonnet-4.6's successor, 2026-11-27)
2732
+ "anthropic/claude-opus-5.5",
2733
+ // Newest flagship Opus w/ adaptive thinking, $4/$20
2678
2734
  "anthropic/claude-opus-5",
2679
- // Newest flagship Opus w/ adaptive thinking
2680
- "anthropic/claude-opus-4.8",
2681
- // Prior flagship Opus — identical cost to 5
2682
- "anthropic/claude-opus-4.7",
2683
- // Flagship Opus w/ adaptive thinking
2684
- "xai/grok-4.5",
2685
- // reasoning band 0.94
2735
+ // Prior flagship Opus — in-family hot swap ($5/$25)
2736
+ "xai/grok-4.7",
2737
+ // reasoning band 0.94 (grok-4.5's prior, carried)
2686
2738
  "deepseek/deepseek-v4-pro",
2687
2739
  // reasoning band 0.95
2688
2740
  "xai/grok-4.3",
2689
- // $1.50/$4 — xAI reasoning model
2690
- "openai/o4-mini",
2691
- // $1.10/$4.40
2692
- "openai/o3"
2693
- // $2/$8
2741
+ // $1.25/$2.50 — xAI reasoning model
2742
+ "openai/gpt-5.4-mini"
2743
+ // $0.75/$4.50 — o4-mini's and o3's successor (retired 2026-11-24 and 2026-12-11; o3 was the next rung)
2694
2744
  ]
2695
2745
  }
2696
2746
  },
@@ -2706,18 +2756,20 @@ var DEFAULT_ROUTING_CONFIG = {
2706
2756
  // $0.15/$0.50 — tool calls verified live 2026-08-27
2707
2757
  "anthropic/claude-haiku-4.5",
2708
2758
  // $1/$5
2709
- "google/gemini-2.5-flash"
2710
- // $0.30/$2.50
2759
+ "google/gemini-3.5-flash-lite"
2760
+ // $0.30/$2.50 — 2.5 Flash's successor (retired 2026-12-01)
2711
2761
  ]
2712
2762
  },
2713
2763
  MEDIUM: {
2714
- // Was moonshot/kimi-k2.7 (hidden 2026-08). GPT-5 Mini carries the
2715
- // Terminal-Bench and tau2 trajectory evidence in portfolio.ts.
2716
- primary: "openai/gpt-5-mini",
2717
- // $0.25/$2 — 4/7 Terminal-Bench, 5/6 tau2 airline
2764
+ // Was moonshot/kimi-k2.7 (hidden 2026-08), then GPT-5 Mini — which
2765
+ // carries the Terminal-Bench and tau2 trajectory evidence in
2766
+ // portfolio.ts — until its 2026-12-11 retirement. GPT-5.6 Luna is what
2767
+ // the gateways serve under that name from then on.
2768
+ primary: "openai/gpt-5.6-luna",
2769
+ // $0.20/$1.20, 1M ctx, vision + tools — gpt-5-mini's affinity (4/7 Terminal-Bench, 5/6 tau2 airline), carried
2718
2770
  fallback: [
2719
- "google/gemini-3.5-flash",
2720
- // $1.50/$9 — tool_agent band 0.88
2771
+ "google/gemini-3.6-flash",
2772
+ // $0.75/$3.75 — tool_agent band 0.88 (3.5's, carried)
2721
2773
  "zai/glm-5.3-flash",
2722
2774
  // $0.15/$0.50 — tools verified
2723
2775
  "openai/gpt-5.6-terra",
@@ -2728,37 +2780,33 @@ var DEFAULT_ROUTING_CONFIG = {
2728
2780
  // $1/$5
2729
2781
  "deepseek/deepseek-chat",
2730
2782
  // $0.14/$0.28
2731
- "moonshot/kimi-k3"
2732
- // $3/$15 — tool_agent band 0.85
2783
+ "moonshot/kimi-k3.1-pro"
2784
+ // $2/$10 — tool_agent band 0.85
2733
2785
  ]
2734
2786
  },
2735
2787
  COMPLEX: {
2736
2788
  // Sonnet 5 promoted over Sonnet 4.6: tau2 airline + retail reward 1.0,
2737
2789
  // Terminal-Bench safety band lead (portfolio.ts).
2738
2790
  primary: "anthropic/claude-sonnet-5",
2739
- // $3/$15 — best agentic quality per trajectory evidence
2791
+ // $2/$10 — best agentic quality per trajectory evidence
2740
2792
  // Fallback chain de-Gemini'd 2026-04-22: Gemini's "high demand" 503s
2741
2793
  // correlate with Anthropic outages (everyone falls back together).
2742
2794
  // Prefer 503-resistant providers first.
2743
2795
  fallback: [
2744
- "anthropic/claude-sonnet-4.6",
2745
- // in-family hot swap — same cost
2796
+ "anthropic/claude-sonnet-5.5",
2797
+ // in-family hot swap — same cost (sonnet-4.6's successor, 2026-11-27)
2798
+ "anthropic/claude-opus-5.5",
2799
+ // Newest flagship Opus — in-family hot swap, $4/$20
2746
2800
  "anthropic/claude-opus-5",
2747
- // Newest flagship Opus — in-family hot swap
2748
- "anthropic/claude-opus-4.8",
2749
- // Prior flagship Opus — identical cost to 5
2750
- "anthropic/claude-opus-4.7",
2751
- // Flagship Opus — in-family hot swap
2752
- "xai/grok-4.5",
2801
+ // Prior flagship Opus — in-family hot swap ($5/$25)
2802
+ "xai/grok-4.7",
2753
2803
  // xAI flagship — strong tool use, independent infra
2754
- "moonshot/kimi-k3",
2804
+ "moonshot/kimi-k3.1-pro",
2755
2805
  // Moonshot flagship — independent infra
2756
2806
  "openai/gpt-5.6-terra",
2757
2807
  // GPT-5.6 balanced tier — stable (Sol excluded: #202)
2758
- "openai/gpt-5.5",
2759
- // Prior flagship — native agent + computer use (exactly the agentic-tier use case)
2760
- "openai/gpt-5.4",
2761
- // Previous flagship — reliable
2808
+ "openai/gpt-6.2-sol",
2809
+ // OpenAI flagship tier, $2/$10, tools verified — replaces gpt-5.5 and gpt-5.4 (2026-11-27)
2762
2810
  "openai/gpt-5.3-codex",
2763
2811
  // code_agent lead
2764
2812
  "zai/glm-5.3",
@@ -2773,18 +2821,16 @@ var DEFAULT_ROUTING_CONFIG = {
2773
2821
  },
2774
2822
  REASONING: {
2775
2823
  primary: "anthropic/claude-sonnet-5",
2776
- // $3/$15 — strong tool use + adaptive thinking
2824
+ // $2/$10 — strong tool use + adaptive thinking
2777
2825
  fallback: [
2778
- "anthropic/claude-sonnet-4.6",
2779
- // in-family hot swap — same cost
2826
+ "anthropic/claude-sonnet-5.5",
2827
+ // in-family hot swap — same cost (sonnet-4.6's successor, 2026-11-27)
2828
+ "anthropic/claude-opus-5.5",
2829
+ // Newest flagship Opus w/ adaptive thinking, $4/$20
2780
2830
  "anthropic/claude-opus-5",
2781
- // Newest flagship Opus w/ adaptive thinking
2782
- "anthropic/claude-opus-4.8",
2783
- // Prior flagship Opus — identical cost to 5
2784
- "anthropic/claude-opus-4.7",
2785
- // Flagship Opus w/ adaptive thinking
2786
- "xai/grok-4.5",
2787
- // reasoning band 0.94
2831
+ // Prior flagship Opus — in-family hot swap ($5/$25)
2832
+ "xai/grok-4.7",
2833
+ // reasoning band 0.94 (grok-4.5's prior, carried)
2788
2834
  "deepseek/deepseek-v4-pro",
2789
2835
  // reasoning band 0.95
2790
2836
  "deepseek/deepseek-reasoner"
@@ -2817,6 +2863,12 @@ var DEFAULT_MODEL_CAPABILITIES = Object.freeze({
2817
2863
  supportsTools: true,
2818
2864
  supportsVision: true
2819
2865
  },
2866
+ "anthropic/claude-fable-5.2": {
2867
+ contextWindow: 1e6,
2868
+ maxOutputTokens: 128e3,
2869
+ supportsTools: true,
2870
+ supportsVision: true
2871
+ },
2820
2872
  "anthropic/claude-haiku-4.5": {
2821
2873
  // 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.
2822
2874
  contextWindow: 2e5,
@@ -2879,13 +2931,6 @@ var DEFAULT_MODEL_CAPABILITIES = Object.freeze({
2879
2931
  supportsTools: true,
2880
2932
  supportsVision: true
2881
2933
  },
2882
- "cohere/north-mini-code": {
2883
- // supportsTools: not probed — fails closed
2884
- contextWindow: 256e3,
2885
- maxOutputTokens: 16384,
2886
- supportsTools: false,
2887
- supportsVision: false
2888
- },
2889
2934
  "deepseek/deepseek-chat": {
2890
2935
  // 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.
2891
2936
  contextWindow: 1048576,
@@ -2955,12 +3000,6 @@ var DEFAULT_MODEL_CAPABILITIES = Object.freeze({
2955
3000
  supportsTools: true,
2956
3001
  supportsVision: true
2957
3002
  },
2958
- "google/gemini-3.5-flash": {
2959
- contextWindow: 1048576,
2960
- maxOutputTokens: 65536,
2961
- supportsTools: true,
2962
- supportsVision: true
2963
- },
2964
3003
  "google/gemini-3.5-flash-lite": {
2965
3004
  contextWindow: 1048576,
2966
3005
  maxOutputTokens: 65536,
@@ -2980,10 +3019,27 @@ var DEFAULT_MODEL_CAPABILITIES = Object.freeze({
2980
3019
  supportsVision: true
2981
3020
  },
2982
3021
  "google/gemini-4-argon": {
2983
- // supportsTools: not probed — fails closed
2984
3022
  contextWindow: 1048576,
2985
3023
  maxOutputTokens: 65536,
2986
- supportsTools: false,
3024
+ supportsTools: true,
3025
+ supportsVision: true
3026
+ },
3027
+ "google/gemini-4-carbon": {
3028
+ contextWindow: 1048576,
3029
+ maxOutputTokens: 65536,
3030
+ supportsTools: true,
3031
+ supportsVision: true
3032
+ },
3033
+ "google/gemini-4-hydrogen": {
3034
+ contextWindow: 1048576,
3035
+ maxOutputTokens: 65536,
3036
+ supportsTools: true,
3037
+ supportsVision: true
3038
+ },
3039
+ "google/gemini-4-neon": {
3040
+ contextWindow: 1048576,
3041
+ maxOutputTokens: 65536,
3042
+ supportsTools: true,
2987
3043
  supportsVision: true
2988
3044
  },
2989
3045
  "minimax/minimax-m2.7": {
@@ -3005,18 +3061,10 @@ var DEFAULT_MODEL_CAPABILITIES = Object.freeze({
3005
3061
  supportsTools: false,
3006
3062
  supportsVision: true
3007
3063
  },
3008
- "moonshot/kimi-k3": {
3009
- // absent from the 2026-11-08 listing but still routed — previous entry retained; probe before removing
3010
- contextWindow: 1048576,
3011
- maxOutputTokens: 65536,
3012
- supportsTools: true,
3013
- supportsVision: true
3014
- },
3015
3064
  "moonshot/kimi-k3.1-pro": {
3016
- // supportsTools: not probed — fails closed
3017
3065
  contextWindow: 1048576,
3018
3066
  maxOutputTokens: 65536,
3019
- supportsTools: false,
3067
+ supportsTools: true,
3020
3068
  supportsVision: true
3021
3069
  },
3022
3070
  "nvidia/minimax-m3.1-flash": {
@@ -3055,10 +3103,9 @@ var DEFAULT_MODEL_CAPABILITIES = Object.freeze({
3055
3103
  supportsVision: false
3056
3104
  },
3057
3105
  "nvidia/nemotron-3.5-bolt": {
3058
- // supportsTools: not probed — fails closed
3059
3106
  contextWindow: 131072,
3060
3107
  maxOutputTokens: 16384,
3061
- supportsTools: false,
3108
+ supportsTools: true,
3062
3109
  supportsVision: true
3063
3110
  },
3064
3111
  "nvidia/nemotron-3.5-lightning": {
@@ -3177,7 +3224,7 @@ var DEFAULT_MODEL_CAPABILITIES = Object.freeze({
3177
3224
  "openai/gpt-5.6-luna-pro": {
3178
3225
  contextWindow: 105e4,
3179
3226
  maxOutputTokens: 128e3,
3180
- supportsTools: false,
3227
+ supportsTools: true,
3181
3228
  supportsVision: true
3182
3229
  },
3183
3230
  "openai/gpt-5.6-sol": {
@@ -3228,26 +3275,20 @@ var DEFAULT_MODEL_CAPABILITIES = Object.freeze({
3228
3275
  supportsTools: true,
3229
3276
  supportsVision: true
3230
3277
  },
3231
- "openai/o1": {
3232
- contextWindow: 2e5,
3233
- maxOutputTokens: 1e5,
3234
- supportsTools: true,
3235
- supportsVision: false
3236
- },
3237
- "openai/o3": {
3238
- contextWindow: 2e5,
3239
- maxOutputTokens: 1e5,
3278
+ "openai/gpt-6.2-astra": {
3279
+ contextWindow: 105e4,
3280
+ maxOutputTokens: 128e3,
3240
3281
  supportsTools: true,
3241
- supportsVision: false
3282
+ supportsVision: true
3242
3283
  },
3243
- "openai/o3-mini": {
3244
- contextWindow: 128e3,
3245
- maxOutputTokens: 1e5,
3284
+ "openai/gpt-6.2-sol": {
3285
+ contextWindow: 105e4,
3286
+ maxOutputTokens: 128e3,
3246
3287
  supportsTools: true,
3247
- supportsVision: false
3288
+ supportsVision: true
3248
3289
  },
3249
- "openai/o4-mini": {
3250
- contextWindow: 128e3,
3290
+ "openai/o3": {
3291
+ contextWindow: 2e5,
3251
3292
  maxOutputTokens: 1e5,
3252
3293
  supportsTools: true,
3253
3294
  supportsVision: false
@@ -3260,10 +3301,9 @@ var DEFAULT_MODEL_CAPABILITIES = Object.freeze({
3260
3301
  supportsVision: false
3261
3302
  },
3262
3303
  "poolside/laguna-xs-2.1": {
3263
- // supportsTools: not probed — fails closed
3264
3304
  contextWindow: 131072,
3265
3305
  maxOutputTokens: 16384,
3266
- supportsTools: false,
3306
+ supportsTools: true,
3267
3307
  supportsVision: false
3268
3308
  },
3269
3309
  "qwen/qwen3.7-flash": {
@@ -3392,6 +3432,14 @@ var model_profiles_generated_default = {
3392
3432
  errorRate: 0,
3393
3433
  samples: 3
3394
3434
  },
3435
+ "anthropic/claude-fable-5.2": {
3436
+ measuredAt: "2026-11-27T23:25:03Z",
3437
+ latencyMs: 5587.3,
3438
+ p95LatencyMs: 6206.1,
3439
+ outputTokensPerSecond: 92.94,
3440
+ errorRate: 0,
3441
+ samples: 3
3442
+ },
3395
3443
  "anthropic/claude-haiku-4.5": {
3396
3444
  measuredAt: "2026-08-29T16:51:33Z",
3397
3445
  latencyMs: 3157.4,
@@ -3432,6 +3480,14 @@ var model_profiles_generated_default = {
3432
3480
  errorRate: 0,
3433
3481
  samples: 3
3434
3482
  },
3483
+ "anthropic/claude-opus-5.5": {
3484
+ measuredAt: "2026-11-27T23:25:03Z",
3485
+ latencyMs: 6485.2,
3486
+ p95LatencyMs: 6951.2,
3487
+ outputTokensPerSecond: 79.15,
3488
+ errorRate: 0,
3489
+ samples: 3
3490
+ },
3435
3491
  "anthropic/claude-sonnet-4.5": {
3436
3492
  measuredAt: "2026-08-29T16:51:33Z",
3437
3493
  latencyMs: 6330.4,
@@ -3456,6 +3512,14 @@ var model_profiles_generated_default = {
3456
3512
  errorRate: 0,
3457
3513
  samples: 3
3458
3514
  },
3515
+ "anthropic/claude-sonnet-5.5": {
3516
+ measuredAt: "2026-11-27T23:25:03Z",
3517
+ latencyMs: 4770.2,
3518
+ p95LatencyMs: 5352,
3519
+ outputTokensPerSecond: 108.11,
3520
+ errorRate: 0,
3521
+ samples: 3
3522
+ },
3459
3523
  "deepseek/deepseek-chat": {
3460
3524
  measuredAt: "2026-08-29T16:51:33Z",
3461
3525
  latencyMs: 4351.4,
@@ -3472,6 +3536,14 @@ var model_profiles_generated_default = {
3472
3536
  errorRate: 0,
3473
3537
  samples: 3
3474
3538
  },
3539
+ "deepseek/deepseek-v4-flash-vision-exp": {
3540
+ measuredAt: "2026-11-27T23:25:03Z",
3541
+ latencyMs: 4078.4,
3542
+ p95LatencyMs: 4464.5,
3543
+ outputTokensPerSecond: 127,
3544
+ errorRate: 0,
3545
+ samples: 3
3546
+ },
3475
3547
  "deepseek/deepseek-v4-pro": {
3476
3548
  measuredAt: "2026-08-29T16:51:33Z",
3477
3549
  latencyMs: 8781.2,
@@ -3560,6 +3632,38 @@ var model_profiles_generated_default = {
3560
3632
  errorRate: 0,
3561
3633
  samples: 3
3562
3634
  },
3635
+ "google/gemini-4-argon": {
3636
+ measuredAt: "2026-11-27T23:25:03Z",
3637
+ latencyMs: 9565.7,
3638
+ p95LatencyMs: 10491.9,
3639
+ outputTokensPerSecond: 53.87,
3640
+ errorRate: 0,
3641
+ samples: 3
3642
+ },
3643
+ "google/gemini-4-carbon": {
3644
+ measuredAt: "2026-11-27T23:25:03Z",
3645
+ latencyMs: 10692.9,
3646
+ p95LatencyMs: 12609.2,
3647
+ outputTokensPerSecond: 48.61,
3648
+ errorRate: 0,
3649
+ samples: 3
3650
+ },
3651
+ "google/gemini-4-hydrogen": {
3652
+ measuredAt: "2026-11-27T23:25:03Z",
3653
+ latencyMs: 4520.7,
3654
+ p95LatencyMs: 4928.3,
3655
+ outputTokensPerSecond: 113.78,
3656
+ errorRate: 0,
3657
+ samples: 3
3658
+ },
3659
+ "google/gemini-4-neon": {
3660
+ measuredAt: "2026-11-27T23:25:03Z",
3661
+ latencyMs: 6728,
3662
+ p95LatencyMs: 8294.8,
3663
+ outputTokensPerSecond: 78,
3664
+ errorRate: 0,
3665
+ samples: 3
3666
+ },
3563
3667
  "minimax/minimax-m2.7": {
3564
3668
  measuredAt: "2026-08-29T16:51:33Z",
3565
3669
  latencyMs: 8761.1,
@@ -3584,6 +3688,14 @@ var model_profiles_generated_default = {
3584
3688
  errorRate: 0,
3585
3689
  samples: 3
3586
3690
  },
3691
+ "moonshot/kimi-k3.1-pro": {
3692
+ measuredAt: "2026-11-23T20:18:18Z",
3693
+ latencyMs: 9243.1,
3694
+ p95LatencyMs: 10504.1,
3695
+ outputTokensPerSecond: 55.89,
3696
+ errorRate: 0,
3697
+ samples: 3
3698
+ },
3587
3699
  "nvidia/mistral-nemotron": {
3588
3700
  measuredAt: "2026-08-29T16:51:33Z",
3589
3701
  latencyMs: 7349.6,
@@ -3600,6 +3712,14 @@ var model_profiles_generated_default = {
3600
3712
  errorRate: 0.3333,
3601
3713
  samples: 3
3602
3714
  },
3715
+ "nvidia/nemotron-3.5-bolt": {
3716
+ measuredAt: "2026-11-27T23:25:03Z",
3717
+ latencyMs: 5670.2,
3718
+ p95LatencyMs: 5688.6,
3719
+ outputTokensPerSecond: 90.3,
3720
+ errorRate: 0,
3721
+ samples: 3
3722
+ },
3603
3723
  "nvidia/nemotron-nano-12b-v2-vl": {
3604
3724
  measuredAt: "2026-08-29T16:51:33Z",
3605
3725
  latencyMs: 5846.9,
@@ -3737,11 +3857,11 @@ var model_profiles_generated_default = {
3737
3857
  samples: 3
3738
3858
  },
3739
3859
  "openai/gpt-5.6-luna-pro": {
3740
- measuredAt: "2026-08-29T16:59:54Z",
3741
- latencyMs: 13914.9,
3742
- p95LatencyMs: 13914.9,
3743
- outputTokensPerSecond: 36.79,
3744
- errorRate: 0.6667,
3860
+ measuredAt: "2026-11-27T23:25:03Z",
3861
+ latencyMs: 11046.8,
3862
+ p95LatencyMs: 12033.6,
3863
+ outputTokensPerSecond: 148.22,
3864
+ errorRate: 0,
3745
3865
  samples: 3
3746
3866
  },
3747
3867
  "openai/gpt-5.6-sol": {
@@ -3784,6 +3904,22 @@ var model_profiles_generated_default = {
3784
3904
  errorRate: 0,
3785
3905
  samples: 3
3786
3906
  },
3907
+ "openai/gpt-6.2-astra": {
3908
+ measuredAt: "2026-11-27T23:25:03Z",
3909
+ latencyMs: 7973.9,
3910
+ p95LatencyMs: 9532.7,
3911
+ outputTokensPerSecond: 47.21,
3912
+ errorRate: 0,
3913
+ samples: 3
3914
+ },
3915
+ "openai/gpt-6.2-sol": {
3916
+ measuredAt: "2026-11-27T23:25:03Z",
3917
+ latencyMs: 6310.9,
3918
+ p95LatencyMs: 6725.5,
3919
+ outputTokensPerSecond: 58.01,
3920
+ errorRate: 0,
3921
+ samples: 3
3922
+ },
3787
3923
  "openai/o1": {
3788
3924
  measuredAt: "2026-08-29T16:51:33Z",
3789
3925
  latencyMs: 4324.9,
@@ -4231,20 +4367,20 @@ var NEUTRAL_AFFINITY = 0.68;
4231
4367
  var TERMINAL_COMPLEX_HIGH = {
4232
4368
  "claude-sonnet-5": 1,
4233
4369
  "gpt-5.3-codex": 0.87,
4234
- "gpt-5-mini": 0.78,
4235
- "gemini-3.5-flash": 0.76
4370
+ "gpt-5.6-luna": 0.78,
4371
+ "gemini-3.6-flash": 0.76
4236
4372
  };
4237
4373
  var WEB_RESEARCH_DEEP = {
4238
4374
  "claude-sonnet-5": 1,
4239
- "gpt-5-mini": 0.88,
4240
- "gemini-3.5-flash": 0.84,
4375
+ "gpt-5.6-luna": 0.88,
4376
+ "gemini-3.6-flash": 0.84,
4241
4377
  "claude-opus-5": 0.8,
4242
4378
  "claude-opus-4.8": 0.78
4243
4379
  };
4244
4380
  var WEB_RESEARCH = {
4245
4381
  "claude-sonnet-5": 1,
4246
- "gpt-5-mini": 0.88,
4247
- "gemini-3.5-flash": 0.86,
4382
+ "gpt-5.6-luna": 0.88,
4383
+ "gemini-3.6-flash": 0.86,
4248
4384
  "claude-opus-5": 0.84,
4249
4385
  "claude-opus-4.8": 0.82
4250
4386
  };
@@ -4252,11 +4388,11 @@ var RETAIL_POLICY_EXCEPTION = {
4252
4388
  "gpt-4.1": 1,
4253
4389
  "claude-sonnet-5": 0.9,
4254
4390
  "deepseek-v4-pro": 0.82,
4255
- "gpt-5-mini": 0.8,
4391
+ "gpt-5.6-luna": 0.8,
4256
4392
  "gpt-4o-mini": 0.76
4257
4393
  };
4258
4394
  var RETAIL_POLICY_EXCEPTION_SIMPLE = {
4259
- "gpt-5-mini": 1,
4395
+ "gpt-5.6-luna": 1,
4260
4396
  "gpt-4.1": 0.86,
4261
4397
  "deepseek-v4-pro": 0.82,
4262
4398
  "gpt-4o-mini": 0.8
@@ -4273,20 +4409,20 @@ var AFFINITY = {
4273
4409
  codeAgent: {
4274
4410
  "gpt-5.3-codex": 1,
4275
4411
  "claude-sonnet-5": 0.98,
4276
- "gpt-5-mini": 0.96,
4277
- "gemini-3.5-flash": 0.92,
4278
- "kimi-k3": 0.9,
4412
+ "gpt-5.6-luna": 0.96,
4413
+ "gemini-3.6-flash": 0.92,
4414
+ "kimi-k3.1-pro": 0.9,
4279
4415
  "deepseek-v4-pro": 0.88,
4280
- "glm-5.2": 0.88
4416
+ "glm-5.3": 0.88
4281
4417
  },
4282
4418
  // Seven official Terminal-Bench calibration trajectories favoured GPT-5 Mini
4283
4419
  // over the prior dynamic choice. Codex/Sonnet are close fallbacks; actual
4284
4420
  // request cost breaks the tie.
4285
4421
  terminalTool: {
4286
- "gpt-5-mini": 1,
4422
+ "gpt-5.6-luna": 1,
4287
4423
  "gpt-5.3-codex": 0.98,
4288
4424
  "claude-sonnet-5": 0.9,
4289
- "gemini-3.5-flash": 0.89
4425
+ "gemini-3.6-flash": 0.89
4290
4426
  },
4291
4427
  // Two complete agent observations on the public Terminal-Bench
4292
4428
  // new-encrypt-command task ended in Codex repeating the same TerminalExec
@@ -4305,20 +4441,20 @@ var AFFINITY = {
4305
4441
  // arguments. DeepSeek V4 Pro completed all three high-risk retail calibration
4306
4442
  // trajectories (global-choice, cross-record, multi-write); Sonnet one.
4307
4443
  retailStandard: {
4308
- "gpt-5-mini": 1,
4444
+ "gpt-5.6-luna": 1,
4309
4445
  "claude-sonnet-5": 0.88,
4310
- "gemini-3.5-flash": 0.82,
4446
+ "gemini-3.6-flash": 0.82,
4311
4447
  "gpt-5.3-codex": 0.81,
4312
- "kimi-k3": 0.78,
4448
+ "kimi-k3.1-pro": 0.78,
4313
4449
  "deepseek-v4-pro": 0.76
4314
4450
  },
4315
4451
  retailHigh: {
4316
4452
  "deepseek-v4-pro": 1,
4317
4453
  "claude-sonnet-5": 0.88,
4318
- "gemini-3.5-flash": 0.82,
4454
+ "gemini-3.6-flash": 0.82,
4319
4455
  "gpt-5.3-codex": 0.81,
4320
- "kimi-k3": 0.78,
4321
- "gpt-5-mini": 0.76
4456
+ "kimi-k3.1-pro": 0.78,
4457
+ "gpt-5.6-luna": 0.76
4322
4458
  },
4323
4459
  // Standard airline workflows stay on GPT-5 Mini: six full-session
4324
4460
  // development trajectories gave it the same 5/6 success as Sonnet at roughly
@@ -4332,14 +4468,14 @@ var AFFINITY = {
4332
4468
  // roughly two orders of magnitude more on the long-tail case.
4333
4469
  airlineComplex: {
4334
4470
  "claude-sonnet-5": 1,
4335
- "gpt-5-mini": 0.78,
4336
- "gemini-3.5-flash": 0.76,
4471
+ "gpt-5.6-luna": 0.78,
4472
+ "gemini-3.6-flash": 0.76,
4337
4473
  "deepseek-v4-pro": 0.74
4338
4474
  },
4339
4475
  airlineStandard: {
4340
- "gpt-5-mini": 1,
4476
+ "gpt-5.6-luna": 1,
4341
4477
  "claude-sonnet-5": 0.9,
4342
- "gemini-3.5-flash": 0.8,
4478
+ "gemini-3.6-flash": 0.8,
4343
4479
  "deepseek-v4-pro": 0.76
4344
4480
  },
4345
4481
  // Full-trajectory tau2 calibration (2026-07-28, official gpt-4.1 simulator):
@@ -4349,10 +4485,10 @@ var AFFINITY = {
4349
4485
  // airline task.
4350
4486
  toolAgent: {
4351
4487
  "claude-sonnet-5": 1,
4352
- "gemini-3.5-flash": 0.88,
4488
+ "gemini-3.6-flash": 0.88,
4353
4489
  "gpt-5.3-codex": 0.87,
4354
- "kimi-k3": 0.85,
4355
- "gpt-5-mini": 0.84,
4490
+ "kimi-k3.1-pro": 0.85,
4491
+ "gpt-5.6-luna": 0.84,
4356
4492
  "deepseek-v4-pro": 0.82
4357
4493
  },
4358
4494
  // Multi-file Terminal work is not equivalent to a one-turn parallel
@@ -4364,28 +4500,28 @@ var AFFINITY = {
4364
4500
  "gpt-5.3-codex": 0.86
4365
4501
  },
4366
4502
  parallelTerminal: {
4367
- "gpt-5-mini": 1,
4503
+ "gpt-5.6-luna": 1,
4368
4504
  "gpt-5.3-codex": 0.98,
4369
4505
  "claude-sonnet-5": 0.92,
4370
- "gemini-3.5-flash": 0.88
4506
+ "gemini-3.6-flash": 0.88
4371
4507
  },
4372
4508
  parallelRetail: {
4373
4509
  "deepseek-v4-pro": 1,
4374
4510
  "claude-sonnet-5": 0.88,
4375
4511
  "claude-opus-4.8": 0.84,
4376
- "gpt-5-mini": 0.78,
4377
- "gemini-3.5-flash": 0.76
4512
+ "gpt-5.6-luna": 0.78,
4513
+ "gemini-3.6-flash": 0.76
4378
4514
  },
4379
4515
  parallelAirlineComplex: {
4380
4516
  "claude-sonnet-5": 1,
4381
- "gpt-5-mini": 0.78,
4517
+ "gpt-5.6-luna": 0.78,
4382
4518
  "claude-opus-4.8": 0.76,
4383
- "gemini-3.5-flash": 0.74
4519
+ "gemini-3.6-flash": 0.74
4384
4520
  },
4385
4521
  parallelAirline: {
4386
- "gpt-5-mini": 1,
4522
+ "gpt-5.6-luna": 1,
4387
4523
  "claude-sonnet-5": 0.9,
4388
- "gemini-3.5-flash": 0.8
4524
+ "gemini-3.6-flash": 0.8
4389
4525
  },
4390
4526
  // RouterBench calibration, 2026-07-26: Opus 4.8 produced complete multi-call
4391
4527
  // payloads on 2/3 multilingual BFCL parallel cases. Gemini 3.5 Flash, Sonnet
@@ -4395,22 +4531,22 @@ var AFFINITY = {
4395
4531
  "claude-opus-4.8": 1,
4396
4532
  "claude-sonnet-5": 0.84,
4397
4533
  "grok-4.5": 0.82,
4398
- "gemini-3.5-flash": 0.8,
4534
+ "gemini-3.6-flash": 0.8,
4399
4535
  "deepseek-v4-pro": 0.78
4400
4536
  },
4401
4537
  codeEdit: {
4402
4538
  "gpt-5.3-codex": 1,
4403
- "claude-sonnet-4.6": 0.94,
4404
- "glm-5.2": 0.9,
4539
+ "claude-sonnet-5.5": 0.94,
4540
+ "glm-5.3": 0.9,
4405
4541
  "deepseek-v4-pro": 0.86
4406
4542
  },
4407
4543
  reasoning: {
4408
4544
  "claude-sonnet-5": 0.98,
4409
- "claude-sonnet-4.6": 0.98,
4545
+ "claude-sonnet-5.5": 0.98,
4410
4546
  "deepseek-v4-pro": 0.95,
4411
- "grok-4.5": 0.94,
4547
+ "grok-4.7": 0.94,
4412
4548
  "gemini-3.1-pro": 0.92,
4413
- "gemini-3.5-flash": 0.92
4549
+ "gemini-3.6-flash": 0.92
4414
4550
  },
4415
4551
  // RouterBench calibration (2026-07-28, six stratified GPQA Diamond tasks,
4416
4552
  // identical agent adapter and 512-token budget): Gemini 3 Flash Preview
@@ -4420,7 +4556,7 @@ var AFFINITY = {
4420
4556
  // this reasoning-only model choice.
4421
4557
  reasoningMcq: {
4422
4558
  "gemini-3-flash-preview": 1,
4423
- "gemini-3.5-flash": 0.91,
4559
+ "gemini-3.6-flash": 0.91,
4424
4560
  "grok-4.5": 0.9,
4425
4561
  "claude-sonnet-5": 0.88,
4426
4562
  "deepseek-v4-pro": 0.84
@@ -4428,18 +4564,31 @@ var AFFINITY = {
4428
4564
  // Same calibration, five multilingual MGSM tasks: Gemini 3.5 Flash was 5/5
4429
4565
  // with the lowest cost and latency; four current flagships were 4/5 and Kimi
4430
4566
  // K2.7 was 3/5.
4567
+ //
4568
+ // Kimi K3.1 Pro, paired against Kimi K3 (2026-11-23): all 50 rows of the
4569
+ // pinned RouterBench MGSM slice (5 per language x 10 languages), the text
4570
+ // adapter's `Answer: <number>` contract and deterministic grader, 512 output
4571
+ // tokens, temperature 0, same rows and settings for both. K3 44/50, K3.1 Pro
4572
+ // 41/50; discordant pairs 5 K3-only vs 2 K3.1-only (not significant). Every
4573
+ // K3-only win was K3.1 Pro hitting the 512-token cap; the non-truncated
4574
+ // errors were the same two rows for both. Rerunning the 10 truncated rows at
4575
+ // 2048 tokens gave 8/10 each (46/50 each overall), so the gap is verbosity at
4576
+ // the calibration budget, not arithmetic. K3.1 Pro was also slower (p95
4577
+ // 10.4s vs 4.7s). It moves from K3's carried 0.9 to 0.88: below the models
4578
+ // the 4/5 calibration put at 0.9, by less than the raw 41/44 ratio because
4579
+ // the difference is within noise.
4431
4580
  reasoningMath: {
4432
- "gemini-3.5-flash": 1,
4581
+ "gemini-3.6-flash": 1,
4433
4582
  "grok-4.5": 0.93,
4434
4583
  "claude-sonnet-5": 0.9,
4435
4584
  "deepseek-v4-pro": 0.9,
4436
- "kimi-k3": 0.9
4585
+ "kimi-k3.1-pro": 0.88
4437
4586
  },
4438
4587
  vision: {
4439
4588
  "gemini-3.1-pro": 0.96,
4440
4589
  "qwen3.7-max": 0.9,
4441
- "claude-sonnet-4.6": 0.9,
4442
- "kimi-k3": 0.9,
4590
+ "claude-sonnet-5.5": 0.9,
4591
+ "kimi-k3.1-pro": 0.9,
4443
4592
  "grok-4.3": 0.9
4444
4593
  },
4445
4594
  // Long-context eligibility is necessary but not sufficient: a provider can
@@ -4449,38 +4598,49 @@ var AFFINITY = {
4449
4598
  longContext: {
4450
4599
  "gemini-3.1-pro": 1,
4451
4600
  "qwen3.7-max": 0.89,
4452
- "glm-5.2": 0.89,
4453
- "gemini-3.5-flash": 0.88,
4601
+ "glm-5.3": 0.89,
4602
+ "gemini-3.6-flash": 0.88,
4454
4603
  "deepseek-v4-pro": 0.85
4455
4604
  },
4456
4605
  // A structured extraction must preserve both the output contract and the
4457
4606
  // source-language fields. For Mandarin input the language-native Kimi
4458
4607
  // candidate gets a distinct band — a candidate-pool decision, not a post-hoc
4459
- // override, so it still falls back normally when Kimi is unavailable. Kimi
4460
- // K3 costs ~5x its retired sibling K2.7, so the band must be wider than the
4461
- // auto affinityFloorGap (0.10) or price alone re-selects a non-native model
4462
- // for Mandarin input; 0.12 keeps K3 alone in the primary band for zh and
4463
- // leaves every other language untouched.
4608
+ // override, so it still falls back normally when Kimi is unavailable. The
4609
+ // Kimi flagship costs several times the cheap extraction models, so the band
4610
+ // must be wider than the auto affinityFloorGap (0.10) or price alone
4611
+ // re-selects a non-native model for Mandarin input; 0.12 keeps Kimi alone in
4612
+ // the primary band for zh and leaves every other language untouched.
4613
+ //
4614
+ // Only one "kimi-k3.1-pro" value in AFFINITY is measured on K3.1 Pro:
4615
+ // reasoningMath (paired K3 vs K3.1 Pro on 50 MGSM rows, 2026-11-23; see that
4616
+ // band). Every other value (codeAgent, retailStandard, retailHigh,
4617
+ // toolAgent, vision, extractionZh, extraction, chat) is still carried over
4618
+ // from the Kimi flagship it replaced (K3, whose values were in turn carried
4619
+ // from K2.7). Those bands' calibrations could not be rerun locally: the
4620
+ // Terminal-Bench and tau2 trajectories need the RouterBench Franklin host
4621
+ // (and Docker for Terminal-Bench), and no extraction or vision slice has a
4622
+ // runner. K3.1 Pro's other evidence is the 2026-11-23 live probe: 3/3
4623
+ // completions, 0 errors, a well-formed tool call.
4464
4624
  extractionZh: {
4465
- "kimi-k3": 1,
4466
- "gemini-3.5-flash": 0.88,
4467
- "gemini-2.5-flash": 0.88,
4625
+ "kimi-k3.1-pro": 1,
4626
+ "gemini-3.6-flash": 0.88,
4627
+ "gemini-3.5-flash-lite": 0.88,
4468
4628
  "gpt-4o-mini": 0.88,
4469
4629
  "claude-sonnet-5": 0.88,
4470
- "claude-sonnet-4.6": 0.88
4630
+ "claude-sonnet-5.5": 0.88
4471
4631
  },
4472
4632
  extraction: {
4473
- "kimi-k3": 0.9,
4474
- "gemini-3.5-flash": 0.9,
4475
- "gemini-2.5-flash": 0.9,
4633
+ "kimi-k3.1-pro": 0.9,
4634
+ "gemini-3.6-flash": 0.9,
4635
+ "gemini-3.5-flash-lite": 0.9,
4476
4636
  "gpt-4o-mini": 0.9,
4477
4637
  "claude-sonnet-5": 0.9,
4478
- "claude-sonnet-4.6": 0.9
4638
+ "claude-sonnet-5.5": 0.9
4479
4639
  },
4480
4640
  chat: {
4481
- "gemini-3.5-flash": 0.86,
4482
- "gemini-2.5-flash": 0.86,
4483
- "kimi-k3": 0.86
4641
+ "gemini-3.6-flash": 0.86,
4642
+ "gemini-3.5-flash-lite": 0.86,
4643
+ "kimi-k3.1-pro": 0.86
4484
4644
  }
4485
4645
  };
4486
4646
  function affinityBand(features) {
@@ -4545,9 +4705,9 @@ function evidenceCandidates(task) {
4545
4705
  return [
4546
4706
  "openai/gpt-5.3-codex",
4547
4707
  "anthropic/claude-sonnet-5",
4548
- "openai/gpt-5-mini",
4549
- "google/gemini-3.5-flash",
4550
- "moonshot/kimi-k3",
4708
+ "openai/gpt-5.6-luna",
4709
+ "google/gemini-3.6-flash",
4710
+ "moonshot/kimi-k3.1-pro",
4551
4711
  "deepseek/deepseek-v4-pro"
4552
4712
  ];
4553
4713
  }
@@ -4555,12 +4715,12 @@ function evidenceCandidates(task) {
4555
4715
  return [
4556
4716
  "anthropic/claude-sonnet-5",
4557
4717
  "anthropic/claude-opus-5",
4558
- "openai/gpt-5-mini",
4718
+ "openai/gpt-5.6-luna",
4559
4719
  "openai/gpt-4.1",
4560
4720
  "openai/gpt-4o-mini",
4561
- "google/gemini-3.5-flash",
4721
+ "google/gemini-3.6-flash",
4562
4722
  "openai/gpt-5.3-codex",
4563
- "moonshot/kimi-k3",
4723
+ "moonshot/kimi-k3.1-pro",
4564
4724
  "deepseek/deepseek-v4-pro"
4565
4725
  ];
4566
4726
  }
@@ -4569,11 +4729,11 @@ function evidenceCandidates(task) {
4569
4729
  "anthropic/claude-opus-5",
4570
4730
  "anthropic/claude-opus-4.8",
4571
4731
  "anthropic/claude-sonnet-5",
4572
- "openai/gpt-5-mini",
4732
+ "openai/gpt-5.6-luna",
4573
4733
  "openai/gpt-4.1",
4574
4734
  "openai/gpt-4o-mini",
4575
4735
  "xai/grok-4.5",
4576
- "google/gemini-3.5-flash",
4736
+ "google/gemini-3.6-flash",
4577
4737
  "deepseek/deepseek-v4-pro"
4578
4738
  ];
4579
4739
  }
@@ -4582,29 +4742,29 @@ function evidenceCandidates(task) {
4582
4742
  "google/gemini-3.1-pro",
4583
4743
  "deepseek/deepseek-v4-pro",
4584
4744
  "qwen/qwen3.7-max",
4585
- "zai/glm-5.2",
4586
- "google/gemini-3.5-flash"
4745
+ "zai/glm-5.3",
4746
+ "google/gemini-3.6-flash"
4587
4747
  ];
4588
4748
  }
4589
4749
  if (task === "reasoning_mcq") {
4590
4750
  return [
4591
4751
  "google/gemini-3-flash-preview",
4592
- "google/gemini-3.5-flash",
4752
+ "google/gemini-3.6-flash",
4593
4753
  "xai/grok-4.5",
4594
4754
  "anthropic/claude-sonnet-5",
4595
4755
  "deepseek/deepseek-v4-pro"
4596
4756
  ];
4597
4757
  }
4598
4758
  if (task === "extraction") {
4599
- return ["moonshot/kimi-k3", "google/gemini-3.5-flash", "anthropic/claude-sonnet-5"];
4759
+ return ["moonshot/kimi-k3.1-pro", "google/gemini-3.6-flash", "anthropic/claude-sonnet-5"];
4600
4760
  }
4601
4761
  if (task === "reasoning_math") {
4602
4762
  return [
4603
- "google/gemini-3.5-flash",
4763
+ "google/gemini-3.6-flash",
4604
4764
  "xai/grok-4.5",
4605
4765
  "anthropic/claude-sonnet-5",
4606
4766
  "deepseek/deepseek-v4-pro",
4607
- "moonshot/kimi-k3"
4767
+ "moonshot/kimi-k3.1-pro"
4608
4768
  ];
4609
4769
  }
4610
4770
  return [];
@@ -4615,11 +4775,15 @@ var VERIFIED_TOOL_FALLBACKS = [
4615
4775
  "anthropic/claude-sonnet-5.5",
4616
4776
  "deepseek/deepseek-v4.1-flash",
4617
4777
  "google/gemini-3.8-flash",
4778
+ "google/gemini-4-argon",
4779
+ "google/gemini-4-carbon",
4780
+ "google/gemini-4-hydrogen",
4781
+ "google/gemini-4-neon",
4618
4782
  "openai/gpt-5.1",
4619
- "openai/gpt-6-astra",
4783
+ "openai/gpt-5.6-luna-pro",
4620
4784
  "openai/gpt-6-luna",
4621
- "openai/gpt-6-sol",
4622
- "openai/gpt-6.1-sol",
4785
+ "openai/gpt-6.2-astra",
4786
+ "openai/gpt-6.2-sol",
4623
4787
  "xai/grok-4.6",
4624
4788
  "xai/grok-4.7",
4625
4789
  "xiaomi/mimo-v2.5"
@@ -4752,8 +4916,8 @@ var PortfolioStrategy = class {
4752
4916
  const scoredModels = rankedEntries.map((item) => item.model);
4753
4917
  const webResearchFallbackOrder = [
4754
4918
  "anthropic/claude-sonnet-5",
4755
- "openai/gpt-5-mini",
4756
- "google/gemini-3.5-flash",
4919
+ "openai/gpt-5.6-luna",
4920
+ "google/gemini-3.6-flash",
4757
4921
  "anthropic/claude-opus-5",
4758
4922
  "anthropic/claude-opus-4.8",
4759
4923
  "openai/gpt-5.3-codex"
@@ -4816,6 +4980,22 @@ var AUTO_ROUTING_PROFILES = {
4816
4980
  };
4817
4981
  var BASE_MINIMUM_PAYMENT_USD = 2e-3;
4818
4982
  var SOLANA_MINIMUM_PAYMENT_USD = 1e-3;
4983
+ function platformFeePercentOf(row) {
4984
+ if (!row) return 0;
4985
+ const mode = row.billingMode ?? row.billing_mode;
4986
+ if (mode !== void 0 && mode !== "paid") return 0;
4987
+ if (row.pricing?.flat !== void 0 && row.pricing.flat !== null) return 0;
4988
+ for (const value of [row.pricing?.platform_fee_percent, row.platform_fee_percent, row.platformFeePercent]) {
4989
+ if (typeof value === "number" && Number.isFinite(value) && value >= 0) return value;
4990
+ }
4991
+ return 0;
4992
+ }
4993
+ function estimateChatCostUsd(pricing, inputTokens, outputTokens) {
4994
+ if (pricing.flatPrice !== void 0) return pricing.flatPrice;
4995
+ const fee = pricing.platformFeePercent;
4996
+ const factor = typeof fee === "number" && Number.isFinite(fee) && fee >= 0 ? 1 + fee / 100 : 1;
4997
+ return (inputTokens / 1e6 * pricing.inputPrice + outputTokens / 1e6 * pricing.outputPrice) * factor;
4998
+ }
4819
4999
  function isTransientError(err) {
4820
5000
  if (retryDisposition(err) !== "unpaid") return false;
4821
5001
  if (err instanceof PaymentError) return false;
@@ -4944,7 +5124,9 @@ function routeWithCatalog(prompt, systemPrompt, maxOutputTokens, modelPricing, o
4944
5124
  const minimumPaymentUsd = options.minimumPaymentUsd ?? SOLANA_MINIMUM_PAYMENT_USD;
4945
5125
  const entry = modelPricing.get(model);
4946
5126
  const isFree = entry !== void 0 && entry.inputPrice === 0 && entry.outputPrice === 0 && !entry.flatPrice;
4947
- const costEstimate = isFree ? 0 : Math.max(costs.costEstimate, minimumPaymentUsd);
5127
+ const usable = entry !== void 0 && [entry.inputPrice, entry.outputPrice, entry.flatPrice ?? 0].every((v) => Number.isFinite(v) && v >= 0);
5128
+ const modelCost = usable ? estimateChatCostUsd(entry, estimatedInputTokens, maxOutputTokens) : costs.costEstimate;
5129
+ const costEstimate = isFree ? 0 : Math.max(modelCost, minimumPaymentUsd);
4948
5130
  const savings = options.routingProfile === "premium" || costs.baselineCost <= 0 ? 0 : entry !== void 0 ? Math.max(0, (costs.baselineCost - costEstimate) / costs.baselineCost) : decision.savings;
4949
5131
  return {
4950
5132
  ...decision,
@@ -5365,7 +5547,7 @@ function getCostSummary() {
5365
5547
  }
5366
5548
 
5367
5549
  // src/version.ts
5368
- var SDK_VERSION = "4.3.1";
5550
+ var SDK_VERSION = "4.5.0";
5369
5551
  var USER_AGENT = `blockrun-ts/${SDK_VERSION}`;
5370
5552
 
5371
5553
  // src/client.ts
@@ -5383,6 +5565,7 @@ function mapRawToModel(m) {
5383
5565
  available: true,
5384
5566
  billingMode: m.billingMode ?? m.billing_mode,
5385
5567
  flatPrice: m.flatPrice ?? m.flat_price ?? m.pricing?.flat,
5568
+ platformFeePercent: platformFeePercentOf(m),
5386
5569
  hidden: m.hidden
5387
5570
  };
5388
5571
  }
@@ -5643,7 +5826,12 @@ var LLMClient = class _LLMClient {
5643
5826
  if (model.billingMode === "flat" && Number.isFinite(model.flatPrice) && model.flatPrice > 0) {
5644
5827
  pricing.set(model.id, { inputPrice, outputPrice, flatPrice: model.flatPrice });
5645
5828
  } else {
5646
- pricing.set(model.id, { inputPrice, outputPrice });
5829
+ const platformFeePercent = platformFeePercentOf(model);
5830
+ pricing.set(model.id, {
5831
+ inputPrice,
5832
+ outputPrice,
5833
+ ...platformFeePercent > 0 ? { platformFeePercent } : {}
5834
+ });
5647
5835
  }
5648
5836
  }
5649
5837
  registerSearchModels(pricing, models);
@@ -6883,6 +7071,18 @@ var LLMClient = class _LLMClient {
6883
7071
  async defi(path7, params) {
6884
7072
  return this.getWithPaymentRaw(`/v1/defillama/${path7}`, params);
6885
7073
  }
7074
+ /**
7075
+ * On-chain US stock price from tokenized-stock DEX pools, paid per call.
7076
+ * This client's chain decides the market: Base (blockrun.ai, Coinbase
7077
+ * Tokenized Stocks) or Solana (sol.blockrun.ai, xStocks). Returns the full
7078
+ * response: price, every pool, the dividend multiplier, the US session and
7079
+ * SEC company facts. A ticker with no market on this chain throws a 404
7080
+ * APIError before anything is signed.
7081
+ */
7082
+ async stockPrice(symbol) {
7083
+ if (!symbol) throw new Error("symbol is required");
7084
+ return await this.getWithPaymentRaw(`/v1/stocks/us/price/${encodeURIComponent(symbol)}`);
7085
+ }
6886
7086
  /** All DeFi protocols with TVL. */
6887
7087
  async defiProtocols() {
6888
7088
  return this.defi("protocols");
@@ -8996,6 +9196,9 @@ var PriceClient = class {
8996
9196
  if (options?.session) query.session = options.session;
8997
9197
  const data = await this.getWithPayment(path7, query);
8998
9198
  return {
9199
+ // Everything the gateway sent, then the typed fields: the on-chain stock
9200
+ // price carries chain, pools, multiplier, usMarket and asset this way.
9201
+ ...data,
8999
9202
  symbol: data.symbol ?? symbol.toUpperCase(),
9000
9203
  price: data.price,
9001
9204
  publishTime: data.publishTime,
@@ -13642,10 +13845,13 @@ var SolanaLLMClient = class {
13642
13845
  const inputPrice = num(model.inputPrice ?? raw.input_price ?? raw.pricing?.input);
13643
13846
  const outputPrice = num(model.outputPrice ?? raw.output_price ?? raw.pricing?.output);
13644
13847
  const flatPrice = num(model.flatPrice ?? raw.flat_price ?? raw.pricing?.flat);
13848
+ const isFlat = (model.billingMode ?? raw.billing_mode) === "flat" && flatPrice > 0;
13849
+ const platformFeePercent = isFlat ? 0 : platformFeePercentOf(raw);
13645
13850
  pricing.set(model.id, {
13646
13851
  inputPrice,
13647
13852
  outputPrice,
13648
- ...(model.billingMode ?? raw.billing_mode) === "flat" && flatPrice > 0 ? { flatPrice } : {}
13853
+ ...isFlat ? { flatPrice } : {},
13854
+ ...platformFeePercent > 0 ? { platformFeePercent } : {}
13649
13855
  });
13650
13856
  }
13651
13857
  registerSearchModels(pricing, models);
@@ -14134,6 +14340,18 @@ var SolanaLLMClient = class {
14134
14340
  async defi(path7, params) {
14135
14341
  return this.getWithPaymentRaw(`/v1/defillama/${path7}`, params);
14136
14342
  }
14343
+ /**
14344
+ * On-chain US stock price from tokenized-stock DEX pools, paid per call.
14345
+ * This client's chain decides the market: Base (blockrun.ai, Coinbase
14346
+ * Tokenized Stocks) or Solana (sol.blockrun.ai, xStocks). Returns the full
14347
+ * response: price, every pool, the dividend multiplier, the US session and
14348
+ * SEC company facts. A ticker with no market on this chain throws a 404
14349
+ * APIError before anything is signed.
14350
+ */
14351
+ async stockPrice(symbol) {
14352
+ if (!symbol) throw new Error("symbol is required");
14353
+ return await this.getWithPaymentRaw(`/v1/stocks/us/price/${encodeURIComponent(symbol)}`);
14354
+ }
14137
14355
  /** All DeFi protocols with TVL. */
14138
14356
  async defiProtocols() {
14139
14357
  return this.defi("protocols");
@@ -15456,6 +15674,7 @@ var AnthropicClient = class {
15456
15674
  createSolanaPaymentPayload,
15457
15675
  createSolanaWallet,
15458
15676
  createWallet,
15677
+ estimateChatCostUsd,
15459
15678
  evmNetwork,
15460
15679
  extractPaymentDetails,
15461
15680
  formatFundingMessageCompact,
@@ -15482,6 +15701,7 @@ var AnthropicClient = class {
15482
15701
  logCost,
15483
15702
  parsePaymentRequired,
15484
15703
  paymentRejectedErrorFromBody,
15704
+ platformFeePercentOf,
15485
15705
  readSettlement,
15486
15706
  retryDisposition,
15487
15707
  saveSolanaWallet,