@blockrun/llm 3.11.0 → 3.12.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 +296 -194
- package/dist/index.cjs +3598 -89
- package/dist/index.d.cts +42 -16
- package/dist/index.d.ts +42 -16
- package/dist/index.js +3598 -89
- package/package.json +2 -7
package/dist/index.d.cts
CHANGED
|
@@ -252,6 +252,8 @@ interface ChatResponse {
|
|
|
252
252
|
model?: string;
|
|
253
253
|
settlementSkipped?: boolean;
|
|
254
254
|
};
|
|
255
|
+
/** Present when a `blockrun/auto|eco|premium` alias selected the model locally. */
|
|
256
|
+
routing?: RoutingDecision;
|
|
255
257
|
}
|
|
256
258
|
interface Model {
|
|
257
259
|
id: string;
|
|
@@ -490,8 +492,8 @@ interface ChatCompletionOptions {
|
|
|
490
492
|
type RoutingProfile = "eco" | "auto" | "premium";
|
|
491
493
|
type RoutingTier = Tier;
|
|
492
494
|
/**
|
|
493
|
-
* Request classification produced by the
|
|
494
|
-
*
|
|
495
|
+
* Request classification produced by the bundled Router Core V3 portfolio
|
|
496
|
+
* router. Present on decisions with `method: "portfolio"`.
|
|
495
497
|
*/
|
|
496
498
|
type RoutingTaskType = TaskType;
|
|
497
499
|
/** Primary model + ordered fallbacks for one routing tier. */
|
|
@@ -500,7 +502,7 @@ interface RoutingDecision extends RoutingDecision$1 {
|
|
|
500
502
|
/**
|
|
501
503
|
* Remaining gateway-callable models, in the router's ranked order.
|
|
502
504
|
* `chat()` walks this list when the primary model hits a transient error
|
|
503
|
-
* (timeout, network, 429, 5xx). Excludes the primary itself.
|
|
505
|
+
* (timeout, network, 429, 5xx). Excludes the primary itself. The router's
|
|
504
506
|
* proxy-namespace `free/*` ids appear here as their `nvidia/*` gateway
|
|
505
507
|
* ids (or are dropped when the mapping is proxy-only).
|
|
506
508
|
*/
|
|
@@ -512,6 +514,12 @@ interface SmartChatOptions extends ChatOptions {
|
|
|
512
514
|
/** Maximum output tokens (used for cost estimation) */
|
|
513
515
|
maxOutputTokens?: number;
|
|
514
516
|
}
|
|
517
|
+
interface SmartChatCompletionOptions extends ChatCompletionOptions {
|
|
518
|
+
/** Routing profile: eco (budget), auto (balanced), premium (best quality) */
|
|
519
|
+
routingProfile?: RoutingProfile;
|
|
520
|
+
/** Maximum output tokens used for route cost/capacity estimation. */
|
|
521
|
+
maxOutputTokens?: number;
|
|
522
|
+
}
|
|
515
523
|
interface SmartChatResponse {
|
|
516
524
|
/** The AI response text */
|
|
517
525
|
response: string;
|
|
@@ -520,6 +528,14 @@ interface SmartChatResponse {
|
|
|
520
528
|
/** Routing decision metadata */
|
|
521
529
|
routing: RoutingDecision;
|
|
522
530
|
}
|
|
531
|
+
interface SmartChatCompletionResponse {
|
|
532
|
+
/** Full OpenAI-compatible response, including tool calls. */
|
|
533
|
+
response: ChatResponse;
|
|
534
|
+
/** Model selected before any transient runtime fallback. */
|
|
535
|
+
model: string;
|
|
536
|
+
/** Local routing decision and ordered fallback candidates. */
|
|
537
|
+
routing: RoutingDecision;
|
|
538
|
+
}
|
|
523
539
|
interface SearchResult {
|
|
524
540
|
query: string;
|
|
525
541
|
summary: string;
|
|
@@ -1192,11 +1208,17 @@ declare class LLMClient {
|
|
|
1192
1208
|
* console.log(response); // 'The capital of France is Paris.'
|
|
1193
1209
|
*/
|
|
1194
1210
|
chat(model: string, prompt: string, options?: ChatOptions): Promise<string>;
|
|
1211
|
+
private makeRoutingDecision;
|
|
1212
|
+
/**
|
|
1213
|
+
* Inspect a local routing decision without making or paying for a model call.
|
|
1214
|
+
* The first invocation may fetch the public model catalog for current prices.
|
|
1215
|
+
*/
|
|
1216
|
+
route(prompt: string, options?: SmartChatOptions): Promise<RoutingDecision>;
|
|
1195
1217
|
/**
|
|
1196
1218
|
* Smart chat with automatic model routing.
|
|
1197
1219
|
*
|
|
1198
|
-
* Uses
|
|
1199
|
-
*
|
|
1220
|
+
* Uses BlockRun's product-neutral Router Core portfolio strategy: it
|
|
1221
|
+
* classifies the task shape locally (no
|
|
1200
1222
|
* extra model call), enforces capability constraints as hard filters, and
|
|
1201
1223
|
* ranks an ordered candidate portfolio — the cheapest model that can handle
|
|
1202
1224
|
* the request wins, and the rest become the transient-error fallback chain.
|
|
@@ -1224,21 +1246,14 @@ declare class LLMClient {
|
|
|
1224
1246
|
* ```
|
|
1225
1247
|
*/
|
|
1226
1248
|
smartChat(prompt: string, options?: SmartChatOptions): Promise<SmartChatResponse>;
|
|
1249
|
+
/** Route a full Agent/tool conversation while preserving its complete response. */
|
|
1250
|
+
smartChatCompletion(messages: ChatMessage[], options?: SmartChatCompletionOptions): Promise<SmartChatCompletionResponse>;
|
|
1227
1251
|
/**
|
|
1228
1252
|
* Get model pricing map (cached).
|
|
1229
1253
|
* Fetches from API on first call, then returns cached result.
|
|
1230
1254
|
*/
|
|
1231
1255
|
private getModelPricing;
|
|
1232
|
-
/**
|
|
1233
|
-
* Fetch model pricing from API.
|
|
1234
|
-
*
|
|
1235
|
-
* For flat-billed models (e.g. ZAI GLM-5 family at $0.001/call) the
|
|
1236
|
-
* router still expects per-token rates, so we synthesise an equivalent
|
|
1237
|
-
* per-token price assuming ~1500 total tokens per call. Without this,
|
|
1238
|
-
* flat models would resolve to inputPrice=outputPrice=0 and the router
|
|
1239
|
-
* would treat them as free, biasing routing decisions and reporting
|
|
1240
|
-
* inflated savings %.
|
|
1241
|
-
*/
|
|
1256
|
+
/** Fetch model pricing from the live catalog, preserving flat billing. */
|
|
1242
1257
|
private fetchModelPricing;
|
|
1243
1258
|
/**
|
|
1244
1259
|
* Full chat completion interface (OpenAI-compatible).
|
|
@@ -2908,6 +2923,8 @@ declare class SolanaLLMClient {
|
|
|
2908
2923
|
private sessionTotalUsd;
|
|
2909
2924
|
private sessionCalls;
|
|
2910
2925
|
private addressCache;
|
|
2926
|
+
private modelPricingCache;
|
|
2927
|
+
private modelPricingPromise;
|
|
2911
2928
|
constructor(options?: SolanaLLMClientOptions);
|
|
2912
2929
|
/** Get Solana wallet address (public key in base58). */
|
|
2913
2930
|
getWalletAddress(): Promise<string>;
|
|
@@ -2915,6 +2932,13 @@ declare class SolanaLLMClient {
|
|
|
2915
2932
|
chat(model: string, prompt: string, options?: ChatOptions): Promise<string>;
|
|
2916
2933
|
/** Full chat completion (OpenAI-compatible). */
|
|
2917
2934
|
chatCompletion(model: string, messages: ChatMessage[], options?: ChatCompletionOptions): Promise<ChatResponse>;
|
|
2935
|
+
private getModelPricing;
|
|
2936
|
+
/** Inspect a Solana route without making or paying for a model call. */
|
|
2937
|
+
route(prompt: string, options?: SmartChatOptions): Promise<RoutingDecision>;
|
|
2938
|
+
/** Smart one-line chat paid on Solana. */
|
|
2939
|
+
smartChat(prompt: string, options?: SmartChatOptions): Promise<SmartChatResponse>;
|
|
2940
|
+
/** Smart full message/tool completion paid on Solana. */
|
|
2941
|
+
smartChatCompletion(messages: ChatMessage[], options?: SmartChatCompletionOptions): Promise<SmartChatCompletionResponse>;
|
|
2918
2942
|
/** List available models. */
|
|
2919
2943
|
listModels(): Promise<Model[]>;
|
|
2920
2944
|
/**
|
|
@@ -3257,6 +3281,8 @@ interface OpenAIChatCompletionResponse {
|
|
|
3257
3281
|
completion_tokens: number;
|
|
3258
3282
|
total_tokens: number;
|
|
3259
3283
|
};
|
|
3284
|
+
/** BlockRun extension present when a `blockrun/*` Auto alias was used. */
|
|
3285
|
+
routing?: RoutingDecision;
|
|
3260
3286
|
}
|
|
3261
3287
|
interface OpenAIChatCompletionChunk {
|
|
3262
3288
|
id: string;
|
|
@@ -3414,4 +3440,4 @@ declare function validateTemperature(temperature?: number): void;
|
|
|
3414
3440
|
*/
|
|
3415
3441
|
declare function validateTopP(topP?: number): void;
|
|
3416
3442
|
|
|
3417
|
-
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, RetiredEndpointError, 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 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 };
|
|
3443
|
+
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, RetiredEndpointError, 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 SmartChatCompletionOptions, type SmartChatCompletionResponse, 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
|
@@ -252,6 +252,8 @@ interface ChatResponse {
|
|
|
252
252
|
model?: string;
|
|
253
253
|
settlementSkipped?: boolean;
|
|
254
254
|
};
|
|
255
|
+
/** Present when a `blockrun/auto|eco|premium` alias selected the model locally. */
|
|
256
|
+
routing?: RoutingDecision;
|
|
255
257
|
}
|
|
256
258
|
interface Model {
|
|
257
259
|
id: string;
|
|
@@ -490,8 +492,8 @@ interface ChatCompletionOptions {
|
|
|
490
492
|
type RoutingProfile = "eco" | "auto" | "premium";
|
|
491
493
|
type RoutingTier = Tier;
|
|
492
494
|
/**
|
|
493
|
-
* Request classification produced by the
|
|
494
|
-
*
|
|
495
|
+
* Request classification produced by the bundled Router Core V3 portfolio
|
|
496
|
+
* router. Present on decisions with `method: "portfolio"`.
|
|
495
497
|
*/
|
|
496
498
|
type RoutingTaskType = TaskType;
|
|
497
499
|
/** Primary model + ordered fallbacks for one routing tier. */
|
|
@@ -500,7 +502,7 @@ interface RoutingDecision extends RoutingDecision$1 {
|
|
|
500
502
|
/**
|
|
501
503
|
* Remaining gateway-callable models, in the router's ranked order.
|
|
502
504
|
* `chat()` walks this list when the primary model hits a transient error
|
|
503
|
-
* (timeout, network, 429, 5xx). Excludes the primary itself.
|
|
505
|
+
* (timeout, network, 429, 5xx). Excludes the primary itself. The router's
|
|
504
506
|
* proxy-namespace `free/*` ids appear here as their `nvidia/*` gateway
|
|
505
507
|
* ids (or are dropped when the mapping is proxy-only).
|
|
506
508
|
*/
|
|
@@ -512,6 +514,12 @@ interface SmartChatOptions extends ChatOptions {
|
|
|
512
514
|
/** Maximum output tokens (used for cost estimation) */
|
|
513
515
|
maxOutputTokens?: number;
|
|
514
516
|
}
|
|
517
|
+
interface SmartChatCompletionOptions extends ChatCompletionOptions {
|
|
518
|
+
/** Routing profile: eco (budget), auto (balanced), premium (best quality) */
|
|
519
|
+
routingProfile?: RoutingProfile;
|
|
520
|
+
/** Maximum output tokens used for route cost/capacity estimation. */
|
|
521
|
+
maxOutputTokens?: number;
|
|
522
|
+
}
|
|
515
523
|
interface SmartChatResponse {
|
|
516
524
|
/** The AI response text */
|
|
517
525
|
response: string;
|
|
@@ -520,6 +528,14 @@ interface SmartChatResponse {
|
|
|
520
528
|
/** Routing decision metadata */
|
|
521
529
|
routing: RoutingDecision;
|
|
522
530
|
}
|
|
531
|
+
interface SmartChatCompletionResponse {
|
|
532
|
+
/** Full OpenAI-compatible response, including tool calls. */
|
|
533
|
+
response: ChatResponse;
|
|
534
|
+
/** Model selected before any transient runtime fallback. */
|
|
535
|
+
model: string;
|
|
536
|
+
/** Local routing decision and ordered fallback candidates. */
|
|
537
|
+
routing: RoutingDecision;
|
|
538
|
+
}
|
|
523
539
|
interface SearchResult {
|
|
524
540
|
query: string;
|
|
525
541
|
summary: string;
|
|
@@ -1192,11 +1208,17 @@ declare class LLMClient {
|
|
|
1192
1208
|
* console.log(response); // 'The capital of France is Paris.'
|
|
1193
1209
|
*/
|
|
1194
1210
|
chat(model: string, prompt: string, options?: ChatOptions): Promise<string>;
|
|
1211
|
+
private makeRoutingDecision;
|
|
1212
|
+
/**
|
|
1213
|
+
* Inspect a local routing decision without making or paying for a model call.
|
|
1214
|
+
* The first invocation may fetch the public model catalog for current prices.
|
|
1215
|
+
*/
|
|
1216
|
+
route(prompt: string, options?: SmartChatOptions): Promise<RoutingDecision>;
|
|
1195
1217
|
/**
|
|
1196
1218
|
* Smart chat with automatic model routing.
|
|
1197
1219
|
*
|
|
1198
|
-
* Uses
|
|
1199
|
-
*
|
|
1220
|
+
* Uses BlockRun's product-neutral Router Core portfolio strategy: it
|
|
1221
|
+
* classifies the task shape locally (no
|
|
1200
1222
|
* extra model call), enforces capability constraints as hard filters, and
|
|
1201
1223
|
* ranks an ordered candidate portfolio — the cheapest model that can handle
|
|
1202
1224
|
* the request wins, and the rest become the transient-error fallback chain.
|
|
@@ -1224,21 +1246,14 @@ declare class LLMClient {
|
|
|
1224
1246
|
* ```
|
|
1225
1247
|
*/
|
|
1226
1248
|
smartChat(prompt: string, options?: SmartChatOptions): Promise<SmartChatResponse>;
|
|
1249
|
+
/** Route a full Agent/tool conversation while preserving its complete response. */
|
|
1250
|
+
smartChatCompletion(messages: ChatMessage[], options?: SmartChatCompletionOptions): Promise<SmartChatCompletionResponse>;
|
|
1227
1251
|
/**
|
|
1228
1252
|
* Get model pricing map (cached).
|
|
1229
1253
|
* Fetches from API on first call, then returns cached result.
|
|
1230
1254
|
*/
|
|
1231
1255
|
private getModelPricing;
|
|
1232
|
-
/**
|
|
1233
|
-
* Fetch model pricing from API.
|
|
1234
|
-
*
|
|
1235
|
-
* For flat-billed models (e.g. ZAI GLM-5 family at $0.001/call) the
|
|
1236
|
-
* router still expects per-token rates, so we synthesise an equivalent
|
|
1237
|
-
* per-token price assuming ~1500 total tokens per call. Without this,
|
|
1238
|
-
* flat models would resolve to inputPrice=outputPrice=0 and the router
|
|
1239
|
-
* would treat them as free, biasing routing decisions and reporting
|
|
1240
|
-
* inflated savings %.
|
|
1241
|
-
*/
|
|
1256
|
+
/** Fetch model pricing from the live catalog, preserving flat billing. */
|
|
1242
1257
|
private fetchModelPricing;
|
|
1243
1258
|
/**
|
|
1244
1259
|
* Full chat completion interface (OpenAI-compatible).
|
|
@@ -2908,6 +2923,8 @@ declare class SolanaLLMClient {
|
|
|
2908
2923
|
private sessionTotalUsd;
|
|
2909
2924
|
private sessionCalls;
|
|
2910
2925
|
private addressCache;
|
|
2926
|
+
private modelPricingCache;
|
|
2927
|
+
private modelPricingPromise;
|
|
2911
2928
|
constructor(options?: SolanaLLMClientOptions);
|
|
2912
2929
|
/** Get Solana wallet address (public key in base58). */
|
|
2913
2930
|
getWalletAddress(): Promise<string>;
|
|
@@ -2915,6 +2932,13 @@ declare class SolanaLLMClient {
|
|
|
2915
2932
|
chat(model: string, prompt: string, options?: ChatOptions): Promise<string>;
|
|
2916
2933
|
/** Full chat completion (OpenAI-compatible). */
|
|
2917
2934
|
chatCompletion(model: string, messages: ChatMessage[], options?: ChatCompletionOptions): Promise<ChatResponse>;
|
|
2935
|
+
private getModelPricing;
|
|
2936
|
+
/** Inspect a Solana route without making or paying for a model call. */
|
|
2937
|
+
route(prompt: string, options?: SmartChatOptions): Promise<RoutingDecision>;
|
|
2938
|
+
/** Smart one-line chat paid on Solana. */
|
|
2939
|
+
smartChat(prompt: string, options?: SmartChatOptions): Promise<SmartChatResponse>;
|
|
2940
|
+
/** Smart full message/tool completion paid on Solana. */
|
|
2941
|
+
smartChatCompletion(messages: ChatMessage[], options?: SmartChatCompletionOptions): Promise<SmartChatCompletionResponse>;
|
|
2918
2942
|
/** List available models. */
|
|
2919
2943
|
listModels(): Promise<Model[]>;
|
|
2920
2944
|
/**
|
|
@@ -3257,6 +3281,8 @@ interface OpenAIChatCompletionResponse {
|
|
|
3257
3281
|
completion_tokens: number;
|
|
3258
3282
|
total_tokens: number;
|
|
3259
3283
|
};
|
|
3284
|
+
/** BlockRun extension present when a `blockrun/*` Auto alias was used. */
|
|
3285
|
+
routing?: RoutingDecision;
|
|
3260
3286
|
}
|
|
3261
3287
|
interface OpenAIChatCompletionChunk {
|
|
3262
3288
|
id: string;
|
|
@@ -3414,4 +3440,4 @@ declare function validateTemperature(temperature?: number): void;
|
|
|
3414
3440
|
*/
|
|
3415
3441
|
declare function validateTopP(topP?: number): void;
|
|
3416
3442
|
|
|
3417
|
-
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, RetiredEndpointError, 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 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 };
|
|
3443
|
+
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, RetiredEndpointError, 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 SmartChatCompletionOptions, type SmartChatCompletionResponse, 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 };
|