@blockrun/clawrouter 0.12.277 → 0.12.279

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
@@ -9,11 +9,11 @@ Agents can only sign transactions.<br><br>
9
9
  <strong>ClawRouter is the only LLM router that lets agents operate independently.</strong><br><br>
10
10
  <em>Pay however you like: <strong>credit card</strong> — sign up at <a href="https://user.blockrun.ai"><strong>user.blockrun.ai</strong></a>, top up, mint an API key<br>
11
11
  or <strong>USDC</strong> on Solana or Base (x402 wallet, no account at all).<br>
12
- Or neither — <!-- br:models.free -->7<!-- /br:models.free --> models are free, with no signup, no key and no wallet.</em></p>
12
+ Or neither — <!-- br:models.free -->6<!-- /br:models.free --> models are free, with no signup, no key and no wallet.</em></p>
13
13
 
14
14
  <br>
15
15
 
16
- <img src="https://img.shields.io/badge/🆓_7_Free_Models-success?style=for-the-badge" alt="7 free models">&nbsp;
16
+ <img src="https://img.shields.io/badge/🆓_6_Free_Models-success?style=for-the-badge" alt="6 free models">&nbsp;
17
17
  <img src="https://img.shields.io/badge/🤖_Agent--Native-black?style=for-the-badge" alt="Agent native">&nbsp;
18
18
  <img src="https://img.shields.io/badge/💳_Card_or_USDC-blue?style=for-the-badge" alt="Card or USDC">&nbsp;
19
19
  <img src="https://img.shields.io/badge/⚡_Local_Routing-yellow?style=for-the-badge" alt="Local routing">&nbsp;
@@ -36,7 +36,7 @@ Or neither — <!-- br:models.free -->7<!-- /br:models.free --> models are free,
36
36
 
37
37
  </div>
38
38
 
