@blockrun/llm 1.12.0 → 1.13.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 +51 -12
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +5 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @blockrun/llm (TypeScript SDK)
|
|
2
2
|
|
|
3
3
|
> **@blockrun/llm** is a TypeScript/Node.js SDK for accessing 41+ large language models (GPT-5, Claude, Gemini, Grok, DeepSeek, Kimi, and more) with automatic pay-per-request USDC micropayments via the x402 protocol. No API keys required — your wallet signature is your authentication. Supports **streaming**, smart routing, Base and Solana chains.
|
|
4
|
+
>
|
|
5
|
+
> 🆓 **Includes 9 fully-free NVIDIA-hosted models** — DeepSeek V4 Pro/Flash (1M context), Nemotron Nano Omni (vision), Qwen3, Llama 4, GLM-4.7, Mistral. Zero USDC, no rate-limit gimmicks. Use `routingProfile: 'free'` or call any `nvidia/*` model directly.
|
|
4
6
|
|
|
5
7
|
[](https://www.npmjs.com/package/@blockrun/llm)
|
|
6
8
|
[](LICENSE)
|
|
@@ -39,6 +41,40 @@ const response = await client.chat('openai/gpt-4o', 'Hello!');
|
|
|
39
41
|
|
|
40
42
|
That's it. The SDK handles x402 payment automatically.
|
|
41
43
|
|
|
44
|
+
### Try It Free (No USDC Required)
|
|
45
|
+
|
|
46
|
+
Want to kick the tires before funding a wallet? Route to BlockRun's free NVIDIA tier:
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { LLMClient } from '@blockrun/llm';
|
|
50
|
+
|
|
51
|
+
const client = new LLMClient(); // Wallet still required for signing, but $0 charged
|
|
52
|
+
|
|
53
|
+
// Option 1: call a free model directly
|
|
54
|
+
const reply = await client.chat('nvidia/qwen3-next-80b-a3b-thinking', 'Explain x402 in 1 sentence');
|
|
55
|
+
|
|
56
|
+
// Option 2: let the smart router pick the best free model per request
|
|
57
|
+
const result = await client.smartChat('What is 2+2?', { routingProfile: 'free' });
|
|
58
|
+
console.log(result.model); // e.g. 'nvidia/deepseek-v4-flash' (cheapest capable for SIMPLE tier)
|
|
59
|
+
console.log(result.response); // '4'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Available free models** (input + output both $0, all NVIDIA-hosted, last refreshed 2026-04-28):
|
|
63
|
+
|
|
64
|
+
| Model ID | Context | Best For |
|
|
65
|
+
|----------|---------|----------|
|
|
66
|
+
| `nvidia/deepseek-v4-pro` | 1M | Flagship reasoning — MMLU-Pro 87.5, GPQA 90.1, SWE-bench 80.6, LiveCodeBench 93.5 |
|
|
67
|
+
| `nvidia/deepseek-v4-flash` | 1M | ~5× faster than V4 Pro — chat, summarization, light reasoning (weaker factual recall) |
|
|
68
|
+
| `nvidia/nemotron-3-nano-omni-30b-a3b-reasoning` | 256K | Only vision-capable free model — text + images + video (≤2 min) + audio (≤1 hr) |
|
|
69
|
+
| `nvidia/qwen3-next-80b-a3b-thinking` | 131K | 116 tok/s reasoning with thinking mode |
|
|
70
|
+
| `nvidia/mistral-small-4-119b` | 131K | 114 tok/s — fastest free chat |
|
|
71
|
+
| `nvidia/glm-4.7` | 131K | 237 tok/s — GLM-4.7 with thinking mode |
|
|
72
|
+
| `nvidia/llama-4-maverick` | 131K | Meta Llama 4 Maverick MoE |
|
|
73
|
+
| `nvidia/qwen3-coder-480b` | 131K | Coding-optimised 480B MoE |
|
|
74
|
+
| `nvidia/deepseek-v3.2` | 131K | Legacy V3.2 — auto-upgrades to V4 Pro via fallback |
|
|
75
|
+
|
|
76
|
+
> Note: `nvidia/gpt-oss-120b` and `nvidia/gpt-oss-20b` were retired 2026-04-28 — NVIDIA's free build.nvidia.com tier reserves the right to use prompts/outputs for service improvement, which conflicts with our data-privacy policy.
|
|
77
|
+
|
|
42
78
|
## Quick Start (Solana)
|
|
43
79
|
|
|
44
80
|
```typescript
|
|
@@ -115,7 +151,7 @@ console.log(complex.model); // 'xai/grok-4-1-fast-reasoning'
|
|
|
115
151
|
|
|
116
152
|
| Profile | Description | Best For |
|
|
117
153
|
|---------|-------------|----------|
|
|
118
|
-
| `free` |
|
|
154
|
+
| `free` | NVIDIA free tier — smart-routes across 9 models (DeepSeek V4 Pro/Flash, Nemotron Nano Omni, Qwen3, GLM-4.7, Llama 4, Mistral) | Zero-cost testing, dev, prod |
|
|
119
155
|
| `eco` | Cheapest models per tier (DeepSeek, xAI) | Cost-sensitive production |
|
|
120
156
|
| `auto` | Best balance of cost/quality (default) | General use |
|
|
121
157
|
| `premium` | Top-tier models (OpenAI, Anthropic) | Quality-critical tasks |
|
|
@@ -245,20 +281,23 @@ Released 2026-04-23 — first fully retrained base since GPT-4.5. 1M context, 12
|
|
|
245
281
|
|
|
246
282
|
### NVIDIA (Free) + Moonshot
|
|
247
283
|
|
|
248
|
-
Free tier refreshed 2026-04-
|
|
249
|
-
`
|
|
250
|
-
|
|
284
|
+
Free tier refreshed 2026-04-28: added DeepSeek V4 Pro/Flash and Nemotron Nano
|
|
285
|
+
Omni (vision); retired `nvidia/gpt-oss-120b` / `nvidia/gpt-oss-20b` over data
|
|
286
|
+
privacy (NVIDIA's free build.nvidia.com tier reserves the right to use prompts
|
|
287
|
+
for service improvement, which conflicts with our policy). Backend
|
|
288
|
+
auto-redirects retired IDs to the replacements below.
|
|
251
289
|
|
|
252
290
|
| Model | Input Price | Output Price | Notes |
|
|
253
291
|
|-------|-------------|--------------|-------|
|
|
254
|
-
| `nvidia/
|
|
255
|
-
| `nvidia/
|
|
256
|
-
| `nvidia/
|
|
257
|
-
| `nvidia/
|
|
292
|
+
| `nvidia/deepseek-v4-pro` | **FREE** | **FREE** | 1.6T MoE / 49B active, 1M context — flagship reasoning (MMLU-Pro 87.5, GPQA 90.1) |
|
|
293
|
+
| `nvidia/deepseek-v4-flash` | **FREE** | **FREE** | 284B / 13B active MoE, 1M context — ~5× faster than V4 Pro |
|
|
294
|
+
| `nvidia/nemotron-3-nano-omni-30b-a3b-reasoning` | **FREE** | **FREE** | 31B / 3.2B active MoE, 256K — only vision-capable free model |
|
|
295
|
+
| `nvidia/qwen3-next-80b-a3b-thinking` | **FREE** | **FREE** | 116 tok/s — reasoning flagship with thinking mode |
|
|
296
|
+
| `nvidia/mistral-small-4-119b` | **FREE** | **FREE** | 114 tok/s — fastest free chat |
|
|
297
|
+
| `nvidia/glm-4.7` | **FREE** | **FREE** | 237 tok/s — GLM-4.7 with thinking mode |
|
|
298
|
+
| `nvidia/llama-4-maverick` | **FREE** | **FREE** | Meta Llama 4 Maverick MoE |
|
|
258
299
|
| `nvidia/qwen3-coder-480b` | **FREE** | **FREE** | Coding-optimised 480B MoE |
|
|
259
|
-
| `nvidia/deepseek-v3.2` | **FREE** | **FREE** |
|
|
260
|
-
| `nvidia/gpt-oss-120b` | **FREE** | **FREE** | OpenAI open-weight 120B — 123 tok/s |
|
|
261
|
-
| `nvidia/gpt-oss-20b` | **FREE** | **FREE** | OpenAI open-weight 20B — 155 tok/s |
|
|
300
|
+
| `nvidia/deepseek-v3.2` | **FREE** | **FREE** | Legacy V3.2 — auto-upgrades to V4 Pro via fallback |
|
|
262
301
|
| `moonshot/kimi-k2.5` | $0.60/M | $3.00/M | Direct from Moonshot — replaces `nvidia/kimi-k2.5` |
|
|
263
302
|
|
|
264
303
|
### E2E Verified Models
|
|
@@ -544,7 +583,7 @@ const premium = await client.smartChat('Write a legal brief', { routingProfile:
|
|
|
544
583
|
|
|
545
584
|
| Profile | Description | Best For |
|
|
546
585
|
|---------|-------------|----------|
|
|
547
|
-
| `free` | NVIDIA free models
|
|
586
|
+
| `free` | NVIDIA free tier (9 models, smart-routed) | Zero-cost testing, dev, prod |
|
|
548
587
|
| `eco` | Budget-optimized | Cost-sensitive workloads |
|
|
549
588
|
| `auto` | Intelligent routing (default) | General use |
|
|
550
589
|
| `premium` | Best quality models | Critical tasks |
|
package/dist/index.cjs
CHANGED
|
@@ -2824,13 +2824,13 @@ var path2 = __toESM(require("path"), 1);
|
|
|
2824
2824
|
var os2 = __toESM(require("os"), 1);
|
|
2825
2825
|
var WALLET_DIR2 = path2.join(os2.homedir(), ".blockrun");
|
|
2826
2826
|
var SOLANA_WALLET_FILE = path2.join(WALLET_DIR2, ".solana-session");
|
|
2827
|
-
function createSolanaWallet() {
|
|
2828
|
-
const { Keypair } =
|
|
2829
|
-
const bs58 =
|
|
2827
|
+
async function createSolanaWallet() {
|
|
2828
|
+
const { Keypair } = await import("@solana/web3.js");
|
|
2829
|
+
const bs58 = await import("bs58");
|
|
2830
2830
|
const keypair = Keypair.generate();
|
|
2831
2831
|
return {
|
|
2832
2832
|
address: keypair.publicKey.toBase58(),
|
|
2833
|
-
privateKey: bs58.default
|
|
2833
|
+
privateKey: (bs58.default ?? bs58).encode(keypair.secretKey)
|
|
2834
2834
|
};
|
|
2835
2835
|
}
|
|
2836
2836
|
async function solanaKeyToBytes(privateKey) {
|
|
@@ -2923,7 +2923,7 @@ async function getOrCreateSolanaWallet() {
|
|
|
2923
2923
|
return { privateKey: fileKey, address: address2, isNew: false };
|
|
2924
2924
|
}
|
|
2925
2925
|
}
|
|
2926
|
-
const { address, privateKey } = createSolanaWallet();
|
|
2926
|
+
const { address, privateKey } = await createSolanaWallet();
|
|
2927
2927
|
saveSolanaWallet(privateKey);
|
|
2928
2928
|
return { address, privateKey, isNew: true };
|
|
2929
2929
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1746,12 +1746,14 @@ interface SolanaWalletInfo {
|
|
|
1746
1746
|
}
|
|
1747
1747
|
/**
|
|
1748
1748
|
* Create a new Solana wallet.
|
|
1749
|
-
* Requires @solana/web3.js (optional dep)
|
|
1749
|
+
* Requires @solana/web3.js (optional dep) — loaded lazily via dynamic
|
|
1750
|
+
* import so callers that never touch Solana don't pay the resolution cost
|
|
1751
|
+
* and ESM consumers don't trip over esbuild's __require shim.
|
|
1750
1752
|
*/
|
|
1751
|
-
declare function createSolanaWallet(): {
|
|
1753
|
+
declare function createSolanaWallet(): Promise<{
|
|
1752
1754
|
address: string;
|
|
1753
1755
|
privateKey: string;
|
|
1754
|
-
}
|
|
1756
|
+
}>;
|
|
1755
1757
|
/**
|
|
1756
1758
|
* Convert a bs58 private key string to Uint8Array (64 bytes).
|
|
1757
1759
|
* Accepts: bs58-encoded 64-byte key (standard Solana format).
|
package/dist/index.d.ts
CHANGED
|
@@ -1746,12 +1746,14 @@ interface SolanaWalletInfo {
|
|
|
1746
1746
|
}
|
|
1747
1747
|
/**
|
|
1748
1748
|
* Create a new Solana wallet.
|
|
1749
|
-
* Requires @solana/web3.js (optional dep)
|
|
1749
|
+
* Requires @solana/web3.js (optional dep) — loaded lazily via dynamic
|
|
1750
|
+
* import so callers that never touch Solana don't pay the resolution cost
|
|
1751
|
+
* and ESM consumers don't trip over esbuild's __require shim.
|
|
1750
1752
|
*/
|
|
1751
|
-
declare function createSolanaWallet(): {
|
|
1753
|
+
declare function createSolanaWallet(): Promise<{
|
|
1752
1754
|
address: string;
|
|
1753
1755
|
privateKey: string;
|
|
1754
|
-
}
|
|
1756
|
+
}>;
|
|
1755
1757
|
/**
|
|
1756
1758
|
* Convert a bs58 private key string to Uint8Array (64 bytes).
|
|
1757
1759
|
* Accepts: bs58-encoded 64-byte key (standard Solana format).
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
-
});
|
|
7
|
-
|
|
8
1
|
// src/client.ts
|
|
9
2
|
import { privateKeyToAccount } from "viem/accounts";
|
|
10
3
|
|
|
@@ -2735,13 +2728,13 @@ import * as path2 from "path";
|
|
|
2735
2728
|
import * as os2 from "os";
|
|
2736
2729
|
var WALLET_DIR2 = path2.join(os2.homedir(), ".blockrun");
|
|
2737
2730
|
var SOLANA_WALLET_FILE = path2.join(WALLET_DIR2, ".solana-session");
|
|
2738
|
-
function createSolanaWallet() {
|
|
2739
|
-
const { Keypair } =
|
|
2740
|
-
const bs58 =
|
|
2731
|
+
async function createSolanaWallet() {
|
|
2732
|
+
const { Keypair } = await import("@solana/web3.js");
|
|
2733
|
+
const bs58 = await import("bs58");
|
|
2741
2734
|
const keypair = Keypair.generate();
|
|
2742
2735
|
return {
|
|
2743
2736
|
address: keypair.publicKey.toBase58(),
|
|
2744
|
-
privateKey: bs58.default
|
|
2737
|
+
privateKey: (bs58.default ?? bs58).encode(keypair.secretKey)
|
|
2745
2738
|
};
|
|
2746
2739
|
}
|
|
2747
2740
|
async function solanaKeyToBytes(privateKey) {
|
|
@@ -2834,7 +2827,7 @@ async function getOrCreateSolanaWallet() {
|
|
|
2834
2827
|
return { privateKey: fileKey, address: address2, isNew: false };
|
|
2835
2828
|
}
|
|
2836
2829
|
}
|
|
2837
|
-
const { address, privateKey } = createSolanaWallet();
|
|
2830
|
+
const { address, privateKey } = await createSolanaWallet();
|
|
2838
2831
|
saveSolanaWallet(privateKey);
|
|
2839
2832
|
return { address, privateKey, isNew: true };
|
|
2840
2833
|
}
|