@blockrun/llm 1.1.0 → 1.3.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 +162 -2
- package/dist/index.cjs +1251 -109
- package/dist/index.d.cts +472 -4
- package/dist/index.d.ts +472 -4
- package/dist/index.js +1134 -4
- package/package.json +10 -9
package/dist/index.d.ts
CHANGED
|
@@ -205,6 +205,157 @@ interface SmartChatResponse {
|
|
|
205
205
|
/** Routing decision metadata */
|
|
206
206
|
routing: RoutingDecision;
|
|
207
207
|
}
|
|
208
|
+
interface SearchResult {
|
|
209
|
+
query: string;
|
|
210
|
+
summary: string;
|
|
211
|
+
citations?: Array<Record<string, string>>;
|
|
212
|
+
sources_used?: number;
|
|
213
|
+
model?: string;
|
|
214
|
+
}
|
|
215
|
+
interface ImageEditOptions {
|
|
216
|
+
/** Model ID (default: "openai/gpt-image-1") */
|
|
217
|
+
model?: string;
|
|
218
|
+
/** Optional base64-encoded mask image */
|
|
219
|
+
mask?: string;
|
|
220
|
+
/** Image size (default: "1024x1024") */
|
|
221
|
+
size?: string;
|
|
222
|
+
/** Number of images to generate (default: 1) */
|
|
223
|
+
n?: number;
|
|
224
|
+
}
|
|
225
|
+
interface SearchOptions {
|
|
226
|
+
/** Source types to search (e.g. ["web", "x", "news"]) */
|
|
227
|
+
sources?: string[];
|
|
228
|
+
/** Maximum number of results (default: 10) */
|
|
229
|
+
maxResults?: number;
|
|
230
|
+
/** Start date filter (YYYY-MM-DD) */
|
|
231
|
+
fromDate?: string;
|
|
232
|
+
/** End date filter (YYYY-MM-DD) */
|
|
233
|
+
toDate?: string;
|
|
234
|
+
}
|
|
235
|
+
interface XUser {
|
|
236
|
+
id: string;
|
|
237
|
+
userName: string;
|
|
238
|
+
name: string;
|
|
239
|
+
profilePicture?: string;
|
|
240
|
+
description?: string;
|
|
241
|
+
followers?: number;
|
|
242
|
+
following?: number;
|
|
243
|
+
isBlueVerified?: boolean;
|
|
244
|
+
verifiedType?: string;
|
|
245
|
+
location?: string;
|
|
246
|
+
joined?: string;
|
|
247
|
+
}
|
|
248
|
+
interface XUserLookupResponse {
|
|
249
|
+
users: XUser[];
|
|
250
|
+
not_found?: string[];
|
|
251
|
+
total_requested?: number;
|
|
252
|
+
total_found?: number;
|
|
253
|
+
}
|
|
254
|
+
interface XFollower {
|
|
255
|
+
id: string;
|
|
256
|
+
name?: string;
|
|
257
|
+
screen_name?: string;
|
|
258
|
+
userName?: string;
|
|
259
|
+
location?: string;
|
|
260
|
+
description?: string;
|
|
261
|
+
protected?: boolean;
|
|
262
|
+
verified?: boolean;
|
|
263
|
+
followers_count?: number;
|
|
264
|
+
following_count?: number;
|
|
265
|
+
favourites_count?: number;
|
|
266
|
+
statuses_count?: number;
|
|
267
|
+
created_at?: string;
|
|
268
|
+
profile_image_url_https?: string;
|
|
269
|
+
can_dm?: boolean;
|
|
270
|
+
}
|
|
271
|
+
interface XFollowersResponse {
|
|
272
|
+
followers: XFollower[];
|
|
273
|
+
has_next_page?: boolean;
|
|
274
|
+
next_cursor?: string;
|
|
275
|
+
total_returned?: number;
|
|
276
|
+
username?: string;
|
|
277
|
+
}
|
|
278
|
+
interface XFollowingsResponse {
|
|
279
|
+
followings: XFollower[];
|
|
280
|
+
has_next_page?: boolean;
|
|
281
|
+
next_cursor?: string;
|
|
282
|
+
total_returned?: number;
|
|
283
|
+
username?: string;
|
|
284
|
+
}
|
|
285
|
+
interface XUserInfoResponse {
|
|
286
|
+
data: Record<string, unknown>;
|
|
287
|
+
username?: string;
|
|
288
|
+
}
|
|
289
|
+
interface XVerifiedFollowersResponse {
|
|
290
|
+
followers: XFollower[];
|
|
291
|
+
has_next_page?: boolean;
|
|
292
|
+
next_cursor?: string;
|
|
293
|
+
total_returned?: number;
|
|
294
|
+
}
|
|
295
|
+
interface XTweet {
|
|
296
|
+
id: string;
|
|
297
|
+
text?: string;
|
|
298
|
+
created_at?: string;
|
|
299
|
+
author?: Record<string, unknown>;
|
|
300
|
+
favorite_count?: number;
|
|
301
|
+
retweet_count?: number;
|
|
302
|
+
reply_count?: number;
|
|
303
|
+
view_count?: number;
|
|
304
|
+
lang?: string;
|
|
305
|
+
entities?: Record<string, unknown>;
|
|
306
|
+
media?: Array<Record<string, unknown>>;
|
|
307
|
+
[key: string]: unknown;
|
|
308
|
+
}
|
|
309
|
+
interface XTweetsResponse {
|
|
310
|
+
tweets: XTweet[];
|
|
311
|
+
has_next_page?: boolean;
|
|
312
|
+
next_cursor?: string;
|
|
313
|
+
total_returned?: number;
|
|
314
|
+
}
|
|
315
|
+
interface XMentionsResponse {
|
|
316
|
+
tweets: XTweet[];
|
|
317
|
+
has_next_page?: boolean;
|
|
318
|
+
next_cursor?: string;
|
|
319
|
+
total_returned?: number;
|
|
320
|
+
username?: string;
|
|
321
|
+
}
|
|
322
|
+
interface XTweetLookupResponse {
|
|
323
|
+
tweets: XTweet[];
|
|
324
|
+
not_found?: string[];
|
|
325
|
+
total_requested?: number;
|
|
326
|
+
total_found?: number;
|
|
327
|
+
}
|
|
328
|
+
interface XTweetRepliesResponse {
|
|
329
|
+
replies: XTweet[];
|
|
330
|
+
has_next_page?: boolean;
|
|
331
|
+
next_cursor?: string;
|
|
332
|
+
total_returned?: number;
|
|
333
|
+
}
|
|
334
|
+
interface XTweetThreadResponse {
|
|
335
|
+
tweets: XTweet[];
|
|
336
|
+
has_next_page?: boolean;
|
|
337
|
+
next_cursor?: string;
|
|
338
|
+
total_returned?: number;
|
|
339
|
+
}
|
|
340
|
+
interface XSearchResponse {
|
|
341
|
+
tweets: XTweet[];
|
|
342
|
+
has_next_page?: boolean;
|
|
343
|
+
next_cursor?: string;
|
|
344
|
+
total_returned?: number;
|
|
345
|
+
}
|
|
346
|
+
interface XTrendingResponse {
|
|
347
|
+
data: Record<string, unknown>;
|
|
348
|
+
}
|
|
349
|
+
interface XArticlesRisingResponse {
|
|
350
|
+
data: Record<string, unknown>;
|
|
351
|
+
}
|
|
352
|
+
interface XAuthorAnalyticsResponse {
|
|
353
|
+
data: Record<string, unknown>;
|
|
354
|
+
handle?: string;
|
|
355
|
+
}
|
|
356
|
+
interface XCompareAuthorsResponse {
|
|
357
|
+
data: Record<string, unknown>;
|
|
358
|
+
}
|
|
208
359
|
declare class BlockrunError extends Error {
|
|
209
360
|
constructor(message: string);
|
|
210
361
|
}
|
|
@@ -344,6 +495,24 @@ declare class LLMClient {
|
|
|
344
495
|
* Handle 402 response: parse requirements, sign payment, retry.
|
|
345
496
|
*/
|
|
346
497
|
private handlePaymentAndRetry;
|
|
498
|
+
/**
|
|
499
|
+
* Make a request with automatic x402 payment handling, returning raw JSON.
|
|
500
|
+
* Used for non-ChatResponse endpoints (X/Twitter, search, image edit, etc.).
|
|
501
|
+
*/
|
|
502
|
+
private requestWithPaymentRaw;
|
|
503
|
+
/**
|
|
504
|
+
* Handle 402 response for raw endpoints: parse requirements, sign payment, retry.
|
|
505
|
+
*/
|
|
506
|
+
private handlePaymentAndRetryRaw;
|
|
507
|
+
/**
|
|
508
|
+
* GET with automatic x402 payment handling, returning raw JSON.
|
|
509
|
+
* Used for Predexon prediction market endpoints that use GET + query params.
|
|
510
|
+
*/
|
|
511
|
+
private getWithPaymentRaw;
|
|
512
|
+
/**
|
|
513
|
+
* Handle 402 response for GET endpoints: parse requirements, sign payment, retry with GET.
|
|
514
|
+
*/
|
|
515
|
+
private handleGetPaymentAndRetryRaw;
|
|
347
516
|
/**
|
|
348
517
|
* Fetch with timeout.
|
|
349
518
|
*/
|
|
@@ -372,6 +541,192 @@ declare class LLMClient {
|
|
|
372
541
|
* }
|
|
373
542
|
*/
|
|
374
543
|
listAllModels(): Promise<(Model | ImageModel)[]>;
|
|
544
|
+
/**
|
|
545
|
+
* Edit an image using img2img.
|
|
546
|
+
*
|
|
547
|
+
* @param prompt - Text description of the desired edit
|
|
548
|
+
* @param image - Base64-encoded image or URL of the source image
|
|
549
|
+
* @param options - Optional edit parameters
|
|
550
|
+
* @returns ImageResponse with edited image URLs
|
|
551
|
+
*/
|
|
552
|
+
imageEdit(prompt: string, image: string, options?: ImageEditOptions): Promise<ImageResponse>;
|
|
553
|
+
/**
|
|
554
|
+
* Standalone search (web, X/Twitter, news).
|
|
555
|
+
*
|
|
556
|
+
* @param query - Search query
|
|
557
|
+
* @param options - Optional search parameters
|
|
558
|
+
* @returns SearchResult with summary and citations
|
|
559
|
+
*/
|
|
560
|
+
search(query: string, options?: SearchOptions): Promise<SearchResult>;
|
|
561
|
+
/**
|
|
562
|
+
* Get USDC balance on Base network.
|
|
563
|
+
*
|
|
564
|
+
* Automatically detects mainnet vs testnet based on API URL.
|
|
565
|
+
*
|
|
566
|
+
* @returns USDC balance as a float (6 decimal places normalized)
|
|
567
|
+
*
|
|
568
|
+
* @example
|
|
569
|
+
* const balance = await client.getBalance();
|
|
570
|
+
* console.log(`Balance: $${balance.toFixed(2)} USDC`);
|
|
571
|
+
*/
|
|
572
|
+
getBalance(): Promise<number>;
|
|
573
|
+
/**
|
|
574
|
+
* Look up X/Twitter user profiles by username.
|
|
575
|
+
*
|
|
576
|
+
* Powered by AttentionVC. $0.002 per user (min $0.02, max $0.20).
|
|
577
|
+
*
|
|
578
|
+
* @param usernames - Single username or array of usernames (without @)
|
|
579
|
+
*/
|
|
580
|
+
xUserLookup(usernames: string | string[]): Promise<XUserLookupResponse>;
|
|
581
|
+
/**
|
|
582
|
+
* Get followers of an X/Twitter user.
|
|
583
|
+
*
|
|
584
|
+
* Powered by AttentionVC. $0.05 per page (~200 accounts).
|
|
585
|
+
*
|
|
586
|
+
* @param username - X/Twitter username (without @)
|
|
587
|
+
* @param cursor - Pagination cursor from previous response
|
|
588
|
+
*/
|
|
589
|
+
xFollowers(username: string, cursor?: string): Promise<XFollowersResponse>;
|
|
590
|
+
/**
|
|
591
|
+
* Get accounts an X/Twitter user is following.
|
|
592
|
+
*
|
|
593
|
+
* Powered by AttentionVC. $0.05 per page (~200 accounts).
|
|
594
|
+
*
|
|
595
|
+
* @param username - X/Twitter username (without @)
|
|
596
|
+
* @param cursor - Pagination cursor from previous response
|
|
597
|
+
*/
|
|
598
|
+
xFollowings(username: string, cursor?: string): Promise<XFollowingsResponse>;
|
|
599
|
+
/**
|
|
600
|
+
* Get detailed profile info for a single X/Twitter user.
|
|
601
|
+
*
|
|
602
|
+
* Powered by AttentionVC. $0.002 per request.
|
|
603
|
+
*
|
|
604
|
+
* @param username - X/Twitter username (without @)
|
|
605
|
+
*/
|
|
606
|
+
xUserInfo(username: string): Promise<XUserInfoResponse>;
|
|
607
|
+
/**
|
|
608
|
+
* Get verified (blue-check) followers of an X/Twitter user.
|
|
609
|
+
*
|
|
610
|
+
* Powered by AttentionVC. $0.048 per page.
|
|
611
|
+
*
|
|
612
|
+
* @param userId - X/Twitter user ID (not username)
|
|
613
|
+
* @param cursor - Pagination cursor from previous response
|
|
614
|
+
*/
|
|
615
|
+
xVerifiedFollowers(userId: string, cursor?: string): Promise<XVerifiedFollowersResponse>;
|
|
616
|
+
/**
|
|
617
|
+
* Get tweets posted by an X/Twitter user.
|
|
618
|
+
*
|
|
619
|
+
* Powered by AttentionVC. $0.032 per page.
|
|
620
|
+
*
|
|
621
|
+
* @param username - X/Twitter username (without @)
|
|
622
|
+
* @param includeReplies - Include reply tweets (default: false)
|
|
623
|
+
* @param cursor - Pagination cursor from previous response
|
|
624
|
+
*/
|
|
625
|
+
xUserTweets(username: string, includeReplies?: boolean, cursor?: string): Promise<XTweetsResponse>;
|
|
626
|
+
/**
|
|
627
|
+
* Get tweets that mention an X/Twitter user.
|
|
628
|
+
*
|
|
629
|
+
* Powered by AttentionVC. $0.032 per page.
|
|
630
|
+
*
|
|
631
|
+
* @param username - X/Twitter username (without @)
|
|
632
|
+
* @param sinceTime - Start time filter (ISO8601 or Unix timestamp)
|
|
633
|
+
* @param untilTime - End time filter (ISO8601 or Unix timestamp)
|
|
634
|
+
* @param cursor - Pagination cursor from previous response
|
|
635
|
+
*/
|
|
636
|
+
xUserMentions(username: string, sinceTime?: string, untilTime?: string, cursor?: string): Promise<XMentionsResponse>;
|
|
637
|
+
/**
|
|
638
|
+
* Fetch full tweet data for up to 200 tweet IDs.
|
|
639
|
+
*
|
|
640
|
+
* Powered by AttentionVC. $0.16 per batch.
|
|
641
|
+
*
|
|
642
|
+
* @param tweetIds - Single tweet ID or array of tweet IDs (max 200)
|
|
643
|
+
*/
|
|
644
|
+
xTweetLookup(tweetIds: string | string[]): Promise<XTweetLookupResponse>;
|
|
645
|
+
/**
|
|
646
|
+
* Get replies to a specific tweet.
|
|
647
|
+
*
|
|
648
|
+
* Powered by AttentionVC. $0.032 per page.
|
|
649
|
+
*
|
|
650
|
+
* @param tweetId - The tweet ID to get replies for
|
|
651
|
+
* @param queryType - Sort order: 'Latest' or 'Default'
|
|
652
|
+
* @param cursor - Pagination cursor from previous response
|
|
653
|
+
*/
|
|
654
|
+
xTweetReplies(tweetId: string, queryType?: string, cursor?: string): Promise<XTweetRepliesResponse>;
|
|
655
|
+
/**
|
|
656
|
+
* Get the full thread context for a tweet.
|
|
657
|
+
*
|
|
658
|
+
* Powered by AttentionVC. $0.032 per page.
|
|
659
|
+
*
|
|
660
|
+
* @param tweetId - The tweet ID to get thread for
|
|
661
|
+
* @param cursor - Pagination cursor from previous response
|
|
662
|
+
*/
|
|
663
|
+
xTweetThread(tweetId: string, cursor?: string): Promise<XTweetThreadResponse>;
|
|
664
|
+
/**
|
|
665
|
+
* Search X/Twitter with advanced query operators.
|
|
666
|
+
*
|
|
667
|
+
* Powered by AttentionVC. $0.032 per page.
|
|
668
|
+
*
|
|
669
|
+
* @param query - Search query (supports Twitter search operators)
|
|
670
|
+
* @param queryType - Sort order: 'Latest', 'Top', or 'Default'
|
|
671
|
+
* @param cursor - Pagination cursor from previous response
|
|
672
|
+
*/
|
|
673
|
+
xSearch(query: string, queryType?: string, cursor?: string): Promise<XSearchResponse>;
|
|
674
|
+
/**
|
|
675
|
+
* Get current trending topics on X/Twitter.
|
|
676
|
+
*
|
|
677
|
+
* Powered by AttentionVC. $0.002 per request.
|
|
678
|
+
*/
|
|
679
|
+
xTrending(): Promise<XTrendingResponse>;
|
|
680
|
+
/**
|
|
681
|
+
* Get rising/viral articles from X/Twitter.
|
|
682
|
+
*
|
|
683
|
+
* Powered by AttentionVC intelligence layer. $0.05 per request.
|
|
684
|
+
*/
|
|
685
|
+
xArticlesRising(): Promise<XArticlesRisingResponse>;
|
|
686
|
+
/**
|
|
687
|
+
* Get author analytics and intelligence metrics for an X/Twitter user.
|
|
688
|
+
*
|
|
689
|
+
* Powered by AttentionVC intelligence layer. $0.02 per request.
|
|
690
|
+
*
|
|
691
|
+
* @param handle - X/Twitter handle (without @)
|
|
692
|
+
*/
|
|
693
|
+
xAuthorAnalytics(handle: string): Promise<XAuthorAnalyticsResponse>;
|
|
694
|
+
/**
|
|
695
|
+
* Compare two X/Twitter authors side-by-side with intelligence metrics.
|
|
696
|
+
*
|
|
697
|
+
* Powered by AttentionVC intelligence layer. $0.05 per request.
|
|
698
|
+
*
|
|
699
|
+
* @param handle1 - First X/Twitter handle (without @)
|
|
700
|
+
* @param handle2 - Second X/Twitter handle (without @)
|
|
701
|
+
*/
|
|
702
|
+
xCompareAuthors(handle1: string, handle2: string): Promise<XCompareAuthorsResponse>;
|
|
703
|
+
/**
|
|
704
|
+
* Query Predexon prediction market data (GET endpoints).
|
|
705
|
+
*
|
|
706
|
+
* Access real-time data from Polymarket, Kalshi, dFlow, and Binance Futures.
|
|
707
|
+
* Powered by Predexon. $0.001 per request.
|
|
708
|
+
*
|
|
709
|
+
* @param path - Endpoint path, e.g. "polymarket/events", "kalshi/markets/12345"
|
|
710
|
+
* @param params - Query parameters passed to the endpoint
|
|
711
|
+
*
|
|
712
|
+
* @example
|
|
713
|
+
* const events = await client.pm("polymarket/events");
|
|
714
|
+
* const market = await client.pm("kalshi/markets/KXBTC-25MAR14");
|
|
715
|
+
* const results = await client.pm("polymarket/search", { q: "bitcoin" });
|
|
716
|
+
*/
|
|
717
|
+
pm(path: string, params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
718
|
+
/**
|
|
719
|
+
* Structured query for Predexon prediction market data (POST endpoints).
|
|
720
|
+
*
|
|
721
|
+
* For complex queries that require a JSON body. $0.005 per request.
|
|
722
|
+
*
|
|
723
|
+
* @param path - Endpoint path, e.g. "polymarket/query", "kalshi/query"
|
|
724
|
+
* @param query - JSON body for the structured query
|
|
725
|
+
*
|
|
726
|
+
* @example
|
|
727
|
+
* const data = await client.pmQuery("polymarket/query", { filter: "active", limit: 10 });
|
|
728
|
+
*/
|
|
729
|
+
pmQuery(path: string, query: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
375
730
|
/**
|
|
376
731
|
* Get current session spending.
|
|
377
732
|
*
|
|
@@ -467,6 +822,19 @@ declare class ImageClient {
|
|
|
467
822
|
* console.log(result.data[0].url);
|
|
468
823
|
*/
|
|
469
824
|
generate(prompt: string, options?: ImageGenerateOptions): Promise<ImageResponse>;
|
|
825
|
+
/**
|
|
826
|
+
* Edit an image using img2img.
|
|
827
|
+
*
|
|
828
|
+
* @param prompt - Text description of the desired edit
|
|
829
|
+
* @param image - Base64-encoded image or URL of the source image
|
|
830
|
+
* @param options - Optional edit parameters
|
|
831
|
+
* @returns ImageResponse with edited image URLs
|
|
832
|
+
*
|
|
833
|
+
* @example
|
|
834
|
+
* const result = await client.edit('Make it a painting', imageBase64);
|
|
835
|
+
* console.log(result.data[0].url);
|
|
836
|
+
*/
|
|
837
|
+
edit(prompt: string, image: string, options?: ImageEditOptions): Promise<ImageResponse>;
|
|
470
838
|
/**
|
|
471
839
|
* List available image generation models with pricing.
|
|
472
840
|
*/
|
|
@@ -566,9 +934,26 @@ declare function createWallet(): {
|
|
|
566
934
|
* @returns Path to saved wallet file
|
|
567
935
|
*/
|
|
568
936
|
declare function saveWallet(privateKey: string): string;
|
|
937
|
+
/**
|
|
938
|
+
* Scan ~/.<dir>/wallet.json files from any provider (agentcash, etc.).
|
|
939
|
+
*
|
|
940
|
+
* Each file should contain JSON with "privateKey" and "address" fields.
|
|
941
|
+
* Results are sorted by modification time (most recent first).
|
|
942
|
+
*
|
|
943
|
+
* @returns Array of wallet objects with privateKey and address
|
|
944
|
+
*/
|
|
945
|
+
declare function scanWallets(): Array<{
|
|
946
|
+
privateKey: string;
|
|
947
|
+
address: string;
|
|
948
|
+
}>;
|
|
569
949
|
/**
|
|
570
950
|
* Load wallet private key from file.
|
|
571
951
|
*
|
|
952
|
+
* Priority:
|
|
953
|
+
* 1. Scan ~/.* /wallet.json (any provider)
|
|
954
|
+
* 2. Legacy ~/.blockrun/.session
|
|
955
|
+
* 3. Legacy ~/.blockrun/wallet.key
|
|
956
|
+
*
|
|
572
957
|
* @returns Private key string or null if not found
|
|
573
958
|
*/
|
|
574
959
|
declare function loadWallet(): string | null;
|
|
@@ -577,9 +962,10 @@ declare function loadWallet(): string | null;
|
|
|
577
962
|
*
|
|
578
963
|
* Priority:
|
|
579
964
|
* 1. BLOCKRUN_WALLET_KEY environment variable
|
|
580
|
-
* 2.
|
|
581
|
-
* 3. ~/.blockrun
|
|
582
|
-
* 4.
|
|
965
|
+
* 2. Scan wallet.json files from providers
|
|
966
|
+
* 3. ~/.blockrun/.session file
|
|
967
|
+
* 4. ~/.blockrun/wallet.key file - legacy
|
|
968
|
+
* 5. Create new wallet
|
|
583
969
|
*
|
|
584
970
|
* @returns WalletInfo with address, privateKey, and isNew flag
|
|
585
971
|
*/
|
|
@@ -672,12 +1058,43 @@ declare class SolanaLLMClient {
|
|
|
672
1058
|
chatCompletion(model: string, messages: ChatMessage[], options?: ChatCompletionOptions): Promise<ChatResponse>;
|
|
673
1059
|
/** List available models. */
|
|
674
1060
|
listModels(): Promise<Model[]>;
|
|
1061
|
+
/**
|
|
1062
|
+
* Get Solana USDC balance.
|
|
1063
|
+
*
|
|
1064
|
+
* @returns USDC balance as a float
|
|
1065
|
+
*/
|
|
1066
|
+
getBalance(): Promise<number>;
|
|
1067
|
+
/** Edit an image using img2img (Solana payment). */
|
|
1068
|
+
imageEdit(prompt: string, image: string, options?: ImageEditOptions): Promise<ImageResponse>;
|
|
1069
|
+
/** Standalone search (Solana payment). */
|
|
1070
|
+
search(query: string, options?: SearchOptions): Promise<SearchResult>;
|
|
1071
|
+
xUserLookup(usernames: string | string[]): Promise<XUserLookupResponse>;
|
|
1072
|
+
xFollowers(username: string, cursor?: string): Promise<XFollowersResponse>;
|
|
1073
|
+
xFollowings(username: string, cursor?: string): Promise<XFollowingsResponse>;
|
|
1074
|
+
xUserInfo(username: string): Promise<XUserInfoResponse>;
|
|
1075
|
+
xVerifiedFollowers(userId: string, cursor?: string): Promise<XVerifiedFollowersResponse>;
|
|
1076
|
+
xUserTweets(username: string, includeReplies?: boolean, cursor?: string): Promise<XTweetsResponse>;
|
|
1077
|
+
xUserMentions(username: string, sinceTime?: string, untilTime?: string, cursor?: string): Promise<XMentionsResponse>;
|
|
1078
|
+
xTweetLookup(tweetIds: string | string[]): Promise<XTweetLookupResponse>;
|
|
1079
|
+
xTweetReplies(tweetId: string, queryType?: string, cursor?: string): Promise<XTweetRepliesResponse>;
|
|
1080
|
+
xTweetThread(tweetId: string, cursor?: string): Promise<XTweetThreadResponse>;
|
|
1081
|
+
xSearch(query: string, queryType?: string, cursor?: string): Promise<XSearchResponse>;
|
|
1082
|
+
xTrending(): Promise<XTrendingResponse>;
|
|
1083
|
+
xArticlesRising(): Promise<XArticlesRisingResponse>;
|
|
1084
|
+
xAuthorAnalytics(handle: string): Promise<XAuthorAnalyticsResponse>;
|
|
1085
|
+
xCompareAuthors(handle1: string, handle2: string): Promise<XCompareAuthorsResponse>;
|
|
1086
|
+
pm(path: string, params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1087
|
+
pmQuery(path: string, query: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
675
1088
|
/** Get session spending. */
|
|
676
1089
|
getSpending(): Spending;
|
|
677
1090
|
/** True if using sol.blockrun.ai. */
|
|
678
1091
|
isSolana(): boolean;
|
|
679
1092
|
private requestWithPayment;
|
|
680
1093
|
private handlePaymentAndRetry;
|
|
1094
|
+
private requestWithPaymentRaw;
|
|
1095
|
+
private handlePaymentAndRetryRaw;
|
|
1096
|
+
private getWithPaymentRaw;
|
|
1097
|
+
private handleGetPaymentAndRetryRaw;
|
|
681
1098
|
private fetchWithTimeout;
|
|
682
1099
|
}
|
|
683
1100
|
/**
|
|
@@ -709,9 +1126,60 @@ declare function solanaKeyToBytes(privateKey: string): Promise<Uint8Array>;
|
|
|
709
1126
|
*/
|
|
710
1127
|
declare function solanaPublicKey(privateKey: string): Promise<string>;
|
|
711
1128
|
declare function saveSolanaWallet(privateKey: string): string;
|
|
1129
|
+
/**
|
|
1130
|
+
* Scan ~/.<dir>/solana-wallet.json files from any provider.
|
|
1131
|
+
*
|
|
1132
|
+
* Each file should contain JSON with "privateKey" and "address" fields.
|
|
1133
|
+
* Also checks ~/.brcc/wallet.json for BRCC wallets.
|
|
1134
|
+
* Results are sorted by modification time (most recent first).
|
|
1135
|
+
*
|
|
1136
|
+
* @returns Array of wallet objects with secretKey and publicKey
|
|
1137
|
+
*/
|
|
1138
|
+
declare function scanSolanaWallets(): Array<{
|
|
1139
|
+
secretKey: string;
|
|
1140
|
+
publicKey: string;
|
|
1141
|
+
}>;
|
|
712
1142
|
declare function loadSolanaWallet(): string | null;
|
|
713
1143
|
declare function getOrCreateSolanaWallet(): Promise<SolanaWalletInfo>;
|
|
714
1144
|
|
|
1145
|
+
declare function getCached(key: string): unknown | null;
|
|
1146
|
+
declare function getCachedByRequest(endpoint: string, body: Record<string, unknown>): unknown | null;
|
|
1147
|
+
declare function setCache(key: string, data: unknown, ttlMs: number): void;
|
|
1148
|
+
declare function saveToCache(endpoint: string, body: Record<string, unknown>, response: unknown, costUsd?: number): void;
|
|
1149
|
+
declare function clearCache(): number;
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* Agent wallet setup utilities.
|
|
1153
|
+
*
|
|
1154
|
+
* Convenience functions for agent runtimes (Claude Code skills, etc.)
|
|
1155
|
+
* that auto-create wallets and return configured clients.
|
|
1156
|
+
*/
|
|
1157
|
+
|
|
1158
|
+
declare function setupAgentWallet(options?: {
|
|
1159
|
+
silent?: boolean;
|
|
1160
|
+
}): LLMClient;
|
|
1161
|
+
declare function setupAgentSolanaWallet(options?: {
|
|
1162
|
+
silent?: boolean;
|
|
1163
|
+
}): Promise<SolanaLLMClient>;
|
|
1164
|
+
declare function status(): Promise<{
|
|
1165
|
+
address: string;
|
|
1166
|
+
balance: number;
|
|
1167
|
+
}>;
|
|
1168
|
+
|
|
1169
|
+
interface CostEntry {
|
|
1170
|
+
timestamp: string;
|
|
1171
|
+
model: string;
|
|
1172
|
+
inputTokens: number;
|
|
1173
|
+
outputTokens: number;
|
|
1174
|
+
costUsd: number;
|
|
1175
|
+
}
|
|
1176
|
+
declare function logCost(entry: CostEntry): void;
|
|
1177
|
+
declare function getCostSummary(): {
|
|
1178
|
+
totalUsd: number;
|
|
1179
|
+
calls: number;
|
|
1180
|
+
byModel: Record<string, number>;
|
|
1181
|
+
};
|
|
1182
|
+
|
|
715
1183
|
/**
|
|
716
1184
|
* OpenAI-compatible API wrapper for BlockRun LLM SDK.
|
|
717
1185
|
*
|
|
@@ -851,4 +1319,4 @@ declare class OpenAI {
|
|
|
851
1319
|
getWalletAddress(): string;
|
|
852
1320
|
}
|
|
853
1321
|
|
|
854
|
-
export { APIError, BASE_CHAIN_ID, BlockrunError, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatUsage, type FunctionCall, type FunctionDefinition, ImageClient, type ImageClientOptions, type ImageData, 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 SearchParameters, 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 XSearchSource, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, formatFundingMessageCompact, formatNeedsFundingMessage, formatWalletCreatedMessage, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, loadSolanaWallet, loadWallet, saveSolanaWallet, saveWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, testnetClient };
|
|
1322
|
+
export { APIError, BASE_CHAIN_ID, BlockrunError, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatUsage, type CostEntry, 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, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, formatFundingMessageCompact, formatNeedsFundingMessage, formatWalletCreatedMessage, getCached, getCachedByRequest, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, loadSolanaWallet, loadWallet, logCost, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, testnetClient };
|