39
- > **ClawRouter** is an open-source smart LLM router that reduces AI API costs by up to <!-- br:savings.autoVsBaselinePct -->84<!-- /br:savings.autoVsBaselinePct -->%. It analyzes each request across <!-- br:clawrouter.dimensions -->15<!-- /br:clawrouter.dimensions --> dimensions and routes to the cheapest capable model in under 1ms, entirely locally. It is the only LLM router that an autonomous agent can pay for by itself — a wallet signature is the account, and USDC micropayments over the x402 protocol are the billing — and it takes an ordinary credit card too: sign up at [user.blockrun.ai](https://user.blockrun.ai), top up, and run the same router on an API key. <!-- br:models.chatVisible -->76<!-- /br:models.chatVisible --> models from OpenAI, Anthropic, Google, xAI, DeepSeek, and more. MIT licensed.
39
+ > **ClawRouter** is an open-source smart LLM router that reduces AI API costs by up to <!-- br:savings.autoVsBaselinePct -->84<!-- /br:savings.autoVsBaselinePct -->%. It analyzes each request across <!-- br:clawrouter.dimensions -->15<!-- /br:clawrouter.dimensions --> dimensions and routes to the cheapest capable model in under 1ms, entirely locally. It is the only LLM router that an autonomous agent can pay for by itself — a wallet signature is the account, and USDC micropayments over the x402 protocol are the billing — and it takes an ordinary credit card too: sign up at [user.blockrun.ai](https://user.blockrun.ai), top up, and run the same router on an API key. <!-- br:models.chatVisible -->78<!-- /br:models.chatVisible --> models from OpenAI, Anthropic, Google, xAI, DeepSeek, and more. MIT licensed.
40
40
 
41
41
  ---
42
42
 
@@ -48,8 +48,8 @@ Not a seat, not a subscription, not a monthly minimum you keep paying while the
48
48
 
49
49
  | | |
50
50
  | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
51
- | **Every LLM** | <!-- br:models.chatVisible -->76<!-- /br:models.chatVisible --> chat models across 9 providers, behind one endpoint and one balance |
52
- | **Every tool** | <!-- br:models.image -->9<!-- /br:models.image --> image models, <!-- br:models.video -->8<!-- /br:models.video --> video models, music, <!-- br:models.speech -->5<!-- /br:models.speech --> voices, img2img editing, and outbound phone calls that come back as transcripts |
51
+ | **Every LLM** | <!-- br:models.chatVisible -->78<!-- /br:models.chatVisible --> chat models across 9 providers, behind one endpoint and one balance |
52
+ | **Every tool** | <!-- br:models.image -->12<!-- /br:models.image --> image models, <!-- br:models.video -->8<!-- /br:models.video --> video models, music, <!-- br:models.speech -->5<!-- /br:models.speech --> voices, img2img editing, and outbound phone calls that come back as transcripts |
53
53
  | **Every data source** | web, news and neural search; prediction markets; live crypto and equity quotes; on-chain SQL over 100M+ labeled wallets; DEX routing; RPC across <!-- br:chains.rpc -->40<!-- /br:chains.rpc --> chains |
54
54
  | **Best value per dollar** | <!-- br:clawrouter.dimensions -->15<!-- /br:clawrouter.dimensions -->-dimension local routing sends each request to the cheapest model that can actually do it — <!-- br:savings.autoVsBaselinePct -->84<!-- /br:savings.autoVsBaselinePct -->% below pinning Claude Opus 5 on the same traffic, computed from a published workload mix rather than estimated |
55
55
 
@@ -65,7 +65,7 @@ Every other LLM router was built for **human developers** — create an account,
65
65
 
66
66
  ClawRouter is built for the agent-first world:
67
67
 
68
- - **Starts at $0** — <!-- br:models.free -->7<!-- /br:models.free --> open-weight models are free forever (incl. a 1M-context reasoner and two sub-second coders). Image turns route to paid models — see the free-tier note below.
68
+ - **Starts at $0** — <!-- br:models.free -->6<!-- /br:models.free --> open-weight models are free forever (incl. a 1M-context reasoner and two sub-second coders). Image turns route to paid models — see the free-tier note below.
69
69
  - **No accounts needed** — a wallet is generated locally, no signup
70
70
  - **No API keys needed** — your wallet signature IS authentication
71
71
  - **No model selection** — <!-- br:clawrouter.dimensions -->15<!-- /br:clawrouter.dimensions -->-dimension scoring + constraint-first ranking ([router-core](https://github.com/BlockRunAI/router-core)) picks the right model automatically
@@ -76,7 +76,7 @@ This is the stack that lets agents operate autonomously: **x402 + USDC + local r
76
76
 
77
77
  ### …and if you are a human, not an agent
78
78
 
79
- Every "no X needed" above is a capability, not a restriction. **ClawRouter takes a credit card too.** Sign up at **[user.blockrun.ai](https://user.blockrun.ai)**, top up, mint an API key, and run `clawrouter login brk_live_…`. Same router, same <!-- br:models.chatVisible -->76<!-- /br:models.chatVisible --> models, same local routing — calls go to `api.blockrun.ai` on a bearer token and bill your account credit. No crypto, no gas, no seed phrase.
79
+ Every "no X needed" above is a capability, not a restriction. **ClawRouter takes a credit card too.** Sign up at **[user.blockrun.ai](https://user.blockrun.ai)**, top up, mint an API key, and run `clawrouter login brk_live_…`. Same router, same <!-- br:models.chatVisible -->78<!-- /br:models.chatVisible --> models, same local routing — calls go to `api.blockrun.ai` on a bearer token and bill your account credit. No crypto, no gas, no seed phrase.
80
80
 
81
81
  | You are | Pay with | Setup |
82
82
  | ------------------- | --------------------------------------- | ------------------------------------------------------------------------------------------- |
@@ -92,8 +92,8 @@ Full walkthrough: [Paying with a credit card](#paying-with-a-credit-card-api-key
92
92
 
93
93
  | | OpenRouter | LiteLLM | Martian | Portkey | **ClawRouter** |
94
94
  | ---------------- | ----------------- | ---------------- | ----------------- | ----------------- | ---------------------------------------------------------------------- |
95
- | **Models** | 200+ | 100+ | Smart routing | Gateway | **<!-- br:models.chatVisible -->76<!-- /br:models.chatVisible -->** |
96
- | **Free tier** | Rate-limited | BYO keys | No | No | **<!-- br:models.free -->7<!-- /br:models.free --> models, no signup** |
95
+ | **Models** | 200+ | 100+ | Smart routing | Gateway | **<!-- br:models.chatVisible -->78<!-- /br:models.chatVisible -->** |
96
+ | **Free tier** | Rate-limited | BYO keys | No | No | **<!-- br:models.free -->6<!-- /br:models.free --> models, no signup** |
97
97
  | **Routing** | Manual selection | Manual selection | Smart (closed) | Observability | **Smart (open source)** |
98
98
  | **Auth** | Account + API key | Your API keys | Account + API key | Account + API key | **Wallet signature _or_ API key** |
99
99
  | **Payment** | Credit card | BYO keys | Credit card | $49-499/mo | **USDC per-request _or_ card credit** |
@@ -109,7 +109,7 @@ Full walkthrough: [Paying with a credit card](#paying-with-a-credit-card-api-key
109
109
 
110
110
  ## Quick Start
111
111
 
112
- > **No wallet? <!-- br:models.free -->7<!-- /br:models.free --> models work free out of the box.** Install, run, and pin `free/nemotron-3.5-lightning` (or any of the <!-- br:models.free -->7<!-- /br:models.free -->) — no crypto, no signup, no balance required. Add a credit card or USDC later when you want paid models.
112
+ > **No wallet? <!-- br:models.free -->6<!-- /br:models.free --> models work free out of the box.** Install, run, and pin `free/nemotron-3.5-lightning` (or any of the <!-- br:models.free -->6<!-- /br:models.free -->) — no crypto, no signup, no balance required. Add a credit card or USDC later when you want paid models.
113
113
 
114
114
  **Two ways to pay for the paid ones — pick one, the rest of ClawRouter is identical:**
115
115
 
@@ -127,7 +127,7 @@ is all it takes to switch and `clawrouter logout` is all it takes to switch back
127
127
 
128
128
  > **Where do I sign up?** [**user.blockrun.ai**](https://user.blockrun.ai) — sign in with
129
129
  > Google, add credit with a card under **Credits**, mint a key under **API Keys**. That
130
- > one key covers all <!-- br:models.chatVisible -->76<!-- /br:models.chatVisible --> chat models
130
+ > one key covers all <!-- br:models.chatVisible -->78<!-- /br:models.chatVisible --> chat models
131
131
  > plus images, video, speech and the live-data APIs. No wallet, no crypto, no seed phrase.
132
132
 
133
133
  ### Desktop control plane (macOS)
@@ -171,7 +171,7 @@ openclaw gateway restart
171
171
 
172
172
  > **Using Claude Code?** Check out [BRCC](https://github.com/BlockRunAI/brcc) — it's purpose-built for Claude Code with the same smart routing and x402 payments.
173
173
  >
174
- > **Using NousResearch Hermes?** See [ClawRouter-Hermes](https://github.com/BlockRunAI/ClawRouter-Hermes) — a Python plugin that wires Hermes into the ClawRouter proxy. Same wallet, same <!-- br:models.chatVisible -->76<!-- /br:models.chatVisible --> models, same x402 USDC settlement on Solana & Base.
174
+ > **Using NousResearch Hermes?** See [ClawRouter-Hermes](https://github.com/BlockRunAI/ClawRouter-Hermes) — a Python plugin that wires Hermes into the ClawRouter proxy. Same wallet, same <!-- br:models.chatVisible -->78<!-- /br:models.chatVisible --> models, same x402 USDC settlement on Solana & Base.
175
175
 
176
176
  No OpenClaw required. ClawRouter runs as a local proxy on port 8402.
177
177
 
@@ -182,7 +182,7 @@ npx @blockrun/clawrouter
182
182
  ```
183
183
 
184
184
  **2. Fund your wallet** — optional, skip for free tier
185
- Your wallet address is printed on first run. For paid models, send a few USDC on Solana (the default chain) or Base — $5 covers thousands of requests. Prefer a card? [Sign up at user.blockrun.ai](https://user.blockrun.ai) and run `clawrouter login brk_live_…` instead. To stay at $0, pin any of the <!-- br:models.free -->7<!-- /br:models.free --> free models (e.g. `free/nemotron-3.5-lightning`) or use `/model free` inside OpenClaw.
185
+ Your wallet address is printed on first run. For paid models, send a few USDC on Solana (the default chain) or Base — $5 covers thousands of requests. Prefer a card? [Sign up at user.blockrun.ai](https://user.blockrun.ai) and run `clawrouter login brk_live_…` instead. To stay at $0, pin any of the <!-- br:models.free -->6<!-- /br:models.free --> free models (e.g. `free/nemotron-3.5-lightning`) or use `/model free` inside OpenClaw.
186
186
 
187
187
  **3. Point your client at `http://localhost:8402`**
188
188
 
@@ -482,7 +482,7 @@ No Surf account, no API key — settles directly to Surf's Base treasury in USDC
482
482
 
483
483
  ## Models & Pricing
484
484
 
485
- <!-- br:models.chatVisible -->76<!-- /br:models.chatVisible --> models across 9 providers, one wallet. **<!-- br:models.free -->7<!-- /br:models.free --> models are $0 — paid models start at fractions of a cent.**
485
+ <!-- br:models.chatVisible -->78<!-- /br:models.chatVisible --> models across 9 providers, one wallet. **<!-- br:models.free -->6<!-- /br:models.free --> models are $0 — paid models start at fractions of a cent.**
486
486
 
487
487
  > **💡 "Cost per request"** = estimated cost for a typical chat message (~500 input + 500 output tokens). Paid requests also carry a flat **$0.001/tx settlement fee** (covers on-chain gas; already included in the price the gateway quotes). Free models never pay it.
488
488
 
@@ -575,7 +575,7 @@ No Surf account, no API key — settles directly to Surf's Base treasury in USDC
575
575
  | openai/gpt-5.4-pro | $30.00 | $180.00 | $0.1050 | 400K | reasoning, tools |
576
576
  | openai/gpt-5.5-pro | $30.00 | $180.00 | $0.1050 | 1M | reasoning, vision, tools |
577
577
 
578
- > **Free tier:** <!-- br:models.free -->7<!-- /br:models.free --> open-weight models cost nothing — `/model free` pins the free default (`nemotron-3.5-lightning`, with the other six as fallbacks), `/model eco` opens on it, or pick one directly (e.g., `/model lightning` for 1M-context reasoning, `/model north-mini` or `/model laguna` for fast coding, `/model nano-30b` for the fastest).
578
+ > **Free tier:** <!-- br:models.free -->6<!-- /br:models.free --> open-weight models cost nothing — `/model free` pins the free default (`nemotron-3.5-lightning`, with the other six as fallbacks), `/model eco` opens on it, or pick one directly (e.g., `/model lightning` for 1M-context reasoning, `/model north-mini` or `/model laguna` for fast coding, `/model nano-30b` for the fastest).
579
579
  >
580
580
  > **No free vision.** Two free models are catalogued as vision-capable and neither reliably is: on a 64×64 solid-colour probe `nemotron-3-nano-omni` was right 1 of 4 times on Base and answered "white" for red on Solana, and `llama-3.2-11b-vision` replied "I'm unable to see the image" 3 of 3 while answering text fine. Both return HTTP 200, so a wrong answer arrives with no error to branch on. ClawRouter therefore does not flag them for vision, and requests carrying an `image_url` route to a paid vision model instead.
581
581
  > **Best value:** `gpt-5-nano` and `gemini-2.5-flash-lite` deliver strong results at ~$0.0003/request.
@@ -718,7 +718,7 @@ chains, the response cache and the local spend controls.
718
718
  - **Balance lives server-side.** There is no local balance to check: a call that
719
719
  outruns your credit comes back as HTTP `402 insufficient_quota`, naming the
720
720
  top-up page. Free models stay free and need no credit at all — all
721
- <!-- br:models.free -->7<!-- /br:models.free --> are served on the API-key gateway too.
721
+ <!-- br:models.free -->6<!-- /br:models.free --> are served on the API-key gateway too.
722
722
  - **One key covers nearly everything.** Verified live against `api.blockrun.ai`
723
723
  on 2026-09-05: chat completions (`/v1/chat/completions`), the Anthropic-shaped
724
724
  `/v1/messages`, `/v1/models`, image generation, speech, video, and the partner
@@ -767,24 +767,9 @@ For basic usage, no configuration needed. For advanced options:
767
767
  | `CLAWROUTER_DISABLED` | `false` | Disable smart routing |
768
768
  | `CLAWROUTER_DEBUG_HEADERS` | `on` | Set to `off` to suppress `x-clawrouter-*` debug response headers |
769
769
  | `CLAWROUTER_SOLANA_RPC_URL` | `https://api.mainnet-beta.solana.com` | Solana RPC endpoint — balance checks and payment signing |
770
- | `TWZRD_AUTO_GATE` | unset (off) | Set to `1` to compose TWZRD AutoGate after SpendControl on the x402 pre-sign hook |
771
770
 
772
771
  **Full reference:** [docs/configuration.md](docs/configuration.md)
773
772
 
774
- ### Pre-spend trust (TWZRD AutoGate, opt-in)
775
-
776
- Default **off**. Spend limits and counterparty lists (`clawrouter policy`) stay the vendor-neutral path. This is not a default-on vendor lock.
777
-
778
- To also run TWZRD wash/preflight on the same `onBeforePaymentCreation` chain — after SpendControl, before the wallet signs:
779
-
780
- ```bash
781
- export TWZRD_AUTO_GATE=1
782
- ```
783
-
784
- Equivalent flag: `TWZRD_GATE_ENABLED=true`. Requires optional dependency `twzrd-x402-gate@0.9.3` (forks that omit it still install). A refuse stamps `X-Twzrd-Caller: clawrouter/<version>` so it is attributable. Unset the flag to go back to SpendControl only.
785
-
786
- **It gates Solana, not Base.** The gate scores Solana recipients; Base/EVM classifies as `network_not_scored` and is waved through without a lookup. On Solana it POSTs the resource URL, `payTo`, price and chain to `intel.twzrd.xyz` before each signature — payment metadata leaves your machine when this is on. We bound that call at `TWZRD_GATE_TIMEOUT_MS` (default 2000) and proceed if it does not answer, because SpendControl is the guarantee and a third party must not be able to stop your payments; set `TWZRD_FAIL_OPEN=false` to refuse instead.
787
-
788
773
  ### Model Exclusion
789
774
 
790
775
  Block specific models from being routed to. Useful if a model doesn't follow your agent instructions or you want to control costs.
@@ -886,7 +871,7 @@ npm test
886
871
 
887
872
  **The LLM router built for autonomous agents**
888
873
 
889
- You're here. <!-- br:models.chatVisible -->76<!-- /br:models.chatVisible --> models, local smart routing, and two ways to pay — a credit-card-funded API key, or x402 USDC from a wallet, which is what lets an agent operate independently.
874
+ You're here. <!-- br:models.chatVisible -->78<!-- /br:models.chatVisible --> models, local smart routing, and two ways to pay — a credit-card-funded API key, or x402 USDC from a wallet, which is what lets an agent operate independently.
890
875
 
891
876
  `curl -fsSL https://blockrun.ai/ClawRouter-update | bash`
892
877
 
@@ -897,7 +882,7 @@ You're here. <!-- br:models.chatVisible -->76<!-- /br:models.chatVisible --> mod
897
882
 
898
883
  **BlockRun for Claude Code**
899
884
 
900
- Run Claude Code with <!-- br:models.chatVisible -->76<!-- /br:models.chatVisible --> models, no rate limits, no Anthropic account, no phone verification. Pay per request with USDC — your wallet is your identity.
885
+ Run Claude Code with <!-- br:models.chatVisible -->78<!-- /br:models.chatVisible --> models, no rate limits, no Anthropic account, no phone verification. Pay per request with USDC — your wallet is your identity.
901
886
 
902
887
  `curl -fsSL https://blockrun.ai/brcc-install | bash`
903
888
 
@@ -910,7 +895,7 @@ Run Claude Code with <!-- br:models.chatVisible -->76<!-- /br:models.chatVisible
910
895
 
911
896
  **ClawRouter for NousResearch Hermes**
912
897
 
913
- Python plugin that wraps the ClawRouter proxy for `hermes-agent`. Same <!-- br:models.chatVisible -->76<!-- /br:models.chatVisible --> models, same x402 USDC payments on Solana & Base, native Hermes ergonomics.
898
+ Python plugin that wraps the ClawRouter proxy for `hermes-agent`. Same <!-- br:models.chatVisible -->78<!-- /br:models.chatVisible --> models, same x402 USDC payments on Solana & Base, native Hermes ergonomics.
914
899
 
915
900
  `pip install hermes-plugin-clawrouter`
916
901
 
@@ -927,15 +912,15 @@ Python plugin that wraps the ClawRouter proxy for `hermes-agent`. Same <!-- br:m
927
912
 
928
913
  ## More Resources
929
914
 
930
- | Resource | Description |
931
- | ------------------------------------------------------ | ----------------------------------------------------------------------- |
932
- | [Documentation](https://blockrun.ai/docs) | Full docs |
933
- | [Model Pricing](https://blockrun.ai/models) | All models & prices |
934
- | [Image Generation & Editing](docs/image-generation.md) | API examples, <!-- br:models.image -->9<!-- /br:models.image --> models |
935
- | [Routing Profiles](docs/routing-profiles.md) | ECO/AUTO/PREMIUM/AGENTIC tiers, fallback chains, ranking weights |
936
- | [Architecture](docs/architecture.md) | Technical deep dive |
937
- | [Configuration](docs/configuration.md) | Environment variables |
938
- | [Troubleshooting](docs/troubleshooting.md) | Common issues |
915
+ | Resource | Description |
916
+ | ------------------------------------------------------ | ------------------------------------------------------------------------ |
917
+ | [Documentation](https://blockrun.ai/docs) | Full docs |
918
+ | [Model Pricing](https://blockrun.ai/models) | All models & prices |
919
+ | [Image Generation & Editing](docs/image-generation.md) | API examples, <!-- br:models.image -->12<!-- /br:models.image --> models |
920
+ | [Routing Profiles](docs/routing-profiles.md) | ECO/AUTO/PREMIUM/AGENTIC tiers, fallback chains, ranking weights |
921
+ | [Architecture](docs/architecture.md) | Technical deep dive |
922
+ | [Configuration](docs/configuration.md) | Environment variables |
923
+ | [Troubleshooting](docs/troubleshooting.md) | Common issues |
939
924
 
940
925
  ### Blog
941
926
 
@@ -954,7 +939,7 @@ Python plugin that wraps the ClawRouter proxy for `hermes-agent`. Same <!-- br:m
954
939
 
955
940
  ### What is BlockRun?
956
941
 
957
- BlockRun lets agents pay for the outcome — every LLM, tool and data source, best value per dollar. One endpoint and one balance covering <!-- br:models.chatVisible -->76<!-- /br:models.chatVisible --> chat models plus image, video, music and speech generation, search, market data and multi-chain RPC, billed per call with USDC over [x402](https://x402.org) or a credit-card-funded API key — no seat, no subscription, no minimum. ClawRouter is the open-source local router agents use to reach it.
942
+ BlockRun lets agents pay for the outcome — every LLM, tool and data source, best value per dollar. One endpoint and one balance covering <!-- br:models.chatVisible -->78<!-- /br:models.chatVisible --> chat models plus image, video, music and speech generation, search, market data and multi-chain RPC, billed per call with USDC over [x402](https://x402.org) or a credit-card-funded API key — no seat, no subscription, no minimum. ClawRouter is the open-source local router agents use to reach it.
958
943
 
959
944
  ### What is ClawRouter?
960
945
 
@@ -982,7 +967,7 @@ No. A wallet is the default because it is what lets an _agent_ pay for itself,
982
967
  but you can sign up at **[user.blockrun.ai](https://user.blockrun.ai)**, top up
983
968
  with a credit card, mint an API key and run `clawrouter login brk_live_…`. Calls
984
969
  then go to `api.blockrun.ai` on a bearer token and bill your account credit — no
985
- crypto, no gas, no seed phrase. And the <!-- br:models.free -->7<!-- /br:models.free --> free models need neither: no
970
+ crypto, no gas, no seed phrase. And the <!-- br:models.free -->6<!-- /br:models.free --> free models need neither: no
986
971
  wallet, no key, no signup. See [Paying with a credit card](#paying-with-a-credit-card-api-key).
987
972
 
988
973
  ### Is ClawRouter free?
package/dist/cli.js CHANGED
@@ -60460,149 +60460,6 @@ var init_api_key = __esm({
60460
60460
  }
60461
60461
  });
60462
60462
 
60463
- // src/twzrd-autogate.ts
60464
- import { randomUUID } from "crypto";
60465
- function normalizeFlag(value) {
60466
- const trimmed = value?.trim().toLowerCase();
60467
- return trimmed === "" ? void 0 : trimmed;
60468
- }
60469
- function isTwzrdAutoGateEnabled(env = process.env) {
60470
- const auto = normalizeFlag(env.TWZRD_AUTO_GATE);
60471
- const gate = normalizeFlag(env.TWZRD_GATE_ENABLED);
60472
- if (auto !== void 0 && FALSY.has(auto) || gate !== void 0 && FALSY.has(gate)) {
60473
- return false;
60474
- }
60475
- return auto !== void 0 && TRUTHY.has(auto) || gate !== void 0 && TRUTHY.has(gate);
60476
- }
60477
- function isMissingTwzrdGateModule(err) {
60478
- const code = err?.code;
60479
- const msg = err instanceof Error ? err.message : String(err);
60480
- const missingModule = code === "ERR_MODULE_NOT_FOUND" || code === "MODULE_NOT_FOUND" || /Cannot find module/i.test(msg) || /Cannot find package/i.test(msg);
60481
- return missingModule && new RegExp(String.raw`['"]${TWZRD_GATE_PACKAGE}['"]`).test(msg);
60482
- }
60483
- function twzrdGateTimeoutMs(env = process.env) {
60484
- const raw = normalizeFlag(env.TWZRD_GATE_TIMEOUT_MS);
60485
- if (raw === void 0) return TWZRD_GATE_TIMEOUT_MS;
60486
- const parsed = Number(raw);
60487
- return Number.isFinite(parsed) && parsed > 0 ? parsed : TWZRD_GATE_TIMEOUT_MS;
60488
- }
60489
- function twzrdGateFailOpen(env = process.env) {
60490
- const raw = normalizeFlag(env.TWZRD_FAIL_OPEN);
60491
- return !(raw !== void 0 && FALSY.has(raw));
60492
- }
60493
- function twzrdAutoGateInstallOptions(env = process.env, runId = randomUUID) {
60494
- return {
60495
- refuseWashFlagged: true,
60496
- gateOnCanSpend: false,
60497
- unsupportedNetworkMode: "observe",
60498
- failOpen: twzrdGateFailOpen(env),
60499
- attribution: {
60500
- integration: `clawrouter/${VERSION}`,
60501
- runId: runId()
60502
- }
60503
- };
60504
- }
60505
- async function runTwzrdGateWithTimeout(run, opts) {
60506
- const log = opts.log ?? console;
60507
- let timer2;
60508
- try {
60509
- const raced = await Promise.race([
60510
- // Swallow here, not at the race, so a late rejection never goes unhandled.
60511
- Promise.resolve().then(run).catch((err) => ({ __twzrdError: err })),
60512
- new Promise((resolve) => {
60513
- timer2 = setTimeout(() => resolve(TIMED_OUT), opts.timeoutMs);
60514
- })
60515
- ]);
60516
- if (raced === TIMED_OUT) {
60517
- return decideOnGateFailure(`did not answer within ${opts.timeoutMs}ms`, opts.failOpen, log);
60518
- }
60519
- if (raced && typeof raced === "object" && "__twzrdError" in raced) {
60520
- const err = raced.__twzrdError;
60521
- const msg = err instanceof Error ? err.message : String(err);
60522
- return decideOnGateFailure(`threw: ${msg.slice(0, 120)}`, opts.failOpen, log);
60523
- }
60524
- return raced;
60525
- } finally {
60526
- if (timer2) clearTimeout(timer2);
60527
- }
60528
- }
60529
- function decideOnGateFailure(what, failOpen, log) {
60530
- const reason = `twzrd gate ${what}`;
60531
- if (failOpen) {
60532
- log.warn(
60533
- `[ClawRouter] ${reason} \u2014 proceeding. SpendControl still applied. Set TWZRD_FAIL_OPEN=false to refuse instead.`
60534
- );
60535
- return void 0;
60536
- }
60537
- log.warn(`[ClawRouter] ${reason} \u2014 refusing the payment (TWZRD_FAIL_OPEN=false).`);
60538
- return { abort: true, reason };
60539
- }
60540
- async function defaultLoadTwzrdGate() {
60541
- const specifier = TWZRD_GATE_PACKAGE;
60542
- return import(specifier);
60543
- }
60544
- async function maybeComposeTwzrdAutoGate(x402, options) {
60545
- const env = options?.env ?? process.env;
60546
- const log = options?.log ?? console;
60547
- if (!isTwzrdAutoGateEnabled(env)) {
60548
- return { status: "skipped" };
60549
- }
60550
- const load = options?.loadGate ?? defaultLoadTwzrdGate;
60551
- let gate;
60552
- try {
60553
- gate = await load();
60554
- } catch (err) {
60555
- if (isMissingTwzrdGateModule(err)) {
60556
- const reason = `${TWZRD_GATE_PACKAGE} is not installed`;
60557
- log.warn(
60558
- `[ClawRouter] TWZRD AutoGate opted in but ${reason} \u2014 skipping. npm i ${TWZRD_GATE_PACKAGE}@0.9.3`
60559
- );
60560
- return { status: "unavailable", reason };
60561
- }
60562
- throw err;
60563
- }
60564
- const installOpts = twzrdAutoGateInstallOptions(env);
60565
- const timeoutMs = twzrdGateTimeoutMs(env);
60566
- const ready = (via) => log.log(
60567
- `[ClawRouter] TWZRD AutoGate ON (opt-in, after SpendControl, ${via}; ${timeoutMs}ms budget, failOpen=${installOpts.failOpen}). Unset TWZRD_AUTO_GATE to disable.`
60568
- );
60569
- if (typeof gate.createTwzrdBeforePaymentHook === "function") {
60570
- const hook = gate.createTwzrdBeforePaymentHook(installOpts);
60571
- x402.onBeforePaymentCreation(
60572
- async (ctx) => runTwzrdGateWithTimeout(() => hook(ctx.selectedRequirements, ctx), {
60573
- timeoutMs,
60574
- failOpen: installOpts.failOpen,
60575
- log
60576
- })
60577
- );
60578
- ready("createTwzrdBeforePaymentHook");
60579
- return { status: "composed", via: "createTwzrdBeforePaymentHook" };
60580
- }
60581
- if (typeof gate.installTwzrdAutoGate === "function") {
60582
- gate.installTwzrdAutoGate(x402, installOpts);
60583
- log.warn(
60584
- "[ClawRouter] TWZRD AutoGate installed via installTwzrdAutoGate \u2014 that entry point registers its own hook, so the timeout budget does not apply and it replaces onBeforePaymentCreation on this client. Prefer a gate build exporting createTwzrdBeforePaymentHook."
60585
- );
60586
- ready("installTwzrdAutoGate");
60587
- return { status: "composed", via: "installTwzrdAutoGate" };
60588
- }
60589
- throw new Error(
60590
- `[ClawRouter] ${TWZRD_GATE_PACKAGE} is installed but exports neither installTwzrdAutoGate nor createTwzrdBeforePaymentHook`
60591
- );
60592
- }
60593
- var TWZRD_GATE_PACKAGE, TRUTHY, FALSY, TWZRD_GATE_TIMEOUT_MS, TIMED_OUT;
60594
- var init_twzrd_autogate = __esm({
60595
- "src/twzrd-autogate.ts"() {
60596
- "use strict";
60597
- init_version4();
60598
- TWZRD_GATE_PACKAGE = "twzrd-x402-gate";
60599
- TRUTHY = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
60600
- FALSY = /* @__PURE__ */ new Set(["0", "false", "no", "off"]);
60601
- TWZRD_GATE_TIMEOUT_MS = 2e3;
60602
- TIMED_OUT = { __twzrdTimedOut: true };
60603
- }
60604
- });
60605
-
60606
60463
  // src/compression/types.ts
60607
60464
  var DEFAULT_COMPRESSION_CONFIG;
60608
60465
  var init_types2 = __esm({
@@ -92187,7 +92044,6 @@ async function startProxy(options) {
92187
92044
  const evmSigner = toClientEvmSigner(account, evmPublicClient);
92188
92045
  const spendControl = options.spendControl ?? getSharedSpendControl();
92189
92046
  registerSpendPolicyHook(x402, spendControl);
92190
- await maybeComposeTwzrdAutoGate(x402);
92191
92047
  registerExactEvmScheme(x402, { signer: evmSigner });
92192
92048
  }
92193
92049
  let solanaAddress;
@@ -95773,7 +95629,6 @@ var init_proxy = __esm({
95773
95629
  init_auth();
95774
95630
  init_api_key();
95775
95631
  init_spend_control();
95776
- init_twzrd_autogate();
95777
95632
  init_compression();
95778
95633
  init_errors5();
95779
95634
  init_version4();
@@ -228831,7 +228686,7 @@ import {
228831
228686
  } from "fs";
228832
228687
  import { readFile as readFileAsync } from "fs/promises";
228833
228688
  import { homedir as homedir15 } from "os";
228834
- import { randomUUID as randomUUID2 } from "crypto";
228689
+ import { randomUUID } from "crypto";
228835
228690
  import { join as join18 } from "path";
228836
228691
  async function waitForProxyHealth(port, timeoutMs = 3e3) {
228837
228692
  const start = Date.now();
@@ -228846,7 +228701,7 @@ async function waitForProxyHealth(port, timeoutMs = 3e3) {
228846
228701
  return false;
228847
228702
  }
228848
228703
  function writePrivateJsonSync(path5, value) {
228849
- const temporary = `${path5}.tmp.${randomUUID2()}`;
228704
+ const temporary = `${path5}.tmp.${randomUUID()}`;
228850
228705
  try {
228851
228706
  writeFileSync3(temporary, JSON.stringify(value, null, 2), { mode: 384 });
228852
228707
  renameSync2(temporary, path5);
@@ -231337,7 +231192,6 @@ Environment Variables:
231337
231192
  BLOCKRUN_API_KEY BlockRun API key (brk_...) \u2014 wins over the wallet when set
231338
231193
  BLOCKRUN_WALLET_KEY Private key for x402 payments (auto-generated if not set)
231339
231194
  BLOCKRUN_PROXY_PORT Default proxy port (default: 8402)
231340
- TWZRD_AUTO_GATE Set to 1 to compose TWZRD AutoGate after SpendControl (default off)
231341
231195
 
231342
231196
  For more info: https://blockrun.ai/clawrouter.md
231343
231197
  `);
package/dist/index.js CHANGED
@@ -60213,149 +60213,6 @@ var init_api_key = __esm({
60213
60213
  }
60214
60214
  });
60215
60215
 
60216
- // src/twzrd-autogate.ts
60217
- import { randomUUID } from "crypto";
60218
- function normalizeFlag(value) {
60219
- const trimmed = value?.trim().toLowerCase();
60220
- return trimmed === "" ? void 0 : trimmed;
60221
- }
60222
- function isTwzrdAutoGateEnabled(env = process.env) {
60223
- const auto = normalizeFlag(env.TWZRD_AUTO_GATE);
60224
- const gate = normalizeFlag(env.TWZRD_GATE_ENABLED);
60225
- if (auto !== void 0 && FALSY.has(auto) || gate !== void 0 && FALSY.has(gate)) {
60226
- return false;
60227
- }
60228
- return auto !== void 0 && TRUTHY.has(auto) || gate !== void 0 && TRUTHY.has(gate);
60229
- }
60230
- function isMissingTwzrdGateModule(err) {
60231
- const code = err?.code;
60232
- const msg = err instanceof Error ? err.message : String(err);
60233
- const missingModule = code === "ERR_MODULE_NOT_FOUND" || code === "MODULE_NOT_FOUND" || /Cannot find module/i.test(msg) || /Cannot find package/i.test(msg);
60234
- return missingModule && new RegExp(String.raw`['"]${TWZRD_GATE_PACKAGE}['"]`).test(msg);
60235
- }
60236
- function twzrdGateTimeoutMs(env = process.env) {
60237
- const raw = normalizeFlag(env.TWZRD_GATE_TIMEOUT_MS);
60238
- if (raw === void 0) return TWZRD_GATE_TIMEOUT_MS;
60239
- const parsed = Number(raw);
60240
- return Number.isFinite(parsed) && parsed > 0 ? parsed : TWZRD_GATE_TIMEOUT_MS;
60241
- }
60242
- function twzrdGateFailOpen(env = process.env) {
60243
- const raw = normalizeFlag(env.TWZRD_FAIL_OPEN);
60244
- return !(raw !== void 0 && FALSY.has(raw));
60245
- }
60246
- function twzrdAutoGateInstallOptions(env = process.env, runId = randomUUID) {
60247
- return {
60248
- refuseWashFlagged: true,
60249
- gateOnCanSpend: false,
60250
- unsupportedNetworkMode: "observe",
60251
- failOpen: twzrdGateFailOpen(env),
60252
- attribution: {
60253
- integration: `clawrouter/${VERSION}`,
60254
- runId: runId()
60255
- }
60256
- };
60257
- }
60258
- async function runTwzrdGateWithTimeout(run, opts) {
60259
- const log = opts.log ?? console;
60260
- let timer2;
60261
- try {
60262
- const raced = await Promise.race([
60263
- // Swallow here, not at the race, so a late rejection never goes unhandled.
60264
- Promise.resolve().then(run).catch((err) => ({ __twzrdError: err })),
60265
- new Promise((resolve) => {
60266
- timer2 = setTimeout(() => resolve(TIMED_OUT), opts.timeoutMs);
60267
- })
60268
- ]);
60269
- if (raced === TIMED_OUT) {
60270
- return decideOnGateFailure(`did not answer within ${opts.timeoutMs}ms`, opts.failOpen, log);
60271
- }
60272
- if (raced && typeof raced === "object" && "__twzrdError" in raced) {
60273
- const err = raced.__twzrdError;
60274
- const msg = err instanceof Error ? err.message : String(err);
60275
- return decideOnGateFailure(`threw: ${msg.slice(0, 120)}`, opts.failOpen, log);
60276
- }
60277
- return raced;
60278
- } finally {
60279
- if (timer2) clearTimeout(timer2);
60280
- }
60281
- }
60282
- function decideOnGateFailure(what, failOpen, log) {
60283
- const reason = `twzrd gate ${what}`;
60284
- if (failOpen) {
60285
- log.warn(
60286
- `[ClawRouter] ${reason} \u2014 proceeding. SpendControl still applied. Set TWZRD_FAIL_OPEN=false to refuse instead.`
60287
- );
60288
- return void 0;
60289
- }
60290
- log.warn(`[ClawRouter] ${reason} \u2014 refusing the payment (TWZRD_FAIL_OPEN=false).`);
60291
- return { abort: true, reason };
60292
- }
60293
- async function defaultLoadTwzrdGate() {
60294
- const specifier = TWZRD_GATE_PACKAGE;
60295
- return import(specifier);
60296
- }
60297
- async function maybeComposeTwzrdAutoGate(x402, options) {
60298
- const env = options?.env ?? process.env;
60299
- const log = options?.log ?? console;
60300
- if (!isTwzrdAutoGateEnabled(env)) {
60301
- return { status: "skipped" };
60302
- }
60303
- const load = options?.loadGate ?? defaultLoadTwzrdGate;
60304
- let gate;
60305
- try {
60306
- gate = await load();
60307
- } catch (err) {
60308
- if (isMissingTwzrdGateModule(err)) {
60309
- const reason = `${TWZRD_GATE_PACKAGE} is not installed`;
60310
- log.warn(
60311
- `[ClawRouter] TWZRD AutoGate opted in but ${reason} \u2014 skipping. npm i ${TWZRD_GATE_PACKAGE}@0.9.3`
60312
- );
60313
- return { status: "unavailable", reason };
60314
- }
60315
- throw err;
60316
- }
60317
- const installOpts = twzrdAutoGateInstallOptions(env);
60318
- const timeoutMs = twzrdGateTimeoutMs(env);
60319
- const ready = (via) => log.log(
60320
- `[ClawRouter] TWZRD AutoGate ON (opt-in, after SpendControl, ${via}; ${timeoutMs}ms budget, failOpen=${installOpts.failOpen}). Unset TWZRD_AUTO_GATE to disable.`
60321
- );
60322
- if (typeof gate.createTwzrdBeforePaymentHook === "function") {
60323
- const hook = gate.createTwzrdBeforePaymentHook(installOpts);
60324
- x402.onBeforePaymentCreation(
60325
- async (ctx) => runTwzrdGateWithTimeout(() => hook(ctx.selectedRequirements, ctx), {
60326
- timeoutMs,
60327
- failOpen: installOpts.failOpen,
60328
- log
60329
- })
60330
- );
60331
- ready("createTwzrdBeforePaymentHook");
60332
- return { status: "composed", via: "createTwzrdBeforePaymentHook" };
60333
- }
60334
- if (typeof gate.installTwzrdAutoGate === "function") {
60335
- gate.installTwzrdAutoGate(x402, installOpts);
60336
- log.warn(
60337
- "[ClawRouter] TWZRD AutoGate installed via installTwzrdAutoGate \u2014 that entry point registers its own hook, so the timeout budget does not apply and it replaces onBeforePaymentCreation on this client. Prefer a gate build exporting createTwzrdBeforePaymentHook."
60338
- );
60339
- ready("installTwzrdAutoGate");
60340
- return { status: "composed", via: "installTwzrdAutoGate" };
60341
- }
60342
- throw new Error(
60343
- `[ClawRouter] ${TWZRD_GATE_PACKAGE} is installed but exports neither installTwzrdAutoGate nor createTwzrdBeforePaymentHook`
60344
- );
60345
- }
60346
- var TWZRD_GATE_PACKAGE, TRUTHY, FALSY, TWZRD_GATE_TIMEOUT_MS, TIMED_OUT;
60347
- var init_twzrd_autogate = __esm({
60348
- "src/twzrd-autogate.ts"() {
60349
- "use strict";
60350
- init_version4();
60351
- TWZRD_GATE_PACKAGE = "twzrd-x402-gate";
60352
- TRUTHY = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
60353
- FALSY = /* @__PURE__ */ new Set(["0", "false", "no", "off"]);
60354
- TWZRD_GATE_TIMEOUT_MS = 2e3;
60355
- TIMED_OUT = { __twzrdTimedOut: true };
60356
- }
60357
- });
60358
-
60359
60216
  // src/compression/types.ts
60360
60217
  var DEFAULT_COMPRESSION_CONFIG;
60361
60218
  var init_types2 = __esm({
@@ -91940,7 +91797,6 @@ async function startProxy(options) {
91940
91797
  const evmSigner = toClientEvmSigner(account, evmPublicClient);
91941
91798
  const spendControl = options.spendControl ?? getSharedSpendControl();
91942
91799
  registerSpendPolicyHook(x402, spendControl);
91943
- await maybeComposeTwzrdAutoGate(x402);
91944
91800
  registerExactEvmScheme(x402, { signer: evmSigner });
91945
91801
  }
91946
91802
  let solanaAddress;
@@ -95526,7 +95382,6 @@ var init_proxy = __esm({
95526
95382
  init_auth();
95527
95383
  init_api_key();
95528
95384
  init_spend_control();
95529
- init_twzrd_autogate();
95530
95385
  init_compression();
95531
95386
  init_errors5();
95532
95387
  init_version4();
@@ -228315,7 +228170,7 @@ import {
228315
228170
  } from "fs";
228316
228171
  import { readFile as readFileAsync } from "fs/promises";
228317
228172
  import { homedir as homedir14 } from "os";
228318
- import { randomUUID as randomUUID2 } from "crypto";
228173
+ import { randomUUID } from "crypto";
228319
228174
  import { join as join17 } from "path";
228320
228175
  async function waitForProxyHealth(port, timeoutMs = 3e3) {
228321
228176
  const start = Date.now();
@@ -228330,7 +228185,7 @@ async function waitForProxyHealth(port, timeoutMs = 3e3) {
228330
228185
  return false;
228331
228186
  }
228332
228187
  function writePrivateJsonSync(path5, value) {
228333
- const temporary = `${path5}.tmp.${randomUUID2()}`;
228188
+ const temporary = `${path5}.tmp.${randomUUID()}`;
228334
228189
  try {
228335
228190
  writeFileSync3(temporary, JSON.stringify(value, null, 2), { mode: 384 });
228336
228191
  renameSync2(temporary, path5);
@@ -1,7 +1,7 @@
1
1
  # 9 Free AI Models, Zero Cost: How BlockRun Gives Developers Top-Tier LLMs for Nothing
2
2
 
3
3
  > **The count in this title is a snapshot, and so is every model name below.**
4
- > It was 9 when this was written; the published free tier is <!-- br:models.free -->7<!-- /br:models.free --> today, and _none_ of the
4
+ > It was 9 when this was written; the published free tier is <!-- br:models.free -->6<!-- /br:models.free --> today, and _none_ of the
5
5
  > nine originals is still in it. Free hosting is volatile — NVIDIA retired four
6
6
  > of the five visible free models in a single sweep on 2026-08-30 — so the tier
7
7
  > gets rebuilt rather than topped up. The URL keeps its original slug so existing
@@ -23,7 +23,7 @@ BlockRun's answer: just take them.
23
23
 
24
24
  ---
25
25
 
26
- ## The Lineup: <!-- br:models.free -->7<!-- /br:models.free --> Models, $0.00
26
+ ## The Lineup: <!-- br:models.free -->6<!-- /br:models.free --> Models, $0.00
27
27
 
28
28
  Through [ClawRouter](https://github.com/BlockRunAI/ClawRouter) — BlockRun's local AI routing proxy — you get zero-cost access to the following (verified live 2026-08-30):
29
29
 
@@ -244,13 +244,13 @@ Look at the cost trajectory over the past three years:
244
244
  - **2023:** GPT-4 dominates alone at $30/$60 per M tokens
245
245
  - **2024:** Open-source models surge, prices halve repeatedly
246
246
  - **2025:** DeepSeek, Qwen push top-tier inference below $1/M
247
- - **2026:** BlockRun offers <!-- br:models.free -->7<!-- /br:models.free --> free models through a single API
247
+ - **2026:** BlockRun offers <!-- br:models.free -->6<!-- /br:models.free --> free models through a single API
248
248
 
249
249
  **A free tier that gets rebuilt rather than retired isn't just a product feature — it's a signal.** Baseline AI capability is becoming infrastructure. Like internet bandwidth before it, the cost of "good enough" AI inference is converging toward zero.
250
250
 
251
251
  BlockRun and ClawRouter exist to be the **routing layer** in this transition: not locked to any single provider, not bound to any single model, always giving developers the lowest-cost path to the right capability.
252
252
 
253
- Today it's <!-- br:models.free -->7<!-- /br:models.free --> free models, and they are not the same seven as last month. Tomorrow it could be 50. Prices will only drop. Capabilities will only improve. The names will keep churning.
253
+ Today it's <!-- br:models.free -->6<!-- /br:models.free --> free models, and they are not the same seven as last month. Tomorrow it could be 50. Prices will only drop. Capabilities will only improve. The names will keep churning.
254
254
 
255
255
  **The one constant: your code doesn't need to change.**
256
256
 
@@ -265,7 +265,7 @@ clawrouter start
265
265
 
266
266
  Point your `base_url` to `http://localhost:8402/v1`. That's the whole setup.
267
267
 
268
- <!-- br:models.free -->7<!-- /br:models.free --> free models. Up to 1M context. Unlimited calls. Zero cost.
268
+ <!-- br:models.free -->6<!-- /br:models.free --> free models. Up to 1M context. Unlimited calls. Zero cost.
269
269
 
270
270
  Go build something.
271
271
 
@@ -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 -->76<!-- /br:models.chatVisible --> AI models. It saves you money in three ways: **smart routing**, **token optimization**, and **response caching**.
53
+ [ClawRouter](https://github.com/BlockRunAI/ClawRouter) is an open-source local proxy that sits between your app and <!-- br:models.chatVisible -->78<!-- /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 -->76<!-- /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.
34
+ ClawRouter is an open-source local proxy that sits between your agent and <!-- br:models.chatVisible -->78<!-- /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,12 +74,12 @@ 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 -->76<!-- /br:models.chatVisible --> models, switch anytime
77
+ - **No vendor lock-in** — <!-- br:models.chatVisible -->78<!-- /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
81
81
  - **Response caching** — identical requests within 10 minutes cost $0
82
- - **<!-- br:models.free -->7<!-- /br:models.free --> free models** — for tasks that don't need a paid model at all
82
+ - **<!-- br:models.free -->6<!-- /br:models.free --> free models** — for tasks that don't need a paid model at all
83
83
 
84
84
  ### Routing Profiles
85
85
 
@@ -135,7 +135,7 @@ Less context repeated = fewer tokens = lower cost. Agents that need to recall ea
135
135
 
136
136
  ### 7. x402 Micropayments — Wallet-Based Budget Control
137
137
 
138
- <p align="center"><img src="assets/blockrun-clawrouter-x402-usdc-micropayment-wallet-budget-control.png" alt="Budget limits enforced by physical construction — wallet loaded via Base/Solana, pay per call across <!-- br:models.chatVisible -->76<!-- /br:models.chatVisible --> models, balance hits zero and the valve shuts cleanly" width="720"></p>
138
+ <p align="center"><img src="assets/blockrun-clawrouter-x402-usdc-micropayment-wallet-budget-control.png" alt="Budget limits enforced by physical construction — wallet loaded via Base/Solana, pay per call across <!-- br:models.chatVisible -->78<!-- /br:models.chatVisible --> models, balance hits zero and the valve shuts cleanly" width="720"></p>
139
139
 
140
140
  ClawRouter pays for inference via [x402](https://x402.org/) USDC micropayments (Base or Solana). You load a wallet. Each inference call costs exactly what it costs. When the wallet runs low, requests stop cleanly.
141
141
 
@@ -144,7 +144,7 @@ There is no monthly invoice. There is no 3am email. There is a wallet balance, a
144
144
  **`maxCostPerRun`** — a per-session cost ceiling that stops or downgrades requests once a session exceeds a configured threshold (e.g., `$0.50`). This closes the remaining gap ([#3181](https://github.com/openclaw/openclaw/issues/3181)) where a wallet with sufficient funds can still accumulate within a single run. Two modes: `graceful` (downgrade to cheaper models) and `strict` (hard 429 once the cap is hit).
145
145
 
146
146
  ```
147
- <!-- br:models.chatVisible@live -->76<!-- /br:models.chatVisible@live --> models. One wallet. Pay per call.
147
+ <!-- br:models.chatVisible@live -->78<!-- /br:models.chatVisible@live --> models. One wallet. Pay per call.
148
148
  ```
149
149
 
150
150
  ---
@@ -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
- ![Guaranteed Feature Parity & Direct Connectivity — Three-panel diagram: Vision (image_url auto-detected → vision-capable models only), Tool Calling (toolCalling flag → agentic models only), Catalog (curated <!-- br:models.chatVisible -->76<!-- /br:models.chatVisible --> models with automatic legacy-to-modern redirects). Direct provider routing means no dropped payloads.](./assets/clawrouter-feature-parity-direct-connectivity.png)
225
+ ![Guaranteed Feature Parity & Direct Connectivity — Three-panel diagram: Vision (image_url auto-detected → vision-capable models only), Tool Calling (toolCalling flag → agentic models only), Catalog (curated <!-- br:models.chatVisible -->78<!-- /br:models.chatVisible --> models with automatic legacy-to-modern redirects). Direct provider routing means no dropped payloads.](./assets/clawrouter-feature-parity-direct-connectivity.png)
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 -->76<!-- /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:
243
+ ClawRouter maintains a curated catalog of <!-- br:models.chatVisible -->78<!-- /br:models.chatVisible --> models across 9 providers (including <!-- br:models.free -->6<!-- /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 -->76<!-- /br:models.chatVisible --> models, redirect aliases |
271
+ | **Model catalog** | Laggy, silent drops | Curated <!-- br:models.chatVisible -->78<!-- /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** |
@@ -15,7 +15,6 @@ Complete reference for ClawRouter configuration options.
15
15
  - [Tier Overrides](#tier-overrides)
16
16
  - [Scoring Weights](#scoring-weights)
17
17
  - [Spend Control & Counterparty Policy](#spend-control--counterparty-policy)
18
- - [TWZRD AutoGate (opt-in)](#twzrd-autogate-opt-in)
19
18
  - [Testing Configuration](#testing-configuration)
20
19
 
21
20
  ---
@@ -33,9 +32,6 @@ Complete reference for ClawRouter configuration options.
33
32
  | `CLAWROUTER_WORKER` | - | Set to `1` to enable Worker Mode (earn USDC by running health checks). |
34
33
  | `CLAWROUTER_DEBUG_HEADERS` | (on) | Set to `off`/`false`/`0` to suppress the `x-clawrouter-*` debug response headers. |
35
34
  | `BLOCKRUN_WEB_SEARCH` | (auto-enabled) | Set to `off` to disable BlockRun's Exa web search provider registration. |
36
- | `TWZRD_AUTO_GATE` | unset (off) | Set to `1` to compose TWZRD AutoGate after SpendControl on the x402 pre-sign hook. Also `TWZRD_GATE_ENABLED=true`. |
37
- | `TWZRD_GATE_TIMEOUT_MS` | `2000` | How long the gate may take to answer before the payment proceeds on its own. Only meaningful with the gate on. |
38
- | `TWZRD_FAIL_OPEN` | `true` | Set to `false` to refuse payments when the gate is unreachable instead of proceeding. Only meaningful with the gate on. |
39
35
 
40
36
  ---
41
37
 
@@ -736,66 +732,6 @@ placement, `clawrouter doctor`'s probe) are not covered.
736
732
 
737
733
  ---
738
734
 
739
- ## TWZRD AutoGate (opt-in)
740
-
741
- Default **off**. This is not a re-open of default-on vendor lock. SpendControl
742
- above remains the vendor-neutral path; TWZRD is composed only when you ask.
743
-
744
- ```bash
745
- export TWZRD_AUTO_GATE=1
746
- # equivalent:
747
- export TWZRD_GATE_ENABLED=true
748
- ```
749
-
750
- When set, `startProxy` registers the gate's `createTwzrdBeforePaymentHook` on the
751
- **same** x402 client, **after** `registerSpendPolicyHook`. SpendControl lists
752
- still run first. A wash `payTo` is refused before `signTransaction`.
753
-
754
- ### What it actually covers
755
-
756
- **Solana, not Base.** The gate's reputation corpus is Solana. `classifyNetwork`
757
- returns `network_not_scored` for `base` / `eip155:*`, and under our
758
- `unsupportedNetworkMode: "observe"` those are waved through with verdict
759
- `unknown` and no network call. The x402 client is shared between both chains, so
760
- the hook is registered once and applies to Solana payments; `refuseWashFlagged`
761
- can only ever fire there.
762
-
763
- ### What leaves your machine
764
-
765
- On a Solana payment the gate POSTs the resource URL, `payTo`, price and chain to
766
- `https://intel.twzrd.xyz/v1/intel/preflight`, stamped with
767
- `X-TWZRD-Integration: clawrouter/<version>` and a per-process run id. Nothing is
768
- sent when the flag is unset, and nothing is sent for Base.
769
-
770
- ### Availability
771
-
772
- The gate's own preflight sets no timeout, and the package defaults to
773
- `failOpen: false` — an outage there would refuse every paid Solana call. That is
774
- the shape of the v0.12.271 outage, where an unreachable third party made every
775
- Solana payment fail with a bare `fetch failed`. So:
776
-
777
- - We bound the answer at `TWZRD_GATE_TIMEOUT_MS` (default `2000`).
778
- - We pass `failOpen: true`. On timeout, rejection, or outage the payment
779
- proceeds and a warning names the reason. SpendControl still applies — it is
780
- the vendor-neutral guarantee and is untouched by any of this.
781
- - `TWZRD_FAIL_OPEN=false` restores refuse-on-outage if you would rather stop
782
- paying than pay unscored.
783
-
784
- ### Other notes
785
-
786
- - Optional dependency: `twzrd-x402-gate@0.9.3`. Forks that omit it still install.
787
- - Missing gate package (`MODULE_NOT_FOUND` for `twzrd-x402-gate` itself): fail
788
- open — proxy boots, payments unguarded by TWZRD. Any other load/install error
789
- fails closed.
790
- - We register the hook ourselves rather than calling `installTwzrdAutoGate`,
791
- which replaces `onBeforePaymentCreation` on the client — that would make every
792
- hook registered afterwards skippable via `TWZRD_AUTO_GATE=0`, including ours.
793
- - Identity: preflight stamps `X-Twzrd-Caller: clawrouter/<version>` so a refuse
794
- is attributable.
795
- - Unset the flag to return to SpendControl only.
796
-
797
- ---
798
-
799
735
  ## Testing Configuration
800
736
 
801
737
  ### Dry Run (No Payments)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blockrun/clawrouter",
3
- "version": "0.12.277",
4
- "description": "Smart LLM router — save 84% on inference costs. 76 models (7 free). Pay by credit card (API key) or USDC (x402 wallet).",
3
+ "version": "0.12.279",
4
+ "description": "Smart LLM router — save 84% on inference costs. 78 models (6 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",
@@ -106,9 +106,6 @@
106
106
  "undici": "^8.10.0",
107
107
  "viem": "^2.39.3"
108
108
  },
109
- "optionalDependencies": {
110
- "twzrd-x402-gate": "0.9.3"
111
- },
112
109
  "peerDependencies": {
113
110
  "openclaw": ">=2025.1.0"
114
111
  },
@@ -132,19 +129,15 @@
132
129
  "overrides": {
133
130
  "axios": "$axios",
134
131
  "undici": "$undici",
135
- "basic-ftp": "^5.3.1",
136
132
  "ws": "^8.21.2",
137
133
  "postcss": "^8.5.25",
138
134
  "esbuild": "^0.28.1",
139
135
  "brace-expansion": "^5.0.9",
140
136
  "fast-uri": "^3.1.5",
141
137
  "tar": "^7.5.22",
142
- "hono": "^4.13.0",
138
+ "hono": "^4.13.5",
143
139
  "@hono/node-server": "^2.1.0",
144
- "ip-address": "^10.4.0",
145
- "jayson": {
146
- "uuid": "^11.1.1"
147
- }
140
+ "ip-address": "^10.4.0"
148
141
  },
149
142
  "engines": {
150
143
  "node": ">=22"
@@ -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 76 models from OpenAI, Anthropic, Google, DeepSeek, xAI, Z.AI, and more. 7 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), AND the Surf unified crypto data API (84 endpoints — CEX/DEX, on-chain SQL over 80+ ClickHouse tables, 100M+ labeled wallets, prediction markets, social/CT mindshare, news, VC fund intel) as built-in agent tools. Not a local-inference tool — prompts are sent to the blockrun.ai gateway.
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 78 models from OpenAI, Anthropic, Google, DeepSeek, xAI, Z.AI, and more. 7 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), AND the Surf unified crypto data API (84 endpoints — CEX/DEX, on-chain SQL over 80+ ClickHouse tables, 100M+ labeled wallets, prediction markets, social/CT mindshare, news, VC fund intel) 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"
@@ -53,7 +53,7 @@ metadata:
53
53
 
54
54
  # ClawRouter
55
55
 
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 -->76<!-- /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.
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 -->78<!-- /br:models.chatVisible --> models from 9 providers (<!-- br:models.free -->6<!-- /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
57
 
58
58
  **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
59
 
@@ -147,7 +147,7 @@ it against a baseline nobody wrote down. See
147
147
 
148
148
  ## Available Models
149
149
 
150
- <!-- br:models.chatVisible -->76<!-- /br:models.chatVisible --> models including: 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-4o, o3, claude-fable-5, claude-opus-5 [Anthropic flagship, 1M ctx], claude-opus-4.8, claude-opus-4.7, claude-opus-4.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.5, grok-4.3, grok-build-0.1, glm-5.3 [Z.AI flagship, 1M ctx], glm-5.3-flash [natively multimodal, 1M ctx — $0.15/$0.50], glm-5.2, minimax-m3, kimi-k3 [1M ctx flagship], kimi-k2.7, qwen3.7-max [Qwen flagship, 1M ctx], qwen3.7-plus, qwen3.7-flash, hy3 [Tencent], mimo [Xiaomi MiMo-V2.5 Pro, 1M ctx], and 7 free open-weight models (nemotron-3.5-lightning [1M ctx, thinking mode — the free default], nemotron-3-nano-30b [fastest, ~121 tok/s], 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]). 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.
150
+ <!-- br:models.chatVisible -->78<!-- /br:models.chatVisible --> models including: 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-4o, o3, claude-fable-5, claude-opus-5 [Anthropic flagship, 1M ctx], claude-opus-4.8, claude-opus-4.7, claude-opus-4.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.5, grok-4.3, grok-build-0.1, glm-5.3 [Z.AI flagship, 1M ctx], glm-5.3-flash [natively multimodal, 1M ctx — $0.15/$0.50], glm-5.2, minimax-m3, kimi-k3 [1M ctx flagship], kimi-k2.7, qwen3.7-max [Qwen flagship, 1M ctx], qwen3.7-plus, qwen3.7-flash, hy3 [Tencent], mimo [Xiaomi MiMo-V2.5 Pro, 1M ctx], and 7 free open-weight models (nemotron-3.5-lightning [1M ctx, thinking mode — the free default], nemotron-3-nano-30b [fastest, ~121 tok/s], 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]). 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.
151
151
 
152
152
  ## Built-in Agent Tools
153
153