@blockrun/clawrouter 0.12.297 → 0.12.298
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 +155 -181
- package/dist/cli.js +90 -8
- package/dist/index.js +7 -8
- package/docs/anthropic-cost-savings.md +1 -1
- package/docs/anthropic-third-party-harness-changes.md +2 -2
- package/docs/clawrouter-vs-openrouter-llm-routing-comparison.md +3 -3
- package/openclaw.plugin.json +1 -1
- package/package.json +2 -2
- package/skills/clawrouter/SKILL.md +40 -30
- package/skills/imagegen/SKILL.md +17 -15
- package/skills/surf/SKILL.md +0 -274
package/dist/cli.js
CHANGED
|
@@ -6758,7 +6758,7 @@ var init_api_key = __esm({
|
|
|
6758
6758
|
HINTS = {
|
|
6759
6759
|
401: `Check BLOCKRUN_API_KEY, or mint a new key at ${PORTAL_KEYS_URL}.`,
|
|
6760
6760
|
402: `Top up your BlockRun credit at ${PORTAL_CREDITS_URL}.`,
|
|
6761
|
-
404: `api.blockrun.ai does not serve this endpoint. Chat, Anthropic-shaped messages, images, speech, video and the partner APIs (
|
|
6761
|
+
404: `api.blockrun.ai does not serve this endpoint. Chat, Anthropic-shaped messages, images, speech, video and the partner APIs (Exa, prediction markets, phone lookup) all work on an API key. The wallet-only exceptions are the routes that bind a lease or a position to a payer address \u2014 buying/renewing/releasing phone numbers, and Polymarket trading \u2014 which need a wallet to own the thing being bought. For those, unset BLOCKRUN_API_KEY and run "clawrouter logout".`
|
|
6762
6762
|
};
|
|
6763
6763
|
}
|
|
6764
6764
|
});
|
|
@@ -137855,8 +137855,7 @@ async function proxyPaidApiRequest(req, res, apiBase, payFetch, getActualPayment
|
|
|
137855
137855
|
const isBlockrunExa = req.url?.startsWith("/v1/exa/") ?? false;
|
|
137856
137856
|
const isModalSandbox = req.url?.startsWith("/v1/modal/") ?? false;
|
|
137857
137857
|
const isPhone = (req.url?.startsWith("/v1/phone/") ?? false) || (req.url?.startsWith("/v1/voice/") ?? false);
|
|
137858
|
-
const
|
|
137859
|
-
const requestLabel = isBlockrunExa ? "BlockRun Exa" : isModalSandbox ? "Modal Sandbox" : isPhone ? "Phone/Voice" : isSurf ? "Surf" : "Partner";
|
|
137858
|
+
const requestLabel = isBlockrunExa ? "BlockRun Exa" : isModalSandbox ? "Modal Sandbox" : isPhone ? "Phone/Voice" : "Partner";
|
|
137860
137859
|
const bodyChunks = [];
|
|
137861
137860
|
for await (const chunk of req) {
|
|
137862
137861
|
bodyChunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
@@ -137927,14 +137926,14 @@ async function proxyPaidApiRequest(req, res, apiBase, payFetch, getActualPayment
|
|
|
137927
137926
|
logUsage({
|
|
137928
137927
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
137929
137928
|
...blockrunRequestId(upstream) ? { requestId: blockrunRequestId(upstream) } : {},
|
|
137930
|
-
model: isBlockrunExa ? "blockrun-exa" : isModalSandbox ? "modal-sandbox" : isPhone ? (req.url ?? "").replace(/^\/v1\//, "").split("?")[0] :
|
|
137931
|
-
tier: isPhone ? "PHONE" :
|
|
137929
|
+
model: isBlockrunExa ? "blockrun-exa" : isModalSandbox ? "modal-sandbox" : isPhone ? (req.url ?? "").replace(/^\/v1\//, "").split("?")[0] : "partner",
|
|
137930
|
+
tier: isPhone ? "PHONE" : "PARTNER",
|
|
137932
137931
|
cost: requestCost,
|
|
137933
137932
|
baselineCost: requestCost,
|
|
137934
137933
|
savings: 0,
|
|
137935
137934
|
latencyMs,
|
|
137936
137935
|
partnerId: (req.url?.split("?")[0] ?? "").replace(/^\/v1\//, "").replace(/\//g, "_") || "unknown",
|
|
137937
|
-
service: isBlockrunExa ? "web_search" : isModalSandbox ? "modal" : isPhone ? "phone" :
|
|
137936
|
+
service: isBlockrunExa ? "web_search" : isModalSandbox ? "modal" : isPhone ? "phone" : "partner"
|
|
137938
137937
|
}).catch(() => {
|
|
137939
137938
|
});
|
|
137940
137939
|
}
|
|
@@ -139209,7 +139208,7 @@ async function startProxy(options) {
|
|
|
139209
139208
|
}
|
|
139210
139209
|
const isVerbatimGatewayPath = req.url === "/v1/messages" || (req.url?.startsWith("/v1/messages?") ?? false) || req.url === "/v1/audio/speech" || (req.url?.startsWith("/v1/audio/speech?") ?? false);
|
|
139211
139210
|
if (isVerbatimGatewayPath || req.url?.match(
|
|
139212
|
-
/^\/v1\/(?:partner|pm|exa|modal|stocks|usstock|crypto|fx|commodity|phone|voice
|
|
139211
|
+
/^\/v1\/(?:partner|pm|exa|modal|stocks|usstock|crypto|fx|commodity|phone|voice)\//
|
|
139213
139212
|
)) {
|
|
139214
139213
|
try {
|
|
139215
139214
|
await proxyPaidApiRequest(
|
|
@@ -139274,7 +139273,7 @@ async function startProxy(options) {
|
|
|
139274
139273
|
res.end(
|
|
139275
139274
|
JSON.stringify({
|
|
139276
139275
|
error: {
|
|
139277
|
-
message: `ClawRouter does not proxy ${req.url}. It serves /v1/chat/completions, /v1/messages, /v1/models, /v1/images/generations, /v1/images/image2image, /v1/videos/generations, /v1/audio/generations, /v1/audio/speech, and the partner prefixes /v1/{partner,pm,exa,modal,stocks,usstock,crypto,fx,commodity,phone,voice
|
|
139276
|
+
message: `ClawRouter does not proxy ${req.url}. It serves /v1/chat/completions, /v1/messages, /v1/models, /v1/images/generations, /v1/images/image2image, /v1/videos/generations, /v1/audio/generations, /v1/audio/speech, and the partner prefixes /v1/{partner,pm,exa,modal,stocks,usstock,crypto,fx,commodity,phone,voice}/. If BlockRun serves this endpoint, call it directly against the gateway.`,
|
|
139278
139277
|
type: "invalid_request_error",
|
|
139279
139278
|
code: "unsupported_endpoint"
|
|
139280
139279
|
}
|
|
@@ -287770,6 +287769,7 @@ ClawRouter v${VERSION} - Smart LLM Router
|
|
|
287770
287769
|
|
|
287771
287770
|
Usage:
|
|
287772
287771
|
clawrouter [options]
|
|
287772
|
+
clawrouter update # Update ClawRouter in place
|
|
287773
287773
|
clawrouter login [brk_...] # Use a BlockRun API key (card-funded credit)
|
|
287774
287774
|
clawrouter logout # Forget the API key and go back to the wallet
|
|
287775
287775
|
clawrouter status # Live proxy status (wallet, balance, chain)
|
|
@@ -287812,6 +287812,8 @@ Query Commands (talk to running proxy on localhost:${getProxyPort()}):
|
|
|
287812
287812
|
cache Response cache stats (hit rate, size)
|
|
287813
287813
|
|
|
287814
287814
|
Management Commands:
|
|
287815
|
+
update Update the OpenClaw plugin and this global CLI in one step.
|
|
287816
|
+
Backs up wallet/config state and rolls back on failure.
|
|
287815
287817
|
setup Finish OpenClaw integration (run after npm install -g).
|
|
287816
287818
|
Registers ClawRouter as a plugin, syncs the model allowlist,
|
|
287817
287819
|
and writes the auth profile. Idempotent \u2014 safe to re-run.
|
|
@@ -288540,6 +288542,79 @@ async function cmdSetup() {
|
|
|
288540
288542
|
Then verify in your bot: /models \u2014 you should see ${VISIBLE_OPENCLAW_MODELS2.length} BlockRun models.`
|
|
288541
288543
|
);
|
|
288542
288544
|
}
|
|
288545
|
+
async function cmdUpdate() {
|
|
288546
|
+
const { execFileSync } = await import("child_process");
|
|
288547
|
+
const { copyFileSync: copyFileSync2, existsSync: existsSync9, mkdtempSync, realpathSync: realpathSync2, rmSync } = await import("fs");
|
|
288548
|
+
const { tmpdir } = await import("os");
|
|
288549
|
+
const { dirname: dirname6, join: join21, relative, isAbsolute } = await import("path");
|
|
288550
|
+
const { fileURLToPath: fileURLToPath2 } = await import("url");
|
|
288551
|
+
const isWindows = process.platform === "win32";
|
|
288552
|
+
const packageRoot = dirname6(dirname6(fileURLToPath2(import.meta.url)));
|
|
288553
|
+
const scriptName = isWindows ? "update.ps1" : "update.sh";
|
|
288554
|
+
const updateScript = join21(packageRoot, "scripts", scriptName);
|
|
288555
|
+
const exitStatus = (error) => typeof error === "object" && error !== null && "status" in error && typeof error.status === "number" ? error.status : 1;
|
|
288556
|
+
if (!existsSync9(updateScript)) {
|
|
288557
|
+
console.error("\u2717 The bundled updater is missing from this ClawRouter installation.");
|
|
288558
|
+
console.error(
|
|
288559
|
+
isWindows ? " Update manually: iwr -useb https://blockrun.ai/ClawRouter-update.ps1 | iex" : " Update manually: curl -fsSL https://blockrun.ai/ClawRouter-update | bash"
|
|
288560
|
+
);
|
|
288561
|
+
process.exitCode = 1;
|
|
288562
|
+
return;
|
|
288563
|
+
}
|
|
288564
|
+
console.log(`\u{1F99E} ClawRouter update (v${VERSION})
|
|
288565
|
+
`);
|
|
288566
|
+
const tempDir = mkdtempSync(join21(tmpdir(), "clawrouter-update-"));
|
|
288567
|
+
try {
|
|
288568
|
+
const script = join21(tempDir, scriptName);
|
|
288569
|
+
copyFileSync2(updateScript, script);
|
|
288570
|
+
if (isWindows) {
|
|
288571
|
+
execFileSync(
|
|
288572
|
+
"powershell.exe",
|
|
288573
|
+
["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", script],
|
|
288574
|
+
{ stdio: "inherit", env: process.env }
|
|
288575
|
+
);
|
|
288576
|
+
} else {
|
|
288577
|
+
execFileSync("bash", [script], { stdio: "inherit", env: process.env });
|
|
288578
|
+
}
|
|
288579
|
+
} catch (error) {
|
|
288580
|
+
process.exitCode = exitStatus(error);
|
|
288581
|
+
return;
|
|
288582
|
+
} finally {
|
|
288583
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
288584
|
+
}
|
|
288585
|
+
let globalRoot;
|
|
288586
|
+
try {
|
|
288587
|
+
globalRoot = execFileSync("npm", ["root", "-g"], {
|
|
288588
|
+
encoding: "utf8",
|
|
288589
|
+
shell: isWindows,
|
|
288590
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
288591
|
+
}).trim();
|
|
288592
|
+
} catch {
|
|
288593
|
+
return;
|
|
288594
|
+
}
|
|
288595
|
+
let fromGlobal;
|
|
288596
|
+
try {
|
|
288597
|
+
const rel = relative(realpathSync2(globalRoot), realpathSync2(packageRoot));
|
|
288598
|
+
fromGlobal = rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
|
|
288599
|
+
} catch {
|
|
288600
|
+
return;
|
|
288601
|
+
}
|
|
288602
|
+
if (!fromGlobal) return;
|
|
288603
|
+
const installSpec = process.env.BLOCKRUN_CLAWROUTER_INSTALL_SPEC || "@blockrun/clawrouter@latest";
|
|
288604
|
+
console.log(`
|
|
288605
|
+
\u2192 Updating global CLI (npm install -g ${installSpec})...`);
|
|
288606
|
+
try {
|
|
288607
|
+
execFileSync("npm", ["install", "-g", installSpec], {
|
|
288608
|
+
stdio: "inherit",
|
|
288609
|
+
shell: isWindows,
|
|
288610
|
+
env: process.env
|
|
288611
|
+
});
|
|
288612
|
+
console.log(" \u2713 Global CLI updated");
|
|
288613
|
+
} catch {
|
|
288614
|
+
console.warn(" \u26A0 Plugin updated, but the global CLI could not be refreshed.");
|
|
288615
|
+
console.warn(` Run manually: npm install -g ${installSpec}`);
|
|
288616
|
+
}
|
|
288617
|
+
}
|
|
288543
288618
|
function parseArgs(args) {
|
|
288544
288619
|
const result = {
|
|
288545
288620
|
version: false,
|
|
@@ -288565,6 +288640,7 @@ function parseArgs(args) {
|
|
|
288565
288640
|
reconcileDays: 7,
|
|
288566
288641
|
queryCache: false,
|
|
288567
288642
|
setup: false,
|
|
288643
|
+
update: false,
|
|
288568
288644
|
share: false,
|
|
288569
288645
|
shareTarget: void 0,
|
|
288570
288646
|
sharePreset: void 0,
|
|
@@ -288665,6 +288741,8 @@ function parseArgs(args) {
|
|
|
288665
288741
|
result.noReuse = true;
|
|
288666
288742
|
} else if (arg === "setup") {
|
|
288667
288743
|
result.setup = true;
|
|
288744
|
+
} else if (arg === "update" && i === 0) {
|
|
288745
|
+
result.update = true;
|
|
288668
288746
|
} else if (arg === "phone") {
|
|
288669
288747
|
result.phone = true;
|
|
288670
288748
|
const next = args[i + 1];
|
|
@@ -288802,6 +288880,10 @@ async function main() {
|
|
|
288802
288880
|
await cmdSetup();
|
|
288803
288881
|
process.exit(0);
|
|
288804
288882
|
}
|
|
288883
|
+
if (args.update) {
|
|
288884
|
+
await cmdUpdate();
|
|
288885
|
+
return;
|
|
288886
|
+
}
|
|
288805
288887
|
if (args.policy) {
|
|
288806
288888
|
const result = runPolicyCommand(args.policyArgs);
|
|
288807
288889
|
if (result.isError) {
|
package/dist/index.js
CHANGED
|
@@ -243215,7 +243215,7 @@ async function explainApiKeyFailure(response) {
|
|
|
243215
243215
|
var HINTS = {
|
|
243216
243216
|
401: `Check BLOCKRUN_API_KEY, or mint a new key at ${PORTAL_KEYS_URL}.`,
|
|
243217
243217
|
402: `Top up your BlockRun credit at ${PORTAL_CREDITS_URL}.`,
|
|
243218
|
-
404: `api.blockrun.ai does not serve this endpoint. Chat, Anthropic-shaped messages, images, speech, video and the partner APIs (
|
|
243218
|
+
404: `api.blockrun.ai does not serve this endpoint. Chat, Anthropic-shaped messages, images, speech, video and the partner APIs (Exa, prediction markets, phone lookup) all work on an API key. The wallet-only exceptions are the routes that bind a lease or a position to a payer address \u2014 buying/renewing/releasing phone numbers, and Polymarket trading \u2014 which need a wallet to own the thing being bought. For those, unset BLOCKRUN_API_KEY and run "clawrouter logout".`
|
|
243219
243219
|
};
|
|
243220
243220
|
|
|
243221
243221
|
// src/model-catalog.ts
|
|
@@ -265580,8 +265580,7 @@ async function proxyPaidApiRequest(req, res, apiBase, payFetch, getActualPayment
|
|
|
265580
265580
|
const isBlockrunExa = req.url?.startsWith("/v1/exa/") ?? false;
|
|
265581
265581
|
const isModalSandbox = req.url?.startsWith("/v1/modal/") ?? false;
|
|
265582
265582
|
const isPhone = (req.url?.startsWith("/v1/phone/") ?? false) || (req.url?.startsWith("/v1/voice/") ?? false);
|
|
265583
|
-
const
|
|
265584
|
-
const requestLabel = isBlockrunExa ? "BlockRun Exa" : isModalSandbox ? "Modal Sandbox" : isPhone ? "Phone/Voice" : isSurf ? "Surf" : "Partner";
|
|
265583
|
+
const requestLabel = isBlockrunExa ? "BlockRun Exa" : isModalSandbox ? "Modal Sandbox" : isPhone ? "Phone/Voice" : "Partner";
|
|
265585
265584
|
const bodyChunks = [];
|
|
265586
265585
|
for await (const chunk of req) {
|
|
265587
265586
|
bodyChunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
@@ -265652,14 +265651,14 @@ async function proxyPaidApiRequest(req, res, apiBase, payFetch, getActualPayment
|
|
|
265652
265651
|
logUsage({
|
|
265653
265652
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
265654
265653
|
...blockrunRequestId(upstream) ? { requestId: blockrunRequestId(upstream) } : {},
|
|
265655
|
-
model: isBlockrunExa ? "blockrun-exa" : isModalSandbox ? "modal-sandbox" : isPhone ? (req.url ?? "").replace(/^\/v1\//, "").split("?")[0] :
|
|
265656
|
-
tier: isPhone ? "PHONE" :
|
|
265654
|
+
model: isBlockrunExa ? "blockrun-exa" : isModalSandbox ? "modal-sandbox" : isPhone ? (req.url ?? "").replace(/^\/v1\//, "").split("?")[0] : "partner",
|
|
265655
|
+
tier: isPhone ? "PHONE" : "PARTNER",
|
|
265657
265656
|
cost: requestCost,
|
|
265658
265657
|
baselineCost: requestCost,
|
|
265659
265658
|
savings: 0,
|
|
265660
265659
|
latencyMs,
|
|
265661
265660
|
partnerId: (req.url?.split("?")[0] ?? "").replace(/^\/v1\//, "").replace(/\//g, "_") || "unknown",
|
|
265662
|
-
service: isBlockrunExa ? "web_search" : isModalSandbox ? "modal" : isPhone ? "phone" :
|
|
265661
|
+
service: isBlockrunExa ? "web_search" : isModalSandbox ? "modal" : isPhone ? "phone" : "partner"
|
|
265663
265662
|
}).catch(() => {
|
|
265664
265663
|
});
|
|
265665
265664
|
}
|
|
@@ -266934,7 +266933,7 @@ async function startProxy(options) {
|
|
|
266934
266933
|
}
|
|
266935
266934
|
const isVerbatimGatewayPath = req.url === "/v1/messages" || (req.url?.startsWith("/v1/messages?") ?? false) || req.url === "/v1/audio/speech" || (req.url?.startsWith("/v1/audio/speech?") ?? false);
|
|
266936
266935
|
if (isVerbatimGatewayPath || req.url?.match(
|
|
266937
|
-
/^\/v1\/(?:partner|pm|exa|modal|stocks|usstock|crypto|fx|commodity|phone|voice
|
|
266936
|
+
/^\/v1\/(?:partner|pm|exa|modal|stocks|usstock|crypto|fx|commodity|phone|voice)\//
|
|
266938
266937
|
)) {
|
|
266939
266938
|
try {
|
|
266940
266939
|
await proxyPaidApiRequest(
|
|
@@ -266999,7 +266998,7 @@ async function startProxy(options) {
|
|
|
266999
266998
|
res.end(
|
|
267000
266999
|
JSON.stringify({
|
|
267001
267000
|
error: {
|
|
267002
|
-
message: `ClawRouter does not proxy ${req.url}. It serves /v1/chat/completions, /v1/messages, /v1/models, /v1/images/generations, /v1/images/image2image, /v1/videos/generations, /v1/audio/generations, /v1/audio/speech, and the partner prefixes /v1/{partner,pm,exa,modal,stocks,usstock,crypto,fx,commodity,phone,voice
|
|
267001
|
+
message: `ClawRouter does not proxy ${req.url}. It serves /v1/chat/completions, /v1/messages, /v1/models, /v1/images/generations, /v1/images/image2image, /v1/videos/generations, /v1/audio/generations, /v1/audio/speech, and the partner prefixes /v1/{partner,pm,exa,modal,stocks,usstock,crypto,fx,commodity,phone,voice}/. If BlockRun serves this endpoint, call it directly against the gateway.`,
|
|
267003
267002
|
type: "invalid_request_error",
|
|
267004
267003
|
code: "unsupported_endpoint"
|
|
267005
267004
|
}
|
|
@@ -50,7 +50,7 @@ This is where you're paying for real value:
|
|
|
50
50
|
|
|
51
51
|
## The Solution: ClawRouter
|
|
52
52
|
|
|
53
|
-
[ClawRouter](https://github.com/BlockRunAI/ClawRouter) is an open-source local proxy that sits between your app and <!-- br:models.chatVisible -->
|
|
53
|
+
[ClawRouter](https://github.com/BlockRunAI/ClawRouter) is an open-source local proxy that sits between your app and <!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> AI models. It saves you money in three ways: **smart routing**, **token optimization**, and **response caching**.
|
|
54
54
|
|
|
55
55
|
```
|
|
56
56
|
┌─────────────┐ ┌──────────────────────────────┐ ┌──────────────────┐
|
|
@@ -31,7 +31,7 @@ This is exactly the problem [ClawRouter](https://github.com/BlockRunAI/ClawRoute
|
|
|
31
31
|
|
|
32
32
|
## ClawRouter: Smart Routing for Agents
|
|
33
33
|
|
|
34
|
-
ClawRouter is an open-source local proxy that sits between your agent and <!-- br:models.chatVisible -->
|
|
34
|
+
ClawRouter is an open-source local proxy that sits between your agent and <!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> LLM models across 9 providers. It analyzes every request across 15 dimensions and routes it to the cheapest model that can handle it — in under 1ms, entirely locally.
|
|
35
35
|
|
|
36
36
|
```
|
|
37
37
|
Your Agent → ClawRouter (localhost:8402) → Best model for the job
|
|
@@ -74,7 +74,7 @@ Then point your agent at `http://localhost:8402/v1/` with any OpenAI-compatible
|
|
|
74
74
|
|
|
75
75
|
- **No API keys to manage** — wallet-based cryptographic auth
|
|
76
76
|
- **No subscriptions** — pay per request in USDC (Base or Solana)
|
|
77
|
-
- **No vendor lock-in** — <!-- br:models.chatVisible -->
|
|
77
|
+
- **No vendor lock-in** — <!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> models, switch anytime
|
|
78
78
|
- **You control your wallet** — non-custodial, funds never held by a third party
|
|
79
79
|
- **Budget caps** — set a max spend per session, ClawRouter gracefully downgrades when budget runs low
|
|
80
80
|
- **Token compression** — 7-layer pipeline reduces token costs by 7–40% before they hit any provider
|
|
@@ -222,7 +222,7 @@ OpenRouter doesn't always pass through provider-specific features correctly. Ima
|
|
|
222
222
|
|
|
223
223
|
**Direct provider routing.** ClawRouter routes through BlockRun's API directly to providers — not through a second aggregator. One hop, not two. Provider-specific features work because there's no middleman translating them.
|
|
224
224
|
|
|
225
|
-

|
|
226
226
|
|
|
227
227
|
---
|
|
228
228
|
|
|
@@ -240,7 +240,7 @@ When new models launch, OpenRouter's catalog lags. Users configure a model that
|
|
|
240
240
|
|
|
241
241
|
### How ClawRouter Solves This
|
|
242
242
|
|
|
243
|
-
ClawRouter maintains a curated catalog of <!-- br:models.chatVisible -->
|
|
243
|
+
ClawRouter maintains a curated catalog of <!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> models across 9 providers (including <!-- br:models.free -->7<!-- /br:models.free --> free models), updated with each release. Delisted models have automatic redirect aliases:
|
|
244
244
|
|
|
245
245
|
```typescript
|
|
246
246
|
// Delisted models redirect automatically
|
|
@@ -268,7 +268,7 @@ No silent drops. No stale catalog. Models are benchmarked for speed, quality, an
|
|
|
268
268
|
| **Rate limits** | Per-key, shared | Per-wallet, independent |
|
|
269
269
|
| **Vision support** | Images sometimes dropped | Auto-detected, vision-only fallback |
|
|
270
270
|
| **Tool calling** | Silent failures with some models | Flag-based filtering, guaranteed support |
|
|
271
|
-
| **Model catalog** | Laggy, silent drops | Curated <!-- br:models.chatVisible -->
|
|
271
|
+
| **Model catalog** | Laggy, silent drops | Curated <!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> models, redirect aliases |
|
|
272
272
|
| **Budget control** | Monthly invoice | Per-session cap (`maxCostPerRun`) |
|
|
273
273
|
| **Setup** | Create account, paste key | Agent generates wallet, auto-configured |
|
|
274
274
|
| **Average cost** | $25/M tokens (Opus direct) | auto-routed = **<!-- br:savings.autoVsBaselinePct -->84<!-- /br:savings.autoVsBaselinePct -->% savings** |
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "blockrun-clawrouter",
|
|
3
3
|
"name": "BlockRun ClawRouter",
|
|
4
|
-
"description": "Smart LLM router \u2014
|
|
4
|
+
"description": "Smart LLM router \u2014 x402 micropayments, 84% cost savings. Phone lookup + AI voice calls (Twilio + Bland.ai).",
|
|
5
5
|
"skills": ["./skills"],
|
|
6
6
|
"activation": {
|
|
7
7
|
"onStartup": true
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockrun/clawrouter",
|
|
3
|
-
"version": "0.12.
|
|
4
|
-
"description": "Smart LLM router — save 84% on inference costs.
|
|
3
|
+
"version": "0.12.298",
|
|
4
|
+
"description": "Smart LLM router — save 84% on inference costs. 90 models (7 free). Pay by credit card (API key) or USDC (x402 wallet).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: clawrouter
|
|
3
|
-
description: Hosted-gateway LLM router — save 84% on inference costs. A local proxy that forwards each request to the blockrun.ai gateway, which routes to the cheapest capable model across
|
|
3
|
+
description: Hosted-gateway LLM router — save 84% on inference costs. A local proxy that forwards each request to the blockrun.ai gateway, which routes to the cheapest capable model across 90 models from OpenAI, Anthropic, Google, DeepSeek, xAI, Z.AI, and more. Free open-weight models included. Also exposes realtime market data (global stocks, crypto, FX, commodities), Twitter/X intelligence, prediction-market data across Polymarket, Kalshi, Limitless, Opinion, Predict.Fun, dFlow + UMA oracle resolution + wallet identity & clustering, phone-number intelligence (carrier + SIM-swap fraud detection) plus AI-powered outbound voice calls (Twilio + Bland.ai) as built-in agent tools. Not a local-inference tool — prompts are sent to the blockrun.ai gateway.
|
|
4
4
|
triggers:
|
|
5
5
|
- "clawrouter"
|
|
6
6
|
- "claw router"
|
|
@@ -21,13 +21,6 @@ triggers:
|
|
|
21
21
|
- "phone number verification"
|
|
22
22
|
- "sim swap detection"
|
|
23
23
|
- "outbound ai call"
|
|
24
|
-
- "blockrun surf"
|
|
25
|
-
- "surf crypto api"
|
|
26
|
-
- "on-chain sql query"
|
|
27
|
-
- "clickhouse onchain"
|
|
28
|
-
- "wallet labels api"
|
|
29
|
-
- "crypto mindshare"
|
|
30
|
-
- "crypto news api"
|
|
31
24
|
homepage: https://blockrun.ai/clawrouter.md
|
|
32
25
|
repository: https://github.com/BlockRunAI/ClawRouter
|
|
33
26
|
license: MIT
|
|
@@ -53,7 +46,7 @@ metadata:
|
|
|
53
46
|
|
|
54
47
|
# ClawRouter
|
|
55
48
|
|
|
56
|
-
Hosted-gateway LLM router that saves <!-- br:savings.autoVsBaselinePct -->84<!-- /br:savings.autoVsBaselinePct -->% on inference costs by forwarding each request to the blockrun.ai gateway, which picks the cheapest model capable of handling it across <!-- br:models.chatVisible -->
|
|
49
|
+
Hosted-gateway LLM router that saves <!-- br:savings.autoVsBaselinePct -->84<!-- /br:savings.autoVsBaselinePct -->% on inference costs by forwarding each request to the blockrun.ai gateway, which picks the cheapest model capable of handling it across <!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> models from 9 providers (<!-- br:models.free -->7<!-- /br:models.free --> free open-weight models). All billing flows through one BlockRun credential — either a USDC wallet paying x402 per call, or a BlockRun API key drawing on card-funded account credit. Either way you do not hold provider API keys.
|
|
57
50
|
|
|
58
51
|
**This is not a local-inference tool.** ClawRouter is a thin local proxy. Your prompts are sent over HTTPS to the blockrun.ai gateway for model execution. If your workload requires inference that never leaves your machine, use a local runtime like Ollama — ClawRouter is not the right tool for that use case.
|
|
59
52
|
|
|
@@ -132,14 +125,14 @@ Routing is done locally by [`@blockrun/router-core`](https://github.com/BlockRun
|
|
|
132
125
|
|
|
133
126
|
Curated primaries on the default `auto` profile:
|
|
134
127
|
|
|
135
|
-
- **SIMPLE** — factual lookups, greetings, translations → gemini-2.5-flash
|
|
136
|
-
- **MEDIUM** — summaries, explanations, data extraction → kimi-k2.7
|
|
137
|
-
- **COMPLEX** — code generation, multi-step analysis → gemini-3.1-pro
|
|
138
|
-
- **REASONING** — proofs, formal logic, multi-step math → grok-4-1-fast-reasoning
|
|
128
|
+
- **SIMPLE** — factual lookups, greetings, translations → gemini-2.5-flash
|
|
129
|
+
- **MEDIUM** — summaries, explanations, data extraction → kimi-k2.7
|
|
130
|
+
- **COMPLEX** — code generation, multi-step analysis → gemini-3.1-pro
|
|
131
|
+
- **REASONING** — proofs, formal logic, multi-step math → grok-4-1-fast-reasoning
|
|
139
132
|
|
|
140
133
|
Turns that actually need their attached tools switch to agent-tuned tiers (gpt-4o-mini → kimi-k2.7 → claude-sonnet-4.6). `eco` opens on the free tier (nemotron-3.5-lightning); `premium` climbs to gpt-5.3-codex / claude-fable-5 / claude-sonnet-4.6. Full chains: [docs/routing-profiles.md](../../docs/routing-profiles.md).
|
|
141
134
|
|
|
142
|
-
|
|
135
|
+
Per-tier
|
|
143
136
|
savings percentages are deliberately not quoted here: the published figure is
|
|
144
137
|
blended across a stated workload mix, and a per-tier number invites comparing
|
|
145
138
|
it against a baseline nobody wrote down. See
|
|
@@ -147,7 +140,34 @@ it against a baseline nobody wrote down. See
|
|
|
147
140
|
|
|
148
141
|
## Available Models
|
|
149
142
|
|
|
150
|
-
<!-- br:models.chatVisible -->
|
|
143
|
+
<!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> models including: gpt-6-astra [GPT-6 flagship, 1M ctx], gpt-6-sol, gpt-6.1-sol [refreshed Sol], gpt-6-luna [fast], gpt-5.6-terra [balanced, stable default], gpt-5.6-sol [flagship], gpt-5.6-luna [cost-efficient], gpt-5.6-sol/terra/luna-pro [pro reasoning tiers], gpt-5.5, gpt-5.5-pro [max compute], chat-latest [ChatGPT Instant], gpt-5.4, gpt-5.1, gpt-4o, o3, claude-fable-5.1, claude-fable-5, claude-opus-5.5 [newest Opus], claude-opus-5 [1M ctx], claude-opus-4.8, claude-opus-4.7, claude-opus-4.5, claude-sonnet-5.5, claude-sonnet-5, claude-sonnet-4.6, gemini-3.1-pro, gemini-3.6-flash, gemini-3.5-flash-lite, gemini-2.5-flash, deepseek-v4-pro, deepseek-chat, grok-4.7, grok-4.6, grok-4.5, grok-4.3, grok-build-0.1, glm-5.3 [Z.AI flagship, 1M ctx], glm-5.3-flash [natively multimodal, 1M ctx], glm-5.2, minimax-m3, kimi-k3 [1M ctx flagship], kimi-k2.7, qwen3.8-max [Qwen 3.8 flagship, 1M ctx], qwen3.7-max, qwen3.7-plus, qwen3.7-flash, mimo [Xiaomi MiMo-V2.5 Pro, 1M ctx], mistral-large-4 [Mistral flagship, 512K ctx, vision], hy4-preview [Tencent, 770B MoE], laguna-s-2.1 [Poolside, coding], and <!-- br:models.free -->7<!-- /br:models.free --> free open-weight models (nemotron-3.5-lightning [1M ctx, thinking mode — the free default], nemotron-3-ultra-550b [550B/55B MoE, 1M ctx — the largest free model], nemotron-3-nano-omni-30b-a3b-reasoning [256K ctx], llama-3.2-11b-vision [Meta Llama], north-mini-code [Cohere, coding, sub-second], laguna-xs-2.1 [Poolside, coding, ~161 tok/s], muse-glimmer-30b [Meta Muse, reasoning]). The free tier is text-only — image turns route to a paid vision model, because the two free models the catalogs advertise as vision-capable fail a solid-colour probe on both chains and do so with an HTTP 200.
|
|
144
|
+
|
|
145
|
+
## Model Prices — Look Them Up Live
|
|
146
|
+
|
|
147
|
+
Model prices move (vendors reprice, promos end), so this skill carries no model price table. Read the live catalog before you budget a call:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
curl -s https://blockrun.ai/api/v1/models # Base
|
|
151
|
+
curl -s https://sol.blockrun.ai/api/v1/models # Solana
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Each entry in `data[]` has an `id`, a `billing_mode` and a `pricing` object. All amounts are USD.
|
|
155
|
+
|
|
156
|
+
| `billing_mode` | `pricing` fields | Estimated cost of one call |
|
|
157
|
+
| ---------------- | ------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------- |
|
|
158
|
+
| `paid` (chat) | `input`, `output` per 1M tokens; optional `cache_read` / `cache_write` per 1M; optional `long_context` | `(input_tokens × input + output_tokens × output) / 1,000,000`, minimum $0.001, plus the $0.001 transaction fee |
|
|
159
|
+
| `free` | `input: 0`, `output: 0` | $0 — no payment |
|
|
160
|
+
| `per_image` | `per_image`, `transaction_fee` | `per_image × images + transaction_fee` |
|
|
161
|
+
| `per_second` | `per_second`, `per_call_surcharge`, `transaction_fee`, `default_duration_seconds` | `per_second × seconds + per_call_surcharge + transaction_fee` |
|
|
162
|
+
| `per_track` | `per_track`, `transaction_fee` | `per_track + transaction_fee` |
|
|
163
|
+
| `per_character` | `per_1k_chars`, `transaction_fee` | `per_1k_chars × characters / 1,000 + transaction_fee` |
|
|
164
|
+
| `per_generation` | `per_generation`, `transaction_fee` | `per_generation + transaction_fee` |
|
|
165
|
+
|
|
166
|
+
- **Cached prompt tokens** bill at `cache_read` instead of `input` (and cache writes at `cache_write`) when the model lists them.
|
|
167
|
+
- **`long_context`** is a list of tiers. When the prompt is larger than a tier's `threshold` (or equal to it, if `inclusive` is true), that tier's `input` / `output` / `cache_*` rates apply to the **whole** request.
|
|
168
|
+
- Image size/quality and video resolution can raise the media price above the listed base rate.
|
|
169
|
+
- The figure above is an estimate. The exact amount is quoted in the HTTP 402 challenge before anything is signed, so a call never settles above its quote.
|
|
170
|
+
- Human-readable rate card: https://blockrun.ai/pricing
|
|
151
171
|
|
|
152
172
|
## Built-in Agent Tools
|
|
153
173
|
|
|
@@ -168,11 +188,11 @@ Realtime prices and historical OHLC across every asset class. The agent should c
|
|
|
168
188
|
|
|
169
189
|
### Image & Video Generation
|
|
170
190
|
|
|
171
|
-
| Tool | Purpose | Price
|
|
172
|
-
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
173
|
-
| `blockrun_image_generation` | 12 image models — GPT Image 1/2/2.5 (Flare, Sunburst), Nano Banana / 2 / Pro, Seedream 5 Pro, Grok Imagine / 2.0 / Pro, CogView-4 |
|
|
174
|
-
| `blockrun_image_edit` | Edit / inpaint existing image (GPT Image 1/2, 2.5 Sunburst, Nano Banana; `model` param) |
|
|
175
|
-
| `blockrun_video_generation` | Grok Imagine + ByteDance Seedance (1.5-pro / 2.0-fast / 2.0) at 720p with synced audio (t2v default), 5–10s, + OpenAI Sora 2 via Azure (`azure/sora-2`, 4/8/12s, t2v + i2v, rejects human faces in reference images). Seedance is token-priced upstream (~20,256 tokens/sec at the 720p+audio default — 2× the prior 480p rate); `image_url` (image-to-video) costs the same as t2v since 2026-06-01. Seedance 2.0 variants accept optional `real_face_asset_id` (`ta_…`) for BytePlus RealFace character-consistency — mutually exclusive with `image_url`. |
|
|
191
|
+
| Tool | Purpose | Price |
|
|
192
|
+
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------- |
|
|
193
|
+
| `blockrun_image_generation` | 12 image models — GPT Image 1/2/2.5 (Flare, Sunburst), Nano Banana / 2 / Pro, Seedream 5 Pro, Grok Imagine / 2.0 / Pro, CogView-4 | per model — see [Model Prices](#model-prices--look-them-up-live) |
|
|
194
|
+
| `blockrun_image_edit` | Edit / inpaint existing image (GPT Image 1/2, 2.5 Sunburst, Nano Banana; `model` param) | per model — see [Model Prices](#model-prices--look-them-up-live) |
|
|
195
|
+
| `blockrun_video_generation` | Grok Imagine + ByteDance Seedance (1.5-pro / 2.0-fast / 2.0) at 720p with synced audio (t2v default), 5–10s, + OpenAI Sora 2 via Azure (`azure/sora-2`, 4/8/12s, t2v + i2v, rejects human faces in reference images). Seedance is token-priced upstream (~20,256 tokens/sec at the 720p+audio default — 2× the prior 480p rate); `image_url` (image-to-video) costs the same as t2v since 2026-06-01. Seedance 2.0 variants accept optional `real_face_asset_id` (`ta_…`) for BytePlus RealFace character-consistency — mutually exclusive with `image_url`. | per model — see [Model Prices](#model-prices--look-them-up-live) |
|
|
176
196
|
|
|
177
197
|
### Phone & Voice (Twilio + Bland.ai)
|
|
178
198
|
|
|
@@ -238,16 +258,6 @@ egress by default, so it works out of the box in geoblocked regions).
|
|
|
238
258
|
`blockrun_predexon_*` data tools first. See the **`polymarket-trading` skill**
|
|
239
259
|
for the golden rules and end-to-end flow.
|
|
240
260
|
|
|
241
|
-
### Crypto Data (Surf) — skill-only integration
|
|
242
|
-
|
|
243
|
-
Surf is a unified crypto data API with **84 endpoints across 13 domains**: CEX/DEX markets, on-chain SQL over 80+ ClickHouse tables (Ethereum, Base, Arbitrum, BSC, TRON, HyperEVM, Tempo), 100M+ labeled wallets, prediction markets (Polymarket + Kalshi), social/CT mindshare, news, project/DeFi metrics, token analytics, unified search, VC fund intelligence. The killer feature is `POST /surf/onchain/sql` — ad-hoc SELECT against the warehouse, no indexer required.
|
|
244
|
-
|
|
245
|
-
**ClawRouter ships Surf as a skill, not as typed wrappers.** The base proxy whitelists `/v1/surf/*` so any call through `http://127.0.0.1:8402/v1/surf/...` flows through the same x402 wallet that pays for LLM calls. The endpoint catalog, parameter shapes, and example flows live in the dedicated **`surf` skill** — Claude Code (or any agent) reads that skill on demand and crafts the HTTP call itself. No `blockrun_surf_*` tool definitions to maintain, no release of ClawRouter when Surf adds endpoint #85.
|
|
246
|
-
|
|
247
|
-
Pricing tiers (per call, settled in USDC directly to Surf's Base treasury): **$0.001** prices/rankings/lists/news · **$0.005** orderbooks/candles/search/wallet details/social · **$0.02** on-chain SQL/query/schema, chat completions. No monthly minimums, no Surf account, no API key. See the `surf` skill for the full endpoint reference.
|
|
248
|
-
|
|
249
|
-
This is the pattern for new BlockRun-marketplace APIs going forward: base proxy whitelists the namespace, a dedicated skill documents the surface — no hand-coded tool wrappers per endpoint.
|
|
250
|
-
|
|
251
261
|
## Example Output
|
|
252
262
|
|
|
253
263
|
```
|
package/skills/imagegen/SKILL.md
CHANGED
|
@@ -55,20 +55,22 @@ Display inline: ``
|
|
|
55
55
|
|
|
56
56
|
### Model Selection
|
|
57
57
|
|
|
58
|
-
| Alias | Full ID |
|
|
59
|
-
| ------------------ | ------------------------------- |
|
|
60
|
-
| `nano-banana` | `google/nano-banana` |
|
|
61
|
-
| `banana-2` | `google/nano-banana-2` |
|
|
62
|
-
| `banana-pro` | `google/nano-banana-pro` |
|
|
63
|
-
| `gpt-image` | `openai/gpt-image-1` |
|
|
64
|
-
| `gpt-image-2` | `openai/gpt-image-2` |
|
|
65
|
-
| `flare` | `openai/gpt-image-2.5-flare` |
|
|
66
|
-
| `sunburst` | `openai/gpt-image-2.5-sunburst` |
|
|
67
|
-
| `seedream` | `bytedance/seedream-5-pro` |
|
|
68
|
-
| `grok-imagine` | `xai/grok-imagine-image` |
|
|
69
|
-
| `grok-imagine-2` | `xai/grok-imagine-image-2.0` |
|
|
70
|
-
| `grok-imagine-pro` | `xai/grok-imagine-image-pro` |
|
|
71
|
-
| `cogview` | `zai/cogview-4` |
|
|
58
|
+
| Alias | Full ID | Sizes | Best for |
|
|
59
|
+
| ------------------ | ------------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
60
|
+
| `nano-banana` | `google/nano-banana` | 1024×1024 | Default — fast, cheap, good quality |
|
|
61
|
+
| `banana-2` | `google/nano-banana-2` | 1024×1024 | Gemini 3.1 Flash imagegen — sharper than nano-banana at 1K |
|
|
62
|
+
| `banana-pro` | `google/nano-banana-pro` | 1024×1024, 2048×2048, 4096×4096 | High-res, large format |
|
|
63
|
+
| `gpt-image` | `openai/gpt-image-1` | 1024×1024, 1536×1024, 1024×1536 | Budget option; supports editing |
|
|
64
|
+
| `gpt-image-2` | `openai/gpt-image-2` | 1024×1024, 1536×1024, 1024×1536 | Photorealistic, reasoning-driven, text rendering (slow — proxy polls up to 5min); legacy `dalle` alias routes here |
|
|
65
|
+
| `flare` | `openai/gpt-image-2.5-flare` | 1024×1024, 1536×1024, 1024×1536 | GPT Image 2.5, fast — top OpenAI quality, caller can pick `quality` at a flat price |
|
|
66
|
+
| `sunburst` | `openai/gpt-image-2.5-sunburst` | 1024×1024, 1536×1024, 1024×1536 | GPT Image 2.5, precision — best for high-fidelity edits |
|
|
67
|
+
| `seedream` | `bytedance/seedream-5-pro` | up to 2848×1600 / 2304×1728 | Flagship quality, reference-image support |
|
|
68
|
+
| `grok-imagine` | `xai/grok-imagine-image` | 1024×1024 | xAI Grok image style |
|
|
69
|
+
| `grok-imagine-2` | `xai/grok-imagine-image-2.0` | 1024×1024 | Grok Imagine 2.0 — between grok-imagine and pro |
|
|
70
|
+
| `grok-imagine-pro` | `xai/grok-imagine-image-pro` | 1024×1024 | Grok high-quality |
|
|
71
|
+
| `cogview` | `zai/cogview-4` | 512×512 to 1440×1440 | Cheapest — Zhipu CogView |
|
|
72
|
+
|
|
73
|
+
**Prices:** per image, and they change — look the model up live instead of trusting a number here. `GET https://blockrun.ai/api/v1/models` (Solana: `https://sol.blockrun.ai/api/v1/models`), find the entry whose `id` is the Full ID above, and read `pricing.per_image` plus `pricing.transaction_fee`. Larger sizes or higher `quality` can cost more than the listed base rate; the exact amount is quoted in the HTTP 402 challenge before anything is signed.
|
|
72
74
|
|
|
73
75
|
**Choosing a model:**
|
|
74
76
|
|
|
@@ -119,7 +121,7 @@ Response is identical to generation:
|
|
|
119
121
|
}
|
|
120
122
|
```
|
|
121
123
|
|
|
122
|
-
**Supported models for editing:** `openai/gpt-image-1` (default
|
|
124
|
+
**Supported models for editing:** `openai/gpt-image-1` (default), `openai/gpt-image-2`, `openai/gpt-image-2.5-sunburst`, `google/nano-banana`, `google/nano-banana-2`, `google/nano-banana-pro`. `mask` works with the OpenAI models only. `openai/gpt-image-2.5-flare` cannot edit.
|
|
123
125
|
|
|
124
126
|
---
|
|
125
127
|
|