@blockrun/clawrouter 0.9.38 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -13
- package/dist/cli.js +196 -85
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +209 -89
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -683,6 +683,8 @@ declare function resolveModelAlias(model: string): string;
|
|
|
683
683
|
type BlockRunModel = {
|
|
684
684
|
id: string;
|
|
685
685
|
name: string;
|
|
686
|
+
/** Model version (e.g., "4.6", "3.1", "5.2") for tracking updates */
|
|
687
|
+
version?: string;
|
|
686
688
|
inputPrice: number;
|
|
687
689
|
outputPrice: number;
|
|
688
690
|
contextWindow: number;
|
package/dist/index.js
CHANGED
|
@@ -1,34 +1,36 @@
|
|
|
1
1
|
// src/models.ts
|
|
2
2
|
var MODEL_ALIASES = {
|
|
3
|
-
// Claude -
|
|
4
|
-
claude: "claude-sonnet-4",
|
|
5
|
-
sonnet: "claude-sonnet-4",
|
|
6
|
-
"sonnet-4
|
|
7
|
-
"sonnet-4
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
// Claude - use newest versions (4.6)
|
|
4
|
+
claude: "anthropic/claude-sonnet-4.6",
|
|
5
|
+
sonnet: "anthropic/claude-sonnet-4.6",
|
|
6
|
+
"sonnet-4": "anthropic/claude-sonnet-4.6",
|
|
7
|
+
"sonnet-4.6": "anthropic/claude-sonnet-4.6",
|
|
8
|
+
"sonnet-4-6": "anthropic/claude-sonnet-4.6",
|
|
9
|
+
opus: "anthropic/claude-opus-4.6",
|
|
10
|
+
"opus-4": "anthropic/claude-opus-4.6",
|
|
11
|
+
"opus-4.6": "anthropic/claude-opus-4.6",
|
|
12
|
+
"opus-4-6": "anthropic/claude-opus-4.6",
|
|
13
|
+
haiku: "anthropic/claude-haiku-4.5",
|
|
11
14
|
// Claude - provider/shortname patterns (common in agent frameworks)
|
|
12
|
-
"anthropic/sonnet": "claude-sonnet-4",
|
|
13
|
-
"anthropic/opus": "claude-opus-4",
|
|
14
|
-
"anthropic/haiku": "claude-haiku-4.5",
|
|
15
|
-
"anthropic/claude": "claude-sonnet-4",
|
|
16
|
-
// Backward compatibility -
|
|
17
|
-
"anthropic/claude-sonnet-4": "claude-sonnet-4",
|
|
18
|
-
"anthropic/claude-sonnet-4-6": "claude-sonnet-4",
|
|
19
|
-
"anthropic/claude-
|
|
20
|
-
"anthropic/claude-opus-4": "claude-opus-4",
|
|
21
|
-
"anthropic/claude-opus-4
|
|
22
|
-
"anthropic/claude-
|
|
23
|
-
"anthropic/claude-haiku-4": "claude-haiku-4.5",
|
|
24
|
-
"anthropic/claude-haiku-4-5": "claude-haiku-4.5",
|
|
25
|
-
"anthropic/claude-haiku-4.5": "claude-haiku-4.5",
|
|
15
|
+
"anthropic/sonnet": "anthropic/claude-sonnet-4.6",
|
|
16
|
+
"anthropic/opus": "anthropic/claude-opus-4.6",
|
|
17
|
+
"anthropic/haiku": "anthropic/claude-haiku-4.5",
|
|
18
|
+
"anthropic/claude": "anthropic/claude-sonnet-4.6",
|
|
19
|
+
// Backward compatibility - map all variants to 4.6
|
|
20
|
+
"anthropic/claude-sonnet-4": "anthropic/claude-sonnet-4.6",
|
|
21
|
+
"anthropic/claude-sonnet-4-6": "anthropic/claude-sonnet-4.6",
|
|
22
|
+
"anthropic/claude-opus-4": "anthropic/claude-opus-4.6",
|
|
23
|
+
"anthropic/claude-opus-4-6": "anthropic/claude-opus-4.6",
|
|
24
|
+
"anthropic/claude-opus-4.5": "anthropic/claude-opus-4.6",
|
|
25
|
+
"anthropic/claude-haiku-4": "anthropic/claude-haiku-4.5",
|
|
26
|
+
"anthropic/claude-haiku-4-5": "anthropic/claude-haiku-4.5",
|
|
26
27
|
// OpenAI
|
|
27
28
|
gpt: "openai/gpt-4o",
|
|
28
29
|
gpt4: "openai/gpt-4o",
|
|
29
30
|
gpt5: "openai/gpt-5.2",
|
|
30
31
|
codex: "openai/gpt-5.2-codex",
|
|
31
32
|
mini: "openai/gpt-4o-mini",
|
|
33
|
+
o1: "openai/o1",
|
|
32
34
|
o3: "openai/o3",
|
|
33
35
|
// DeepSeek
|
|
34
36
|
deepseek: "deepseek/deepseek-chat",
|
|
@@ -104,6 +106,7 @@ var BLOCKRUN_MODELS = [
|
|
|
104
106
|
{
|
|
105
107
|
id: "openai/gpt-5.2",
|
|
106
108
|
name: "GPT-5.2",
|
|
109
|
+
version: "5.2",
|
|
107
110
|
inputPrice: 1.75,
|
|
108
111
|
outputPrice: 14,
|
|
109
112
|
contextWindow: 4e5,
|
|
@@ -115,6 +118,7 @@ var BLOCKRUN_MODELS = [
|
|
|
115
118
|
{
|
|
116
119
|
id: "openai/gpt-5-mini",
|
|
117
120
|
name: "GPT-5 Mini",
|
|
121
|
+
version: "5.0",
|
|
118
122
|
inputPrice: 0.25,
|
|
119
123
|
outputPrice: 2,
|
|
120
124
|
contextWindow: 2e5,
|
|
@@ -123,6 +127,7 @@ var BLOCKRUN_MODELS = [
|
|
|
123
127
|
{
|
|
124
128
|
id: "openai/gpt-5-nano",
|
|
125
129
|
name: "GPT-5 Nano",
|
|
130
|
+
version: "5.0",
|
|
126
131
|
inputPrice: 0.05,
|
|
127
132
|
outputPrice: 0.4,
|
|
128
133
|
contextWindow: 128e3,
|
|
@@ -131,6 +136,7 @@ var BLOCKRUN_MODELS = [
|
|
|
131
136
|
{
|
|
132
137
|
id: "openai/gpt-5.2-pro",
|
|
133
138
|
name: "GPT-5.2 Pro",
|
|
139
|
+
version: "5.2",
|
|
134
140
|
inputPrice: 21,
|
|
135
141
|
outputPrice: 168,
|
|
136
142
|
contextWindow: 4e5,
|
|
@@ -141,8 +147,9 @@ var BLOCKRUN_MODELS = [
|
|
|
141
147
|
{
|
|
142
148
|
id: "openai/gpt-5.2-codex",
|
|
143
149
|
name: "GPT-5.2 Codex",
|
|
144
|
-
|
|
145
|
-
|
|
150
|
+
version: "5.2",
|
|
151
|
+
inputPrice: 1.75,
|
|
152
|
+
outputPrice: 14,
|
|
146
153
|
contextWindow: 128e3,
|
|
147
154
|
maxOutput: 32e3,
|
|
148
155
|
agentic: true
|
|
@@ -151,6 +158,7 @@ var BLOCKRUN_MODELS = [
|
|
|
151
158
|
{
|
|
152
159
|
id: "openai/gpt-4.1",
|
|
153
160
|
name: "GPT-4.1",
|
|
161
|
+
version: "4.1",
|
|
154
162
|
inputPrice: 2,
|
|
155
163
|
outputPrice: 8,
|
|
156
164
|
contextWindow: 128e3,
|
|
@@ -160,15 +168,25 @@ var BLOCKRUN_MODELS = [
|
|
|
160
168
|
{
|
|
161
169
|
id: "openai/gpt-4.1-mini",
|
|
162
170
|
name: "GPT-4.1 Mini",
|
|
171
|
+
version: "4.1",
|
|
163
172
|
inputPrice: 0.4,
|
|
164
173
|
outputPrice: 1.6,
|
|
165
174
|
contextWindow: 128e3,
|
|
166
175
|
maxOutput: 16384
|
|
167
176
|
},
|
|
168
|
-
|
|
177
|
+
{
|
|
178
|
+
id: "openai/gpt-4.1-nano",
|
|
179
|
+
name: "GPT-4.1 Nano",
|
|
180
|
+
version: "4.1",
|
|
181
|
+
inputPrice: 0.1,
|
|
182
|
+
outputPrice: 0.4,
|
|
183
|
+
contextWindow: 128e3,
|
|
184
|
+
maxOutput: 16384
|
|
185
|
+
},
|
|
169
186
|
{
|
|
170
187
|
id: "openai/gpt-4o",
|
|
171
188
|
name: "GPT-4o",
|
|
189
|
+
version: "4o",
|
|
172
190
|
inputPrice: 2.5,
|
|
173
191
|
outputPrice: 10,
|
|
174
192
|
contextWindow: 128e3,
|
|
@@ -179,15 +197,37 @@ var BLOCKRUN_MODELS = [
|
|
|
179
197
|
{
|
|
180
198
|
id: "openai/gpt-4o-mini",
|
|
181
199
|
name: "GPT-4o Mini",
|
|
200
|
+
version: "4o-mini",
|
|
182
201
|
inputPrice: 0.15,
|
|
183
202
|
outputPrice: 0.6,
|
|
184
203
|
contextWindow: 128e3,
|
|
185
204
|
maxOutput: 16384
|
|
186
205
|
},
|
|
187
|
-
// OpenAI O-series (Reasoning)
|
|
206
|
+
// OpenAI O-series (Reasoning)
|
|
207
|
+
{
|
|
208
|
+
id: "openai/o1",
|
|
209
|
+
name: "o1",
|
|
210
|
+
version: "1",
|
|
211
|
+
inputPrice: 15,
|
|
212
|
+
outputPrice: 60,
|
|
213
|
+
contextWindow: 2e5,
|
|
214
|
+
maxOutput: 1e5,
|
|
215
|
+
reasoning: true
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
id: "openai/o1-mini",
|
|
219
|
+
name: "o1-mini",
|
|
220
|
+
version: "1-mini",
|
|
221
|
+
inputPrice: 1.1,
|
|
222
|
+
outputPrice: 4.4,
|
|
223
|
+
contextWindow: 128e3,
|
|
224
|
+
maxOutput: 65536,
|
|
225
|
+
reasoning: true
|
|
226
|
+
},
|
|
188
227
|
{
|
|
189
228
|
id: "openai/o3",
|
|
190
229
|
name: "o3",
|
|
230
|
+
version: "3",
|
|
191
231
|
inputPrice: 2,
|
|
192
232
|
outputPrice: 8,
|
|
193
233
|
contextWindow: 2e5,
|
|
@@ -197,6 +237,7 @@ var BLOCKRUN_MODELS = [
|
|
|
197
237
|
{
|
|
198
238
|
id: "openai/o3-mini",
|
|
199
239
|
name: "o3-mini",
|
|
240
|
+
version: "3-mini",
|
|
200
241
|
inputPrice: 1.1,
|
|
201
242
|
outputPrice: 4.4,
|
|
202
243
|
contextWindow: 128e3,
|
|
@@ -206,6 +247,7 @@ var BLOCKRUN_MODELS = [
|
|
|
206
247
|
{
|
|
207
248
|
id: "openai/o4-mini",
|
|
208
249
|
name: "o4-mini",
|
|
250
|
+
version: "4-mini",
|
|
209
251
|
inputPrice: 1.1,
|
|
210
252
|
outputPrice: 4.4,
|
|
211
253
|
contextWindow: 128e3,
|
|
@@ -213,10 +255,11 @@ var BLOCKRUN_MODELS = [
|
|
|
213
255
|
reasoning: true
|
|
214
256
|
},
|
|
215
257
|
// Anthropic - all Claude models excel at agentic workflows
|
|
216
|
-
//
|
|
258
|
+
// Use newest versions (4.6) with full provider prefix
|
|
217
259
|
{
|
|
218
|
-
id: "claude-haiku-4.5",
|
|
260
|
+
id: "anthropic/claude-haiku-4.5",
|
|
219
261
|
name: "Claude Haiku 4.5",
|
|
262
|
+
version: "4.5",
|
|
220
263
|
inputPrice: 1,
|
|
221
264
|
outputPrice: 5,
|
|
222
265
|
contextWindow: 2e5,
|
|
@@ -224,8 +267,9 @@ var BLOCKRUN_MODELS = [
|
|
|
224
267
|
agentic: true
|
|
225
268
|
},
|
|
226
269
|
{
|
|
227
|
-
id: "claude-sonnet-4",
|
|
270
|
+
id: "anthropic/claude-sonnet-4.6",
|
|
228
271
|
name: "Claude Sonnet 4.6",
|
|
272
|
+
version: "4.6",
|
|
229
273
|
inputPrice: 3,
|
|
230
274
|
outputPrice: 15,
|
|
231
275
|
contextWindow: 2e5,
|
|
@@ -234,19 +278,32 @@ var BLOCKRUN_MODELS = [
|
|
|
234
278
|
agentic: true
|
|
235
279
|
},
|
|
236
280
|
{
|
|
237
|
-
id: "claude-opus-4",
|
|
281
|
+
id: "anthropic/claude-opus-4.6",
|
|
238
282
|
name: "Claude Opus 4.6",
|
|
239
|
-
|
|
240
|
-
|
|
283
|
+
version: "4.6",
|
|
284
|
+
inputPrice: 5,
|
|
285
|
+
outputPrice: 25,
|
|
241
286
|
contextWindow: 2e5,
|
|
242
287
|
maxOutput: 32e3,
|
|
243
288
|
reasoning: true,
|
|
244
289
|
agentic: true
|
|
245
290
|
},
|
|
246
291
|
// Google
|
|
292
|
+
{
|
|
293
|
+
id: "google/gemini-3.1-pro-preview",
|
|
294
|
+
name: "Gemini 3.1 Pro Preview",
|
|
295
|
+
version: "3.1",
|
|
296
|
+
inputPrice: 2,
|
|
297
|
+
outputPrice: 12,
|
|
298
|
+
contextWindow: 105e4,
|
|
299
|
+
maxOutput: 65536,
|
|
300
|
+
reasoning: true,
|
|
301
|
+
vision: true
|
|
302
|
+
},
|
|
247
303
|
{
|
|
248
304
|
id: "google/gemini-3-pro-preview",
|
|
249
305
|
name: "Gemini 3 Pro Preview",
|
|
306
|
+
version: "3.0",
|
|
250
307
|
inputPrice: 2,
|
|
251
308
|
outputPrice: 12,
|
|
252
309
|
contextWindow: 105e4,
|
|
@@ -254,9 +311,20 @@ var BLOCKRUN_MODELS = [
|
|
|
254
311
|
reasoning: true,
|
|
255
312
|
vision: true
|
|
256
313
|
},
|
|
314
|
+
{
|
|
315
|
+
id: "google/gemini-3-flash-preview",
|
|
316
|
+
name: "Gemini 3 Flash Preview",
|
|
317
|
+
version: "3.0",
|
|
318
|
+
inputPrice: 0.5,
|
|
319
|
+
outputPrice: 3,
|
|
320
|
+
contextWindow: 1e6,
|
|
321
|
+
maxOutput: 65536,
|
|
322
|
+
vision: true
|
|
323
|
+
},
|
|
257
324
|
{
|
|
258
325
|
id: "google/gemini-2.5-pro",
|
|
259
326
|
name: "Gemini 2.5 Pro",
|
|
327
|
+
version: "2.5",
|
|
260
328
|
inputPrice: 1.25,
|
|
261
329
|
outputPrice: 10,
|
|
262
330
|
contextWindow: 105e4,
|
|
@@ -267,8 +335,18 @@ var BLOCKRUN_MODELS = [
|
|
|
267
335
|
{
|
|
268
336
|
id: "google/gemini-2.5-flash",
|
|
269
337
|
name: "Gemini 2.5 Flash",
|
|
270
|
-
|
|
271
|
-
|
|
338
|
+
version: "2.5",
|
|
339
|
+
inputPrice: 0.3,
|
|
340
|
+
outputPrice: 2.5,
|
|
341
|
+
contextWindow: 1e6,
|
|
342
|
+
maxOutput: 65536
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
id: "google/gemini-2.5-flash-lite",
|
|
346
|
+
name: "Gemini 2.5 Flash Lite",
|
|
347
|
+
version: "2.5",
|
|
348
|
+
inputPrice: 0.1,
|
|
349
|
+
outputPrice: 0.4,
|
|
272
350
|
contextWindow: 1e6,
|
|
273
351
|
maxOutput: 65536
|
|
274
352
|
},
|
|
@@ -276,6 +354,7 @@ var BLOCKRUN_MODELS = [
|
|
|
276
354
|
{
|
|
277
355
|
id: "deepseek/deepseek-chat",
|
|
278
356
|
name: "DeepSeek V3.2 Chat",
|
|
357
|
+
version: "3.2",
|
|
279
358
|
inputPrice: 0.28,
|
|
280
359
|
outputPrice: 0.42,
|
|
281
360
|
contextWindow: 128e3,
|
|
@@ -284,6 +363,7 @@ var BLOCKRUN_MODELS = [
|
|
|
284
363
|
{
|
|
285
364
|
id: "deepseek/deepseek-reasoner",
|
|
286
365
|
name: "DeepSeek V3.2 Reasoner",
|
|
366
|
+
version: "3.2",
|
|
287
367
|
inputPrice: 0.28,
|
|
288
368
|
outputPrice: 0.42,
|
|
289
369
|
contextWindow: 128e3,
|
|
@@ -294,8 +374,9 @@ var BLOCKRUN_MODELS = [
|
|
|
294
374
|
{
|
|
295
375
|
id: "moonshot/kimi-k2.5",
|
|
296
376
|
name: "Kimi K2.5",
|
|
297
|
-
|
|
298
|
-
|
|
377
|
+
version: "k2.5",
|
|
378
|
+
inputPrice: 0.6,
|
|
379
|
+
outputPrice: 3,
|
|
299
380
|
contextWindow: 262144,
|
|
300
381
|
maxOutput: 8192,
|
|
301
382
|
reasoning: true,
|
|
@@ -306,6 +387,7 @@ var BLOCKRUN_MODELS = [
|
|
|
306
387
|
{
|
|
307
388
|
id: "xai/grok-3",
|
|
308
389
|
name: "Grok 3",
|
|
390
|
+
version: "3",
|
|
309
391
|
inputPrice: 3,
|
|
310
392
|
outputPrice: 15,
|
|
311
393
|
contextWindow: 131072,
|
|
@@ -316,6 +398,7 @@ var BLOCKRUN_MODELS = [
|
|
|
316
398
|
{
|
|
317
399
|
id: "xai/grok-3-mini",
|
|
318
400
|
name: "Grok 3 Mini",
|
|
401
|
+
version: "3-mini",
|
|
319
402
|
inputPrice: 0.3,
|
|
320
403
|
outputPrice: 0.5,
|
|
321
404
|
contextWindow: 131072,
|
|
@@ -325,6 +408,7 @@ var BLOCKRUN_MODELS = [
|
|
|
325
408
|
{
|
|
326
409
|
id: "xai/grok-4-fast-reasoning",
|
|
327
410
|
name: "Grok 4 Fast Reasoning",
|
|
411
|
+
version: "4",
|
|
328
412
|
inputPrice: 0.2,
|
|
329
413
|
outputPrice: 0.5,
|
|
330
414
|
contextWindow: 131072,
|
|
@@ -334,6 +418,7 @@ var BLOCKRUN_MODELS = [
|
|
|
334
418
|
{
|
|
335
419
|
id: "xai/grok-4-fast-non-reasoning",
|
|
336
420
|
name: "Grok 4 Fast",
|
|
421
|
+
version: "4",
|
|
337
422
|
inputPrice: 0.2,
|
|
338
423
|
outputPrice: 0.5,
|
|
339
424
|
contextWindow: 131072,
|
|
@@ -342,6 +427,7 @@ var BLOCKRUN_MODELS = [
|
|
|
342
427
|
{
|
|
343
428
|
id: "xai/grok-4-1-fast-reasoning",
|
|
344
429
|
name: "Grok 4.1 Fast Reasoning",
|
|
430
|
+
version: "4.1",
|
|
345
431
|
inputPrice: 0.2,
|
|
346
432
|
outputPrice: 0.5,
|
|
347
433
|
contextWindow: 131072,
|
|
@@ -351,6 +437,7 @@ var BLOCKRUN_MODELS = [
|
|
|
351
437
|
{
|
|
352
438
|
id: "xai/grok-4-1-fast-non-reasoning",
|
|
353
439
|
name: "Grok 4.1 Fast",
|
|
440
|
+
version: "4.1",
|
|
354
441
|
inputPrice: 0.2,
|
|
355
442
|
outputPrice: 0.5,
|
|
356
443
|
contextWindow: 131072,
|
|
@@ -359,6 +446,7 @@ var BLOCKRUN_MODELS = [
|
|
|
359
446
|
{
|
|
360
447
|
id: "xai/grok-code-fast-1",
|
|
361
448
|
name: "Grok Code Fast",
|
|
449
|
+
version: "1",
|
|
362
450
|
inputPrice: 0.2,
|
|
363
451
|
outputPrice: 1.5,
|
|
364
452
|
contextWindow: 131072,
|
|
@@ -369,17 +457,28 @@ var BLOCKRUN_MODELS = [
|
|
|
369
457
|
{
|
|
370
458
|
id: "xai/grok-4-0709",
|
|
371
459
|
name: "Grok 4 (0709)",
|
|
460
|
+
version: "4-0709",
|
|
372
461
|
inputPrice: 0.2,
|
|
373
462
|
outputPrice: 1.5,
|
|
374
463
|
contextWindow: 131072,
|
|
375
464
|
maxOutput: 16384,
|
|
376
465
|
reasoning: true
|
|
377
466
|
},
|
|
378
|
-
|
|
467
|
+
{
|
|
468
|
+
id: "xai/grok-2-vision",
|
|
469
|
+
name: "Grok 2 Vision",
|
|
470
|
+
version: "2",
|
|
471
|
+
inputPrice: 2,
|
|
472
|
+
outputPrice: 10,
|
|
473
|
+
contextWindow: 131072,
|
|
474
|
+
maxOutput: 16384,
|
|
475
|
+
vision: true
|
|
476
|
+
},
|
|
379
477
|
// MiniMax
|
|
380
478
|
{
|
|
381
479
|
id: "minimax/minimax-m2.5",
|
|
382
480
|
name: "MiniMax M2.5",
|
|
481
|
+
version: "m2.5",
|
|
383
482
|
inputPrice: 0.3,
|
|
384
483
|
outputPrice: 1.2,
|
|
385
484
|
contextWindow: 204800,
|
|
@@ -391,6 +490,7 @@ var BLOCKRUN_MODELS = [
|
|
|
391
490
|
{
|
|
392
491
|
id: "nvidia/gpt-oss-120b",
|
|
393
492
|
name: "NVIDIA GPT-OSS 120B",
|
|
493
|
+
version: "120b",
|
|
394
494
|
inputPrice: 0,
|
|
395
495
|
outputPrice: 0,
|
|
396
496
|
contextWindow: 128e3,
|
|
@@ -399,6 +499,7 @@ var BLOCKRUN_MODELS = [
|
|
|
399
499
|
{
|
|
400
500
|
id: "nvidia/kimi-k2.5",
|
|
401
501
|
name: "NVIDIA Kimi K2.5",
|
|
502
|
+
version: "k2.5",
|
|
402
503
|
inputPrice: 0.55,
|
|
403
504
|
outputPrice: 2.5,
|
|
404
505
|
contextWindow: 262144,
|
|
@@ -1681,10 +1782,10 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1681
1782
|
tiers: {
|
|
1682
1783
|
SIMPLE: {
|
|
1683
1784
|
primary: "moonshot/kimi-k2.5",
|
|
1684
|
-
// $0.
|
|
1785
|
+
// $0.60/$3.00 - best quality/price for simple tasks
|
|
1685
1786
|
fallback: [
|
|
1686
|
-
"google/gemini-2.5-flash",
|
|
1687
|
-
// 1M context,
|
|
1787
|
+
"google/gemini-2.5-flash-lite",
|
|
1788
|
+
// 1M context, ultra cheap ($0.10/$0.40)
|
|
1688
1789
|
"nvidia/gpt-oss-120b",
|
|
1689
1790
|
// FREE fallback
|
|
1690
1791
|
"deepseek/deepseek-chat"
|
|
@@ -1694,26 +1795,28 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1694
1795
|
primary: "xai/grok-code-fast-1",
|
|
1695
1796
|
// Code specialist, $0.20/$1.50
|
|
1696
1797
|
fallback: [
|
|
1697
|
-
"google/gemini-2.5-flash",
|
|
1698
|
-
// 1M context,
|
|
1798
|
+
"google/gemini-2.5-flash-lite",
|
|
1799
|
+
// 1M context, ultra cheap ($0.10/$0.40)
|
|
1699
1800
|
"deepseek/deepseek-chat",
|
|
1700
1801
|
"xai/grok-4-1-fast-non-reasoning"
|
|
1701
1802
|
// Upgraded Grok 4.1
|
|
1702
1803
|
]
|
|
1703
1804
|
},
|
|
1704
1805
|
COMPLEX: {
|
|
1705
|
-
primary: "google/gemini-3-pro-preview",
|
|
1706
|
-
//
|
|
1806
|
+
primary: "google/gemini-3.1-pro-preview",
|
|
1807
|
+
// Newest Gemini 3.1 - upgraded from 3.0
|
|
1707
1808
|
fallback: [
|
|
1708
|
-
"google/gemini-2.5-flash",
|
|
1709
|
-
// CRITICAL: 1M context, cheap failsafe
|
|
1809
|
+
"google/gemini-2.5-flash-lite",
|
|
1810
|
+
// CRITICAL: 1M context, ultra-cheap failsafe ($0.10/$0.40)
|
|
1811
|
+
"google/gemini-3-pro-preview",
|
|
1812
|
+
// 3.0 fallback
|
|
1710
1813
|
"google/gemini-2.5-pro",
|
|
1711
1814
|
"deepseek/deepseek-chat",
|
|
1712
1815
|
"xai/grok-4-0709",
|
|
1713
1816
|
"openai/gpt-5.2",
|
|
1714
1817
|
// Newer and cheaper input than gpt-4o
|
|
1715
1818
|
"openai/gpt-4o",
|
|
1716
|
-
"claude-sonnet-4"
|
|
1819
|
+
"anthropic/claude-sonnet-4.6"
|
|
1717
1820
|
]
|
|
1718
1821
|
},
|
|
1719
1822
|
REASONING: {
|
|
@@ -1733,17 +1836,17 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1733
1836
|
SIMPLE: {
|
|
1734
1837
|
primary: "nvidia/gpt-oss-120b",
|
|
1735
1838
|
// FREE! $0.00/$0.00
|
|
1736
|
-
fallback: ["google/gemini-2.5-flash", "deepseek/deepseek-chat"]
|
|
1839
|
+
fallback: ["google/gemini-2.5-flash-lite", "deepseek/deepseek-chat"]
|
|
1737
1840
|
},
|
|
1738
1841
|
MEDIUM: {
|
|
1739
|
-
primary: "google/gemini-2.5-flash",
|
|
1740
|
-
// $0.
|
|
1842
|
+
primary: "google/gemini-2.5-flash-lite",
|
|
1843
|
+
// $0.10/$0.40 - cheapest capable with 1M context
|
|
1741
1844
|
fallback: ["deepseek/deepseek-chat", "nvidia/gpt-oss-120b"]
|
|
1742
1845
|
},
|
|
1743
1846
|
COMPLEX: {
|
|
1744
|
-
primary: "google/gemini-2.5-flash",
|
|
1745
|
-
// $0.
|
|
1746
|
-
fallback: ["deepseek/deepseek-chat", "xai/grok-4-0709"]
|
|
1847
|
+
primary: "google/gemini-2.5-flash-lite",
|
|
1848
|
+
// $0.10/$0.40 - 1M context handles complexity
|
|
1849
|
+
fallback: ["google/gemini-2.5-flash", "deepseek/deepseek-chat", "xai/grok-4-0709"]
|
|
1747
1850
|
},
|
|
1748
1851
|
REASONING: {
|
|
1749
1852
|
primary: "xai/grok-4-1-fast-reasoning",
|
|
@@ -1756,8 +1859,8 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1756
1859
|
premiumTiers: {
|
|
1757
1860
|
SIMPLE: {
|
|
1758
1861
|
primary: "moonshot/kimi-k2.5",
|
|
1759
|
-
// $0.
|
|
1760
|
-
fallback: ["claude-haiku-4.5", "google/gemini-2.5-flash", "xai/grok-code-fast-1"]
|
|
1862
|
+
// $0.60/$3.00 - good for simple coding
|
|
1863
|
+
fallback: ["anthropic/claude-haiku-4.5", "google/gemini-2.5-flash-lite", "xai/grok-code-fast-1"]
|
|
1761
1864
|
},
|
|
1762
1865
|
MEDIUM: {
|
|
1763
1866
|
primary: "openai/gpt-5.2-codex",
|
|
@@ -1766,26 +1869,28 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1766
1869
|
"moonshot/kimi-k2.5",
|
|
1767
1870
|
"google/gemini-2.5-pro",
|
|
1768
1871
|
"xai/grok-4-0709",
|
|
1769
|
-
"claude-sonnet-4"
|
|
1872
|
+
"anthropic/claude-sonnet-4.6"
|
|
1770
1873
|
]
|
|
1771
1874
|
},
|
|
1772
1875
|
COMPLEX: {
|
|
1773
|
-
primary: "claude-opus-4",
|
|
1876
|
+
primary: "anthropic/claude-opus-4.6",
|
|
1774
1877
|
// Best quality for complex tasks
|
|
1775
1878
|
fallback: [
|
|
1776
1879
|
"openai/gpt-5.2-codex",
|
|
1777
|
-
"claude-opus-4",
|
|
1778
|
-
"claude-sonnet-4",
|
|
1880
|
+
"anthropic/claude-opus-4.6",
|
|
1881
|
+
"anthropic/claude-sonnet-4.6",
|
|
1882
|
+
"google/gemini-3.1-pro-preview",
|
|
1883
|
+
// Newest Gemini
|
|
1779
1884
|
"google/gemini-3-pro-preview",
|
|
1780
1885
|
"moonshot/kimi-k2.5"
|
|
1781
1886
|
]
|
|
1782
1887
|
},
|
|
1783
1888
|
REASONING: {
|
|
1784
|
-
primary: "claude-sonnet-4",
|
|
1889
|
+
primary: "anthropic/claude-sonnet-4.6",
|
|
1785
1890
|
// $3/$15 - best for reasoning/instructions
|
|
1786
1891
|
fallback: [
|
|
1787
|
-
"claude-opus-4",
|
|
1788
|
-
"claude-opus-4",
|
|
1892
|
+
"anthropic/claude-opus-4.6",
|
|
1893
|
+
"anthropic/claude-opus-4.6",
|
|
1789
1894
|
"openai/o4-mini",
|
|
1790
1895
|
// Newer and cheaper than o3 ($1.10 vs $2.00)
|
|
1791
1896
|
"openai/o3",
|
|
@@ -1798,39 +1903,29 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
1798
1903
|
SIMPLE: {
|
|
1799
1904
|
primary: "moonshot/kimi-k2.5",
|
|
1800
1905
|
// Cheaper than Haiku ($0.5/$2.4 vs $1/$5), larger context
|
|
1801
|
-
fallback: [
|
|
1802
|
-
"claude-haiku-4.5",
|
|
1803
|
-
"xai/grok-4-1-fast-non-reasoning",
|
|
1804
|
-
"openai/gpt-4o-mini"
|
|
1805
|
-
]
|
|
1906
|
+
fallback: ["anthropic/claude-haiku-4.5", "xai/grok-4-1-fast-non-reasoning", "openai/gpt-4o-mini"]
|
|
1806
1907
|
},
|
|
1807
1908
|
MEDIUM: {
|
|
1808
1909
|
primary: "xai/grok-code-fast-1",
|
|
1809
1910
|
// Code specialist for agentic coding
|
|
1810
|
-
fallback: [
|
|
1811
|
-
"moonshot/kimi-k2.5",
|
|
1812
|
-
"claude-haiku-4.5",
|
|
1813
|
-
"claude-sonnet-4"
|
|
1814
|
-
]
|
|
1911
|
+
fallback: ["moonshot/kimi-k2.5", "anthropic/claude-haiku-4.5", "claude-sonnet-4"]
|
|
1815
1912
|
},
|
|
1816
1913
|
COMPLEX: {
|
|
1817
|
-
primary: "claude-sonnet-4",
|
|
1914
|
+
primary: "anthropic/claude-sonnet-4.6",
|
|
1818
1915
|
fallback: [
|
|
1819
|
-
"claude-opus-4",
|
|
1916
|
+
"anthropic/claude-opus-4.6",
|
|
1820
1917
|
// Latest Opus - best agentic
|
|
1821
1918
|
"openai/gpt-5.2",
|
|
1919
|
+
"google/gemini-3.1-pro-preview",
|
|
1920
|
+
// Newest Gemini
|
|
1822
1921
|
"google/gemini-3-pro-preview",
|
|
1823
1922
|
"xai/grok-4-0709"
|
|
1824
1923
|
]
|
|
1825
1924
|
},
|
|
1826
1925
|
REASONING: {
|
|
1827
|
-
primary: "claude-sonnet-4",
|
|
1926
|
+
primary: "anthropic/claude-sonnet-4.6",
|
|
1828
1927
|
// Strong tool use + reasoning for agentic tasks
|
|
1829
|
-
fallback: [
|
|
1830
|
-
"claude-opus-4",
|
|
1831
|
-
"xai/grok-4-1-fast-reasoning",
|
|
1832
|
-
"deepseek/deepseek-reasoner"
|
|
1833
|
-
]
|
|
1928
|
+
fallback: ["anthropic/claude-opus-4.6", "xai/grok-4-1-fast-reasoning", "deepseek/deepseek-reasoner"]
|
|
1834
1929
|
}
|
|
1835
1930
|
},
|
|
1836
1931
|
overrides: {
|
|
@@ -1934,7 +2029,33 @@ async function logUsage(entry) {
|
|
|
1934
2029
|
}
|
|
1935
2030
|
|
|
1936
2031
|
// src/stats.ts
|
|
1937
|
-
import {
|
|
2032
|
+
import { readdir } from "fs/promises";
|
|
2033
|
+
|
|
2034
|
+
// src/fs-read.ts
|
|
2035
|
+
import { open } from "fs/promises";
|
|
2036
|
+
import { openSync, readSync, closeSync, fstatSync } from "fs";
|
|
2037
|
+
async function readTextFile(filePath) {
|
|
2038
|
+
const fh = await open(filePath, "r");
|
|
2039
|
+
try {
|
|
2040
|
+
const buf = Buffer.alloc((await fh.stat()).size);
|
|
2041
|
+
await fh.read(buf, 0, buf.length, 0);
|
|
2042
|
+
return buf.toString("utf-8");
|
|
2043
|
+
} finally {
|
|
2044
|
+
await fh.close();
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
function readTextFileSync(filePath) {
|
|
2048
|
+
const fd = openSync(filePath, "r");
|
|
2049
|
+
try {
|
|
2050
|
+
const buf = Buffer.alloc(fstatSync(fd).size);
|
|
2051
|
+
readSync(fd, buf);
|
|
2052
|
+
return buf.toString("utf-8");
|
|
2053
|
+
} finally {
|
|
2054
|
+
closeSync(fd);
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2058
|
+
// src/stats.ts
|
|
1938
2059
|
import { join as join3 } from "path";
|
|
1939
2060
|
import { homedir as homedir2 } from "os";
|
|
1940
2061
|
|
|
@@ -1953,7 +2074,7 @@ var USER_AGENT = `clawrouter/${VERSION}`;
|
|
|
1953
2074
|
var LOG_DIR2 = join3(homedir2(), ".openclaw", "blockrun", "logs");
|
|
1954
2075
|
async function parseLogFile(filePath) {
|
|
1955
2076
|
try {
|
|
1956
|
-
const content = await
|
|
2077
|
+
const content = await readTextFile(filePath);
|
|
1957
2078
|
const lines = content.trim().split("\n").filter(Boolean);
|
|
1958
2079
|
return lines.map((line) => {
|
|
1959
2080
|
const entry = JSON.parse(line);
|
|
@@ -5204,7 +5325,7 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
5204
5325
|
}
|
|
5205
5326
|
|
|
5206
5327
|
// src/auth.ts
|
|
5207
|
-
import { writeFile,
|
|
5328
|
+
import { writeFile, mkdir as mkdir2 } from "fs/promises";
|
|
5208
5329
|
import { join as join4 } from "path";
|
|
5209
5330
|
import { homedir as homedir3 } from "os";
|
|
5210
5331
|
import { generatePrivateKey, privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
|
|
@@ -5212,7 +5333,7 @@ var WALLET_DIR = join4(homedir3(), ".openclaw", "blockrun");
|
|
|
5212
5333
|
var WALLET_FILE = join4(WALLET_DIR, "wallet.key");
|
|
5213
5334
|
async function loadSavedWallet() {
|
|
5214
5335
|
try {
|
|
5215
|
-
const key = (await
|
|
5336
|
+
const key = (await readTextFile(WALLET_FILE)).trim();
|
|
5216
5337
|
if (key.startsWith("0x") && key.length === 66) {
|
|
5217
5338
|
console.log(`[ClawRouter] \u2713 Loaded existing wallet from ${WALLET_FILE}`);
|
|
5218
5339
|
return key;
|
|
@@ -5233,7 +5354,7 @@ async function generateAndSaveWallet() {
|
|
|
5233
5354
|
await mkdir2(WALLET_DIR, { recursive: true });
|
|
5234
5355
|
await writeFile(WALLET_FILE, key + "\n", { mode: 384 });
|
|
5235
5356
|
try {
|
|
5236
|
-
const verification = (await
|
|
5357
|
+
const verification = (await readTextFile(WALLET_FILE)).trim();
|
|
5237
5358
|
if (verification !== key) {
|
|
5238
5359
|
throw new Error("Wallet file verification failed - content mismatch");
|
|
5239
5360
|
}
|
|
@@ -5262,7 +5383,6 @@ async function resolveOrGenerateWalletKey() {
|
|
|
5262
5383
|
|
|
5263
5384
|
// src/index.ts
|
|
5264
5385
|
import {
|
|
5265
|
-
readFileSync,
|
|
5266
5386
|
writeFileSync,
|
|
5267
5387
|
existsSync,
|
|
5268
5388
|
readdirSync,
|
|
@@ -5369,7 +5489,7 @@ function injectModelsConfig(logger) {
|
|
|
5369
5489
|
}
|
|
5370
5490
|
if (existsSync(configPath)) {
|
|
5371
5491
|
try {
|
|
5372
|
-
const content =
|
|
5492
|
+
const content = readTextFileSync(configPath).trim();
|
|
5373
5493
|
if (content) {
|
|
5374
5494
|
config = JSON.parse(content);
|
|
5375
5495
|
} else {
|
|
@@ -5561,7 +5681,7 @@ function injectAuthProfile(logger) {
|
|
|
5561
5681
|
};
|
|
5562
5682
|
if (existsSync(authPath)) {
|
|
5563
5683
|
try {
|
|
5564
|
-
const existing = JSON.parse(
|
|
5684
|
+
const existing = JSON.parse(readTextFileSync(authPath));
|
|
5565
5685
|
if (existing.version && existing.profiles) {
|
|
5566
5686
|
store = existing;
|
|
5567
5687
|
}
|
|
@@ -5680,7 +5800,7 @@ async function createWalletCommand() {
|
|
|
5680
5800
|
let address;
|
|
5681
5801
|
try {
|
|
5682
5802
|
if (existsSync(WALLET_FILE)) {
|
|
5683
|
-
walletKey =
|
|
5803
|
+
walletKey = readTextFileSync(WALLET_FILE).trim();
|
|
5684
5804
|
if (walletKey.startsWith("0x") && walletKey.length === 66) {
|
|
5685
5805
|
const account = privateKeyToAccount4(walletKey);
|
|
5686
5806
|
address = account.address;
|