@blockrun/llm 3.8.2 → 3.8.3
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 +1 -12
- package/dist/index.d.cts +19 -30
- package/dist/index.d.ts +19 -30
- package/dist/index.js +1 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -38,7 +38,6 @@ __export(index_exports, {
|
|
|
38
38
|
ImageClient: () => ImageClient,
|
|
39
39
|
KNOWN_PROVIDERS: () => KNOWN_PROVIDERS,
|
|
40
40
|
LLMClient: () => LLMClient,
|
|
41
|
-
MAX_TOKENS_SANITY_LIMIT: () => MAX_TOKENS_SANITY_LIMIT,
|
|
42
41
|
MusicClient: () => MusicClient,
|
|
43
42
|
NETWORK_ALIASES: () => NETWORK_ALIASES,
|
|
44
43
|
OpenAI: () => OpenAI,
|
|
@@ -356,7 +355,6 @@ function validateModel(model) {
|
|
|
356
355
|
throw new Error("Model must be a non-empty string");
|
|
357
356
|
}
|
|
358
357
|
}
|
|
359
|
-
var MAX_TOKENS_SANITY_LIMIT = 1e6;
|
|
360
358
|
function validateMaxTokens(maxTokens) {
|
|
361
359
|
if (maxTokens === void 0 || maxTokens === null) {
|
|
362
360
|
return;
|
|
@@ -367,14 +365,6 @@ function validateMaxTokens(maxTokens) {
|
|
|
367
365
|
if (maxTokens < 1) {
|
|
368
366
|
throw new Error("maxTokens must be positive (minimum: 1)");
|
|
369
367
|
}
|
|
370
|
-
if (maxTokens > MAX_TOKENS_SANITY_LIMIT) {
|
|
371
|
-
throw Object.assign(
|
|
372
|
-
new Error(
|
|
373
|
-
`maxTokens implausibly large (client-side sanity limit: ${MAX_TOKENS_SANITY_LIMIT}). This is not a model limit \u2014 the gateway enforces the real per-model ceiling and reports it.`
|
|
374
|
-
),
|
|
375
|
-
{ code: "MAX_TOKENS_SANITY_LIMIT", limit: MAX_TOKENS_SANITY_LIMIT }
|
|
376
|
-
);
|
|
377
|
-
}
|
|
378
368
|
}
|
|
379
369
|
function validateTemperature(temperature) {
|
|
380
370
|
if (temperature === void 0 || temperature === null) {
|
|
@@ -514,7 +504,7 @@ function getCostSummary() {
|
|
|
514
504
|
}
|
|
515
505
|
|
|
516
506
|
// src/version.ts
|
|
517
|
-
var SDK_VERSION = "3.8.
|
|
507
|
+
var SDK_VERSION = "3.8.3";
|
|
518
508
|
var USER_AGENT = `blockrun-ts/${SDK_VERSION}`;
|
|
519
509
|
|
|
520
510
|
// src/client.ts
|
|
@@ -6139,7 +6129,6 @@ var AnthropicClient = class {
|
|
|
6139
6129
|
ImageClient,
|
|
6140
6130
|
KNOWN_PROVIDERS,
|
|
6141
6131
|
LLMClient,
|
|
6142
|
-
MAX_TOKENS_SANITY_LIMIT,
|
|
6143
6132
|
MusicClient,
|
|
6144
6133
|
NETWORK_ALIASES,
|
|
6145
6134
|
OpenAI,
|
package/dist/index.d.cts
CHANGED
|
@@ -3161,37 +3161,26 @@ declare const KNOWN_PROVIDERS: Set<string>;
|
|
|
3161
3161
|
*/
|
|
3162
3162
|
declare function validateModel(model: string): void;
|
|
3163
3163
|
/**
|
|
3164
|
-
*
|
|
3165
|
-
*
|
|
3166
|
-
*
|
|
3167
|
-
*
|
|
3168
|
-
*
|
|
3169
|
-
*
|
|
3170
|
-
*
|
|
3171
|
-
*
|
|
3172
|
-
*
|
|
3173
|
-
*
|
|
3174
|
-
*
|
|
3175
|
-
*
|
|
3176
|
-
*
|
|
3177
|
-
*
|
|
3178
|
-
*
|
|
3179
|
-
*
|
|
3180
|
-
*
|
|
3181
|
-
* as-of-date probe results, not a maintained invariant — nothing in this repo
|
|
3182
|
-
* ships a model catalog, so CI cannot detect when they go stale.
|
|
3183
|
-
*
|
|
3184
|
-
* Keep a bound so an obvious mistake (1e9, a byte count, a timestamp) fails
|
|
3185
|
-
* fast locally instead of becoming a payment quote. Set it far above any real
|
|
3186
|
-
* model so it can never be the binding constraint again.
|
|
3187
|
-
*/
|
|
3188
|
-
declare const MAX_TOKENS_SANITY_LIMIT = 1000000;
|
|
3189
|
-
/**
|
|
3190
|
-
* Validates that max_tokens is a positive integer no larger than
|
|
3191
|
-
* {@link MAX_TOKENS_SANITY_LIMIT}.
|
|
3164
|
+
* Mirrors the gateway's own contract for `max_tokens`, which is exactly
|
|
3165
|
+
* `z.number().int().min(1).optional()` — an integer, at least 1, and
|
|
3166
|
+
* deliberately **no upper bound**.
|
|
3167
|
+
*
|
|
3168
|
+
* There is no ceiling here on purpose. The gateway clamps every request with
|
|
3169
|
+
* `min(requested, model.maxOutput, contextHeadroom)` and then quotes only a
|
|
3170
|
+
* fraction of the clamped value, so an oversized `maxTokens` cannot inflate a
|
|
3171
|
+
* payment: 1e9 and 1_000_000 produce a byte-identical quote, because both land
|
|
3172
|
+
* on the same `model.maxOutput`. A client-side ceiling could therefore only
|
|
3173
|
+
* ever reject a request the gateway would have accepted and handled correctly.
|
|
3174
|
+
*
|
|
3175
|
+
* Earlier versions of this file did carry one, justified in a comment as
|
|
3176
|
+
* stopping a stray 1e9 from "becoming a payment quote". That was never true —
|
|
3177
|
+
* it was asserted here without being checked against the route handler, which
|
|
3178
|
+
* is the same mistake as the old `"maxTokens too large (maximum: 100000)"`
|
|
3179
|
+
* message that got recorded downstream as an upstream model ceiling. Verify
|
|
3180
|
+
* against the gateway before reintroducing any number in this file.
|
|
3192
3181
|
*
|
|
3193
3182
|
* @param maxTokens - Maximum number of tokens to generate
|
|
3194
|
-
* @throws {Error} If maxTokens is
|
|
3183
|
+
* @throws {Error} If maxTokens is not a positive integer
|
|
3195
3184
|
*
|
|
3196
3185
|
* @example
|
|
3197
3186
|
* validateMaxTokens(1000);
|
|
@@ -3218,4 +3207,4 @@ declare function validateTemperature(temperature?: number): void;
|
|
|
3218
3207
|
*/
|
|
3219
3208
|
declare function validateTopP(topP?: number): void;
|
|
3220
3209
|
|
|
3221
|
-
export { APIError, AnthropicClient, type AudioModel, type AudioTrack, BASE_CHAIN_ID, type BarResolution, 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, 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,
|
|
3210
|
+
export { APIError, AnthropicClient, type AudioModel, type AudioTrack, BASE_CHAIN_ID, type BarResolution, 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, 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, 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 ResponseFormat, type RoutingDecision, type RoutingProfile, type RoutingTier, 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 SmartChatOptions, type SmartChatResponse, 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_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, 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 XSearchSource, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatSolanaWalletMigrationNotice, formatWalletCreatedMessage, formatWalletMigrationNotice, getCached, getCachedByRequest, getCostLogSummary, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, importSolanaWallet, importWallet, listDiscoveredSolanaWallets, listDiscoveredWallets, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, validateMaxTokens, validateModel, validateTemperature, validateTopP };
|
package/dist/index.d.ts
CHANGED
|
@@ -3161,37 +3161,26 @@ declare const KNOWN_PROVIDERS: Set<string>;
|
|
|
3161
3161
|
*/
|
|
3162
3162
|
declare function validateModel(model: string): void;
|
|
3163
3163
|
/**
|
|
3164
|
-
*
|
|
3165
|
-
*
|
|
3166
|
-
*
|
|
3167
|
-
*
|
|
3168
|
-
*
|
|
3169
|
-
*
|
|
3170
|
-
*
|
|
3171
|
-
*
|
|
3172
|
-
*
|
|
3173
|
-
*
|
|
3174
|
-
*
|
|
3175
|
-
*
|
|
3176
|
-
*
|
|
3177
|
-
*
|
|
3178
|
-
*
|
|
3179
|
-
*
|
|
3180
|
-
*
|
|
3181
|
-
* as-of-date probe results, not a maintained invariant — nothing in this repo
|
|
3182
|
-
* ships a model catalog, so CI cannot detect when they go stale.
|
|
3183
|
-
*
|
|
3184
|
-
* Keep a bound so an obvious mistake (1e9, a byte count, a timestamp) fails
|
|
3185
|
-
* fast locally instead of becoming a payment quote. Set it far above any real
|
|
3186
|
-
* model so it can never be the binding constraint again.
|
|
3187
|
-
*/
|
|
3188
|
-
declare const MAX_TOKENS_SANITY_LIMIT = 1000000;
|
|
3189
|
-
/**
|
|
3190
|
-
* Validates that max_tokens is a positive integer no larger than
|
|
3191
|
-
* {@link MAX_TOKENS_SANITY_LIMIT}.
|
|
3164
|
+
* Mirrors the gateway's own contract for `max_tokens`, which is exactly
|
|
3165
|
+
* `z.number().int().min(1).optional()` — an integer, at least 1, and
|
|
3166
|
+
* deliberately **no upper bound**.
|
|
3167
|
+
*
|
|
3168
|
+
* There is no ceiling here on purpose. The gateway clamps every request with
|
|
3169
|
+
* `min(requested, model.maxOutput, contextHeadroom)` and then quotes only a
|
|
3170
|
+
* fraction of the clamped value, so an oversized `maxTokens` cannot inflate a
|
|
3171
|
+
* payment: 1e9 and 1_000_000 produce a byte-identical quote, because both land
|
|
3172
|
+
* on the same `model.maxOutput`. A client-side ceiling could therefore only
|
|
3173
|
+
* ever reject a request the gateway would have accepted and handled correctly.
|
|
3174
|
+
*
|
|
3175
|
+
* Earlier versions of this file did carry one, justified in a comment as
|
|
3176
|
+
* stopping a stray 1e9 from "becoming a payment quote". That was never true —
|
|
3177
|
+
* it was asserted here without being checked against the route handler, which
|
|
3178
|
+
* is the same mistake as the old `"maxTokens too large (maximum: 100000)"`
|
|
3179
|
+
* message that got recorded downstream as an upstream model ceiling. Verify
|
|
3180
|
+
* against the gateway before reintroducing any number in this file.
|
|
3192
3181
|
*
|
|
3193
3182
|
* @param maxTokens - Maximum number of tokens to generate
|
|
3194
|
-
* @throws {Error} If maxTokens is
|
|
3183
|
+
* @throws {Error} If maxTokens is not a positive integer
|
|
3195
3184
|
*
|
|
3196
3185
|
* @example
|
|
3197
3186
|
* validateMaxTokens(1000);
|
|
@@ -3218,4 +3207,4 @@ declare function validateTemperature(temperature?: number): void;
|
|
|
3218
3207
|
*/
|
|
3219
3208
|
declare function validateTopP(topP?: number): void;
|
|
3220
3209
|
|
|
3221
|
-
export { APIError, AnthropicClient, type AudioModel, type AudioTrack, BASE_CHAIN_ID, type BarResolution, 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, 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,
|
|
3210
|
+
export { APIError, AnthropicClient, type AudioModel, type AudioTrack, BASE_CHAIN_ID, type BarResolution, 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, 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, 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 ResponseFormat, type RoutingDecision, type RoutingProfile, type RoutingTier, 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 SmartChatOptions, type SmartChatResponse, 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_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, 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 XSearchSource, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatSolanaWalletMigrationNotice, formatWalletCreatedMessage, formatWalletMigrationNotice, getCached, getCachedByRequest, getCostLogSummary, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, importSolanaWallet, importWallet, listDiscoveredSolanaWallets, listDiscoveredWallets, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, validateMaxTokens, validateModel, validateTemperature, validateTopP };
|
package/dist/index.js
CHANGED
|
@@ -242,7 +242,6 @@ function validateModel(model) {
|
|
|
242
242
|
throw new Error("Model must be a non-empty string");
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
-
var MAX_TOKENS_SANITY_LIMIT = 1e6;
|
|
246
245
|
function validateMaxTokens(maxTokens) {
|
|
247
246
|
if (maxTokens === void 0 || maxTokens === null) {
|
|
248
247
|
return;
|
|
@@ -253,14 +252,6 @@ function validateMaxTokens(maxTokens) {
|
|
|
253
252
|
if (maxTokens < 1) {
|
|
254
253
|
throw new Error("maxTokens must be positive (minimum: 1)");
|
|
255
254
|
}
|
|
256
|
-
if (maxTokens > MAX_TOKENS_SANITY_LIMIT) {
|
|
257
|
-
throw Object.assign(
|
|
258
|
-
new Error(
|
|
259
|
-
`maxTokens implausibly large (client-side sanity limit: ${MAX_TOKENS_SANITY_LIMIT}). This is not a model limit \u2014 the gateway enforces the real per-model ceiling and reports it.`
|
|
260
|
-
),
|
|
261
|
-
{ code: "MAX_TOKENS_SANITY_LIMIT", limit: MAX_TOKENS_SANITY_LIMIT }
|
|
262
|
-
);
|
|
263
|
-
}
|
|
264
255
|
}
|
|
265
256
|
function validateTemperature(temperature) {
|
|
266
257
|
if (temperature === void 0 || temperature === null) {
|
|
@@ -400,7 +391,7 @@ function getCostSummary() {
|
|
|
400
391
|
}
|
|
401
392
|
|
|
402
393
|
// src/version.ts
|
|
403
|
-
var SDK_VERSION = "3.8.
|
|
394
|
+
var SDK_VERSION = "3.8.3";
|
|
404
395
|
var USER_AGENT = `blockrun-ts/${SDK_VERSION}`;
|
|
405
396
|
|
|
406
397
|
// src/client.ts
|
|
@@ -6024,7 +6015,6 @@ export {
|
|
|
6024
6015
|
ImageClient,
|
|
6025
6016
|
KNOWN_PROVIDERS,
|
|
6026
6017
|
LLMClient,
|
|
6027
|
-
MAX_TOKENS_SANITY_LIMIT,
|
|
6028
6018
|
MusicClient,
|
|
6029
6019
|
NETWORK_ALIASES,
|
|
6030
6020
|
OpenAI,
|