You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@blockrun/llm

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blockrun/llm - npm Package Compare versions

Comparing version
1.4.3
to
1.5.0
+109
-11
dist/index.d.cts

@@ -143,2 +143,7 @@ import * as _anthropic_ai_sdk from '@anthropic-ai/sdk';

}
/** Usage info for Live Search sources */
interface SearchUsage {
/** Number of search sources used in the response */
numSourcesUsed?: number;
}
interface Spending {

@@ -148,2 +153,35 @@ totalUsd: number;

}
/** Pre-request cost estimate for a chat call */
interface CostEstimate {
/** Model ID used for the estimate */
model: string;
/** Estimated input token count */
estimatedInputTokens: number;
/** Estimated output token count */
estimatedOutputTokens: number;
/** Estimated cost in USD */
estimatedCostUsd: number;
}
/** Per-call spending report with running session totals */
interface SpendingReport {
/** Model ID used */
model: string;
/** Input tokens consumed */
inputTokens: number;
/** Output tokens consumed */
outputTokens: number;
/** Cost of this call in USD */
costUsd: number;
/** Cumulative session spend in USD */
sessionTotalUsd: number;
/** Total number of calls in this session */
sessionCalls: number;
}
/** Chat response bundled with its spending report */
interface ChatResponseWithCost {
/** The chat completion response */
response: ChatResponse;
/** Spending report for this call */
spendingReport: SpendingReport;
}
interface ResourceInfo {

@@ -189,5 +227,5 @@ url: string;

topP?: number;
/** Enable xAI Live Search (shortcut for searchParameters.mode = "on") */
/** Enable Live Search (shortcut for searchParameters.mode = "on") */
search?: boolean;
/** Full xAI Live Search configuration (for Grok models) */
/** Full Live Search configuration (for search-enabled models) */
searchParameters?: SearchParameters;

@@ -202,5 +240,5 @@ }

topP?: number;
/** Enable xAI Live Search (shortcut for searchParameters.mode = "on") */
/** Enable Live Search (shortcut for searchParameters.mode = "on") */
search?: boolean;
/** Full xAI Live Search configuration (for Grok models) */
/** Full Live Search configuration (for search-enabled models) */
searchParameters?: SearchParameters;

@@ -413,3 +451,3 @@ /** Tool definitions for function calling */

*
* const response = await client.chat('openai/gpt-4o', 'Hello!');
* const response = await client.chat('openai/gpt-5.2', 'Hello!');
* console.log(response);

@@ -462,3 +500,3 @@ */

*
* @param model - Model ID (e.g., 'openai/gpt-4o', 'anthropic/claude-sonnet-4')
* @param model - Model ID (e.g., 'openai/gpt-5.2', 'anthropic/claude-sonnet-4.6')
* @param prompt - User message

@@ -469,3 +507,3 @@ * @param options - Optional chat parameters

* @example
* const response = await client.chat('gpt-4o', 'What is the capital of France?');
* const response = await client.chat('gpt-5.2', 'What is the capital of France?');
* console.log(response); // 'The capital of France is Paris.'

@@ -1118,3 +1156,3 @@ */

*
* const response = await client.chat('openai/gpt-4o', 'gm Solana');
* const response = await client.chat('openai/gpt-5.2', 'gm Solana');
*/

@@ -1239,2 +1277,7 @@

declare function clearCache(): number;
declare function getCostLogSummary(): {
totalUsd: number;
calls: number;
byEndpoint: Record<string, number>;
};

@@ -1289,3 +1332,3 @@ /**

* const response = await client.chat.completions.create({
* model: 'gpt-4o',
* model: 'gpt-5.2',
* messages: [{ role: 'user', content: 'Hello!' }]

@@ -1397,3 +1440,3 @@ * });

* const response = await client.chat.completions.create({
* model: 'gpt-4o',
* model: 'gpt-5.2',
* messages: [{ role: 'user', content: 'Hello!' }]

@@ -1433,2 +1476,57 @@ * });

export { APIError, AnthropicClient, BASE_CHAIN_ID, type BlockRunAnthropicOptions, BlockrunError, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatUsage, type CostEntry, type CreatePaymentOptions, type FunctionCall, type FunctionDefinition, ImageClient, type ImageClientOptions, type ImageData, type ImageEditOptions, type ImageGenerateOptions, type ImageModel, type ImageResponse, LLMClient, type LLMClientOptions, type Model, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PaymentError, type PaymentLinks, type RoutingDecision, type RoutingProfile, type RoutingTier, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SmartChatOptions, type SmartChatResponse, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type Spending, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XArticlesRisingResponse, type XAuthorAnalyticsResponse, type XCompareAuthorsResponse, type XFollower, type XFollowersResponse, type XFollowingsResponse, type XMentionsResponse, type XSearchResponse, type XSearchSource, type XTrendingResponse, type XTweet, type XTweetLookupResponse, type XTweetRepliesResponse, type XTweetThreadResponse, type XTweetsResponse, type XUser, type XUserInfoResponse, type XUserLookupResponse, type XVerifiedFollowersResponse, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatWalletCreatedMessage, getCached, getCachedByRequest, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, testnetClient };
/**
* Input validation and security utilities for BlockRun LLM SDK.
*
* This module provides validation functions to ensure:
* - Private keys are properly formatted
* - API URLs use HTTPS
* - Server responses don't leak sensitive information
* - Resource URLs match expected domains
*/
/**
* Known LLM providers (for optional validation).
*/
declare const KNOWN_PROVIDERS: Set<string>;
/**
* Validates that a model ID is a non-empty string.
*
* @param model - The model ID (e.g., "openai/gpt-5.2", "anthropic/claude-sonnet-4.5")
* @throws {Error} If the model is invalid
*
* @example
* validateModel("openai/gpt-5.2");
*/
declare function validateModel(model: string): void;
/**
* Validates that max_tokens is an integer between 1 and 100,000.
*
* @param maxTokens - Maximum number of tokens to generate
* @throws {Error} If maxTokens is invalid
*
* @example
* validateMaxTokens(1000);
*/
declare function validateMaxTokens(maxTokens?: number): void;
/**
* Validates that temperature is a number between 0 and 2.
*
* @param temperature - Sampling temperature (0-2)
* @throws {Error} If temperature is invalid
*
* @example
* validateTemperature(0.7);
*/
declare function validateTemperature(temperature?: number): void;
/**
* Validates that top_p is a number between 0 and 1.
*
* @param topP - Top-p sampling parameter (0-1)
* @throws {Error} If topP is invalid
*
* @example
* validateTopP(0.9);
*/
declare function validateTopP(topP?: number): void;
export { APIError, AnthropicClient, BASE_CHAIN_ID, type BlockRunAnthropicOptions, BlockrunError, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatResponseWithCost, type ChatUsage, type CostEntry, type CostEstimate, type CreatePaymentOptions, type FunctionCall, type FunctionDefinition, ImageClient, type ImageClientOptions, type ImageData, type ImageEditOptions, type ImageGenerateOptions, type ImageModel, type ImageResponse, KNOWN_PROVIDERS, LLMClient, type LLMClientOptions, type Model, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PaymentError, type PaymentLinks, type RoutingDecision, type RoutingProfile, type RoutingTier, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SearchUsage, type SmartChatOptions, type SmartChatResponse, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type Spending, type SpendingReport, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XArticlesRisingResponse, type XAuthorAnalyticsResponse, type XCompareAuthorsResponse, type XFollower, type XFollowersResponse, type XFollowingsResponse, type XMentionsResponse, type XSearchResponse, type XSearchSource, type XTrendingResponse, type XTweet, type XTweetLookupResponse, type XTweetRepliesResponse, type XTweetThreadResponse, type XTweetsResponse, type XUser, type XUserInfoResponse, type XUserLookupResponse, type XVerifiedFollowersResponse, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatWalletCreatedMessage, getCached, getCachedByRequest, getCostLogSummary, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, testnetClient, validateMaxTokens, validateModel, validateTemperature, validateTopP };

