@blockrun/llm 3.15.0 → 3.15.1
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 +3 -3
- package/dist/index.cjs +5 -2
- package/dist/index.js +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
### Cut your LLM bill by <!-- br:savings.autoVsBaselinePct -->84<!-- /br:savings.autoVsBaselinePct -->%. One line of TypeScript.
|
|
6
6
|
|
|
7
|
-
The smart-routing SDK for <!-- br:models.chatVisible -->
|
|
7
|
+
The smart-routing SDK for <!-- br:models.chatVisible -->76<!-- /br:models.chatVisible --> models — every request goes to the cheapest model that can handle it,
|
|
8
8
|
paid with an API key or per-request USDC on Solana or Base. No vendor lock-in.
|
|
9
9
|
|
|
10
10
|
[](https://www.npmjs.com/package/@blockrun/llm)
|
|
@@ -56,7 +56,7 @@ console.log(r.response); // the proof
|
|
|
56
56
|
| | OpenAI SDK | OpenRouter | LiteLLM | **@blockrun/llm** |
|
|
57
57
|
| ------------------ | -------------- | ----------------- | ---------------- | ----------------------------------------------------------------------- |
|
|
58
58
|
| **Cost routing** | ✗ one vendor | Manual selection | Manual selection | **Automatic — <!-- br:savings.autoVsBaselinePct -->84<!-- /br:savings.autoVsBaselinePct -->% cheaper** |
|
|
59
|
-
| **Models** | GPT only | 200+ | 100+ (BYO keys) | **<!-- br:models.chatVisible -->
|
|
59
|
+
| **Models** | GPT only | 200+ | 100+ (BYO keys) | **<!-- br:models.chatVisible -->76<!-- /br:models.chatVisible -->, one credential** |
|
|
60
60
|
| **Free tier** | ✗ | Rate-limited | ✗ | **<!-- br:models.free -->7<!-- /br:models.free --> models, no signup** |
|
|
61
61
|
| **Auth** | API key | Account + API key | Your API keys | **API key *or* wallet signature** |
|
|
62
62
|
| **Payment** | Card + invoice | Credit card | BYO keys | **Account credit or USDC per-request** |
|
|
@@ -1749,7 +1749,7 @@ The `AnthropicClient` wraps the official `@anthropic-ai/sdk` with a custom fetch
|
|
|
1749
1749
|
## Frequently Asked Questions
|
|
1750
1750
|
|
|
1751
1751
|
### What is @blockrun/llm?
|
|
1752
|
-
@blockrun/llm is a TypeScript SDK that cuts LLM costs by up to <!-- br:savings.autoVsBaselinePct -->84<!-- /br:savings.autoVsBaselinePct -->% with built-in smart routing: every request is routed to the cheapest of <!-- br:models.chatVisible -->
|
|
1752
|
+
@blockrun/llm is a TypeScript SDK that cuts LLM costs by up to <!-- br:savings.autoVsBaselinePct -->84<!-- /br:savings.autoVsBaselinePct -->% with built-in smart routing: every request is routed to the cheapest of <!-- br:models.chatVisible -->76<!-- /br:models.chatVisible --> models (OpenAI, Anthropic, Google, xAI, DeepSeek, Moonshot, and more) that can handle it, then paid per-request in USDC via the x402 protocol — with API key account billing or x402 wallet payments on Solana or Base.
|
|
1753
1753
|
|
|
1754
1754
|
### How does payment work?
|
|
1755
1755
|
When you make an API call, the SDK automatically handles x402 payment. It signs a USDC transaction locally using your wallet private key (which never leaves your machine), and includes the payment proof in the request header. Settlement is non-custodial and instant on Base or Solana.
|
package/dist/index.cjs
CHANGED
|
@@ -243,9 +243,12 @@ function sanitizeErrorResponse(errorBody) {
|
|
|
243
243
|
return { message: "API request failed" };
|
|
244
244
|
}
|
|
245
245
|
const body = errorBody;
|
|
246
|
+
const detail = typeof body.message === "string" && body.message !== body.error ? body.message : void 0;
|
|
246
247
|
return {
|
|
247
248
|
message: typeof body.error === "string" ? body.error : "API request failed",
|
|
248
|
-
code: typeof body.code === "string" ? body.code : void 0
|
|
249
|
+
code: typeof body.code === "string" ? body.code : void 0,
|
|
250
|
+
...detail ? { detail } : {},
|
|
251
|
+
...typeof body.hint === "string" ? { hint: body.hint } : {}
|
|
249
252
|
};
|
|
250
253
|
}
|
|
251
254
|
function validateResourceUrl(url, baseUrl) {
|
|
@@ -4617,7 +4620,7 @@ function getCostSummary() {
|
|
|
4617
4620
|
}
|
|
4618
4621
|
|
|
4619
4622
|
// src/version.ts
|
|
4620
|
-
var SDK_VERSION = "3.15.
|
|
4623
|
+
var SDK_VERSION = "3.15.1";
|
|
4621
4624
|
var USER_AGENT = `blockrun-ts/${SDK_VERSION}`;
|
|
4622
4625
|
|
|
4623
4626
|
// src/client.ts
|
package/dist/index.js
CHANGED
|
@@ -126,9 +126,12 @@ function sanitizeErrorResponse(errorBody) {
|
|
|
126
126
|
return { message: "API request failed" };
|
|
127
127
|
}
|
|
128
128
|
const body = errorBody;
|
|
129
|
+
const detail = typeof body.message === "string" && body.message !== body.error ? body.message : void 0;
|
|
129
130
|
return {
|
|
130
131
|
message: typeof body.error === "string" ? body.error : "API request failed",
|
|
131
|
-
code: typeof body.code === "string" ? body.code : void 0
|
|
132
|
+
code: typeof body.code === "string" ? body.code : void 0,
|
|
133
|
+
...detail ? { detail } : {},
|
|
134
|
+
...typeof body.hint === "string" ? { hint: body.hint } : {}
|
|
132
135
|
};
|
|
133
136
|
}
|
|
134
137
|
function validateResourceUrl(url, baseUrl) {
|
|
@@ -4500,7 +4503,7 @@ function getCostSummary() {
|
|
|
4500
4503
|
}
|
|
4501
4504
|
|
|
4502
4505
|
// src/version.ts
|
|
4503
|
-
var SDK_VERSION = "3.15.
|
|
4506
|
+
var SDK_VERSION = "3.15.1";
|
|
4504
4507
|
var USER_AGENT = `blockrun-ts/${SDK_VERSION}`;
|
|
4505
4508
|
|
|
4506
4509
|
// src/client.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockrun/llm",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "TypeScript SDK for BlockRun - every frontier model behind one OpenAI-compatible client. Pay with a BlockRun API key or per-call in USDC. Smart routing picks the cheapest capable model. No rate limits.",
|
|
6
6
|
"main": "dist/index.cjs",
|