@blockrun/llm 1.0.0 → 1.1.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 +48 -11
- package/dist/{chunk-S7BEMV6T.js → chunk-KRDGCX7W.js} +25914 -25839
- package/dist/{esm-EBZAIN5N.js → esm-PTFDM6PE.js} +159 -6
- package/dist/index.cjs +36896 -38
- package/dist/index.d.cts +112 -2
- package/dist/index.d.ts +112 -2
- package/dist/{index.esm-WP2DIBSK.js → index.esm-SXKIFLA7.js} +3 -2
- package/dist/index.js +332 -2
- package/package.json +71 -71
- package/dist/chunk-2ESYSVXG.js +0 -48
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @blockrun/llm
|
|
2
2
|
|
|
3
|
-
Pay-per-request access to GPT-4o, Claude 4, Gemini
|
|
3
|
+
Pay-per-request access to GPT-4o, Claude 4, Gemini 3.1, and more via x402 micropayments on Base and Solana.
|
|
4
4
|
|
|
5
5
|
**Networks:**
|
|
6
6
|
- **Base Mainnet:** Chain ID 8453 - Production with real USDC
|
|
@@ -35,13 +35,44 @@ That's it. The SDK handles x402 payment automatically.
|
|
|
35
35
|
## Quick Start (Solana)
|
|
36
36
|
|
|
37
37
|
```typescript
|
|
38
|
-
import {
|
|
38
|
+
import { SolanaLLMClient } from '@blockrun/llm';
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
const
|
|
40
|
+
// SOLANA_WALLET_KEY env var (bs58-encoded Solana secret key)
|
|
41
|
+
const client = new SolanaLLMClient();
|
|
42
|
+
const response = await client.chat('openai/gpt-4o', 'gm Solana');
|
|
43
|
+
console.log(response);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Set `SOLANA_WALLET_KEY` to your bs58-encoded Solana secret key. Payments are automatic via x402 — your key never leaves your machine.
|
|
47
|
+
|
|
48
|
+
## Solana Support
|
|
49
|
+
|
|
50
|
+
Pay for AI calls with Solana USDC via [sol.blockrun.ai](https://sol.blockrun.ai):
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import { SolanaLLMClient } from '@blockrun/llm';
|
|
54
|
+
|
|
55
|
+
// SOLANA_WALLET_KEY env var (bs58-encoded Solana secret key)
|
|
56
|
+
const client = new SolanaLLMClient();
|
|
57
|
+
|
|
58
|
+
// Or pass key directly
|
|
59
|
+
const client2 = new SolanaLLMClient({ privateKey: 'your-bs58-solana-key' });
|
|
60
|
+
|
|
61
|
+
// Same API as LLMClient
|
|
62
|
+
const response = await client.chat('openai/gpt-4o', 'gm Solana');
|
|
63
|
+
console.log(response);
|
|
64
|
+
|
|
65
|
+
// Live Search with Grok (Solana payment)
|
|
66
|
+
const tweet = await client.chat('xai/grok-3-mini', 'What is trending on X?', { search: true });
|
|
42
67
|
```
|
|
43
68
|
|
|
44
|
-
|
|
69
|
+
**Setup:**
|
|
70
|
+
1. Export your Solana wallet key: `export SOLANA_WALLET_KEY="your-bs58-key"`
|
|
71
|
+
2. Fund with USDC on Solana mainnet
|
|
72
|
+
3. That's it — payments are automatic via x402
|
|
73
|
+
|
|
74
|
+
**Supported endpoint:** `https://sol.blockrun.ai/api`
|
|
75
|
+
**Payment:** Solana USDC (SPL, mainnet)
|
|
45
76
|
|
|
46
77
|
## How It Works
|
|
47
78
|
|
|
@@ -95,9 +126,11 @@ For Solana, set `BLOCKRUN_SOLANA_KEY` environment variable with your base58-enco
|
|
|
95
126
|
### Google Gemini
|
|
96
127
|
| Model | Input Price | Output Price |
|
|
97
128
|
|-------|-------------|--------------|
|
|
98
|
-
| `google/gemini-3-pro
|
|
129
|
+
| `google/gemini-3.1-pro` | $2.00/M | $12.00/M |
|
|
130
|
+
| `google/gemini-3-flash-preview` | $0.50/M | $3.00/M |
|
|
99
131
|
| `google/gemini-2.5-pro` | $1.25/M | $10.00/M |
|
|
100
132
|
| `google/gemini-2.5-flash` | $0.30/M | $2.50/M |
|
|
133
|
+
| `google/gemini-2.5-flash-lite` | $0.10/M | $0.40/M |
|
|
101
134
|
|
|
102
135
|
### DeepSeek
|
|
103
136
|
| Model | Input Price | Output Price |
|
|
@@ -123,6 +156,11 @@ For Solana, set `BLOCKRUN_SOLANA_KEY` environment variable with your base58-enco
|
|
|
123
156
|
|-------|-------------|--------------|
|
|
124
157
|
| `moonshot/kimi-k2.5` | $0.60/M | $3.00/M |
|
|
125
158
|
|
|
159
|
+
### MiniMax
|
|
160
|
+
| Model | Input Price | Output Price |
|
|
161
|
+
|-------|-------------|--------------|
|
|
162
|
+
| `minimax/minimax-m2.5` | $0.30/M | $1.20/M |
|
|
163
|
+
|
|
126
164
|
### NVIDIA (Free & Hosted)
|
|
127
165
|
| Model | Input Price | Output Price | Notes |
|
|
128
166
|
|-------|-------------|--------------|-------|
|
|
@@ -323,9 +361,8 @@ const client = new LLMClient({
|
|
|
323
361
|
|
|
324
362
|
| Variable | Description |
|
|
325
363
|
|----------|-------------|
|
|
326
|
-
| `BASE_CHAIN_WALLET_KEY` | Your Base chain wallet private key (for Base) |
|
|
327
|
-
| `
|
|
328
|
-
| `BLOCKRUN_NETWORK` | Default network: `base` or `solana` (optional, default: base) |
|
|
364
|
+
| `BASE_CHAIN_WALLET_KEY` | Your Base chain wallet private key (for Base / `LLMClient`) |
|
|
365
|
+
| `SOLANA_WALLET_KEY` | Your Solana wallet secret key - bs58 encoded (for `SolanaLLMClient`) |
|
|
329
366
|
| `BLOCKRUN_API_URL` | API endpoint (optional, default: https://blockrun.ai/api) |
|
|
330
367
|
|
|
331
368
|
## Error Handling
|
|
@@ -387,11 +424,11 @@ BASE_CHAIN_WALLET_KEY=0x...
|
|
|
387
424
|
### Solana
|
|
388
425
|
1. Create a Solana wallet (Phantom, Backpack, Solflare, etc.)
|
|
389
426
|
2. Get USDC on Solana for API payments
|
|
390
|
-
3. Export your secret key and set as `
|
|
427
|
+
3. Export your secret key and set as `SOLANA_WALLET_KEY`
|
|
391
428
|
|
|
392
429
|
```bash
|
|
393
430
|
# .env
|
|
394
|
-
|
|
431
|
+
SOLANA_WALLET_KEY=...your_bs58_secret_key
|
|
395
432
|
```
|
|
396
433
|
|
|
397
434
|
Note: Solana transactions are gasless for the user - the CDP facilitator pays for transaction fees.
|