@@ -143,2 +143,7 @@ import * as _anthropic_ai_sdk from '@anthropic-ai/sdk';

}
/** Usage info for Live Search sources */
interface SearchUsage {
/** Number of search sources used in the response */
numSourcesUsed?: number;
}
interface Spending {

@@ -148,2 +153,35 @@ totalUsd: number;

}
/** Pre-request cost estimate for a chat call */
interface CostEstimate {
/** Model ID used for the estimate */
model: string;
/** Estimated input token count */
estimatedInputTokens: number;
/** Estimated output token count */
estimatedOutputTokens: number;
/** Estimated cost in USD */
estimatedCostUsd: number;
}
/** Per-call spending report with running session totals */
interface SpendingReport {
/** Model ID used */
model: string;
/** Input tokens consumed */
inputTokens: number;
/** Output tokens consumed */
outputTokens: number;
/** Cost of this call in USD */
costUsd: number;
/** Cumulative session spend in USD */
sessionTotalUsd: number;
/** Total number of calls in this session */
sessionCalls: number;
}
/** Chat response bundled with its spending report */
interface ChatResponseWithCost {
/** The chat completion response */
response: ChatResponse;
/** Spending report for this call */
spendingReport: SpendingReport;
}
interface ResourceInfo {

@@ -189,5 +227,5 @@ url: string;

topP?: number;
/** Enable xAI Live Search (shortcut for searchParameters.mode = "on") */
/** Enable Live Search (shortcut for searchParameters.mode = "on") */
search?: boolean;
/** Full xAI Live Search configuration (for Grok models) */
/** Full Live Search configuration (for search-enabled models) */
searchParameters?: SearchParameters;

@@ -202,5 +240,5 @@ }

topP?: number;
/** Enable xAI Live Search (shortcut for searchParameters.mode = "on") */
/** Enable Live Search (shortcut for searchParameters.mode = "on") */
search?: boolean;
/** Full xAI Live Search configuration (for Grok models) */
/** Full Live Search configuration (for search-enabled models) */
searchParameters?: SearchParameters;

@@ -413,3 +451,3 @@ /** Tool definitions for function calling */

*
* const response = await client.chat('openai/gpt-4o', 'Hello!');
* const response = await client.chat('openai/gpt-5.2', 'Hello!');
* console.log(response);

@@ -462,3 +500,3 @@ */

*
* @param model - Model ID (e.g., 'openai/gpt-4o', 'anthropic/claude-sonnet-4')
* @param model - Model ID (e.g., 'openai/gpt-5.2', 'anthropic/claude-sonnet-4.6')
* @param prompt - User message

@@ -469,3 +507,3 @@ * @param options - Optional chat parameters

* @example
* const response = await client.chat('gpt-4o', 'What is the capital of France?');
* const response = await client.chat('gpt-5.2', 'What is the capital of France?');
* console.log(response); // 'The capital of France is Paris.'

@@ -1118,3 +1156,3 @@ */

*
* const response = await client.chat('openai/gpt-4o', 'gm Solana');
* const response = await client.chat('openai/gpt-5.2', 'gm Solana');
*/

@@ -1239,2 +1277,7 @@

declare function clearCache(): number;
declare function getCostLogSummary(): {
totalUsd: number;
calls: number;
byEndpoint: Record<string, number>;
};

