@blockrun/clawrouter 0.12.68 → 0.12.69

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.d.ts CHANGED
@@ -497,6 +497,11 @@ declare class SolanaBalanceMonitor {
497
497
  */
498
498
  formatUSDC(amountMicros: bigint): string;
499
499
  getWalletAddress(): string;
500
+ /**
501
+ * Check native SOL balance (in lamports). Useful for detecting users who
502
+ * funded with SOL instead of USDC.
503
+ */
504
+ checkSolBalance(): Promise<bigint>;
500
505
  private fetchBalance;
501
506
  private fetchBalanceOnce;
502
507
  private buildInfo;
@@ -870,6 +875,10 @@ type BlockRunModel = {
870
875
  * Default: false (must opt-in to prevent silent regressions on new models).
871
876
  */
872
877
  toolCalling?: boolean;
878
+ /** Model is deprecated — will be routed to fallbackModel if set */
879
+ deprecated?: boolean;
880
+ /** Model ID to route to when this model is deprecated */
881
+ fallbackModel?: string;
873
882
  };
874
883
  declare const BLOCKRUN_MODELS: BlockRunModel[];
875
884
  /**
package/dist/index.js CHANGED
@@ -31728,6 +31728,23 @@ var init_solana_balance = __esm({
31728
31728
  getWalletAddress() {
31729
31729
  return this.walletAddress;
31730
31730
  }
31731
+ /**
31732
+ * Check native SOL balance (in lamports). Useful for detecting users who
31733
+ * funded with SOL instead of USDC.
31734
+ */
31735
+ async checkSolBalance() {
31736
+ const controller = new AbortController();
31737
+ const timer = setTimeout(() => controller.abort(), BALANCE_TIMEOUT_MS);
31738
+ try {
31739
+ const owner = address(this.walletAddress);
31740
+ const response = await this.rpc.getBalance(owner).send({ abortSignal: controller.signal });
31741
+ return BigInt(response.value);
31742
+ } catch {
31743
+ return 0n;
31744
+ } finally {
31745
+ clearTimeout(timer);
31746
+ }
31747
+ }
31731
31748
  async fetchBalance() {
31732
31749
  const owner = address(this.walletAddress);
31733
31750
  const mint = address(SOLANA_USDC_MINT);
@@ -32856,6 +32873,9 @@ var MODEL_ALIASES = {
32856
32873
  gpt5: "openai/gpt-5.4",
32857
32874
  "gpt-5.4": "openai/gpt-5.4",
32858
32875
  "gpt-5.4-pro": "openai/gpt-5.4-pro",
32876
+ "gpt-5.4-nano": "openai/gpt-5.4-nano",
32877
+ nano: "openai/gpt-5.4-nano",
32878
+ "gpt-5-nano": "openai/gpt-5.4-nano",
32859
32879
  codex: "openai/gpt-5.3-codex",
32860
32880
  mini: "openai/gpt-4o-mini",
32861
32881
  o1: "openai/o1",
@@ -32873,6 +32893,7 @@ var MODEL_ALIASES = {
32873
32893
  flash: "google/gemini-2.5-flash",
32874
32894
  "gemini-3.1-pro-preview": "google/gemini-3.1-pro",
32875
32895
  "google/gemini-3.1-pro-preview": "google/gemini-3.1-pro",
32896
+ "gemini-3.1-flash-lite": "google/gemini-3.1-flash-lite",
32876
32897
  // xAI
32877
32898
  grok: "xai/grok-3",
32878
32899
  "grok-fast": "xai/grok-4-fast-reasoning",
@@ -32988,7 +33009,9 @@ var BLOCKRUN_MODELS = [
32988
33009
  outputPrice: 0.4,
32989
33010
  contextWindow: 128e3,
32990
33011
  maxOutput: 32768,
32991
- toolCalling: true
33012
+ toolCalling: true,
33013
+ deprecated: true,
33014
+ fallbackModel: "openai/gpt-5.4-nano"
32992
33015
  },
32993
33016
  {
32994
33017
  id: "openai/gpt-5.2-pro",
@@ -33026,6 +33049,16 @@ var BLOCKRUN_MODELS = [
33026
33049
  reasoning: true,
33027
33050
  toolCalling: true
33028
33051
  },
33052
+ {
33053
+ id: "openai/gpt-5.4-nano",
33054
+ name: "GPT-5.4 Nano",
33055
+ version: "5.4",
33056
+ inputPrice: 0.2,
33057
+ outputPrice: 1.25,
33058
+ contextWindow: 105e4,
33059
+ maxOutput: 32768,
33060
+ toolCalling: true
33061
+ },
33029
33062
  // OpenAI GPT-5.3 Family
33030
33063
  {
33031
33064
  id: "openai/gpt-5.3",
@@ -33270,6 +33303,16 @@ var BLOCKRUN_MODELS = [
33270
33303
  maxOutput: 65536,
33271
33304
  toolCalling: true
33272
33305
  },
33306
+ {
33307
+ id: "google/gemini-3.1-flash-lite",
33308
+ name: "Gemini 3.1 Flash Lite",
33309
+ version: "3.1",
33310
+ inputPrice: 0.25,
33311
+ outputPrice: 1.5,
33312
+ contextWindow: 1e6,
33313
+ maxOutput: 8192,
33314
+ toolCalling: true
33315
+ },
33273
33316
  // DeepSeek
33274
33317
  {
33275
33318
  id: "deepseek/deepseek-chat",
@@ -44678,8 +44721,12 @@ var DEFAULT_ROUTING_CONFIG = {
44678
44721
  // 1,431ms, IQ 32, 41% retention
44679
44722
  "moonshot/kimi-k2.5",
44680
44723
  // 1,646ms, IQ 47, strong quality
44724
+ "google/gemini-3.1-flash-lite",
44725
+ // $0.25/$1.50, 1M context — newest flash-lite
44681
44726
  "google/gemini-2.5-flash-lite",
44682
- // 1,353ms, 1M context, ultra cheap ($0.10/$0.40)
44727
+ // 1,353ms, $0.10/$0.40
44728
+ "openai/gpt-5.4-nano",
44729
+ // $0.20/$1.25, 1M context
44683
44730
  "xai/grok-4-fast-non-reasoning",
44684
44731
  // 1,143ms, $0.20/$0.50 — fast fallback
44685
44732
  "nvidia/gpt-oss-120b"
@@ -44696,8 +44743,10 @@ var DEFAULT_ROUTING_CONFIG = {
44696
44743
  // 1,431ms, IQ 32, 41% retention
44697
44744
  "google/gemini-2.5-flash",
44698
44745
  // 1,238ms, 60% retention
44746
+ "google/gemini-3.1-flash-lite",
44747
+ // $0.25/$1.50, 1M context
44699
44748
  "google/gemini-2.5-flash-lite",
44700
- // 1,353ms, 1M context ($0.10/$0.40)
44749
+ // 1,353ms, $0.10/$0.40
44701
44750
  "xai/grok-4-1-fast-non-reasoning",
44702
44751
  // 1,244ms, fast fallback
44703
44752
  "xai/grok-3-mini"
@@ -44747,28 +44796,33 @@ var DEFAULT_ROUTING_CONFIG = {
44747
44796
  primary: "nvidia/gpt-oss-120b",
44748
44797
  // 1,252ms, FREE! $0.00/$0.00
44749
44798
  fallback: [
44799
+ "google/gemini-3.1-flash-lite",
44800
+ // $0.25/$1.50 — newest flash-lite
44801
+ "openai/gpt-5.4-nano",
44802
+ // $0.20/$1.25 — fast nano
44750
44803
  "google/gemini-2.5-flash-lite",
44751
44804
  // 1,353ms, $0.10/$0.40
44752
- "xai/grok-4-fast-non-reasoning",
44805
+ "xai/grok-4-fast-non-reasoning"
44753
44806
  // 1,143ms, $0.20/$0.50
44754
- "google/gemini-2.5-flash"
44755
- // 1,238ms
44756
44807
  ]
44757
44808
  },
44758
44809
  MEDIUM: {
44759
- primary: "google/gemini-2.5-flash-lite",
44760
- // 1,353ms, $0.10/$0.40 - cheapest capable with 1M context
44810
+ primary: "google/gemini-3.1-flash-lite",
44811
+ // $0.25/$1.50 1M context, newest flash-lite
44761
44812
  fallback: [
44813
+ "openai/gpt-5.4-nano",
44814
+ // $0.20/$1.25, 1M context
44815
+ "google/gemini-2.5-flash-lite",
44816
+ // 1,353ms, $0.10/$0.40
44762
44817
  "xai/grok-4-fast-non-reasoning",
44763
44818
  "google/gemini-2.5-flash",
44764
- "deepseek/deepseek-chat",
44765
44819
  "nvidia/gpt-oss-120b"
44766
44820
  ]
44767
44821
  },
44768
44822
  COMPLEX: {
44769
- primary: "google/gemini-2.5-flash-lite",
44770
- // 1,353ms, $0.10/$0.40 - 1M context handles complexity
44771
- fallback: ["xai/grok-4-0709", "google/gemini-2.5-flash", "deepseek/deepseek-chat"]
44823
+ primary: "google/gemini-3.1-flash-lite",
44824
+ // $0.25/$1.50 1M context handles complexity
44825
+ fallback: ["google/gemini-2.5-flash-lite", "xai/grok-4-0709", "google/gemini-2.5-flash", "deepseek/deepseek-chat"]
44772
44826
  },
44773
44827
  REASONING: {
44774
44828
  primary: "xai/grok-4-1-fast-reasoning",
@@ -50964,7 +51018,7 @@ async function startProxyInBackground(api) {
50964
51018
  const currentChain = await resolvePaymentChain();
50965
51019
  const displayAddress = currentChain === "solana" && proxy.solanaAddress ? proxy.solanaAddress : wallet.address;
50966
51020
  const network = currentChain === "solana" ? "Solana" : "Base";
50967
- proxy.balanceMonitor.checkBalance().then((balance) => {
51021
+ proxy.balanceMonitor.checkBalance().then(async (balance) => {
50968
51022
  if (balance.isEmpty) {
50969
51023
  api.logger.info(`Wallet (${network}): ${displayAddress}`);
50970
51024
  api.logger.info(
@@ -50977,6 +51031,20 @@ async function startProxyInBackground(api) {
50977
51031
  } else {
50978
51032
  api.logger.info(`Wallet (${network}): ${displayAddress} | Balance: ${balance.balanceUSD}`);
50979
51033
  }
51034
+ if (currentChain === "solana" && (balance.isEmpty || balance.isLow)) {
51035
+ try {
51036
+ const { SolanaBalanceMonitor: SolanaBalanceMonitor2 } = await Promise.resolve().then(() => (init_solana_balance(), solana_balance_exports));
51037
+ const monitor = proxy.balanceMonitor;
51038
+ const solLamports = await monitor.checkSolBalance();
51039
+ if (solLamports > 10000000n) {
51040
+ const sol = Number(solLamports) / 1e9;
51041
+ api.logger.info(
51042
+ `You have ${sol.toFixed(2)} SOL \u2014 swap to USDC: https://jup.ag/swap/SOL-USDC`
51043
+ );
51044
+ }
51045
+ } catch {
51046
+ }
51047
+ }
50980
51048
  }).catch(() => {
50981
51049
  api.logger.info(`Wallet (${network}): ${displayAddress} | Balance: (checking...)`);
50982
51050
  });