@blockrun/llm 3.25.0 → 3.26.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/README.md +11 -0
- package/dist/index.cjs +32 -11
- package/dist/index.d.cts +26 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.js +31 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -634,6 +634,17 @@ console.log(res.usage?.server_side_tool_usage); // { x_posts_fetched, ... }
|
|
|
634
634
|
console.log(res.costUsd, res.settlement); // what you paid, and the tx
|
|
635
635
|
```
|
|
636
636
|
|
|
637
|
+
Reasoning models take `reasoningEffort` on any chat call. Unset, the model's
|
|
638
|
+
own default applies, and some default to their highest effort (Reflection Beam
|
|
639
|
+
defaults to `"max"`); reasoning tokens bill as output:
|
|
640
|
+
|
|
641
|
+
```typescript
|
|
642
|
+
const quick = await client.chatCompletion('reflection/beam-1.0-501b-a23b', messages, {
|
|
643
|
+
reasoningEffort: 'low', // none | minimal | low | medium | high | xhigh | max, per model
|
|
644
|
+
maxTokens: 8192, // reasoning counts toward max_tokens
|
|
645
|
+
});
|
|
646
|
+
```
|
|
647
|
+
|
|
637
648
|
`costUsd`, `settlement` and the per-call `timeout` work the same on `LLMClient`
|
|
638
649
|
(Base / Arc). Both clients default to a 600 s request timeout
|
|
639
650
|
(`BLOCKRUN_CHAT_TIMEOUT`, in seconds, overrides it; the `timeout` option, in
|
package/dist/index.cjs
CHANGED
|
@@ -5122,7 +5122,7 @@ function getCostSummary() {
|
|
|
5122
5122
|
}
|
|
5123
5123
|
|
|
5124
5124
|
// src/version.ts
|
|
5125
|
-
var SDK_VERSION = "3.
|
|
5125
|
+
var SDK_VERSION = "3.26.0";
|
|
5126
5126
|
var USER_AGENT = `blockrun-ts/${SDK_VERSION}`;
|
|
5127
5127
|
|
|
5128
5128
|
// src/client.ts
|
|
@@ -5251,6 +5251,7 @@ var LLMClient = class _LLMClient {
|
|
|
5251
5251
|
searchParameters: options?.searchParameters,
|
|
5252
5252
|
responseFormat: options?.responseFormat,
|
|
5253
5253
|
stop: options?.stop,
|
|
5254
|
+
reasoningEffort: options?.reasoningEffort,
|
|
5254
5255
|
fallbackModels: options?.fallbackModels
|
|
5255
5256
|
});
|
|
5256
5257
|
return result.choices[0].message.content || "";
|
|
@@ -5323,6 +5324,7 @@ var LLMClient = class _LLMClient {
|
|
|
5323
5324
|
searchParameters: options?.searchParameters,
|
|
5324
5325
|
responseFormat: options?.responseFormat,
|
|
5325
5326
|
stop: options?.stop,
|
|
5327
|
+
reasoningEffort: options?.reasoningEffort,
|
|
5326
5328
|
// An explicit caller-supplied chain wins over the routed one.
|
|
5327
5329
|
fallbackModels: options?.fallbackModels ?? decision.fallbacks
|
|
5328
5330
|
});
|
|
@@ -5360,6 +5362,7 @@ var LLMClient = class _LLMClient {
|
|
|
5360
5362
|
toolChoice: options.toolChoice,
|
|
5361
5363
|
responseFormat: options.responseFormat,
|
|
5362
5364
|
stop: options.stop,
|
|
5365
|
+
reasoningEffort: options.reasoningEffort,
|
|
5363
5366
|
timeout: options.timeout,
|
|
5364
5367
|
// An explicit caller-supplied chain wins over the routed one.
|
|
5365
5368
|
fallbackModels: options.fallbackModels ?? decision.fallbacks
|
|
@@ -5446,6 +5449,7 @@ var LLMClient = class _LLMClient {
|
|
|
5446
5449
|
if (options?.toolChoice !== void 0) body.tool_choice = options.toolChoice;
|
|
5447
5450
|
if (options?.responseFormat !== void 0) body.response_format = options.responseFormat;
|
|
5448
5451
|
if (options?.stop !== void 0) body.stop = options.stop;
|
|
5452
|
+
if (options?.reasoningEffort !== void 0) body.reasoning_effort = options.reasoningEffort;
|
|
5449
5453
|
return body;
|
|
5450
5454
|
};
|
|
5451
5455
|
const chain = [model, ...options?.fallbackModels ?? []];
|
|
@@ -5819,6 +5823,7 @@ var LLMClient = class _LLMClient {
|
|
|
5819
5823
|
if (options?.toolChoice !== void 0) body.tool_choice = options.toolChoice;
|
|
5820
5824
|
if (options?.responseFormat !== void 0) body.response_format = options.responseFormat;
|
|
5821
5825
|
if (options?.stop !== void 0) body.stop = options.stop;
|
|
5826
|
+
if (options?.reasoningEffort !== void 0) body.reasoning_effort = options.reasoningEffort;
|
|
5822
5827
|
const cacheKey2 = `/v1/chat/completions:${requestModel}`;
|
|
5823
5828
|
const requestBody = JSON.stringify(body);
|
|
5824
5829
|
const cached = this.preAuthCache.get(cacheKey2);
|
|
@@ -9952,11 +9957,11 @@ var WALLET_DIR = path4.join(os3.homedir(), ".blockrun");
|
|
|
9952
9957
|
var SOLANA_WALLET_FILE = path4.join(WALLET_DIR, ".solana-session");
|
|
9953
9958
|
async function createSolanaWallet() {
|
|
9954
9959
|
const { Keypair } = await loadSolanaWeb3("Solana wallet operations");
|
|
9955
|
-
const
|
|
9960
|
+
const bs582 = await import("bs58");
|
|
9956
9961
|
const keypair = Keypair.generate();
|
|
9957
9962
|
return {
|
|
9958
9963
|
address: keypair.publicKey.toBase58(),
|
|
9959
|
-
privateKey: (
|
|
9964
|
+
privateKey: (bs582.default ?? bs582).encode(keypair.secretKey)
|
|
9960
9965
|
};
|
|
9961
9966
|
}
|
|
9962
9967
|
async function solanaKeyToBytes(privateKey) {
|
|
@@ -9994,8 +9999,8 @@ async function solanaKeyToBytes(privateKey) {
|
|
|
9994
9999
|
return bytes;
|
|
9995
10000
|
}
|
|
9996
10001
|
try {
|
|
9997
|
-
const
|
|
9998
|
-
const bytes = (
|
|
10002
|
+
const bs582 = await import("bs58");
|
|
10003
|
+
const bytes = (bs582.default ?? bs582).decode(key);
|
|
9999
10004
|
if (bytes.length !== 64) {
|
|
10000
10005
|
throw new Error(`Invalid Solana key length: expected 64 bytes, got ${bytes.length}`);
|
|
10001
10006
|
}
|
|
@@ -10176,7 +10181,19 @@ async function getOrCreateSolanaWallet() {
|
|
|
10176
10181
|
|
|
10177
10182
|
// src/poll-ownership.ts
|
|
10178
10183
|
var import_crypto = require("crypto");
|
|
10184
|
+
|
|
10185
|
+
// src/bs58.ts
|
|
10179
10186
|
var import_bs58 = __toESM(require("bs58"), 1);
|
|
10187
|
+
function unwrapBs58(mod) {
|
|
10188
|
+
const m = mod;
|
|
10189
|
+
if (typeof m?.encode === "function") return m;
|
|
10190
|
+
const inner = m?.default;
|
|
10191
|
+
if (typeof inner?.encode === "function") return inner;
|
|
10192
|
+
throw new Error("bs58: no encode() on the module or its default export");
|
|
10193
|
+
}
|
|
10194
|
+
var bs58 = unwrapBs58(import_bs58.default);
|
|
10195
|
+
|
|
10196
|
+
// src/poll-ownership.ts
|
|
10180
10197
|
var POLL_AUTH_HEADERS = {
|
|
10181
10198
|
wallet: "x-poll-wallet",
|
|
10182
10199
|
timestamp: "x-poll-timestamp",
|
|
@@ -10208,9 +10225,9 @@ function signPollOwnership(secretKey, kind, jobId, nowMs = Date.now()) {
|
|
|
10208
10225
|
const timestampS = Math.floor(nowMs / 1e3);
|
|
10209
10226
|
const signature = (0, import_crypto.sign)(null, Buffer.from(pollAuthMessage(kind, jobId, timestampS), "utf8"), privateKey);
|
|
10210
10227
|
return {
|
|
10211
|
-
[POLL_AUTH_HEADERS.wallet]:
|
|
10228
|
+
[POLL_AUTH_HEADERS.wallet]: bs58.encode(publicKey),
|
|
10212
10229
|
[POLL_AUTH_HEADERS.timestamp]: String(timestampS),
|
|
10213
|
-
[POLL_AUTH_HEADERS.signature]:
|
|
10230
|
+
[POLL_AUTH_HEADERS.signature]: bs58.encode(signature)
|
|
10214
10231
|
};
|
|
10215
10232
|
}
|
|
10216
10233
|
|
|
@@ -10219,7 +10236,6 @@ var import_async_hooks = require("async_hooks");
|
|
|
10219
10236
|
var import_crypto2 = require("crypto");
|
|
10220
10237
|
var fs6 = __toESM(require("fs"), 1);
|
|
10221
10238
|
var path5 = __toESM(require("path"), 1);
|
|
10222
|
-
var import_bs582 = __toESM(require("bs58"), 1);
|
|
10223
10239
|
var BATCH_SCHEME = "batch-settlement";
|
|
10224
10240
|
var BLOCKRUN_SOL_OPERATOR = "5YKPQUFjw5WQqhSUkEGKNNfYYVqnRRNbpYyL71qQ1vm3";
|
|
10225
10241
|
var DEFAULT_BATCH_RATE_LIMIT = { maxAttempts: 3, maxWaitMs: 6e4 };
|
|
@@ -10798,7 +10814,7 @@ function decodeChannelAccount(owner, data) {
|
|
|
10798
10814
|
return void 0;
|
|
10799
10815
|
}
|
|
10800
10816
|
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
10801
|
-
const key = (offset) =>
|
|
10817
|
+
const key = (offset) => bs58.encode(data.subarray(offset, offset + 32));
|
|
10802
10818
|
return {
|
|
10803
10819
|
deposit: view.getBigUint64(CHANNEL.deposit, true),
|
|
10804
10820
|
settled: view.getBigUint64(CHANNEL.settled, true),
|
|
@@ -13069,6 +13085,7 @@ var SolanaLLMClient = class {
|
|
|
13069
13085
|
searchParameters: options?.searchParameters,
|
|
13070
13086
|
responseFormat: options?.responseFormat,
|
|
13071
13087
|
stop: options?.stop,
|
|
13088
|
+
reasoningEffort: options?.reasoningEffort,
|
|
13072
13089
|
fallbackModels: options?.fallbackModels
|
|
13073
13090
|
});
|
|
13074
13091
|
return result.choices[0].message.content || "";
|
|
@@ -13097,6 +13114,7 @@ var SolanaLLMClient = class {
|
|
|
13097
13114
|
if (options?.toolChoice !== void 0) body.tool_choice = options.toolChoice;
|
|
13098
13115
|
if (options?.responseFormat !== void 0) body.response_format = options.responseFormat;
|
|
13099
13116
|
if (options?.stop !== void 0) body.stop = options.stop;
|
|
13117
|
+
if (options?.reasoningEffort !== void 0) body.reasoning_effort = options.reasoningEffort;
|
|
13100
13118
|
return body;
|
|
13101
13119
|
};
|
|
13102
13120
|
const chain = [model, ...options?.fallbackModels ?? []];
|
|
@@ -13201,6 +13219,7 @@ var SolanaLLMClient = class {
|
|
|
13201
13219
|
toolChoice: options.toolChoice,
|
|
13202
13220
|
responseFormat: options.responseFormat,
|
|
13203
13221
|
stop: options.stop,
|
|
13222
|
+
reasoningEffort: options.reasoningEffort,
|
|
13204
13223
|
timeout: options.timeout,
|
|
13205
13224
|
// An explicit caller-supplied chain wins over the routed one.
|
|
13206
13225
|
fallbackModels: options.fallbackModels ?? decision.fallbacks
|
|
@@ -14560,7 +14579,8 @@ var ChatCompletions = class {
|
|
|
14560
14579
|
tools: params.tools,
|
|
14561
14580
|
toolChoice: params.tool_choice,
|
|
14562
14581
|
responseFormat: params.response_format,
|
|
14563
|
-
stop: params.stop
|
|
14582
|
+
stop: params.stop,
|
|
14583
|
+
reasoningEffort: params.reasoning_effort
|
|
14564
14584
|
}
|
|
14565
14585
|
);
|
|
14566
14586
|
return this.transformResponse(response);
|
|
@@ -14576,7 +14596,8 @@ var ChatCompletions = class {
|
|
|
14576
14596
|
tools: params.tools,
|
|
14577
14597
|
toolChoice: params.tool_choice,
|
|
14578
14598
|
responseFormat: params.response_format,
|
|
14579
|
-
stop: params.stop
|
|
14599
|
+
stop: params.stop,
|
|
14600
|
+
reasoningEffort: params.reasoning_effort
|
|
14580
14601
|
}
|
|
14581
14602
|
);
|
|
14582
14603
|
return new StreamingResponse(response, params.model);
|
package/dist/index.d.cts
CHANGED
|
@@ -520,6 +520,12 @@ type ResponseFormat = {
|
|
|
520
520
|
type: "json_schema";
|
|
521
521
|
json_schema: Record<string, unknown>;
|
|
522
522
|
};
|
|
523
|
+
/**
|
|
524
|
+
* `reasoning_effort` values. The gateway passes the value through, and each
|
|
525
|
+
* model accepts its own subset; xhigh/max exist on a few (e.g. Reflection
|
|
526
|
+
* Beam, Z.ai GLM), none/minimal only on models that can stop reasoning.
|
|
527
|
+
*/
|
|
528
|
+
type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
523
529
|
interface ChatOptions {
|
|
524
530
|
/** System prompt */
|
|
525
531
|
system?: string;
|
|
@@ -537,6 +543,15 @@ interface ChatOptions {
|
|
|
537
543
|
responseFormat?: ResponseFormat;
|
|
538
544
|
/** Up to 4 stop sequences (forwarded natively / mapped to stop_sequences) */
|
|
539
545
|
stop?: string | string[];
|
|
546
|
+
/**
|
|
547
|
+
* Reasoning effort for reasoning models, sent as `reasoning_effort`. Omitted
|
|
548
|
+
* when unset, so the model's own default applies (some default to their
|
|
549
|
+
* HIGHEST effort, e.g. Reflection Beam defaults to "max"). Accepted values
|
|
550
|
+
* are per model; the gateway maps "none"/"minimal" to the lowest effort a
|
|
551
|
+
* model accepts when it cannot turn reasoning off. Reasoning tokens bill as
|
|
552
|
+
* output tokens.
|
|
553
|
+
*/
|
|
554
|
+
reasoningEffort?: ReasoningEffort;
|
|
540
555
|
/**
|
|
541
556
|
* Models to try in order if the primary returns a transient error
|
|
542
557
|
* (timeout, network, 5xx). 4xx and PaymentError still propagate
|
|
@@ -564,6 +579,15 @@ interface ChatCompletionOptions {
|
|
|
564
579
|
responseFormat?: ResponseFormat;
|
|
565
580
|
/** Up to 4 stop sequences (forwarded natively / mapped to stop_sequences) */
|
|
566
581
|
stop?: string | string[];
|
|
582
|
+
/**
|
|
583
|
+
* Reasoning effort for reasoning models, sent as `reasoning_effort`. Omitted
|
|
584
|
+
* when unset, so the model's own default applies (some default to their
|
|
585
|
+
* HIGHEST effort, e.g. Reflection Beam defaults to "max"). Accepted values
|
|
586
|
+
* are per model; the gateway maps "none"/"minimal" to the lowest effort a
|
|
587
|
+
* model accepts when it cannot turn reasoning off. Reasoning tokens bill as
|
|
588
|
+
* output tokens.
|
|
589
|
+
*/
|
|
590
|
+
reasoningEffort?: ReasoningEffort;
|
|
567
591
|
/**
|
|
568
592
|
* Models to try in order if the primary returns a transient error
|
|
569
593
|
* (timeout, network, 5xx). 4xx and PaymentError still propagate
|
|
@@ -4315,6 +4339,7 @@ interface OpenAIChatCompletionParams {
|
|
|
4315
4339
|
user?: string;
|
|
4316
4340
|
tools?: Tool[];
|
|
4317
4341
|
tool_choice?: ToolChoice;
|
|
4342
|
+
reasoning_effort?: ReasoningEffort;
|
|
4318
4343
|
}
|
|
4319
4344
|
interface OpenAIChatCompletionChoice {
|
|
4320
4345
|
index: number;
|
|
@@ -4546,4 +4571,4 @@ declare function readSettlement(response: Response, quotedUsd: number, scheme: S
|
|
|
4546
4571
|
settlement: Settlement;
|
|
4547
4572
|
};
|
|
4548
4573
|
|
|
4549
|
-
export { APIError, API_KEY_URL, ARC_CHAIN_ID, AnthropicClient, type AnyTool, type ApiKeyOptions, type AudioModel, type AudioTrack, BASE_CHAIN_ID, BLOCKRUN_SOL_OPERATOR, type BarResolution, type BatchAttempt, BatchChannelLockedError, BatchCloseDeferredError, type BatchPayloadKind, BatchPaymentUnresolvedError, type BatchUnresolvedReason, type BlockRunAnthropicOptions, BlockrunClient, type BlockrunClientOptions, BlockrunError, type CallInitiatedResponse, type CallModel, type CallOptions, type CallStatusResponse, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatResponseWithCost, type ChatUsage, type CostEntry, type CostEstimate, type CreatePaymentOptions, DEFAULT_BATCH_IN_DOUBT, DEFAULT_BATCH_LOCK_WAIT_MS, DEFAULT_BATCH_RATE_LIMIT, EVM_NETWORKS, type EvmNetwork, type FunctionCall, type FunctionDefinition, type HistoryOptions, ImageClient, type ImageClientOptions, type ImageData, type ImageEditOptions, type ImageGenerateOptions, type ImageModel, type ImageResponse, KNOWN_PROVIDERS, LLMClient, type LLMClientOptions, type ListOptions, type MarketSession, type Model, MusicClient, type MusicClientOptions, type MusicGenerateOptions, type MusicResponse, NETWORK_ALIASES, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PHONE_PRICES, PORTAL_URL, PORTRAIT_ENROLLMENT_PRICE_USD, PaymentError, type PaymentLinks, type PhoneBuyOptions, type PhoneBuyResponse, PhoneClient, type PhoneClientOptions, type PhoneListResponse, type PhoneLookupResponse, type PhoneNumberRecord, type PhoneReleaseResponse, type PhoneRenewResponse, type PollOptions, PortraitClient, type PortraitClientOptions, type PortraitEnrollOptions, type PortraitEnrollResponse, type PriceBar, type PriceCategory, PriceClient, type PriceClientOptions, type PriceHistoryResponse, type PriceOptions, type PricePoint, RPC_PRICE_USD, type Rechallenge, type ResponseFormat, RetiredEndpointError, type RetryDisposition, type RoutingDecision, type RoutingProfile, type RoutingTaskType, type RoutingTier, type RoutingTierConfig, type RpcBatchRequest, RpcClient, type RpcClientOptions, type RpcError, type RpcNetwork, type RpcResponse, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, SUPPORTED_NETWORKS, SearchClient, type SearchClientOptions, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SearchUsage, type Settlement, type SmartChatCompletionOptions, type SmartChatCompletionResponse, type SmartChatOptions, type SmartChatResponse, type SolanaBatchEvent, type SolanaBatchOptions, SolanaBatchPayer, type SolanaBatchPayerInit, type SolanaBatchStats, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type SoundEffectOptions, type SpeechAudio, SpeechClient, type SpeechClientOptions, type SpeechGenerateOptions, type SpeechModel, type SpeechResponse, type SpeechVoice, type Spending, type SpendingReport, type StockMarket, SurfClient, type SurfClientOptions, type SymbolListResponse, type Tool, type ToolCall, type ToolChoice, USDC_ARC, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, type UrlCitation, VideoClient, type VideoClientOptions, type VideoClip, type VideoGenerateOptions, type VideoModel, type VideoResponse, VoiceClient, type VoiceClientOptions, type VoiceInfo, type VoicePreset, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type WebSearchTool, type X402ClientLike, type X402HookContext, type XSearchSource, type XSearchTool, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, evmNetwork, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatSolanaWalletMigrationNotice, formatWalletCreatedMessage, formatWalletMigrationNotice, getCached, getCachedByRequest, getCostLogSummary, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, importSolanaWallet, importWallet, listDiscoveredSolanaWallets, listDiscoveredWallets, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, readSettlement, retryDisposition, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentClient, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, toWireSearchParameters, toWireTools, validateMaxTokens, validateModel, validateTemperature, validateTopP };
|
|
4574
|
+
export { APIError, API_KEY_URL, ARC_CHAIN_ID, AnthropicClient, type AnyTool, type ApiKeyOptions, type AudioModel, type AudioTrack, BASE_CHAIN_ID, BLOCKRUN_SOL_OPERATOR, type BarResolution, type BatchAttempt, BatchChannelLockedError, BatchCloseDeferredError, type BatchPayloadKind, BatchPaymentUnresolvedError, type BatchUnresolvedReason, type BlockRunAnthropicOptions, BlockrunClient, type BlockrunClientOptions, BlockrunError, type CallInitiatedResponse, type CallModel, type CallOptions, type CallStatusResponse, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatResponseWithCost, type ChatUsage, type CostEntry, type CostEstimate, type CreatePaymentOptions, DEFAULT_BATCH_IN_DOUBT, DEFAULT_BATCH_LOCK_WAIT_MS, DEFAULT_BATCH_RATE_LIMIT, EVM_NETWORKS, type EvmNetwork, type FunctionCall, type FunctionDefinition, type HistoryOptions, ImageClient, type ImageClientOptions, type ImageData, type ImageEditOptions, type ImageGenerateOptions, type ImageModel, type ImageResponse, KNOWN_PROVIDERS, LLMClient, type LLMClientOptions, type ListOptions, type MarketSession, type Model, MusicClient, type MusicClientOptions, type MusicGenerateOptions, type MusicResponse, NETWORK_ALIASES, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PHONE_PRICES, PORTAL_URL, PORTRAIT_ENROLLMENT_PRICE_USD, PaymentError, type PaymentLinks, type PhoneBuyOptions, type PhoneBuyResponse, PhoneClient, type PhoneClientOptions, type PhoneListResponse, type PhoneLookupResponse, type PhoneNumberRecord, type PhoneReleaseResponse, type PhoneRenewResponse, type PollOptions, PortraitClient, type PortraitClientOptions, type PortraitEnrollOptions, type PortraitEnrollResponse, type PriceBar, type PriceCategory, PriceClient, type PriceClientOptions, type PriceHistoryResponse, type PriceOptions, type PricePoint, RPC_PRICE_USD, type ReasoningEffort, type Rechallenge, type ResponseFormat, RetiredEndpointError, type RetryDisposition, type RoutingDecision, type RoutingProfile, type RoutingTaskType, type RoutingTier, type RoutingTierConfig, type RpcBatchRequest, RpcClient, type RpcClientOptions, type RpcError, type RpcNetwork, type RpcResponse, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, SUPPORTED_NETWORKS, SearchClient, type SearchClientOptions, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SearchUsage, type Settlement, type SmartChatCompletionOptions, type SmartChatCompletionResponse, type SmartChatOptions, type SmartChatResponse, type SolanaBatchEvent, type SolanaBatchOptions, SolanaBatchPayer, type SolanaBatchPayerInit, type SolanaBatchStats, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type SoundEffectOptions, type SpeechAudio, SpeechClient, type SpeechClientOptions, type SpeechGenerateOptions, type SpeechModel, type SpeechResponse, type SpeechVoice, type Spending, type SpendingReport, type StockMarket, SurfClient, type SurfClientOptions, type SymbolListResponse, type Tool, type ToolCall, type ToolChoice, USDC_ARC, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, type UrlCitation, VideoClient, type VideoClientOptions, type VideoClip, type VideoGenerateOptions, type VideoModel, type VideoResponse, VoiceClient, type VoiceClientOptions, type VoiceInfo, type VoicePreset, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type WebSearchTool, type X402ClientLike, type X402HookContext, type XSearchSource, type XSearchTool, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, evmNetwork, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatSolanaWalletMigrationNotice, formatWalletCreatedMessage, formatWalletMigrationNotice, getCached, getCachedByRequest, getCostLogSummary, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, importSolanaWallet, importWallet, listDiscoveredSolanaWallets, listDiscoveredWallets, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, readSettlement, retryDisposition, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentClient, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, toWireSearchParameters, toWireTools, validateMaxTokens, validateModel, validateTemperature, validateTopP };
|
package/dist/index.d.ts
CHANGED
|
@@ -520,6 +520,12 @@ type ResponseFormat = {
|
|
|
520
520
|
type: "json_schema";
|
|
521
521
|
json_schema: Record<string, unknown>;
|
|
522
522
|
};
|
|
523
|
+
/**
|
|
524
|
+
* `reasoning_effort` values. The gateway passes the value through, and each
|
|
525
|
+
* model accepts its own subset; xhigh/max exist on a few (e.g. Reflection
|
|
526
|
+
* Beam, Z.ai GLM), none/minimal only on models that can stop reasoning.
|
|
527
|
+
*/
|
|
528
|
+
type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
523
529
|
interface ChatOptions {
|
|
524
530
|
/** System prompt */
|
|
525
531
|
system?: string;
|
|
@@ -537,6 +543,15 @@ interface ChatOptions {
|
|
|
537
543
|
responseFormat?: ResponseFormat;
|
|
538
544
|
/** Up to 4 stop sequences (forwarded natively / mapped to stop_sequences) */
|
|
539
545
|
stop?: string | string[];
|
|
546
|
+
/**
|
|
547
|
+
* Reasoning effort for reasoning models, sent as `reasoning_effort`. Omitted
|
|
548
|
+
* when unset, so the model's own default applies (some default to their
|
|
549
|
+
* HIGHEST effort, e.g. Reflection Beam defaults to "max"). Accepted values
|
|
550
|
+
* are per model; the gateway maps "none"/"minimal" to the lowest effort a
|
|
551
|
+
* model accepts when it cannot turn reasoning off. Reasoning tokens bill as
|
|
552
|
+
* output tokens.
|
|
553
|
+
*/
|
|
554
|
+
reasoningEffort?: ReasoningEffort;
|
|
540
555
|
/**
|
|
541
556
|
* Models to try in order if the primary returns a transient error
|
|
542
557
|
* (timeout, network, 5xx). 4xx and PaymentError still propagate
|
|
@@ -564,6 +579,15 @@ interface ChatCompletionOptions {
|
|
|
564
579
|
responseFormat?: ResponseFormat;
|
|
565
580
|
/** Up to 4 stop sequences (forwarded natively / mapped to stop_sequences) */
|
|
566
581
|
stop?: string | string[];
|
|
582
|
+
/**
|
|
583
|
+
* Reasoning effort for reasoning models, sent as `reasoning_effort`. Omitted
|
|
584
|
+
* when unset, so the model's own default applies (some default to their
|
|
585
|
+
* HIGHEST effort, e.g. Reflection Beam defaults to "max"). Accepted values
|
|
586
|
+
* are per model; the gateway maps "none"/"minimal" to the lowest effort a
|
|
587
|
+
* model accepts when it cannot turn reasoning off. Reasoning tokens bill as
|
|
588
|
+
* output tokens.
|
|
589
|
+
*/
|
|
590
|
+
reasoningEffort?: ReasoningEffort;
|
|
567
591
|
/**
|
|
568
592
|
* Models to try in order if the primary returns a transient error
|
|
569
593
|
* (timeout, network, 5xx). 4xx and PaymentError still propagate
|
|
@@ -4315,6 +4339,7 @@ interface OpenAIChatCompletionParams {
|
|
|
4315
4339
|
user?: string;
|
|
4316
4340
|
tools?: Tool[];
|
|
4317
4341
|
tool_choice?: ToolChoice;
|
|
4342
|
+
reasoning_effort?: ReasoningEffort;
|
|
4318
4343
|
}
|
|
4319
4344
|
interface OpenAIChatCompletionChoice {
|
|
4320
4345
|
index: number;
|
|
@@ -4546,4 +4571,4 @@ declare function readSettlement(response: Response, quotedUsd: number, scheme: S
|
|
|
4546
4571
|
settlement: Settlement;
|
|
4547
4572
|
};
|
|
4548
4573
|
|
|
4549
|
-
export { APIError, API_KEY_URL, ARC_CHAIN_ID, AnthropicClient, type AnyTool, type ApiKeyOptions, type AudioModel, type AudioTrack, BASE_CHAIN_ID, BLOCKRUN_SOL_OPERATOR, type BarResolution, type BatchAttempt, BatchChannelLockedError, BatchCloseDeferredError, type BatchPayloadKind, BatchPaymentUnresolvedError, type BatchUnresolvedReason, type BlockRunAnthropicOptions, BlockrunClient, type BlockrunClientOptions, BlockrunError, type CallInitiatedResponse, type CallModel, type CallOptions, type CallStatusResponse, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatResponseWithCost, type ChatUsage, type CostEntry, type CostEstimate, type CreatePaymentOptions, DEFAULT_BATCH_IN_DOUBT, DEFAULT_BATCH_LOCK_WAIT_MS, DEFAULT_BATCH_RATE_LIMIT, EVM_NETWORKS, type EvmNetwork, type FunctionCall, type FunctionDefinition, type HistoryOptions, ImageClient, type ImageClientOptions, type ImageData, type ImageEditOptions, type ImageGenerateOptions, type ImageModel, type ImageResponse, KNOWN_PROVIDERS, LLMClient, type LLMClientOptions, type ListOptions, type MarketSession, type Model, MusicClient, type MusicClientOptions, type MusicGenerateOptions, type MusicResponse, NETWORK_ALIASES, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PHONE_PRICES, PORTAL_URL, PORTRAIT_ENROLLMENT_PRICE_USD, PaymentError, type PaymentLinks, type PhoneBuyOptions, type PhoneBuyResponse, PhoneClient, type PhoneClientOptions, type PhoneListResponse, type PhoneLookupResponse, type PhoneNumberRecord, type PhoneReleaseResponse, type PhoneRenewResponse, type PollOptions, PortraitClient, type PortraitClientOptions, type PortraitEnrollOptions, type PortraitEnrollResponse, type PriceBar, type PriceCategory, PriceClient, type PriceClientOptions, type PriceHistoryResponse, type PriceOptions, type PricePoint, RPC_PRICE_USD, type Rechallenge, type ResponseFormat, RetiredEndpointError, type RetryDisposition, type RoutingDecision, type RoutingProfile, type RoutingTaskType, type RoutingTier, type RoutingTierConfig, type RpcBatchRequest, RpcClient, type RpcClientOptions, type RpcError, type RpcNetwork, type RpcResponse, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, SUPPORTED_NETWORKS, SearchClient, type SearchClientOptions, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SearchUsage, type Settlement, type SmartChatCompletionOptions, type SmartChatCompletionResponse, type SmartChatOptions, type SmartChatResponse, type SolanaBatchEvent, type SolanaBatchOptions, SolanaBatchPayer, type SolanaBatchPayerInit, type SolanaBatchStats, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type SoundEffectOptions, type SpeechAudio, SpeechClient, type SpeechClientOptions, type SpeechGenerateOptions, type SpeechModel, type SpeechResponse, type SpeechVoice, type Spending, type SpendingReport, type StockMarket, SurfClient, type SurfClientOptions, type SymbolListResponse, type Tool, type ToolCall, type ToolChoice, USDC_ARC, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, type UrlCitation, VideoClient, type VideoClientOptions, type VideoClip, type VideoGenerateOptions, type VideoModel, type VideoResponse, VoiceClient, type VoiceClientOptions, type VoiceInfo, type VoicePreset, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type WebSearchTool, type X402ClientLike, type X402HookContext, type XSearchSource, type XSearchTool, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, evmNetwork, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatSolanaWalletMigrationNotice, formatWalletCreatedMessage, formatWalletMigrationNotice, getCached, getCachedByRequest, getCostLogSummary, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, importSolanaWallet, importWallet, listDiscoveredSolanaWallets, listDiscoveredWallets, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, readSettlement, retryDisposition, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentClient, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, toWireSearchParameters, toWireTools, validateMaxTokens, validateModel, validateTemperature, validateTopP };
|
|
4574
|
+
export { APIError, API_KEY_URL, ARC_CHAIN_ID, AnthropicClient, type AnyTool, type ApiKeyOptions, type AudioModel, type AudioTrack, BASE_CHAIN_ID, BLOCKRUN_SOL_OPERATOR, type BarResolution, type BatchAttempt, BatchChannelLockedError, BatchCloseDeferredError, type BatchPayloadKind, BatchPaymentUnresolvedError, type BatchUnresolvedReason, type BlockRunAnthropicOptions, BlockrunClient, type BlockrunClientOptions, BlockrunError, type CallInitiatedResponse, type CallModel, type CallOptions, type CallStatusResponse, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatResponseWithCost, type ChatUsage, type CostEntry, type CostEstimate, type CreatePaymentOptions, DEFAULT_BATCH_IN_DOUBT, DEFAULT_BATCH_LOCK_WAIT_MS, DEFAULT_BATCH_RATE_LIMIT, EVM_NETWORKS, type EvmNetwork, type FunctionCall, type FunctionDefinition, type HistoryOptions, ImageClient, type ImageClientOptions, type ImageData, type ImageEditOptions, type ImageGenerateOptions, type ImageModel, type ImageResponse, KNOWN_PROVIDERS, LLMClient, type LLMClientOptions, type ListOptions, type MarketSession, type Model, MusicClient, type MusicClientOptions, type MusicGenerateOptions, type MusicResponse, NETWORK_ALIASES, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PHONE_PRICES, PORTAL_URL, PORTRAIT_ENROLLMENT_PRICE_USD, PaymentError, type PaymentLinks, type PhoneBuyOptions, type PhoneBuyResponse, PhoneClient, type PhoneClientOptions, type PhoneListResponse, type PhoneLookupResponse, type PhoneNumberRecord, type PhoneReleaseResponse, type PhoneRenewResponse, type PollOptions, PortraitClient, type PortraitClientOptions, type PortraitEnrollOptions, type PortraitEnrollResponse, type PriceBar, type PriceCategory, PriceClient, type PriceClientOptions, type PriceHistoryResponse, type PriceOptions, type PricePoint, RPC_PRICE_USD, type ReasoningEffort, type Rechallenge, type ResponseFormat, RetiredEndpointError, type RetryDisposition, type RoutingDecision, type RoutingProfile, type RoutingTaskType, type RoutingTier, type RoutingTierConfig, type RpcBatchRequest, RpcClient, type RpcClientOptions, type RpcError, type RpcNetwork, type RpcResponse, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, SUPPORTED_NETWORKS, SearchClient, type SearchClientOptions, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SearchUsage, type Settlement, type SmartChatCompletionOptions, type SmartChatCompletionResponse, type SmartChatOptions, type SmartChatResponse, type SolanaBatchEvent, type SolanaBatchOptions, SolanaBatchPayer, type SolanaBatchPayerInit, type SolanaBatchStats, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type SoundEffectOptions, type SpeechAudio, SpeechClient, type SpeechClientOptions, type SpeechGenerateOptions, type SpeechModel, type SpeechResponse, type SpeechVoice, type Spending, type SpendingReport, type StockMarket, SurfClient, type SurfClientOptions, type SymbolListResponse, type Tool, type ToolCall, type ToolChoice, USDC_ARC, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, type UrlCitation, VideoClient, type VideoClientOptions, type VideoClip, type VideoGenerateOptions, type VideoModel, type VideoResponse, VoiceClient, type VoiceClientOptions, type VoiceInfo, type VoicePreset, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type WebSearchTool, type X402ClientLike, type X402HookContext, type XSearchSource, type XSearchTool, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, evmNetwork, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatSolanaWalletMigrationNotice, formatWalletCreatedMessage, formatWalletMigrationNotice, getCached, getCachedByRequest, getCostLogSummary, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, importSolanaWallet, importWallet, listDiscoveredSolanaWallets, listDiscoveredWallets, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, readSettlement, retryDisposition, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentClient, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, toWireSearchParameters, toWireTools, validateMaxTokens, validateModel, validateTemperature, validateTopP };
|
package/dist/index.js
CHANGED
|
@@ -4989,7 +4989,7 @@ function getCostSummary() {
|
|
|
4989
4989
|
}
|
|
4990
4990
|
|
|
4991
4991
|
// src/version.ts
|
|
4992
|
-
var SDK_VERSION = "3.
|
|
4992
|
+
var SDK_VERSION = "3.26.0";
|
|
4993
4993
|
var USER_AGENT = `blockrun-ts/${SDK_VERSION}`;
|
|
4994
4994
|
|
|
4995
4995
|
// src/client.ts
|
|
@@ -5118,6 +5118,7 @@ var LLMClient = class _LLMClient {
|
|
|
5118
5118
|
searchParameters: options?.searchParameters,
|
|
5119
5119
|
responseFormat: options?.responseFormat,
|
|
5120
5120
|
stop: options?.stop,
|
|
5121
|
+
reasoningEffort: options?.reasoningEffort,
|
|
5121
5122
|
fallbackModels: options?.fallbackModels
|
|
5122
5123
|
});
|
|
5123
5124
|
return result.choices[0].message.content || "";
|
|
@@ -5190,6 +5191,7 @@ var LLMClient = class _LLMClient {
|
|
|
5190
5191
|
searchParameters: options?.searchParameters,
|
|
5191
5192
|
responseFormat: options?.responseFormat,
|
|
5192
5193
|
stop: options?.stop,
|
|
5194
|
+
reasoningEffort: options?.reasoningEffort,
|
|
5193
5195
|
// An explicit caller-supplied chain wins over the routed one.
|
|
5194
5196
|
fallbackModels: options?.fallbackModels ?? decision.fallbacks
|
|
5195
5197
|
});
|
|
@@ -5227,6 +5229,7 @@ var LLMClient = class _LLMClient {
|
|
|
5227
5229
|
toolChoice: options.toolChoice,
|
|
5228
5230
|
responseFormat: options.responseFormat,
|
|
5229
5231
|
stop: options.stop,
|
|
5232
|
+
reasoningEffort: options.reasoningEffort,
|
|
5230
5233
|
timeout: options.timeout,
|
|
5231
5234
|
// An explicit caller-supplied chain wins over the routed one.
|
|
5232
5235
|
fallbackModels: options.fallbackModels ?? decision.fallbacks
|
|
@@ -5313,6 +5316,7 @@ var LLMClient = class _LLMClient {
|
|
|
5313
5316
|
if (options?.toolChoice !== void 0) body.tool_choice = options.toolChoice;
|
|
5314
5317
|
if (options?.responseFormat !== void 0) body.response_format = options.responseFormat;
|
|
5315
5318
|
if (options?.stop !== void 0) body.stop = options.stop;
|
|
5319
|
+
if (options?.reasoningEffort !== void 0) body.reasoning_effort = options.reasoningEffort;
|
|
5316
5320
|
return body;
|
|
5317
5321
|
};
|
|
5318
5322
|
const chain = [model, ...options?.fallbackModels ?? []];
|
|
@@ -5686,6 +5690,7 @@ var LLMClient = class _LLMClient {
|
|
|
5686
5690
|
if (options?.toolChoice !== void 0) body.tool_choice = options.toolChoice;
|
|
5687
5691
|
if (options?.responseFormat !== void 0) body.response_format = options.responseFormat;
|
|
5688
5692
|
if (options?.stop !== void 0) body.stop = options.stop;
|
|
5693
|
+
if (options?.reasoningEffort !== void 0) body.reasoning_effort = options.reasoningEffort;
|
|
5689
5694
|
const cacheKey2 = `/v1/chat/completions:${requestModel}`;
|
|
5690
5695
|
const requestBody = JSON.stringify(body);
|
|
5691
5696
|
const cached = this.preAuthCache.get(cacheKey2);
|
|
@@ -9819,11 +9824,11 @@ var WALLET_DIR = path4.join(os3.homedir(), ".blockrun");
|
|
|
9819
9824
|
var SOLANA_WALLET_FILE = path4.join(WALLET_DIR, ".solana-session");
|
|
9820
9825
|
async function createSolanaWallet() {
|
|
9821
9826
|
const { Keypair } = await loadSolanaWeb3("Solana wallet operations");
|
|
9822
|
-
const
|
|
9827
|
+
const bs582 = await import("bs58");
|
|
9823
9828
|
const keypair = Keypair.generate();
|
|
9824
9829
|
return {
|
|
9825
9830
|
address: keypair.publicKey.toBase58(),
|
|
9826
|
-
privateKey: (
|
|
9831
|
+
privateKey: (bs582.default ?? bs582).encode(keypair.secretKey)
|
|
9827
9832
|
};
|
|
9828
9833
|
}
|
|
9829
9834
|
async function solanaKeyToBytes(privateKey) {
|
|
@@ -9861,8 +9866,8 @@ async function solanaKeyToBytes(privateKey) {
|
|
|
9861
9866
|
return bytes;
|
|
9862
9867
|
}
|
|
9863
9868
|
try {
|
|
9864
|
-
const
|
|
9865
|
-
const bytes = (
|
|
9869
|
+
const bs582 = await import("bs58");
|
|
9870
|
+
const bytes = (bs582.default ?? bs582).decode(key);
|
|
9866
9871
|
if (bytes.length !== 64) {
|
|
9867
9872
|
throw new Error(`Invalid Solana key length: expected 64 bytes, got ${bytes.length}`);
|
|
9868
9873
|
}
|
|
@@ -10043,7 +10048,19 @@ async function getOrCreateSolanaWallet() {
|
|
|
10043
10048
|
|
|
10044
10049
|
// src/poll-ownership.ts
|
|
10045
10050
|
import { createPrivateKey, createPublicKey, sign as ed25519Sign } from "crypto";
|
|
10046
|
-
|
|
10051
|
+
|
|
10052
|
+
// src/bs58.ts
|
|
10053
|
+
import bs58Import from "bs58";
|
|
10054
|
+
function unwrapBs58(mod) {
|
|
10055
|
+
const m = mod;
|
|
10056
|
+
if (typeof m?.encode === "function") return m;
|
|
10057
|
+
const inner = m?.default;
|
|
10058
|
+
if (typeof inner?.encode === "function") return inner;
|
|
10059
|
+
throw new Error("bs58: no encode() on the module or its default export");
|
|
10060
|
+
}
|
|
10061
|
+
var bs58 = unwrapBs58(bs58Import);
|
|
10062
|
+
|
|
10063
|
+
// src/poll-ownership.ts
|
|
10047
10064
|
var POLL_AUTH_HEADERS = {
|
|
10048
10065
|
wallet: "x-poll-wallet",
|
|
10049
10066
|
timestamp: "x-poll-timestamp",
|
|
@@ -10086,7 +10103,6 @@ import { AsyncLocalStorage } from "async_hooks";
|
|
|
10086
10103
|
import { randomUUID } from "crypto";
|
|
10087
10104
|
import * as fs6 from "fs";
|
|
10088
10105
|
import * as path5 from "path";
|
|
10089
|
-
import bs582 from "bs58";
|
|
10090
10106
|
var BATCH_SCHEME = "batch-settlement";
|
|
10091
10107
|
var BLOCKRUN_SOL_OPERATOR = "5YKPQUFjw5WQqhSUkEGKNNfYYVqnRRNbpYyL71qQ1vm3";
|
|
10092
10108
|
var DEFAULT_BATCH_RATE_LIMIT = { maxAttempts: 3, maxWaitMs: 6e4 };
|
|
@@ -10665,7 +10681,7 @@ function decodeChannelAccount(owner, data) {
|
|
|
10665
10681
|
return void 0;
|
|
10666
10682
|
}
|
|
10667
10683
|
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
10668
|
-
const key = (offset) =>
|
|
10684
|
+
const key = (offset) => bs58.encode(data.subarray(offset, offset + 32));
|
|
10669
10685
|
return {
|
|
10670
10686
|
deposit: view.getBigUint64(CHANNEL.deposit, true),
|
|
10671
10687
|
settled: view.getBigUint64(CHANNEL.settled, true),
|
|
@@ -12936,6 +12952,7 @@ var SolanaLLMClient = class {
|
|
|
12936
12952
|
searchParameters: options?.searchParameters,
|
|
12937
12953
|
responseFormat: options?.responseFormat,
|
|
12938
12954
|
stop: options?.stop,
|
|
12955
|
+
reasoningEffort: options?.reasoningEffort,
|
|
12939
12956
|
fallbackModels: options?.fallbackModels
|
|
12940
12957
|
});
|
|
12941
12958
|
return result.choices[0].message.content || "";
|
|
@@ -12964,6 +12981,7 @@ var SolanaLLMClient = class {
|
|
|
12964
12981
|
if (options?.toolChoice !== void 0) body.tool_choice = options.toolChoice;
|
|
12965
12982
|
if (options?.responseFormat !== void 0) body.response_format = options.responseFormat;
|
|
12966
12983
|
if (options?.stop !== void 0) body.stop = options.stop;
|
|
12984
|
+
if (options?.reasoningEffort !== void 0) body.reasoning_effort = options.reasoningEffort;
|
|
12967
12985
|
return body;
|
|
12968
12986
|
};
|
|
12969
12987
|
const chain = [model, ...options?.fallbackModels ?? []];
|
|
@@ -13068,6 +13086,7 @@ var SolanaLLMClient = class {
|
|
|
13068
13086
|
toolChoice: options.toolChoice,
|
|
13069
13087
|
responseFormat: options.responseFormat,
|
|
13070
13088
|
stop: options.stop,
|
|
13089
|
+
reasoningEffort: options.reasoningEffort,
|
|
13071
13090
|
timeout: options.timeout,
|
|
13072
13091
|
// An explicit caller-supplied chain wins over the routed one.
|
|
13073
13092
|
fallbackModels: options.fallbackModels ?? decision.fallbacks
|
|
@@ -14427,7 +14446,8 @@ var ChatCompletions = class {
|
|
|
14427
14446
|
tools: params.tools,
|
|
14428
14447
|
toolChoice: params.tool_choice,
|
|
14429
14448
|
responseFormat: params.response_format,
|
|
14430
|
-
stop: params.stop
|
|
14449
|
+
stop: params.stop,
|
|
14450
|
+
reasoningEffort: params.reasoning_effort
|
|
14431
14451
|
}
|
|
14432
14452
|
);
|
|
14433
14453
|
return this.transformResponse(response);
|
|
@@ -14443,7 +14463,8 @@ var ChatCompletions = class {
|
|
|
14443
14463
|
tools: params.tools,
|
|
14444
14464
|
toolChoice: params.tool_choice,
|
|
14445
14465
|
responseFormat: params.response_format,
|
|
14446
|
-
stop: params.stop
|
|
14466
|
+
stop: params.stop,
|
|
14467
|
+
reasoningEffort: params.reasoning_effort
|
|
14447
14468
|
}
|
|
14448
14469
|
);
|
|
14449
14470
|
return new StreamingResponse(response, params.model);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockrun/llm",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.26.0",
|
|
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",
|