@blockrun/llm 3.6.1 → 3.7.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
@@ -161,6 +161,16 @@ function createNonce() {
161
161
  crypto.getRandomValues(bytes);
162
162
  return `0x${Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("")}`;
163
163
  }
164
+ var BLOCKRUN_SERVICE_CODE = "blockrun";
165
+ function withBuilderCodeServiceCode(extensions) {
166
+ const merged = { ...extensions || {} };
167
+ const existing = merged["builder-code"] || {};
168
+ merged["builder-code"] = {
169
+ ...existing,
170
+ info: { ...existing.info || {}, s: [BLOCKRUN_SERVICE_CODE] }
171
+ };
172
+ return merged;
173
+ }
164
174
  async function createPaymentPayload(privateKey, fromAddress, recipient, amount, network = "eip155:8453", options = {}) {
165
175
  const now = Math.floor(Date.now() / 1e3);
166
176
  const validAfter = now - 600;
@@ -208,7 +218,7 @@ async function createPaymentPayload(privateKey, fromAddress, recipient, amount,
208
218
  nonce
209
219
  }
210
220
  },
211
- extensions: options.extensions || {}
221
+ extensions: withBuilderCodeServiceCode(options.extensions)
212
222
  };
213
223
  return btoa(JSON.stringify(paymentData));
214
224
  }
@@ -268,7 +278,7 @@ async function createSolanaPaymentPayload(secretKey, fromAddress, recipient, amo
268
278
  payload: {
269
279
  transaction: serializedTx
270
280
  },
271
- extensions: options.extensions || {}
281
+ extensions: withBuilderCodeServiceCode(options.extensions)
272
282
  };
273
283
  return btoa(JSON.stringify(paymentData));
274
284
  }
@@ -5752,6 +5762,9 @@ var ChatCompletions = class {
5752
5762
  this.apiUrl = apiUrl;
5753
5763
  this.timeout = timeout;
5754
5764
  }
5765
+ client;
5766
+ apiUrl;
5767
+ timeout;
5755
5768
  async create(params) {
5756
5769
  if (params.stream) {
5757
5770
  return this.createStream(params);
package/dist/index.js CHANGED
@@ -54,6 +54,16 @@ function createNonce() {
54
54
  crypto.getRandomValues(bytes);
55
55
  return `0x${Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("")}`;
56
56
  }
57
+ var BLOCKRUN_SERVICE_CODE = "blockrun";
58
+ function withBuilderCodeServiceCode(extensions) {
59
+ const merged = { ...extensions || {} };
60
+ const existing = merged["builder-code"] || {};
61
+ merged["builder-code"] = {
62
+ ...existing,
63
+ info: { ...existing.info || {}, s: [BLOCKRUN_SERVICE_CODE] }
64
+ };
65
+ return merged;
66
+ }
57
67
  async function createPaymentPayload(privateKey, fromAddress, recipient, amount, network = "eip155:8453", options = {}) {
58
68
  const now = Math.floor(Date.now() / 1e3);
59
69
  const validAfter = now - 600;
@@ -101,7 +111,7 @@ async function createPaymentPayload(privateKey, fromAddress, recipient, amount,
101
111
  nonce
102
112
  }
103
113
  },
104
- extensions: options.extensions || {}
114
+ extensions: withBuilderCodeServiceCode(options.extensions)
105
115
  };
106
116
  return btoa(JSON.stringify(paymentData));
107
117
  }
@@ -161,7 +171,7 @@ async function createSolanaPaymentPayload(secretKey, fromAddress, recipient, amo
161
171
  payload: {
162
172
  transaction: serializedTx
163
173
  },
164
- extensions: options.extensions || {}
174
+ extensions: withBuilderCodeServiceCode(options.extensions)
165
175
  };
166
176
  return btoa(JSON.stringify(paymentData));
167
177
  }
@@ -5645,6 +5655,9 @@ var ChatCompletions = class {
5645
5655
  this.apiUrl = apiUrl;
5646
5656
  this.timeout = timeout;
5647
5657
  }
5658
+ client;
5659
+ apiUrl;
5660
+ timeout;
5648
5661
  async create(params) {
5649
5662
  if (params.stream) {
5650
5663
  return this.createStream(params);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/llm",
3
- "version": "3.6.1",
3
+ "version": "3.7.0",
4
4
  "type": "module",
5
5
  "description": "BlockRun SDK - Pay-per-request AI (LLM, Image, Video, Music, Voice) via x402 on Base and Solana",
6
6
  "main": "dist/index.cjs",