@blockrun/llm 3.26.4 → 3.26.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
@@ -44,7 +44,7 @@ console.log(r.response); // the proof
44
44
  ## Why This SDK
45
45
 
46
46
  - 🧠 **Smart routing that pays for itself.** The bundled [Router Core V3](https://github.com/BlockRunAI/router-core) engine (shared with [ClawRouter](https://github.com/BlockRunAI/ClawRouter)) classifies every request locally in <1ms across <!-- br:clawrouter.dimensions -->15<!-- /br:clawrouter.dimensions --> dimensions and routes to the cheapest capable model.
47
- - 🆓 **<!-- br:models.free -->8<!-- /br:models.free --> genuinely free models.** $0 in and out, including two 1M-context Nemotrons, two that accept images, and free coding models from Cohere and Poolside.
47
+ - 🆓 **<!-- br:models.free -->9<!-- /br:models.free --> genuinely free models.** $0 in and out, including two 1M-context Nemotrons, two that accept images, and free coding models from Cohere and Poolside.
48
48
  - 🔐 **Two ways to connect.** A **BlockRun API key** billed against account credit ([sign up](https://user.blockrun.ai), [create a key](https://user.blockrun.ai/dashboard/keys), [add credit](https://user.blockrun.ai/dashboard/credits)), or a wallet signature with x402 micropayments and no account at all. Same code either way.
49
49
  - 💸 **Pay per request in USDC.** x402 micropayments on Solana, Base or Arc. Agents can fund and pay their own way.
50
50
  - 🛡️ **Automatic failover.** Transient errors (timeouts, 429, 5xx) before payment walk the router's ranked fallback chain instead of failing your request; a failure after a payment was sent never buys a second model.
@@ -57,7 +57,7 @@ console.log(r.response); // the proof
57
57
  | ------------------ | -------------- | ----------------- | ---------------- | ----------------------------------------------------------------------- |
58
58
  | **Cost routing** | ✗ one vendor | Manual selection | Manual selection | **Automatic — <!-- br:savings.autoVsBaselinePct -->84<!-- /br:savings.autoVsBaselinePct -->% cheaper** |
59
59
  | **Models** | GPT only | 200+ | 100+ (BYO keys) | **<!-- br:models.chatVisible -->91<!-- /br:models.chatVisible -->, one credential** |
60
- | **Free tier** | ✗ | Rate-limited | ✗ | **<!-- br:models.free -->8<!-- /br:models.free --> models, no signup** |
60
+ | **Free tier** | ✗ | Rate-limited | ✗ | **<!-- br:models.free -->9<!-- /br:models.free --> models, no signup** |
61
61
  | **Auth** | API key | Account + API key | Your API keys | **API key *or* wallet signature** |
62
62
  | **Payment** | Card + invoice | Credit card | BYO keys | **Account credit or USDC per-request** |
63
63
  | **Agent-ready** | ✗ | ✗ | ✗ | **✓ — one key, or agents fund their own wallet** |
@@ -351,7 +351,7 @@ const reply = await client.chat('nvidia/nemotron-3.5-lightning', 'hello', {
351
351
 
352
352
  | Profile | Strategy | Savings vs Opus 5 | Best For |
353
353
  |---------|----------|-------------------|----------|
354
- | `eco` | Cheapest capable model — ranks the <!-- br:models.free -->8<!-- /br:models.free -->-model free tier first | **<!-- br:savings.ecoVsBaselinePct -->98<!-- /br:savings.ecoVsBaselinePct -->%** | Cost-sensitive production, zero-cost testing |
354
+ | `eco` | Cheapest capable model — ranks the <!-- br:models.free -->9<!-- /br:models.free -->-model free tier first | **<!-- br:savings.ecoVsBaselinePct -->98<!-- /br:savings.ecoVsBaselinePct -->%** | Cost-sensitive production, zero-cost testing |
355
355
  | `auto` | Best balance of cost and quality (default) | **<!-- br:savings.autoVsBaselinePct -->84<!-- /br:savings.autoVsBaselinePct -->%** | General use |
356
356
  | `premium` | Highest-quality model per tier | 0% | Quality-critical tasks |
357
357
 
package/dist/index.cjs CHANGED
@@ -4828,6 +4828,17 @@ async function loadSplToken(what) {
4828
4828
  }
4829
4829
  }
4830
4830
 
4831
+ // src/bs58.ts
4832
+ var import_bs58 = __toESM(require("bs58"), 1);
4833
+ function unwrapBs58(mod) {
4834
+ const m = mod;
4835
+ if (typeof m?.encode === "function") return m;
4836
+ const inner = m?.default;
4837
+ if (typeof inner?.encode === "function") return inner;
4838
+ throw new Error("bs58: no encode() on the module or its default export");
4839
+ }
4840
+ var bs58 = unwrapBs58(import_bs58.default);
4841
+
4831
4842
  // src/x402.ts
4832
4843
  var BASE_CHAIN_ID = 8453;
4833
4844
  var USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
@@ -4910,6 +4921,15 @@ async function getBlockhashEntry(connection, rpcUrl, forceRefresh) {
4910
4921
  trimOldest(blockhashCache, MAX_TRACKED_ENDPOINTS);
4911
4922
  return entry;
4912
4923
  }
4924
+ function quotedBlockhash(extra) {
4925
+ const value = extra?.recentBlockhash;
4926
+ if (typeof value !== "string" || value.length === 0) return null;
4927
+ try {
4928
+ return bs58.decode(value).length === 32 ? value : null;
4929
+ } catch {
4930
+ return null;
4931
+ }
4932
+ }
4913
4933
  var TRANSFER_TYPES = {
4914
4934
  TransferWithAuthorization: [
4915
4935
  { name: "from", type: "address" },
@@ -5046,7 +5066,8 @@ async function createSolanaPaymentPayload(secretKey, fromAddress, recipient, amo
5046
5066
  }
5047
5067
  return null;
5048
5068
  };
5049
- let entry = await getBlockhashEntry(connection, rpcUrl, options.forceFreshBlockhash ?? false);
5069
+ const quoted = quotedBlockhash(options.extra);
5070
+ let entry = quoted ? { blockhash: quoted, fetchedAt: Date.now() } : await getBlockhashEntry(connection, rpcUrl, options.forceFreshBlockhash ?? false);
5050
5071
  let serializedTx = findDistinctTx(entry);
5051
5072
  if (serializedTx === null) {
5052
5073
  entry = await getBlockhashEntry(connection, rpcUrl, true);
@@ -5181,7 +5202,7 @@ function getCostSummary() {
5181
5202
  }
5182
5203
 
5183
5204
  // src/version.ts
5184
- var SDK_VERSION = "3.26.4";
5205
+ var SDK_VERSION = "3.26.5";
5185
5206
  var USER_AGENT = `blockrun-ts/${SDK_VERSION}`;
5186
5207
 
5187
5208
  // src/client.ts
@@ -10307,19 +10328,6 @@ async function getOrCreateSolanaWallet() {
10307
10328
 
10308
10329
  // src/poll-ownership.ts
10309
10330
  var import_crypto = require("crypto");
10310
-
10311
- // src/bs58.ts
10312
- var import_bs58 = __toESM(require("bs58"), 1);
10313
- function unwrapBs58(mod) {
10314
- const m = mod;
10315
- if (typeof m?.encode === "function") return m;
10316
- const inner = m?.default;
10317
- if (typeof inner?.encode === "function") return inner;
10318
- throw new Error("bs58: no encode() on the module or its default export");
10319
- }
10320
- var bs58 = unwrapBs58(import_bs58.default);
10321
-
10322
- // src/poll-ownership.ts
10323
10331
  var POLL_AUTH_HEADERS = {
10324
10332
  wallet: "x-poll-wallet",
10325
10333
  timestamp: "x-poll-timestamp",
package/dist/index.d.cts CHANGED
@@ -2655,6 +2655,11 @@ interface CreateSolanaPaymentOptions {
2655
2655
  resourceUrl?: string;
2656
2656
  resourceDescription?: string;
2657
2657
  maxTimeoutSeconds?: number;
2658
+ /**
2659
+ * The 402 accept's `extra`, echoed back as `accepted.extra`. When it carries
2660
+ * a valid `recentBlockhash`, the transaction is signed on that blockhash
2661
+ * instead of one fetched from `rpcUrl`.
2662
+ */
2658
2663
  extra?: Record<string, unknown>;
2659
2664
  extensions?: Record<string, unknown>;
2660
2665
  rpcUrl?: string;
package/dist/index.d.ts CHANGED
@@ -2655,6 +2655,11 @@ interface CreateSolanaPaymentOptions {
2655
2655
  resourceUrl?: string;
2656
2656
  resourceDescription?: string;
2657
2657
  maxTimeoutSeconds?: number;
2658
+ /**
2659
+ * The 402 accept's `extra`, echoed back as `accepted.extra`. When it carries
2660
+ * a valid `recentBlockhash`, the transaction is signed on that blockhash
2661
+ * instead of one fetched from `rpcUrl`.
2662
+ */
2658
2663
  extra?: Record<string, unknown>;
2659
2664
  extensions?: Record<string, unknown>;
2660
2665
  rpcUrl?: string;
package/dist/index.js CHANGED
@@ -4695,6 +4695,17 @@ async function loadSplToken(what) {
4695
4695
  }
4696
4696
  }
4697
4697
 
4698
+ // src/bs58.ts
4699
+ import bs58Import from "bs58";
4700
+ function unwrapBs58(mod) {
4701
+ const m = mod;
4702
+ if (typeof m?.encode === "function") return m;
4703
+ const inner = m?.default;
4704
+ if (typeof inner?.encode === "function") return inner;
4705
+ throw new Error("bs58: no encode() on the module or its default export");
4706
+ }
4707
+ var bs58 = unwrapBs58(bs58Import);
4708
+
4698
4709
  // src/x402.ts
4699
4710
  var BASE_CHAIN_ID = 8453;
4700
4711
  var USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
@@ -4777,6 +4788,15 @@ async function getBlockhashEntry(connection, rpcUrl, forceRefresh) {
4777
4788
  trimOldest(blockhashCache, MAX_TRACKED_ENDPOINTS);
4778
4789
  return entry;
4779
4790
  }
4791
+ function quotedBlockhash(extra) {
4792
+ const value = extra?.recentBlockhash;
4793
+ if (typeof value !== "string" || value.length === 0) return null;
4794
+ try {
4795
+ return bs58.decode(value).length === 32 ? value : null;
4796
+ } catch {
4797
+ return null;
4798
+ }
4799
+ }
4780
4800
  var TRANSFER_TYPES = {
4781
4801
  TransferWithAuthorization: [
4782
4802
  { name: "from", type: "address" },
@@ -4913,7 +4933,8 @@ async function createSolanaPaymentPayload(secretKey, fromAddress, recipient, amo
4913
4933
  }
4914
4934
  return null;
4915
4935
  };
4916
- let entry = await getBlockhashEntry(connection, rpcUrl, options.forceFreshBlockhash ?? false);
4936
+ const quoted = quotedBlockhash(options.extra);
4937
+ let entry = quoted ? { blockhash: quoted, fetchedAt: Date.now() } : await getBlockhashEntry(connection, rpcUrl, options.forceFreshBlockhash ?? false);
4917
4938
  let serializedTx = findDistinctTx(entry);
4918
4939
  if (serializedTx === null) {
4919
4940
  entry = await getBlockhashEntry(connection, rpcUrl, true);
@@ -5048,7 +5069,7 @@ function getCostSummary() {
5048
5069
  }
5049
5070
 
5050
5071
  // src/version.ts
5051
- var SDK_VERSION = "3.26.4";
5072
+ var SDK_VERSION = "3.26.5";
5052
5073
  var USER_AGENT = `blockrun-ts/${SDK_VERSION}`;
5053
5074
 
5054
5075
  // src/client.ts
@@ -10174,19 +10195,6 @@ async function getOrCreateSolanaWallet() {
10174
10195
 
10175
10196
  // src/poll-ownership.ts
10176
10197
  import { createPrivateKey, createPublicKey, sign as ed25519Sign } from "crypto";
10177
-
10178
- // src/bs58.ts
10179
- import bs58Import from "bs58";
10180
- function unwrapBs58(mod) {
10181
- const m = mod;
10182
- if (typeof m?.encode === "function") return m;
10183
- const inner = m?.default;
10184
- if (typeof inner?.encode === "function") return inner;
10185
- throw new Error("bs58: no encode() on the module or its default export");
10186
- }
10187
- var bs58 = unwrapBs58(bs58Import);
10188
-
10189
- // src/poll-ownership.ts
10190
10198
  var POLL_AUTH_HEADERS = {
10191
10199
  wallet: "x-poll-wallet",
10192
10200
  timestamp: "x-poll-timestamp",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/llm",
3
- "version": "3.26.4",
3
+ "version": "3.26.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",