@blockrun/llm 3.24.3 → 3.24.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -987,6 +987,7 @@ token price.
987
987
 
988
988
  | Model | Context |
989
989
  |---|---|
990
+ | `google/gemini-4-argon` | 1M |
990
991
  | `google/gemini-3.1-pro` | 1M |
991
992
  | `google/gemini-3.8-flash` | 1M |
992
993
  | `google/gemini-3.6-flash` | 1M |
package/dist/index.cjs CHANGED
@@ -571,7 +571,7 @@ function withCost(body, response, bookedUsd, scheme) {
571
571
  // src/client.ts
572
572
  var import_accounts2 = require("viem/accounts");
573
573
 
574
- // node_modules/.pnpm/@blockrun+router-core@https+++codeload.github.com+BlockRunAI+router-core+tar.gz+2cd5a1026f755_easf3bov3hzdfoup33nwewqudy/node_modules/@blockrun/router-core/dist/index.js
574
+ // node_modules/.pnpm/@blockrun+router-core@https+++codeload.github.com+BlockRunAI+router-core+tar.gz+8773a9954b091_rjdkm4uoakz3dfyojiwn3sv45i/node_modules/@blockrun/router-core/dist/index.js
575
575
  var UNSEGMENTED_SCRIPT = /[؀-ۿ -ヿ㐀-䶿一-鿿가-힯豈-﫿＀-￯]/;
576
576
  var WORD_CHAR = /[\p{L}\p{N}]/u;
577
577
  var ASCII_PHRASE = /^[a-z0-9' -]+$/;
@@ -1213,10 +1213,9 @@ var DEFAULT_MODEL_CAPABILITIES = Object.freeze({
1213
1213
  supportsVision: false
1214
1214
  },
1215
1215
  "deepseek/deepseek-v4.1-flash": {
1216
- // supportsTools: not probed — fails closed
1217
1216
  contextWindow: 1048576,
1218
1217
  maxOutputTokens: 65536,
1219
- supportsTools: false,
1218
+ supportsTools: true,
1220
1219
  supportsVision: false
1221
1220
  },
1222
1221
  "google/gemini-2.5-flash": {
@@ -1279,6 +1278,13 @@ var DEFAULT_MODEL_CAPABILITIES = Object.freeze({
1279
1278
  supportsTools: true,
1280
1279
  supportsVision: true
1281
1280
  },
1281
+ "google/gemini-4-argon": {
1282
+ // supportsTools: not probed — fails closed
1283
+ contextWindow: 1048576,
1284
+ maxOutputTokens: 65536,
1285
+ supportsTools: false,
1286
+ supportsVision: true
1287
+ },
1282
1288
  "minimax/minimax-m2.7": {
1283
1289
  contextWindow: 204800,
1284
1290
  maxOutputTokens: 16384,
@@ -1500,10 +1506,9 @@ var DEFAULT_MODEL_CAPABILITIES = Object.freeze({
1500
1506
  supportsVision: true
1501
1507
  },
1502
1508
  "openai/gpt-6.1-sol": {
1503
- // supportsTools: not probed — fails closed
1504
1509
  contextWindow: 105e4,
1505
1510
  maxOutputTokens: 128e3,
1506
- supportsTools: false,
1511
+ supportsTools: true,
1507
1512
  supportsVision: true
1508
1513
  },
1509
1514
  "openai/o1": {
@@ -1758,6 +1763,14 @@ var model_profiles_generated_default = {
1758
1763
  errorRate: 0,
1759
1764
  samples: 3
1760
1765
  },
1766
+ "deepseek/deepseek-v4.1-flash": {
1767
+ measuredAt: "2026-10-20T18:12:51Z",
1768
+ latencyMs: 2383.5,
1769
+ p95LatencyMs: 2547.8,
1770
+ outputTokensPerSecond: 216.53,
1771
+ errorRate: 0,
1772
+ samples: 3
1773
+ },
1761
1774
  "google/gemini-2.5-flash": {
1762
1775
  measuredAt: "2026-08-29T16:51:33Z",
1763
1776
  latencyMs: 5416.4,
@@ -2046,6 +2059,14 @@ var model_profiles_generated_default = {
2046
2059
  errorRate: 0,
2047
2060
  samples: 3
2048
2061
  },
2062
+ "openai/gpt-6.1-sol": {
2063
+ measuredAt: "2026-10-20T18:12:51Z",
2064
+ latencyMs: 11324,
2065
+ p95LatencyMs: 12747.6,
2066
+ outputTokensPerSecond: 45.11,
2067
+ errorRate: 0,
2068
+ samples: 3
2069
+ },
2049
2070
  "openai/o1": {
2050
2071
  measuredAt: "2026-08-29T16:51:33Z",
2051
2072
  latencyMs: 4324.9,
@@ -2861,11 +2882,13 @@ var VERIFIED_TOOL_FALLBACKS = [
2861
2882
  "anthropic/claude-fable-5.1",
2862
2883
  "anthropic/claude-opus-5.5",
2863
2884
  "anthropic/claude-sonnet-5.5",
2885
+ "deepseek/deepseek-v4.1-flash",
2864
2886
  "google/gemini-3.8-flash",
2865
2887
  "openai/gpt-5.1",
2866
2888
  "openai/gpt-6-astra",
2867
2889
  "openai/gpt-6-luna",
2868
2890
  "openai/gpt-6-sol",
2891
+ "openai/gpt-6.1-sol",
2869
2892
  "xai/grok-4.6",
2870
2893
  "xai/grok-4.7",
2871
2894
  "xiaomi/mimo-v2.5"
@@ -5066,7 +5089,7 @@ function getCostSummary() {
5066
5089
  }
5067
5090
 
5068
5091
  // src/version.ts
5069
- var SDK_VERSION = "3.24.3";
5092
+ var SDK_VERSION = "3.24.5";
5070
5093
  var USER_AGENT = `blockrun-ts/${SDK_VERSION}`;
5071
5094
 
5072
5095
  // src/client.ts
@@ -5134,8 +5157,15 @@ var LLMClient = class _LLMClient {
5134
5157
  modelPricingCache = null;
5135
5158
  modelPricingPromise = null;
5136
5159
  // Pre-auth cache: avoids the 402 round-trip on repeat requests to the same model.
5137
- // Key = "endpoint:model", value = cached payment header + timestamp.
5160
+ // Key = "endpoint:model", value = cached payment header + timestamp + the
5161
+ // length of the request body it was quoted for.
5138
5162
  // TTL: 1 hour — pre-auth quotes are stable server-side on that horizon.
5163
+ //
5164
+ // A quote prices ONE request (input size + max_tokens), and exact settles
5165
+ // the whole signed amount, so reusing it for a smaller request overpaid and
5166
+ // for a larger one underpaid. The gateway refuses both with a 402 (an
5167
+ // over-signed payment since blockrun#874), so a reuse is only attempted for
5168
+ // a body the same size as the one that was quoted.
5139
5169
  preAuthCache = /* @__PURE__ */ new Map();
5140
5170
  static PRE_AUTH_TTL_MS = 36e5;
5141
5171
  /**
@@ -5742,9 +5772,10 @@ var LLMClient = class _LLMClient {
5742
5772
  if (options?.responseFormat !== void 0) body.response_format = options.responseFormat;
5743
5773
  if (options?.stop !== void 0) body.stop = options.stop;
5744
5774
  const cacheKey2 = `/v1/chat/completions:${requestModel}`;
5775
+ const requestBody = JSON.stringify(body);
5745
5776
  const cached = this.preAuthCache.get(cacheKey2);
5746
5777
  const now = Date.now();
5747
- if (cached && now - cached.cachedAt < _LLMClient.PRE_AUTH_TTL_MS) {
5778
+ if (cached && now - cached.cachedAt < _LLMClient.PRE_AUTH_TTL_MS && cached.bodyLength === requestBody.length) {
5748
5779
  let signed;
5749
5780
  try {
5750
5781
  signed = await this.signPayment(cached.paymentHeader);
@@ -5813,7 +5844,7 @@ var LLMClient = class _LLMClient {
5813
5844
  }
5814
5845
  }
5815
5846
  if (!paymentHeader) throw new PaymentError("402 response but no payment requirements found");
5816
- this.preAuthCache.set(cacheKey2, { paymentHeader, cachedAt: now });
5847
+ this.preAuthCache.set(cacheKey2, { paymentHeader, cachedAt: now, bodyLength: requestBody.length });
5817
5848
  const { paymentPayload, costUsd } = await this.signPayment(paymentHeader);
5818
5849
  const streamResp = await this.fetchWithTimeout(url, {
5819
5850
  method: "POST",
package/dist/index.js CHANGED
@@ -440,7 +440,7 @@ function withCost(body, response, bookedUsd, scheme) {
440
440
  // src/client.ts
441
441
  import { privateKeyToAccount } from "viem/accounts";
442
442
 
443
- // node_modules/.pnpm/@blockrun+router-core@https+++codeload.github.com+BlockRunAI+router-core+tar.gz+2cd5a1026f755_easf3bov3hzdfoup33nwewqudy/node_modules/@blockrun/router-core/dist/index.js
443
+ // node_modules/.pnpm/@blockrun+router-core@https+++codeload.github.com+BlockRunAI+router-core+tar.gz+8773a9954b091_rjdkm4uoakz3dfyojiwn3sv45i/node_modules/@blockrun/router-core/dist/index.js
444
444
  var UNSEGMENTED_SCRIPT = /[؀-ۿ -ヿ㐀-䶿一-鿿가-힯豈-﫿＀-￯]/;
445
445
  var WORD_CHAR = /[\p{L}\p{N}]/u;
446
446
  var ASCII_PHRASE = /^[a-z0-9' -]+$/;
@@ -1082,10 +1082,9 @@ var DEFAULT_MODEL_CAPABILITIES = Object.freeze({
1082
1082
  supportsVision: false
1083
1083
  },
1084
1084
  "deepseek/deepseek-v4.1-flash": {
1085
- // supportsTools: not probed — fails closed
1086
1085
  contextWindow: 1048576,
1087
1086
  maxOutputTokens: 65536,
1088
- supportsTools: false,
1087
+ supportsTools: true,
1089
1088
  supportsVision: false
1090
1089
  },
1091
1090
  "google/gemini-2.5-flash": {
@@ -1148,6 +1147,13 @@ var DEFAULT_MODEL_CAPABILITIES = Object.freeze({
1148
1147
  supportsTools: true,
1149
1148
  supportsVision: true
1150
1149
  },
1150
+ "google/gemini-4-argon": {
1151
+ // supportsTools: not probed — fails closed
1152
+ contextWindow: 1048576,
1153
+ maxOutputTokens: 65536,
1154
+ supportsTools: false,
1155
+ supportsVision: true
1156
+ },
1151
1157
  "minimax/minimax-m2.7": {
1152
1158
  contextWindow: 204800,
1153
1159
  maxOutputTokens: 16384,
@@ -1369,10 +1375,9 @@ var DEFAULT_MODEL_CAPABILITIES = Object.freeze({
1369
1375
  supportsVision: true
1370
1376
  },
1371
1377
  "openai/gpt-6.1-sol": {
1372
- // supportsTools: not probed — fails closed
1373
1378
  contextWindow: 105e4,
1374
1379
  maxOutputTokens: 128e3,
1375
- supportsTools: false,
1380
+ supportsTools: true,
1376
1381
  supportsVision: true
1377
1382
  },
1378
1383
  "openai/o1": {
@@ -1627,6 +1632,14 @@ var model_profiles_generated_default = {
1627
1632
  errorRate: 0,
1628
1633
  samples: 3
1629
1634
  },
1635
+ "deepseek/deepseek-v4.1-flash": {
1636
+ measuredAt: "2026-10-20T18:12:51Z",
1637
+ latencyMs: 2383.5,
1638
+ p95LatencyMs: 2547.8,
1639
+ outputTokensPerSecond: 216.53,
1640
+ errorRate: 0,
1641
+ samples: 3
1642
+ },
1630
1643
  "google/gemini-2.5-flash": {
1631
1644
  measuredAt: "2026-08-29T16:51:33Z",
1632
1645
  latencyMs: 5416.4,
@@ -1915,6 +1928,14 @@ var model_profiles_generated_default = {
1915
1928
  errorRate: 0,
1916
1929
  samples: 3
1917
1930
  },
1931
+ "openai/gpt-6.1-sol": {
1932
+ measuredAt: "2026-10-20T18:12:51Z",
1933
+ latencyMs: 11324,
1934
+ p95LatencyMs: 12747.6,
1935
+ outputTokensPerSecond: 45.11,
1936
+ errorRate: 0,
1937
+ samples: 3
1938
+ },
1918
1939
  "openai/o1": {
1919
1940
  measuredAt: "2026-08-29T16:51:33Z",
1920
1941
  latencyMs: 4324.9,
@@ -2730,11 +2751,13 @@ var VERIFIED_TOOL_FALLBACKS = [
2730
2751
  "anthropic/claude-fable-5.1",
2731
2752
  "anthropic/claude-opus-5.5",
2732
2753
  "anthropic/claude-sonnet-5.5",
2754
+ "deepseek/deepseek-v4.1-flash",
2733
2755
  "google/gemini-3.8-flash",
2734
2756
  "openai/gpt-5.1",
2735
2757
  "openai/gpt-6-astra",
2736
2758
  "openai/gpt-6-luna",
2737
2759
  "openai/gpt-6-sol",
2760
+ "openai/gpt-6.1-sol",
2738
2761
  "xai/grok-4.6",
2739
2762
  "xai/grok-4.7",
2740
2763
  "xiaomi/mimo-v2.5"
@@ -4935,7 +4958,7 @@ function getCostSummary() {
4935
4958
  }
4936
4959
 
4937
4960
  // src/version.ts
4938
- var SDK_VERSION = "3.24.3";
4961
+ var SDK_VERSION = "3.24.5";
4939
4962
  var USER_AGENT = `blockrun-ts/${SDK_VERSION}`;
4940
4963
 
4941
4964
  // src/client.ts
@@ -5003,8 +5026,15 @@ var LLMClient = class _LLMClient {
5003
5026
  modelPricingCache = null;
5004
5027
  modelPricingPromise = null;
5005
5028
  // Pre-auth cache: avoids the 402 round-trip on repeat requests to the same model.
5006
- // Key = "endpoint:model", value = cached payment header + timestamp.
5029
+ // Key = "endpoint:model", value = cached payment header + timestamp + the
5030
+ // length of the request body it was quoted for.
5007
5031
  // TTL: 1 hour — pre-auth quotes are stable server-side on that horizon.
5032
+ //
5033
+ // A quote prices ONE request (input size + max_tokens), and exact settles
5034
+ // the whole signed amount, so reusing it for a smaller request overpaid and
5035
+ // for a larger one underpaid. The gateway refuses both with a 402 (an
5036
+ // over-signed payment since blockrun#874), so a reuse is only attempted for
5037
+ // a body the same size as the one that was quoted.
5008
5038
  preAuthCache = /* @__PURE__ */ new Map();
5009
5039
  static PRE_AUTH_TTL_MS = 36e5;
5010
5040
  /**
@@ -5611,9 +5641,10 @@ var LLMClient = class _LLMClient {
5611
5641
  if (options?.responseFormat !== void 0) body.response_format = options.responseFormat;
5612
5642
  if (options?.stop !== void 0) body.stop = options.stop;
5613
5643
  const cacheKey2 = `/v1/chat/completions:${requestModel}`;
5644
+ const requestBody = JSON.stringify(body);
5614
5645
  const cached = this.preAuthCache.get(cacheKey2);
5615
5646
  const now = Date.now();
5616
- if (cached && now - cached.cachedAt < _LLMClient.PRE_AUTH_TTL_MS) {
5647
+ if (cached && now - cached.cachedAt < _LLMClient.PRE_AUTH_TTL_MS && cached.bodyLength === requestBody.length) {
5617
5648
  let signed;
5618
5649
  try {
5619
5650
  signed = await this.signPayment(cached.paymentHeader);
@@ -5682,7 +5713,7 @@ var LLMClient = class _LLMClient {
5682
5713
  }
5683
5714
  }
5684
5715
  if (!paymentHeader) throw new PaymentError("402 response but no payment requirements found");
5685
- this.preAuthCache.set(cacheKey2, { paymentHeader, cachedAt: now });
5716
+ this.preAuthCache.set(cacheKey2, { paymentHeader, cachedAt: now, bodyLength: requestBody.length });
5686
5717
  const { paymentPayload, costUsd } = await this.signPayment(paymentHeader);
5687
5718
  const streamResp = await this.fetchWithTimeout(url, {
5688
5719
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/llm",
3
- "version": "3.24.3",
3
+ "version": "3.24.5",
4
4
  "type": "module",
5
5
  "description": "TypeScript SDK for BlockRun - every frontier model behind one OpenAI-compatible client. Pay with a BlockRun API key or per-call in USDC. Smart routing picks the cheapest capable model. No rate limits.",
6
6
  "main": "dist/index.cjs",
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "devDependencies": {
60
60
  "@blockrun/core": "^0.1.0",
61
- "@blockrun/router-core": "https://codeload.github.com/BlockRunAI/router-core/tar.gz/2cd5a1026f755cd39a3f0d6e61cab23a5ad391a9",
61
+ "@blockrun/router-core": "https://codeload.github.com/BlockRunAI/router-core/tar.gz/8773a9954b091bd0090acdfec67c75a006c0e156",
62
62
  "@eslint/js": "^10.0.1",
63
63
  "@solana/kit": "^5.5.1",
64
64
  "@types/node": "^26.4.1",