@blockrun/llm 1.7.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -34,6 +34,8 @@ interface ChatMessage {
34
34
  name?: string;
35
35
  tool_call_id?: string;
36
36
  tool_calls?: ToolCall[];
37
+ reasoning_content?: string;
38
+ thinking?: string;
37
39
  }
38
40
  interface ChatChoice {
39
41
  index: number;
@@ -45,6 +47,8 @@ interface ChatUsage {
45
47
  completion_tokens: number;
46
48
  total_tokens: number;
47
49
  num_sources_used?: number;
50
+ cache_read_input_tokens?: number;
51
+ cache_creation_input_tokens?: number;
48
52
  }
49
53
  interface ChatResponse {
50
54
  id: string;
@@ -60,13 +64,21 @@ interface Model {
60
64
  name: string;
61
65
  provider: string;
62
66
  description: string;
67
+ /** Per 1M tokens. 0 when billingMode !== "paid". */
63
68
  inputPrice: number;
69
+ /** Per 1M tokens. 0 when billingMode !== "paid". */
64
70
  outputPrice: number;
65
71
  contextWindow: number;
66
72
  maxOutput: number;
67
73
  categories: string[];
68
74
  available: boolean;
69
75
  type?: "llm" | "image";
76
+ /** One of "paid" (per-token), "flat" (flatPrice per request) or "free". */
77
+ billingMode?: "paid" | "flat" | "free";
78
+ /** Flat per-request price when billingMode === "flat". */
79
+ flatPrice?: number;
80
+ /** True for deprecated/superseded models that remain routable. */
81
+ hidden?: boolean;
70
82
  }
71
83
  interface ImageData {
72
84
  url: string;
@@ -571,6 +583,80 @@ interface XAuthorAnalyticsResponse {
571
583
  interface XCompareAuthorsResponse {
572
584
  data: Record<string, unknown>;
573
585
  }
586
+ type PriceCategory = "crypto" | "fx" | "commodity" | "usstock" | "stocks";
587
+ type StockMarket = "us" | "hk" | "jp" | "kr" | "gb" | "de" | "fr" | "nl" | "ie" | "lu" | "cn" | "ca";
588
+ type BarResolution = "1" | "5" | "15" | "60" | "240" | "D" | "W" | "M";
589
+ type MarketSession = "pre" | "post" | "on";
590
+ interface PricePoint {
591
+ symbol: string;
592
+ price: number;
593
+ publishTime?: number;
594
+ confidence?: number;
595
+ feedId?: string;
596
+ timestamp?: string;
597
+ assetType?: string;
598
+ category?: string;
599
+ source?: string;
600
+ free?: boolean;
601
+ }
602
+ interface PriceBar {
603
+ t?: number;
604
+ o?: number;
605
+ h?: number;
606
+ l?: number;
607
+ c?: number;
608
+ v?: number;
609
+ }
610
+ interface PriceHistoryResponse {
611
+ symbol: string;
612
+ resolution?: string;
613
+ from?: number;
614
+ to?: number;
615
+ bars: PriceBar[];
616
+ source?: string;
617
+ category?: string;
618
+ }
619
+ interface SymbolListResponse {
620
+ symbols: Array<Record<string, unknown>>;
621
+ count?: number;
622
+ }
623
+ interface PriceOptions {
624
+ /** Required when category === "stocks". */
625
+ market?: StockMarket;
626
+ /** Optional US-equity session hint; ignored for non-equity. */
627
+ session?: MarketSession;
628
+ }
629
+ interface HistoryOptions extends PriceOptions {
630
+ /** TradingView-style bar resolution. Defaults to "D". */
631
+ resolution?: BarResolution;
632
+ /** Window start, unix seconds (required). */
633
+ from: number;
634
+ /** Window end, unix seconds. Defaults to now on the backend. */
635
+ to?: number;
636
+ }
637
+ interface ListOptions extends PriceOptions {
638
+ /** Free-text filter (maps to ?q=). */
639
+ query?: string;
640
+ /** Page size, capped at 2000. Defaults to 100. */
641
+ limit?: number;
642
+ }
643
+ interface SearchClientOptions {
644
+ privateKey?: `0x${string}` | string;
645
+ apiUrl?: string;
646
+ timeout?: number;
647
+ }
648
+ interface XClientOptions {
649
+ privateKey?: `0x${string}` | string;
650
+ apiUrl?: string;
651
+ timeout?: number;
652
+ }
653
+ interface PriceClientOptions {
654
+ privateKey?: `0x${string}` | string;
655
+ apiUrl?: string;
656
+ timeout?: number;
657
+ /** If false, construction succeeds without a wallet (free endpoints only). */
658
+ requireWallet?: boolean;
659
+ }
574
660
  declare class BlockrunError extends Error {
575
661
  constructor(message: string);
576
662
  }
@@ -1184,6 +1270,130 @@ declare class MusicClient {
1184
1270
  getSpending(): Spending;
1185
1271
  }
1186
1272
 
1273
+ /**
1274
+ * BlockRun Search Client - Standalone Grok Live Search via x402 micropayments.
1275
+ *
1276
+ * Backend endpoint: POST /api/v1/search
1277
+ * Pricing: $0.025/source + margin (default 10 sources ≈ $0.26).
1278
+ *
1279
+ * Usage:
1280
+ * import { SearchClient } from "@blockrun/llm";
1281
+ *
1282
+ * const client = new SearchClient({ privateKey: "0x..." });
1283
+ * const result = await client.search("Latest news on x402 adoption", {
1284
+ * sources: ["x", "web"],
1285
+ * });
1286
+ * console.log(result.summary);
1287
+ */
1288
+
1289
+ declare class SearchClient {
1290
+ private account;
1291
+ private privateKey;
1292
+ private apiUrl;
1293
+ private timeout;
1294
+ constructor(options?: SearchClientOptions);
1295
+ search(query: string, options?: SearchOptions): Promise<SearchResult>;
1296
+ private requestWithPayment;
1297
+ private handlePaymentAndRetry;
1298
+ private fetchWithTimeout;
1299
+ getWalletAddress(): string;
1300
+ }
1301
+
1302
+ /**
1303
+ * BlockRun X (Twitter) Client - AttentionVC-partnered X/Twitter API via x402.
1304
+ *
1305
+ * Wraps the /api/v1/x/* endpoint family. Every call is gated by an x402
1306
+ * payment; the client handles the 402 → sign → retry dance automatically.
1307
+ *
1308
+ * Usage:
1309
+ * import { XClient } from "@blockrun/llm";
1310
+ *
1311
+ * const x = new XClient({ privateKey: "0x..." });
1312
+ * const info = await x.userInfo("elonmusk");
1313
+ * const followers = await x.followers("paulg");
1314
+ * const results = await x.search("x402 micropayments", { queryType: "Latest" });
1315
+ */
1316
+
1317
+ interface XUserTweetsOptions {
1318
+ username?: string;
1319
+ userId?: string;
1320
+ cursor?: string;
1321
+ includeReplies?: boolean;
1322
+ }
1323
+ interface XMentionsOptions {
1324
+ sinceTime?: string;
1325
+ untilTime?: string;
1326
+ cursor?: string;
1327
+ }
1328
+ interface XTweetRepliesOptions {
1329
+ cursor?: string;
1330
+ queryType?: "Latest" | "Default";
1331
+ }
1332
+ interface XSearchOptions {
1333
+ queryType?: "Latest" | "Top" | "Default";
1334
+ cursor?: string;
1335
+ }
1336
+ declare class XClient {
1337
+ private account;
1338
+ private privateKey;
1339
+ private apiUrl;
1340
+ private timeout;
1341
+ constructor(options?: XClientOptions);
1342
+ userLookup(usernames: string | string[]): Promise<XUserLookupResponse>;
1343
+ userInfo(username: string): Promise<XUserInfoResponse>;
1344
+ followers(username: string, cursor?: string): Promise<XFollowersResponse>;
1345
+ /** `/v1/x/users/following` (singular path variant). */
1346
+ following(username: string, cursor?: string): Promise<XFollowingsResponse>;
1347
+ /** `/v1/x/users/followings` (plural path variant). */
1348
+ followings(username: string, cursor?: string): Promise<XFollowingsResponse>;
1349
+ verifiedFollowers(userId: string, cursor?: string): Promise<XVerifiedFollowersResponse>;
1350
+ userTweets(options: XUserTweetsOptions): Promise<XTweetsResponse>;
1351
+ mentions(username: string, options?: XMentionsOptions): Promise<XMentionsResponse>;
1352
+ tweetLookup(tweetIds: string | string[]): Promise<XTweetLookupResponse>;
1353
+ tweetReplies(tweetId: string, options?: XTweetRepliesOptions): Promise<XTweetRepliesResponse>;
1354
+ tweetThread(tweetId: string, cursor?: string): Promise<XTweetThreadResponse>;
1355
+ search(query: string, options?: XSearchOptions): Promise<XSearchResponse>;
1356
+ trending(): Promise<XTrendingResponse>;
1357
+ articlesRising(): Promise<XArticlesRisingResponse>;
1358
+ private post;
1359
+ private payAndRetry;
1360
+ private fetchWithTimeout;
1361
+ getWalletAddress(): string;
1362
+ }
1363
+
1364
+ /**
1365
+ * BlockRun Price Client - Pyth-backed market data via x402.
1366
+ *
1367
+ * Payment gating mirrors CategoryConfig.paid in the backend:
1368
+ * crypto, fx, commodity → FREE across price + history + list
1369
+ * usstock, stocks/{market} → PAID for price + history; list always free
1370
+ *
1371
+ * Usage:
1372
+ * import { PriceClient } from "@blockrun/llm";
1373
+ *
1374
+ * const p = new PriceClient({ privateKey: "0x..." });
1375
+ * const btc = await p.price("crypto", "BTC-USD");
1376
+ * const aapl = await p.price("stocks", "AAPL", { market: "us" });
1377
+ * const bars = await p.history("stocks", "AAPL", { market: "us",
1378
+ * from: 1700000000, to: 1710000000 });
1379
+ * const symbols = await p.listSymbols("crypto", { query: "sol" });
1380
+ */
1381
+
1382
+ declare class PriceClient {
1383
+ private account;
1384
+ private privateKey;
1385
+ private apiUrl;
1386
+ private timeout;
1387
+ constructor(options?: PriceClientOptions);
1388
+ price(category: PriceCategory, symbol: string, options?: PriceOptions): Promise<PricePoint>;
1389
+ history(category: PriceCategory, symbol: string, options: HistoryOptions): Promise<PriceHistoryResponse>;
1390
+ listSymbols(category: PriceCategory, options?: ListOptions): Promise<SymbolListResponse>;
1391
+ getWalletAddress(): string | null;
1392
+ private getWithPayment;
1393
+ private payAndRetry;
1394
+ private fetchWithTimeout;
1395
+ }
1396
+
1187
1397
  /**
1188
1398
  * x402 Payment Protocol v2 Implementation for BlockRun.
1189
1399
  *
@@ -1814,4 +2024,4 @@ declare function validateTemperature(temperature?: number): void;
1814
2024
  */
1815
2025
  declare function validateTopP(topP?: number): void;
1816
2026
 
1817
- export { APIError, AnthropicClient, type AudioModel, type AudioTrack, 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, MusicClient, type MusicClientOptions, type MusicGenerateOptions, type MusicResponse, 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, type VideoClientOptions, type VideoClip, type VideoGenerateOptions, type VideoModel, type VideoResponse, 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 };
2027
+ export { APIError, AnthropicClient, type AudioModel, type AudioTrack, BASE_CHAIN_ID, type BarResolution, 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, 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, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PaymentError, type PaymentLinks, type PriceBar, type PriceCategory, PriceClient, type PriceClientOptions, type PriceHistoryResponse, type PriceOptions, type PricePoint, type RoutingDecision, type RoutingProfile, type RoutingTier, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, SearchClient, type SearchClientOptions, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SearchUsage, type SmartChatOptions, type SmartChatResponse, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type Spending, type SpendingReport, type StockMarket, type SymbolListResponse, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, type VideoClientOptions, type VideoClip, type VideoGenerateOptions, type VideoModel, type VideoResponse, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XArticlesRisingResponse, type XAuthorAnalyticsResponse, XClient, type XClientOptions, type XCompareAuthorsResponse, type XFollower, type XFollowersResponse, type XFollowingsResponse, type XMentionsOptions, type XMentionsResponse, type XSearchOptions, type XSearchResponse, type XSearchSource, type XTrendingResponse, type XTweet, type XTweetLookupResponse, type XTweetRepliesOptions, type XTweetRepliesResponse, type XTweetThreadResponse, type XTweetsResponse, type XUser, type XUserInfoResponse, type XUserLookupResponse, type XUserTweetsOptions, 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 };
package/dist/index.d.ts CHANGED
@@ -34,6 +34,8 @@ interface ChatMessage {
34
34
  name?: string;
35
35
  tool_call_id?: string;
36
36
  tool_calls?: ToolCall[];
37
+ reasoning_content?: string;
38
+ thinking?: string;
37
39
  }
38
40
  interface ChatChoice {
39
41
  index: number;
@@ -45,6 +47,8 @@ interface ChatUsage {
45
47
  completion_tokens: number;
46
48
  total_tokens: number;
47
49
  num_sources_used?: number;
50
+ cache_read_input_tokens?: number;
51
+ cache_creation_input_tokens?: number;
48
52
  }
49
53
  interface ChatResponse {
50
54
  id: string;
@@ -60,13 +64,21 @@ interface Model {
60
64
  name: string;
61
65
  provider: string;
62
66
  description: string;
67
+ /** Per 1M tokens. 0 when billingMode !== "paid". */
63
68
  inputPrice: number;
69
+ /** Per 1M tokens. 0 when billingMode !== "paid". */
64
70
  outputPrice: number;
65
71
  contextWindow: number;
66
72
  maxOutput: number;
67
73
  categories: string[];
68
74
  available: boolean;
69
75
  type?: "llm" | "image";
76
+ /** One of "paid" (per-token), "flat" (flatPrice per request) or "free". */
77
+ billingMode?: "paid" | "flat" | "free";
78
+ /** Flat per-request price when billingMode === "flat". */
79
+ flatPrice?: number;
80
+ /** True for deprecated/superseded models that remain routable. */
81
+ hidden?: boolean;
70
82
  }
71
83
  interface ImageData {
72
84
  url: string;
@@ -571,6 +583,80 @@ interface XAuthorAnalyticsResponse {
571
583
  interface XCompareAuthorsResponse {
572
584
  data: Record<string, unknown>;
573
585
  }
586
+ type PriceCategory = "crypto" | "fx" | "commodity" | "usstock" | "stocks";
587
+ type StockMarket = "us" | "hk" | "jp" | "kr" | "gb" | "de" | "fr" | "nl" | "ie" | "lu" | "cn" | "ca";
588
+ type BarResolution = "1" | "5" | "15" | "60" | "240" | "D" | "W" | "M";
589
+ type MarketSession = "pre" | "post" | "on";
590
+ interface PricePoint {
591
+ symbol: string;
592
+ price: number;
593
+ publishTime?: number;
594
+ confidence?: number;
595
+ feedId?: string;
596
+ timestamp?: string;
597
+ assetType?: string;
598
+ category?: string;
599
+ source?: string;
600
+ free?: boolean;
601
+ }
602
+ interface PriceBar {
603
+ t?: number;
604
+ o?: number;
605
+ h?: number;
606
+ l?: number;
607
+ c?: number;
608
+ v?: number;
609
+ }
610
+ interface PriceHistoryResponse {
611
+ symbol: string;
612
+ resolution?: string;
613
+ from?: number;
614
+ to?: number;
615
+ bars: PriceBar[];
616
+ source?: string;
617
+ category?: string;
618
+ }
619
+ interface SymbolListResponse {
620
+ symbols: Array<Record<string, unknown>>;
621
+ count?: number;
622
+ }
623
+ interface PriceOptions {
624
+ /** Required when category === "stocks". */
625
+ market?: StockMarket;
626
+ /** Optional US-equity session hint; ignored for non-equity. */
627
+ session?: MarketSession;
628
+ }
629
+ interface HistoryOptions extends PriceOptions {
630
+ /** TradingView-style bar resolution. Defaults to "D". */
631
+ resolution?: BarResolution;
632
+ /** Window start, unix seconds (required). */
633
+ from: number;
634
+ /** Window end, unix seconds. Defaults to now on the backend. */
635
+ to?: number;
636
+ }
637
+ interface ListOptions extends PriceOptions {
638
+ /** Free-text filter (maps to ?q=). */
639
+ query?: string;
640
+ /** Page size, capped at 2000. Defaults to 100. */
641
+ limit?: number;
642
+ }
643
+ interface SearchClientOptions {
644
+ privateKey?: `0x${string}` | string;
645
+ apiUrl?: string;
646
+ timeout?: number;
647
+ }
648
+ interface XClientOptions {
649
+ privateKey?: `0x${string}` | string;
650
+ apiUrl?: string;
651
+ timeout?: number;
652
+ }
653
+ interface PriceClientOptions {
654
+ privateKey?: `0x${string}` | string;
655
+ apiUrl?: string;
656
+ timeout?: number;
657
+ /** If false, construction succeeds without a wallet (free endpoints only). */
658
+ requireWallet?: boolean;
659
+ }
574
660
  declare class BlockrunError extends Error {
575
661
  constructor(message: string);
576
662
  }
@@ -1184,6 +1270,130 @@ declare class MusicClient {
1184
1270
  getSpending(): Spending;
1185
1271
  }
1186
1272
 
1273
+ /**
1274
+ * BlockRun Search Client - Standalone Grok Live Search via x402 micropayments.
1275
+ *
1276
+ * Backend endpoint: POST /api/v1/search
1277
+ * Pricing: $0.025/source + margin (default 10 sources ≈ $0.26).
1278
+ *
1279
+ * Usage:
1280
+ * import { SearchClient } from "@blockrun/llm";
1281
+ *
1282
+ * const client = new SearchClient({ privateKey: "0x..." });
1283
+ * const result = await client.search("Latest news on x402 adoption", {
1284
+ * sources: ["x", "web"],
1285
+ * });
1286
+ * console.log(result.summary);
1287
+ */
1288
+
1289
+ declare class SearchClient {
1290
+ private account;
1291
+ private privateKey;
1292
+ private apiUrl;
1293
+ private timeout;
1294
+ constructor(options?: SearchClientOptions);
1295
+ search(query: string, options?: SearchOptions): Promise<SearchResult>;
1296
+ private requestWithPayment;
1297
+ private handlePaymentAndRetry;
1298
+ private fetchWithTimeout;
1299
+ getWalletAddress(): string;
1300
+ }
1301
+
1302
+ /**
1303
+ * BlockRun X (Twitter) Client - AttentionVC-partnered X/Twitter API via x402.
1304
+ *
1305
+ * Wraps the /api/v1/x/* endpoint family. Every call is gated by an x402
1306
+ * payment; the client handles the 402 → sign → retry dance automatically.
1307
+ *
1308
+ * Usage:
1309
+ * import { XClient } from "@blockrun/llm";
1310
+ *
1311
+ * const x = new XClient({ privateKey: "0x..." });
1312
+ * const info = await x.userInfo("elonmusk");
1313
+ * const followers = await x.followers("paulg");
1314
+ * const results = await x.search("x402 micropayments", { queryType: "Latest" });
1315
+ */
1316
+
1317
+ interface XUserTweetsOptions {
1318
+ username?: string;
1319
+ userId?: string;
1320
+ cursor?: string;
1321
+ includeReplies?: boolean;
1322
+ }
1323
+ interface XMentionsOptions {
1324
+ sinceTime?: string;
1325
+ untilTime?: string;
1326
+ cursor?: string;
1327
+ }
1328
+ interface XTweetRepliesOptions {
1329
+ cursor?: string;
1330
+ queryType?: "Latest" | "Default";
1331
+ }
1332
+ interface XSearchOptions {
1333
+ queryType?: "Latest" | "Top" | "Default";
1334
+ cursor?: string;
1335
+ }
1336
+ declare class XClient {
1337
+ private account;
1338
+ private privateKey;
1339
+ private apiUrl;
1340
+ private timeout;
1341
+ constructor(options?: XClientOptions);
1342
+ userLookup(usernames: string | string[]): Promise<XUserLookupResponse>;
1343
+ userInfo(username: string): Promise<XUserInfoResponse>;
1344
+ followers(username: string, cursor?: string): Promise<XFollowersResponse>;
1345
+ /** `/v1/x/users/following` (singular path variant). */
1346
+ following(username: string, cursor?: string): Promise<XFollowingsResponse>;
1347
+ /** `/v1/x/users/followings` (plural path variant). */
1348
+ followings(username: string, cursor?: string): Promise<XFollowingsResponse>;
1349
+ verifiedFollowers(userId: string, cursor?: string): Promise<XVerifiedFollowersResponse>;
1350
+ userTweets(options: XUserTweetsOptions): Promise<XTweetsResponse>;
1351
+ mentions(username: string, options?: XMentionsOptions): Promise<XMentionsResponse>;
1352
+ tweetLookup(tweetIds: string | string[]): Promise<XTweetLookupResponse>;
1353
+ tweetReplies(tweetId: string, options?: XTweetRepliesOptions): Promise<XTweetRepliesResponse>;
1354
+ tweetThread(tweetId: string, cursor?: string): Promise<XTweetThreadResponse>;
1355
+ search(query: string, options?: XSearchOptions): Promise<XSearchResponse>;
1356
+ trending(): Promise<XTrendingResponse>;
1357
+ articlesRising(): Promise<XArticlesRisingResponse>;
1358
+ private post;
1359
+ private payAndRetry;
1360
+ private fetchWithTimeout;
1361
+ getWalletAddress(): string;
1362
+ }
1363
+
1364
+ /**
1365
+ * BlockRun Price Client - Pyth-backed market data via x402.
1366
+ *
1367
+ * Payment gating mirrors CategoryConfig.paid in the backend:
1368
+ * crypto, fx, commodity → FREE across price + history + list
1369
+ * usstock, stocks/{market} → PAID for price + history; list always free
1370
+ *
1371
+ * Usage:
1372
+ * import { PriceClient } from "@blockrun/llm";
1373
+ *
1374
+ * const p = new PriceClient({ privateKey: "0x..." });
1375
+ * const btc = await p.price("crypto", "BTC-USD");
1376
+ * const aapl = await p.price("stocks", "AAPL", { market: "us" });
1377
+ * const bars = await p.history("stocks", "AAPL", { market: "us",
1378
+ * from: 1700000000, to: 1710000000 });
1379
+ * const symbols = await p.listSymbols("crypto", { query: "sol" });
1380
+ */
1381
+
1382
+ declare class PriceClient {
1383
+ private account;
1384
+ private privateKey;
1385
+ private apiUrl;
1386
+ private timeout;
1387
+ constructor(options?: PriceClientOptions);
1388
+ price(category: PriceCategory, symbol: string, options?: PriceOptions): Promise<PricePoint>;
1389
+ history(category: PriceCategory, symbol: string, options: HistoryOptions): Promise<PriceHistoryResponse>;
1390
+ listSymbols(category: PriceCategory, options?: ListOptions): Promise<SymbolListResponse>;
1391
+ getWalletAddress(): string | null;
1392
+ private getWithPayment;
1393
+ private payAndRetry;
1394
+ private fetchWithTimeout;
1395
+ }
1396
+
1187
1397
  /**
1188
1398
  * x402 Payment Protocol v2 Implementation for BlockRun.
1189
1399
  *
@@ -1814,4 +2024,4 @@ declare function validateTemperature(temperature?: number): void;
1814
2024
  */
1815
2025
  declare function validateTopP(topP?: number): void;
1816
2026
 
1817
- export { APIError, AnthropicClient, type AudioModel, type AudioTrack, 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, MusicClient, type MusicClientOptions, type MusicGenerateOptions, type MusicResponse, 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, type VideoClientOptions, type VideoClip, type VideoGenerateOptions, type VideoModel, type VideoResponse, 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 };
2027
+ export { APIError, AnthropicClient, type AudioModel, type AudioTrack, BASE_CHAIN_ID, type BarResolution, 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, 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, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PaymentError, type PaymentLinks, type PriceBar, type PriceCategory, PriceClient, type PriceClientOptions, type PriceHistoryResponse, type PriceOptions, type PricePoint, type RoutingDecision, type RoutingProfile, type RoutingTier, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, SearchClient, type SearchClientOptions, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SearchUsage, type SmartChatOptions, type SmartChatResponse, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type Spending, type SpendingReport, type StockMarket, type SymbolListResponse, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, type VideoClientOptions, type VideoClip, type VideoGenerateOptions, type VideoModel, type VideoResponse, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XArticlesRisingResponse, type XAuthorAnalyticsResponse, XClient, type XClientOptions, type XCompareAuthorsResponse, type XFollower, type XFollowersResponse, type XFollowingsResponse, type XMentionsOptions, type XMentionsResponse, type XSearchOptions, type XSearchResponse, type XSearchSource, type XTrendingResponse, type XTweet, type XTweetLookupResponse, type XTweetRepliesOptions, type XTweetRepliesResponse, type XTweetThreadResponse, type XTweetsResponse, type XUser, type XUserInfoResponse, type XUserLookupResponse, type XUserTweetsOptions, 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 };