@@ -1289,3 +1332,3 @@ /**

* const response = await client.chat.completions.create({
* model: 'gpt-4o',
* model: 'gpt-5.2',
* messages: [{ role: 'user', content: 'Hello!' }]

@@ -1397,3 +1440,3 @@ * });

* const response = await client.chat.completions.create({
* model: 'gpt-4o',
* model: 'gpt-5.2',
* messages: [{ role: 'user', content: 'Hello!' }]

@@ -1433,2 +1476,57 @@ * });

export { APIError, AnthropicClient, BASE_CHAIN_ID, type BlockRunAnthropicOptions, BlockrunError, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatUsage, type CostEntry, type CreatePaymentOptions, type FunctionCall, type FunctionDefinition, ImageClient, type ImageClientOptions, type ImageData, type ImageEditOptions, type ImageGenerateOptions, type ImageModel, type ImageResponse, LLMClient, type LLMClientOptions, type Model, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PaymentError, type PaymentLinks, type RoutingDecision, type RoutingProfile, type RoutingTier, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SmartChatOptions, type SmartChatResponse, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type Spending, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XArticlesRisingResponse, type XAuthorAnalyticsResponse, type XCompareAuthorsResponse, type XFollower, type XFollowersResponse, type XFollowingsResponse, type XMentionsResponse, type XSearchResponse, type XSearchSource, type XTrendingResponse, type XTweet, type XTweetLookupResponse, type XTweetRepliesResponse, type XTweetThreadResponse, type XTweetsResponse, type XUser, type XUserInfoResponse, type XUserLookupResponse, type XVerifiedFollowersResponse, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatWalletCreatedMessage, getCached, getCachedByRequest, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, testnetClient };
/**
* Input validation and security utilities for BlockRun LLM SDK.
*
* This module provides validation functions to ensure:
* - Private keys are properly formatted
* - API URLs use HTTPS
* - Server responses don't leak sensitive information
* - Resource URLs match expected domains
*/
/**
* Known LLM providers (for optional validation).
*/
declare const KNOWN_PROVIDERS: Set<string>;
/**
* Validates that a model ID is a non-empty string.
*
* @param model - The model ID (e.g., "openai/gpt-5.2", "anthropic/claude-sonnet-4.5")
* @throws {Error} If the model is invalid
*
* @example
* validateModel("openai/gpt-5.2");
*/
declare function validateModel(model: string): void;
/**
* Validates that max_tokens is an integer between 1 and 100,000.
*
* @param maxTokens - Maximum number of tokens to generate
* @throws {Error} If maxTokens is invalid
*
* @example
* validateMaxTokens(1000);
*/
declare function validateMaxTokens(maxTokens?: number): void;
/**
* Validates that temperature is a number between 0 and 2.
*
* @param temperature - Sampling temperature (0-2)
* @throws {Error} If temperature is invalid
*
* @example
* validateTemperature(0.7);
*/
declare function validateTemperature(temperature?: number): void;
/**
* Validates that top_p is a number between 0 and 1.
*
* @param topP - Top-p sampling parameter (0-1)
* @throws {Error} If topP is invalid
*
* @example
* validateTopP(0.9);
*/
declare function validateTopP(topP?: number): void;
export { APIError, AnthropicClient, BASE_CHAIN_ID, type BlockRunAnthropicOptions, BlockrunError, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatResponseWithCost, type ChatUsage, type CostEntry, type CostEstimate, type CreatePaymentOptions, type FunctionCall, type FunctionDefinition, ImageClient, type ImageClientOptions, type ImageData, type ImageEditOptions, type ImageGenerateOptions, type ImageModel, type ImageResponse, KNOWN_PROVIDERS, LLMClient, type LLMClientOptions, type Model, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PaymentError, type PaymentLinks, type RoutingDecision, type RoutingProfile, type RoutingTier, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SearchUsage, type SmartChatOptions, type SmartChatResponse, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type Spending, type SpendingReport, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XArticlesRisingResponse, type XAuthorAnalyticsResponse, type XCompareAuthorsResponse, type XFollower, type XFollowersResponse, type XFollowingsResponse, type XMentionsResponse, type XSearchResponse, type XSearchSource, type XTrendingResponse, type XTweet, type XTweetLookupResponse, type XTweetRepliesResponse, type XTweetThreadResponse, type XTweetsResponse, type XUser, type XUserInfoResponse, type XUserLookupResponse, type XVerifiedFollowersResponse, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatWalletCreatedMessage, getCached, getCachedByRequest, getCostLogSummary, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, testnetClient, validateMaxTokens, validateModel, validateTemperature, validateTopP };
+2
-2
{
"name": "@blockrun/llm",
"version": "1.4.3",
"version": "1.5.0",
"type": "module",

@@ -51,3 +51,3 @@ "description": "BlockRun LLM Gateway SDK - Pay-per-request AI via x402 on Base and Solana",

"dependencies": {
"@blockrun/clawrouter": "^0.10.18",
"@blockrun/clawrouter": "^0.12.71",
"bs58": "^6.0.0",

@@ -54,0 +54,0 @@ "viem": "^2.21.0"

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display