@blockrun/llm 2.4.0 → 2.7.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: