@blockrun/llm 3.17.0 → 3.17.1
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 +16 -10
- package/dist/index.d.cts +13 -7
- package/dist/index.d.ts +13 -7
- package/dist/index.js +16 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4660,7 +4660,7 @@ function getCostSummary() {
|
|
|
4660
4660
|
}
|
|
4661
4661
|
|
|
4662
4662
|
// src/version.ts
|
|
4663
|
-
var SDK_VERSION = "3.
|
|
4663
|
+
var SDK_VERSION = "3.17.1";
|
|
4664
4664
|
var USER_AGENT = `blockrun-ts/${SDK_VERSION}`;
|
|
4665
4665
|
|
|
4666
4666
|
// src/client.ts
|
|
@@ -10220,13 +10220,19 @@ var SolanaLLMClient = class {
|
|
|
10220
10220
|
/**
|
|
10221
10221
|
* Follow a 202 `{ id, poll_url }` to completion, on Solana.
|
|
10222
10222
|
*
|
|
10223
|
-
*
|
|
10224
|
-
*
|
|
10225
|
-
*
|
|
10226
|
-
*
|
|
10227
|
-
*
|
|
10228
|
-
*
|
|
10229
|
-
*
|
|
10223
|
+
* Two things differ from Base and both come from the same constraint — a
|
|
10224
|
+
* Solana payment is a transaction pinned to a recent blockhash, valid for
|
|
10225
|
+
* ~150 blocks (~60s), and a long render outlives it:
|
|
10226
|
+
*
|
|
10227
|
+
* 1. **The POST already settled.** Base settles on the completed poll; Solana
|
|
10228
|
+
* cannot, because by then the signed transaction has expired. So sol
|
|
10229
|
+
* settles optimistically at submit, and this loop only fetches the result.
|
|
10230
|
+
* The cost is recorded by the caller at POST, never here — recording it on
|
|
10231
|
+
* completion would lose the charge whenever a paid job then fails.
|
|
10232
|
+
* 2. **Every poll re-signs.** One authorization cannot be replayed across a
|
|
10233
|
+
* long render. The gateway binds the job to the payer address rather than
|
|
10234
|
+
* to the signature, so a fresh signature from the same wallet is accepted
|
|
10235
|
+
* and is never charged again.
|
|
10230
10236
|
*/
|
|
10231
10237
|
async followSolanaJob(submitBody, budgetMs, intervalMs = 2e3) {
|
|
10232
10238
|
const id = submitBody.id;
|
|
@@ -10254,7 +10260,7 @@ var SolanaLLMClient = class {
|
|
|
10254
10260
|
}
|
|
10255
10261
|
throw new APIError(`Poll failed: ${challenge.status}`, challenge.status, sanitizeErrorResponse(errorBody));
|
|
10256
10262
|
}
|
|
10257
|
-
const { paymentPayload
|
|
10263
|
+
const { paymentPayload } = await this.signPaymentFrom402(
|
|
10258
10264
|
pollUrl,
|
|
10259
10265
|
challenge,
|
|
10260
10266
|
true,
|
|
@@ -10279,7 +10285,6 @@ var SolanaLLMClient = class {
|
|
|
10279
10285
|
);
|
|
10280
10286
|
}
|
|
10281
10287
|
if (paid.status === 200 && lastStatus === "completed") {
|
|
10282
|
-
this.recordSettlement(costUsd);
|
|
10283
10288
|
return data;
|
|
10284
10289
|
}
|
|
10285
10290
|
if (paid.status !== 200 && paid.status !== 202 && paid.status !== 504) {
|
|
@@ -10403,6 +10408,7 @@ var SolanaLLMClient = class {
|
|
|
10403
10408
|
});
|
|
10404
10409
|
await this.assertPaid(retryResponse);
|
|
10405
10410
|
if (retryResponse.status === 202) {
|
|
10411
|
+
this.recordSettlement(costUsd);
|
|
10406
10412
|
const submitted = await retryResponse.json();
|
|
10407
10413
|
return this.followSolanaJob(submitted, this.timeout);
|
|
10408
10414
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -2921,13 +2921,19 @@ declare class SolanaLLMClient {
|
|
|
2921
2921
|
/**
|
|
2922
2922
|
* Follow a 202 `{ id, poll_url }` to completion, on Solana.
|
|
2923
2923
|
*
|
|
2924
|
-
*
|
|
2925
|
-
*
|
|
2926
|
-
*
|
|
2927
|
-
*
|
|
2928
|
-
*
|
|
2929
|
-
*
|
|
2930
|
-
*
|
|
2924
|
+
* Two things differ from Base and both come from the same constraint — a
|
|
2925
|
+
* Solana payment is a transaction pinned to a recent blockhash, valid for
|
|
2926
|
+
* ~150 blocks (~60s), and a long render outlives it:
|
|
2927
|
+
*
|
|
2928
|
+
* 1. **The POST already settled.** Base settles on the completed poll; Solana
|
|
2929
|
+
* cannot, because by then the signed transaction has expired. So sol
|
|
2930
|
+
* settles optimistically at submit, and this loop only fetches the result.
|
|
2931
|
+
* The cost is recorded by the caller at POST, never here — recording it on
|
|
2932
|
+
* completion would lose the charge whenever a paid job then fails.
|
|
2933
|
+
* 2. **Every poll re-signs.** One authorization cannot be replayed across a
|
|
2934
|
+
* long render. The gateway binds the job to the payer address rather than
|
|
2935
|
+
* to the signature, so a fresh signature from the same wallet is accepted
|
|
2936
|
+
* and is never charged again.
|
|
2931
2937
|
*/
|
|
2932
2938
|
private followSolanaJob;
|
|
2933
2939
|
private signPaymentFrom402;
|
package/dist/index.d.ts
CHANGED
|
@@ -2921,13 +2921,19 @@ declare class SolanaLLMClient {
|
|
|
2921
2921
|
/**
|
|
2922
2922
|
* Follow a 202 `{ id, poll_url }` to completion, on Solana.
|
|
2923
2923
|
*
|
|
2924
|
-
*
|
|
2925
|
-
*
|
|
2926
|
-
*
|
|
2927
|
-
*
|
|
2928
|
-
*
|
|
2929
|
-
*
|
|
2930
|
-
*
|
|
2924
|
+
* Two things differ from Base and both come from the same constraint — a
|
|
2925
|
+
* Solana payment is a transaction pinned to a recent blockhash, valid for
|
|
2926
|
+
* ~150 blocks (~60s), and a long render outlives it:
|
|
2927
|
+
*
|
|
2928
|
+
* 1. **The POST already settled.** Base settles on the completed poll; Solana
|
|
2929
|
+
* cannot, because by then the signed transaction has expired. So sol
|
|
2930
|
+
* settles optimistically at submit, and this loop only fetches the result.
|
|
2931
|
+
* The cost is recorded by the caller at POST, never here — recording it on
|
|
2932
|
+
* completion would lose the charge whenever a paid job then fails.
|
|
2933
|
+
* 2. **Every poll re-signs.** One authorization cannot be replayed across a
|
|
2934
|
+
* long render. The gateway binds the job to the payer address rather than
|
|
2935
|
+
* to the signature, so a fresh signature from the same wallet is accepted
|
|
2936
|
+
* and is never charged again.
|
|
2931
2937
|
*/
|
|
2932
2938
|
private followSolanaJob;
|
|
2933
2939
|
private signPaymentFrom402;
|
package/dist/index.js
CHANGED
|
@@ -4539,7 +4539,7 @@ function getCostSummary() {
|
|
|
4539
4539
|
}
|
|
4540
4540
|
|
|
4541
4541
|
// src/version.ts
|
|
4542
|
-
var SDK_VERSION = "3.
|
|
4542
|
+
var SDK_VERSION = "3.17.1";
|
|
4543
4543
|
var USER_AGENT = `blockrun-ts/${SDK_VERSION}`;
|
|
4544
4544
|
|
|
4545
4545
|
// src/client.ts
|
|
@@ -10099,13 +10099,19 @@ var SolanaLLMClient = class {
|
|
|
10099
10099
|
/**
|
|
10100
10100
|
* Follow a 202 `{ id, poll_url }` to completion, on Solana.
|
|
10101
10101
|
*
|
|
10102
|
-
*
|
|
10103
|
-
*
|
|
10104
|
-
*
|
|
10105
|
-
*
|
|
10106
|
-
*
|
|
10107
|
-
*
|
|
10108
|
-
*
|
|
10102
|
+
* Two things differ from Base and both come from the same constraint — a
|
|
10103
|
+
* Solana payment is a transaction pinned to a recent blockhash, valid for
|
|
10104
|
+
* ~150 blocks (~60s), and a long render outlives it:
|
|
10105
|
+
*
|
|
10106
|
+
* 1. **The POST already settled.** Base settles on the completed poll; Solana
|
|
10107
|
+
* cannot, because by then the signed transaction has expired. So sol
|
|
10108
|
+
* settles optimistically at submit, and this loop only fetches the result.
|
|
10109
|
+
* The cost is recorded by the caller at POST, never here — recording it on
|
|
10110
|
+
* completion would lose the charge whenever a paid job then fails.
|
|
10111
|
+
* 2. **Every poll re-signs.** One authorization cannot be replayed across a
|
|
10112
|
+
* long render. The gateway binds the job to the payer address rather than
|
|
10113
|
+
* to the signature, so a fresh signature from the same wallet is accepted
|
|
10114
|
+
* and is never charged again.
|
|
10109
10115
|
*/
|
|
10110
10116
|
async followSolanaJob(submitBody, budgetMs, intervalMs = 2e3) {
|
|
10111
10117
|
const id = submitBody.id;
|
|
@@ -10133,7 +10139,7 @@ var SolanaLLMClient = class {
|
|
|
10133
10139
|
}
|
|
10134
10140
|
throw new APIError(`Poll failed: ${challenge.status}`, challenge.status, sanitizeErrorResponse(errorBody));
|
|
10135
10141
|
}
|
|
10136
|
-
const { paymentPayload
|
|
10142
|
+
const { paymentPayload } = await this.signPaymentFrom402(
|
|
10137
10143
|
pollUrl,
|
|
10138
10144
|
challenge,
|
|
10139
10145
|
true,
|
|
@@ -10158,7 +10164,6 @@ var SolanaLLMClient = class {
|
|
|
10158
10164
|
);
|
|
10159
10165
|
}
|
|
10160
10166
|
if (paid.status === 200 && lastStatus === "completed") {
|
|
10161
|
-
this.recordSettlement(costUsd);
|
|
10162
10167
|
return data;
|
|
10163
10168
|
}
|
|
10164
10169
|
if (paid.status !== 200 && paid.status !== 202 && paid.status !== 504) {
|
|
@@ -10282,6 +10287,7 @@ var SolanaLLMClient = class {
|
|
|
10282
10287
|
});
|
|
10283
10288
|
await this.assertPaid(retryResponse);
|
|
10284
10289
|
if (retryResponse.status === 202) {
|
|
10290
|
+
this.recordSettlement(costUsd);
|
|
10285
10291
|
const submitted = await retryResponse.json();
|
|
10286
10292
|
return this.followSolanaJob(submitted, this.timeout);
|
|
10287
10293
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockrun/llm",
|
|
3
|
-
"version": "3.17.
|
|
3
|
+
"version": "3.17.1",
|
|
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",
|