@blockrun/clawrouter 0.12.26 → 0.12.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/clawrouter",
3
- "version": "0.12.26",
3
+ "version": "0.12.27",
4
4
  "description": "Smart LLM router — save 92% on inference costs. 41+ models, one wallet, x402 micropayments.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,6 +22,7 @@
22
22
  "files": [
23
23
  "dist",
24
24
  "scripts",
25
+ "skills",
25
26
  "openclaw.plugin.json"
26
27
  ],
27
28
  "scripts": {
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: clawrouter
3
+ description: Smart LLM router — save 67% on inference costs. Routes every request to the cheapest capable model across 41 models from OpenAI, Anthropic, Google, DeepSeek, and xAI.
4
+ homepage: https://github.com/BlockRunAI/ClawRouter
5
+ metadata: { "openclaw": { "emoji": "🦀", "requires": { "config": ["models.providers.blockrun"] } } }
6
+ ---
7
+
8
+ # ClawRouter
9
+
10
+ Smart LLM router that saves 67% on inference costs by routing each request to the cheapest model that can handle it. 41 models across 5 providers, all through one wallet.
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ openclaw plugins install @blockrun/clawrouter
16
+ ```
17
+
18
+ ## Setup
19
+
20
+ ```bash
21
+ # Enable smart routing (auto-picks cheapest model per request)
22
+ openclaw models set blockrun/auto
23
+
24
+ # Or pin a specific model
25
+ openclaw models set openai/gpt-4o
26
+ ```
27
+
28
+ ## How Routing Works
29
+
30
+ ClawRouter classifies each request into one of four tiers:
31
+
32
+ - **SIMPLE** (40% of traffic) — factual lookups, greetings, translations → Gemini Flash ($0.60/M, 99% savings)
33
+ - **MEDIUM** (30%) — summaries, explanations, data extraction → DeepSeek Chat ($0.42/M, 99% savings)
34
+ - **COMPLEX** (20%) — code generation, multi-step analysis → Claude Opus ($75/M, best quality)
35
+ - **REASONING** (10%) — proofs, formal logic, multi-step math → o3 ($8/M, 89% savings)
36
+
37
+ Rules handle ~80% of requests in <1ms. Only ambiguous queries hit the LLM classifier (~$0.00003 per classification).
38
+
39
+ ## Available Models
40
+
41
+ 41 models including: gpt-5.2, gpt-4o, gpt-4o-mini, o3, o1, claude-opus-4.6, claude-sonnet-4.6, claude-haiku-4.5, gemini-3.1-pro, gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite, deepseek-chat, deepseek-reasoner, grok-3, grok-3-mini.
42
+
43
+ ## Example Output
44
+
45
+ ```
46
+ [ClawRouter] google/gemini-2.5-flash (SIMPLE, rules, confidence=0.92)
47
+ Cost: $0.0025 | Baseline: $0.308 | Saved: 99.2%
48
+ ```
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: imagegen
3
+ description: Generate images via BlockRun's image API. Trigger when the user asks to generate, create, draw, or make an image.
4
+ metadata: { "openclaw": { "emoji": "🖼️", "requires": { "config": ["models.providers.blockrun"] } } }
5
+ ---
6
+
7
+ # Image Generation
8
+
9
+ When the user asks to generate, create, draw, or make an image, generate it by calling ClawRouter's image API directly — no extra setup needed.
10
+
11
+ ## How to Generate
12
+
13
+ POST to `http://localhost:8402/v1/images/generations`:
14
+
15
+ ```json
16
+ {
17
+ "model": "google/nano-banana",
18
+ "prompt": "<user's prompt>",
19
+ "size": "1024x1024",
20
+ "n": 1
21
+ }
22
+ ```
23
+
24
+ The response contains a public image URL:
25
+
26
+ ```json
27
+ {
28
+ "created": 1741460000,
29
+ "data": [{ "url": "https://files.catbox.moe/abc123.png" }]
30
+ }
31
+ ```
32
+
33
+ Display the image inline in your response:
34
+
35
+ ```markdown
36
+ ![generated image](https://files.catbox.moe/abc123.png)
37
+ ```
38
+
39
+ ## Model Selection
40
+
41
+ Pick the model based on what the user asks for (or default to `nano-banana`):
42
+
43
+ | Model shorthand | Full ID | Price | Best for |
44
+ |---|---|---|---|
45
+ | `nano-banana` | `google/nano-banana` | $0.05 | Default — fast, cheap, good quality |
46
+ | `banana-pro` | `google/nano-banana-pro` | $0.10 | High-res up to 4096×4096 |
47
+ | `dall-e-3` | `openai/dall-e-3` | $0.04 | Photorealistic, complex scenes |
48
+ | `gpt-image` | `openai/gpt-image-1` | $0.02 | Budget option |
49
+ | `flux` | `black-forest/flux-1.1-pro` | $0.04 | Artistic styles, fewer restrictions |
50
+
51
+ If the user mentions "high res" or "large", use `banana-pro`. If they want "photorealistic" or "dall-e", use `dall-e-3`. Otherwise default to `nano-banana`.
52
+
53
+ ## Size Options
54
+
55
+ Default is `1024x1024`. Adjust based on user request:
56
+
57
+ - Portrait: `1024x1792`
58
+ - Landscape: `1792x1024` (dall-e-3) or `1024x1024` (others)
59
+ - High-res: up to `4096x4096` with `banana-pro` only
60
+
61
+ ## Example Interactions
62
+
63
+ **User:** Draw me a golden retriever surfing on a wave
64
+
65
+ → Call `nano-banana` with prompt `"a golden retriever surfing on a wave"`, display the image.
66
+
67
+ **User:** Generate a high-res mountain landscape, landscape format
68
+
69
+ → Call `banana-pro` with size `1024x1024` (max varies by model), prompt `"mountain landscape"`.
70
+
71
+ **User:** Make a cyberpunk city with dall-e
72
+
73
+ → Call `dall-e-3` with prompt `"a futuristic cyberpunk city"`.
74
+
75
+ ## Notes
76
+
77
+ - Payment is automatic via x402 — deducted from the user's BlockRun wallet
78
+ - If the call fails with a payment error, tell the user to fund their wallet at [blockrun.ai](https://blockrun.ai)
79
+ - DALL-E 3 applies OpenAI content policy; use `flux` or `nano-banana` for more flexibility
80
+ - Google models may return base64 — ClawRouter handles uploading automatically, you'll get a URL back
@@ -0,0 +1,182 @@
1
+ ---
2
+ name: release
3
+ description: Use this skill for EVERY ClawRouter release. Enforces the full checklist — version sync, CHANGELOG, blockrun server constant, build, tests, npm publish, git tag, GitHub release. No step can be skipped.
4
+ ---
5
+
6
+ # ClawRouter Release Checklist
7
+
8
+ **This skill is mandatory for every release. Execute every step in order. Do not skip.**
9
+
10
+ ## Step 1: Confirm the New Version
11
+
12
+ Read the current version:
13
+
14
+ ```bash
15
+ cat package.json | grep '"version"'
16
+ ```
17
+
18
+ Ask: "What version are we releasing?" Confirm it follows semver and is higher than current.
19
+
20
+ ---
21
+
22
+ ## Step 2: Update `package.json` Version
23
+
24
+ Edit `package.json` — bump `"version"` to the new version.
25
+
26
+ ---
27
+
28
+ ## Step 3: Write CHANGELOG Entry
29
+
30
+ Open `CHANGELOG.md`. Add a new section at the top (after the header) in this format:
31
+
32
+ ```markdown
33
+ ## v{VERSION} — {DATE}
34
+
35
+ - **Feature/Fix name** — description
36
+ - **Feature/Fix name** — description
37
+ ```
38
+
39
+ Rules:
40
+ - Date format: `Mar 8, 2026`
41
+ - One bullet per logical change
42
+ - Every bullet must be present — no "see git log"
43
+ - Include **all** changes since the previous release
44
+
45
+ ---
46
+
47
+ ## Step 4: Sync `CURRENT_CLAWROUTER_VERSION` in blockrun
48
+
49
+ **This is the most commonly forgotten step.**
50
+
51
+ File: `/Users/vickyfu/Documents/blockrun-web/blockrun/src/app/api/v1/chat/completions/route.ts`
52
+
53
+ Find this line:
54
+ ```typescript
55
+ const CURRENT_CLAWROUTER_VERSION = "x.y.z";
56
+ ```
57
+
58
+ Update it to match the new version. Verify with:
59
+ ```bash
60
+ grep CURRENT_CLAWROUTER_VERSION /Users/vickyfu/Documents/blockrun-web/blockrun/src/app/api/v1/chat/completions/route.ts
61
+ ```
62
+
63
+ **Do not skip this.** It controls the update nudge shown to users running outdated versions.
64
+
65
+ ---
66
+
67
+ ## Step 5: Build
68
+
69
+ ```bash
70
+ npm run build
71
+ ```
72
+
73
+ Fix any TypeScript or build errors before proceeding.
74
+
75
+ ---
76
+
77
+ ## Step 6: Run Tests
78
+
79
+ ```bash
80
+ npm test
81
+ npm run typecheck
82
+ npm run lint
83
+ ```
84
+
85
+ All must pass. Fix failures before proceeding.
86
+
87
+ ---
88
+
89
+ ## Step 7: Commit Everything
90
+
91
+ Stage and commit:
92
+
93
+ ```bash
94
+ git add package.json CHANGELOG.md
95
+ git commit -m "chore: bump version to {VERSION}"
96
+ ```
97
+
98
+ If blockrun's route.ts was updated, commit that separately in the blockrun repo.
99
+
100
+ ---
101
+
102
+ ## Step 8: Push to GitHub
103
+
104
+ ```bash
105
+ git push origin main
106
+ ```
107
+
108
+ ---
109
+
110
+ ## Step 9: Create Git Tag
111
+
112
+ ```bash
113
+ git tag v{VERSION}
114
+ git push origin v{VERSION}
115
+ ```
116
+
117
+ ---
118
+
119
+ ## Step 10: Create GitHub Release
120
+
121
+ ```bash
122
+ gh release create v{VERSION} \
123
+ --title "v{VERSION}" \
124
+ --notes "$(sed -n '/^## v{VERSION}/,/^## v[0-9]/p' CHANGELOG.md | head -n -1)"
125
+ ```
126
+
127
+ Verify the release on GitHub: https://github.com/BlockRunAI/ClawRouter/releases
128
+
129
+ The release notes **must** match the CHANGELOG entry exactly.
130
+
131
+ ---
132
+
133
+ ## Step 11: Publish to npm
134
+
135
+ ```bash
136
+ npm publish --access public
137
+ ```
138
+
139
+ Verify: https://npmjs.com/package/@blockrun/clawrouter
140
+
141
+ Expected output: `+ @blockrun/clawrouter@{VERSION}`
142
+
143
+ ---
144
+
145
+ ## Step 12: Final Verification
146
+
147
+ Run this checklist to confirm everything is in sync:
148
+
149
+ ```bash
150
+ # 1. package.json version
151
+ cat package.json | grep '"version"'
152
+
153
+ # 2. CHANGELOG has the entry
154
+ head -10 CHANGELOG.md
155
+
156
+ # 3. blockrun CURRENT_CLAWROUTER_VERSION
157
+ grep CURRENT_CLAWROUTER_VERSION /Users/vickyfu/Documents/blockrun-web/blockrun/src/app/api/v1/chat/completions/route.ts
158
+
159
+ # 4. npm package is live
160
+ npm view @blockrun/clawrouter version
161
+
162
+ # 5. GitHub tag exists
163
+ git tag | grep v{VERSION}
164
+
165
+ # 6. GitHub release exists
166
+ gh release view v{VERSION}
167
+ ```
168
+
169
+ All 6 must match the new version. If any mismatch, fix before declaring the release done.
170
+
171
+ ---
172
+
173
+ ## Common Mistakes (Never Repeat These)
174
+
175
+ | Mistake | Prevention |
176
+ |---------|-----------|
177
+ | Forgot to update `CURRENT_CLAWROUTER_VERSION` in blockrun | Step 4 — always check |
178
+ | CHANGELOG entry missing or incomplete | Step 3 — write it before building |
179
+ | npm publish before tests pass | Steps 5-6 must precede Step 11 |
180
+ | GitHub release notes empty | Step 10 — extract from CHANGELOG |
181
+ | Git tag not pushed | Step 9 — push tag separately |
182
+ | docs not reflecting new features | Update docs in same PR as the feature |