@blockrun/llm 2.3.0 → 2.5.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 CHANGED
@@ -41,6 +41,53 @@ const response = await client.chat('openai/gpt-4o', 'Hello!');
41
41
 
42
42
  That's it. The SDK handles x402 payment automatically.
43
43
 
44
+ ## `BlockrunClient` — the universal primitive (recommended for new code)
45
+
46
+ Starting in `2.5.0`, the SDK ships a single `BlockrunClient` that speaks to
47
+ **every** BlockRun endpoint over x402. New API surfaces are intended to be
48
+ distributed as [Claude Code skills](https://github.com/anthropics/skills)
49
+ that drive this primitive — no SDK release required to add an endpoint.
50
+
51
+ ```typescript
52
+ import { BlockrunClient } from '@blockrun/llm';
53
+
54
+ const br = new BlockrunClient();
55
+
56
+ // Sync GET — Surf market price (Tier 1, $0.001)
57
+ const btc = await br.get('/v1/surf/market/price', { symbol: 'BTC' });
58
+
59
+ // Sync POST — raw on-chain SQL (Tier 3, $0.020)
60
+ const rows = await br.post('/v1/surf/onchain/sql', {
61
+ query: 'SELECT block_number FROM ethereum.blocks ORDER BY block_number DESC LIMIT 1',
62
+ });
63
+
64
+ // Submit + poll — long-running video gen (settled only on completion)
65
+ const video = await br.poll('/v1/videos/generations', {
66
+ model: 'xai/grok-imagine-video',
67
+ prompt: 'a red apple spinning',
68
+ });
69
+
70
+ // Streaming SSE — chat completions
71
+ for await (const chunk of br.stream('/v1/chat/completions', {
72
+ model: 'anthropic/claude-sonnet-4-6',
73
+ messages: [{ role: 'user', content: 'Hi' }],
74
+ stream: true,
75
+ })) {
76
+ process.stdout.write(chunk?.choices?.[0]?.delta?.content ?? '');
77
+ }
78
+ ```
79
+
80
+ Four call shapes cover every endpoint type:
81
+ - `get<T>(path, params?)` — synchronous GET (price, ranking, list, news)
82
+ - `post<T>(path, body?)` — synchronous POST (on-chain SQL, search)
83
+ - `poll<T>(path, body?, { budgetMs, intervalMs })` — submit + poll (image, video, music, voice)
84
+ - `stream<T>(path, body?)` — async iterator over SSE chunks (chat)
85
+
86
+ The per-API client classes (`LLMClient`, `ImageClient`, `VideoClient`,
87
+ `VoiceClient`, `MusicClient`, `SearchClient`, `XClient`, `PriceClient`,
88
+ `SurfClient`) all remain — they will be soft-deprecated in 2.6 (rewritten as
89
+ shims over `BlockrunClient`) and removed in 3.0.
90
+
44
91
  ### Try It Free (No USDC Required)
45
92
 
46
93
  Want to kick the tires before funding a wallet? Route to BlockRun's free NVIDIA tier:
@@ -455,6 +502,50 @@ const results = await x.search('x402 micropayments', { queryType: 'Latest' });
455
502
  const tweets = await x.userTweets({ username: 'vitalikbuterin', includeReplies: false });
456
503
  ```
457
504
 
505
+ ### Surf Crypto Data
506
+
507
+ `SurfClient` exposes the full `/v1/surf/*` catalog — 84+ pay-per-call
508
+ endpoints across CEX/DEX market data, on-chain SQL, wallet intelligence,
509
+ prediction markets (Polymarket + Kalshi), social analytics, news, VC fund
510
+ data, and an OpenAI-compatible chat surface. Flat pricing per call:
511
+
512
+ | Tier | Price/call | Examples |
513
+ |------|-----------|----------|
514
+ | 1 | $0.001 | `/market/price`, `/market/ranking`, `/news/feed`, prediction-market reads, social tweets |
515
+ | 2 | $0.005 | `/exchange/depth`, `/exchange/klines`, `/wallet/detail`, `/search/*`, `/social/ranking` |
516
+ | 3 | $0.020 | `/onchain/sql`, `/onchain/query`, `/onchain/schema`, `/chat/completions` |
517
+
518
+ Because the catalog is broad and evolving, the client deliberately ships a
519
+ generic `get` / `post` pair instead of 84 typed wrappers. Pass the path
520
+ (with or without the `/v1/surf` prefix), query params, or a JSON body —
521
+ type the response via a generic if you want.
522
+
523
+ ```ts
524
+ import { SurfClient } from '@blockrun/llm';
525
+
526
+ const surf = new SurfClient();
527
+
528
+ // Tier 1 — token price ($0.001)
529
+ const btc = await surf.get('/market/price', { symbol: 'BTC' });
530
+
531
+ // Tier 2 — order book depth ($0.005)
532
+ const book = await surf.get('/exchange/depth', {
533
+ exchange: 'binance',
534
+ symbol: 'BTC-USDT',
535
+ });
536
+
537
+ // Tier 3 — raw on-chain SQL against 80+ ClickHouse tables ($0.020)
538
+ const rows = await surf.post('/onchain/sql', {
539
+ query: 'SELECT block_number FROM ethereum.blocks ORDER BY block_number DESC LIMIT 5',
540
+ });
541
+
542
+ // Typed response via generic
543
+ type Price = { symbol: string; price: number; timestamp: string };
544
+ const eth = await surf.get<Price>('/market/price', { symbol: 'ETH' });
545
+ ```
546
+
547
+ Full endpoint inventory: <https://blockrun.ai/marketplace/surf>.
548
+
458
549
  Methods: `userLookup`, `userInfo`, `followers`, `following`, `followings`,
459
550
  `verifiedFollowers`, `userTweets`, `mentions`, `tweetLookup`, `tweetReplies`,
460
551
  `tweetThread`, `search`, `trending`, `articlesRising`.