@qadanm/opencode-smart-router 0.0.0-stage → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +286 -0
  2. package/CONTRIBUTING.md +103 -0
  3. package/LICENSE +21 -0
  4. package/README.md +425 -2
  5. package/SECURITY.md +174 -0
  6. package/config.example.json +107 -0
  7. package/dist/npm/index.js +40 -0
  8. package/docs/ARCHITECTURE.md +104 -0
  9. package/docs/DEBUGGING-GUI.md +70 -0
  10. package/docs/INSTALL.md +151 -0
  11. package/docs/LIMITATIONS.md +230 -0
  12. package/docs/MODELS.md +124 -0
  13. package/docs/OPENDESIGN-INTEGRATION.md +635 -0
  14. package/docs/QA.md +142 -0
  15. package/docs/SHARED-CORE.md +114 -0
  16. package/install +75 -0
  17. package/package.json +94 -4
  18. package/scripts/install.sh +324 -0
  19. package/scripts/uninstall.sh +91 -0
  20. package/src/allowance.ts +135 -0
  21. package/src/core/classify/classifier.ts +305 -0
  22. package/src/core/config-writer.ts +167 -0
  23. package/src/core/config.ts +1047 -0
  24. package/src/core/context/strategy.ts +188 -0
  25. package/src/core/context-health.ts +39 -0
  26. package/src/core/failures.ts +398 -0
  27. package/src/core/history/opencode.ts +173 -0
  28. package/src/core/models/protocol.ts +22 -0
  29. package/src/core/models/registry.ts +204 -0
  30. package/src/core/models/seed.ts +781 -0
  31. package/src/core/offline/mode.ts +321 -0
  32. package/src/core/plan-page.ts +390 -0
  33. package/src/core/plans/catalog.ts +487 -0
  34. package/src/core/policy/calibration.ts +259 -0
  35. package/src/core/policy/eligibility.ts +630 -0
  36. package/src/core/providers/enablement.ts +143 -0
  37. package/src/core/providers/opendesign-credits.ts +206 -0
  38. package/src/core/providers/opendesign-models.ts +654 -0
  39. package/src/core/providers/opendesign.ts +474 -0
  40. package/src/core/quota/calibration.ts +166 -0
  41. package/src/core/quota/commandcode.ts +471 -0
  42. package/src/core/quota/credentials.ts +490 -0
  43. package/src/core/quota/ledger.ts +1304 -0
  44. package/src/core/quota/opencode-go.ts +148 -0
  45. package/src/core/quota/opendesign.ts +1043 -0
  46. package/src/core/quota/reconcile.ts +155 -0
  47. package/src/core/quota/report.ts +261 -0
  48. package/src/core/quota/service.ts +273 -0
  49. package/src/core/reprompt.ts +48 -0
  50. package/src/core/routing/engine.ts +978 -0
  51. package/src/core/types.ts +866 -0
  52. package/src/core/ui.ts +236 -0
  53. package/src/core/util.ts +114 -0
  54. package/src/gui/index.tsx +1675 -0
  55. package/src/gui/viewmodel.ts +456 -0
  56. package/src/index.ts +33 -0
  57. package/src/rpc.ts +204 -0
  58. package/src/server/containment.ts +131 -0
  59. package/src/server/controller.ts +3405 -0
  60. package/src/server/route-tracker.ts +60 -0
  61. package/src/server/shared-core.ts +701 -0
  62. package/src/tui/index.tsx +168 -0
@@ -0,0 +1,781 @@
1
+ import type { CostTier, ModelRecord, PeakPricing } from "../types.js"
2
+ import { OPENDESIGN_MODELS } from "../providers/opendesign-models.js"
3
+ import { OPENDESIGN_DESIGN_PLAN_MODELS, modelMonthlyAllowanceUsd, resolvePlan } from "../plans/catalog.js"
4
+
5
+ export interface SeedModel {
6
+ key: string
7
+ providerID: string
8
+ modelID: string
9
+ name: string
10
+ context: number
11
+ maxOutput: number
12
+ input: string[]
13
+ tools?: boolean
14
+ cost: CostTier[]
15
+ peakPricing?: PeakPricing
16
+ intelligence: number
17
+ design: number
18
+ designEvidence?: ModelRecord["designEvidence"]
19
+ /** Credit multiplier applied to usage value. One for plain USD billing. */
20
+ creditMultiplier?: number
21
+ /** True when the model is funded from a pool reserved for escalation. */
22
+ escalationOnly?: boolean
23
+ premium?: boolean
24
+ /** Per-kind capability evidence, passed through with provenance intact. */
25
+ capabilities?: ModelRecord["capabilities"]
26
+ training?: boolean
27
+ free?: boolean
28
+ tier: 1 | 2 | 3
29
+ approved?: boolean
30
+ monthlyAllowanceUsd: number
31
+ protocol?: "anthropic" | "openai-compat"
32
+ notes?: string
33
+ }
34
+
35
+ const cost = (input: number, output: number, read: number, write = 0): CostTier[] => [
36
+ { input, output, cache: { read, write } },
37
+ ]
38
+
39
+ const tieredCost = (
40
+ base: CostTier,
41
+ size: number,
42
+ high: { input: number; output: number; read: number; write: number },
43
+ ): CostTier[] => [
44
+ base,
45
+ {
46
+ input: high.input,
47
+ output: high.output,
48
+ cache: { read: high.read, write: high.write },
49
+ tier: { type: "context", size },
50
+ },
51
+ ]
52
+
53
+ /**
54
+ * Command Code documents these DeepSeek models at off-peak rates and charges
55
+ * 2x from 01:00-04:00 and 06:00-10:00 UTC, Monday-Friday.
56
+ *
57
+ * OpenCode Go publishes the identical peak schedule for DeepSeek V4.1 Flash
58
+ * and V4 Pro, so the same shape is reused rather than duplicated.
59
+ */
60
+ const DEEPSEEK_PEAK_PRICING: PeakPricing = {
61
+ multiplier: 2,
62
+ windowsUtc: [
63
+ { startHour: 1, endHour: 4 },
64
+ { startHour: 6, endHour: 10 },
65
+ ],
66
+ weekdaysOnly: true,
67
+ }
68
+
69
+ const COMMAND_CODE_DEEPSEEK_PEAK = DEEPSEEK_PEAK_PRICING
70
+
71
+ /**
72
+ * Curated seed. Intelligence values come from Command Code's published model
73
+ * cards where available. Models that are new or unscored are deliberately not
74
+ * approved for automatic substantive work.
75
+ *
76
+ * Design scores are curated quality estimates, not benchmark results. They are
77
+ * separate from intelligence and are documented in docs/MODELS.md.
78
+ */
79
+ const BASE_SEED_MODELS: ReadonlyArray<SeedModel> = [
80
+ // ---------------------------------------------------------------------------
81
+ // OpenCode Go: economy
82
+ // ---------------------------------------------------------------------------
83
+ {
84
+ key: "opencode-go/gpt-6-luna",
85
+ providerID: "opencode-go",
86
+ modelID: "gpt-6-luna",
87
+ name: "GPT-6 Luna",
88
+ context: 1_050_000,
89
+ maxOutput: 128_000,
90
+ input: ["text", "image", "pdf"],
91
+ cost: tieredCost(cost(0.1, 0.5, 0.01, 0.125)[0]!, 272_000, { input: 0.2, output: 0.75, read: 0.02, write: 0.25 }),
92
+ intelligence: 38.1,
93
+ design: 55,
94
+ designEvidence: "curated",
95
+ tier: 1,
96
+ monthlyAllowanceUsd: 60,
97
+ notes: "Economy tier. Reliable for narrow mechanical edits, below the standard intelligence floor.",
98
+ },
99
+ {
100
+ key: "opencode-go/mimo-v2.6-flash",
101
+ providerID: "opencode-go",
102
+ modelID: "mimo-v2.6-flash",
103
+ name: "MiMo-V2.6-Flash",
104
+ context: 1_048_576,
105
+ maxOutput: 131_072,
106
+ input: ["text", "image", "audio", "video"],
107
+ cost: cost(0.14, 0.28, 0.0028),
108
+ intelligence: 37.9,
109
+ design: 50,
110
+ designEvidence: "curated",
111
+ tier: 1,
112
+ monthlyAllowanceUsd: 120,
113
+ notes: "Cheap multimodal model. Economy tier only.",
114
+ },
115
+ {
116
+ key: "opencode-go/hy3",
117
+ providerID: "opencode-go",
118
+ modelID: "hy3",
119
+ name: "Hy3",
120
+ context: 256_000,
121
+ maxOutput: 128_000,
122
+ input: ["text"],
123
+ cost: cost(0.14, 0.58, 0.035),
124
+ intelligence: 25.3,
125
+ design: 45,
126
+ designEvidence: "curated",
127
+ tier: 1,
128
+ monthlyAllowanceUsd: 240,
129
+ notes: "Economy tier. Text only. Narrow mechanical work.",
130
+ },
131
+ {
132
+ key: "opencode-go/longcat-2.0",
133
+ providerID: "opencode-go",
134
+ modelID: "longcat-2.0",
135
+ name: "LongCat-2.0",
136
+ context: 1_000_000,
137
+ maxOutput: 131_072,
138
+ input: ["text"],
139
+ cost: cost(0.3, 1.2, 0.006),
140
+ intelligence: 19.1,
141
+ design: 40,
142
+ designEvidence: "curated",
143
+ tier: 1,
144
+ monthlyAllowanceUsd: 240,
145
+ notes: "Economy tier. Very low intelligence; use only with deterministic validation.",
146
+ },
147
+
148
+ // ---------------------------------------------------------------------------
149
+ // OpenCode Go: standard
150
+ // ---------------------------------------------------------------------------
151
+ {
152
+ key: "opencode-go/deepseek-v4.1-flash",
153
+ providerID: "opencode-go",
154
+ modelID: "deepseek-v4.1-flash",
155
+ name: "DeepSeek V4.1 Flash",
156
+ context: 1_000_000,
157
+ maxOutput: 384_000,
158
+ input: ["text", "image"],
159
+ cost: cost(0.15, 0.6, 0.003),
160
+ peakPricing: DEEPSEEK_PEAK_PRICING,
161
+ intelligence: 39.5,
162
+ design: 65,
163
+ designEvidence: "observed",
164
+ tier: 2,
165
+ monthlyAllowanceUsd: 80,
166
+ notes:
167
+ "Approved standard floor. Strong general coding value and native image input. Off-peak list price; 2x during 01-04 and 06-10 UTC Mon-Fri.",
168
+ },
169
+ {
170
+ key: "opencode-go/glm-5.3-flash",
171
+ providerID: "opencode-go",
172
+ modelID: "glm-5.3-flash",
173
+ name: "GLM-5.3-Flash",
174
+ context: 1_000_000,
175
+ maxOutput: 131_072,
176
+ input: ["text", "image", "video"],
177
+ cost: cost(0.15, 0.5, 0.03),
178
+ intelligence: 41.8,
179
+ design: 65,
180
+ designEvidence: "curated",
181
+ tier: 2,
182
+ monthlyAllowanceUsd: 60,
183
+ },
184
+ {
185
+ key: "opencode-go/minimax-m3.1-flash",
186
+ providerID: "opencode-go",
187
+ modelID: "minimax-m3.1-flash",
188
+ name: "MiniMax M3.1 Flash",
189
+ context: 1_000_000,
190
+ maxOutput: 512_000,
191
+ input: ["text", "image", "video"],
192
+ cost: cost(0.15, 0.6, 0.015),
193
+ intelligence: 42.7,
194
+ design: 60,
195
+ designEvidence: "curated",
196
+ tier: 2,
197
+ monthlyAllowanceUsd: 20,
198
+ },
199
+ {
200
+ key: "opencode-go/claude-haiku-5-5",
201
+ providerID: "opencode-go",
202
+ modelID: "claude-haiku-5-5",
203
+ name: "Claude Haiku 5.5",
204
+ context: 1_000_000,
205
+ maxOutput: 128_000,
206
+ input: ["text", "image", "pdf"],
207
+ cost: tieredCost(cost(0.1, 0.5, 0.01, 0.125)[0]!, 100_000, { input: 0.5, output: 2.5, read: 0.05, write: 0.625 }),
208
+ intelligence: 43.4,
209
+ design: 70,
210
+ designEvidence: "curated",
211
+ tier: 2,
212
+ monthlyAllowanceUsd: 15,
213
+ },
214
+ {
215
+ key: "opencode-go/mimo-v2.6-pro",
216
+ providerID: "opencode-go",
217
+ modelID: "mimo-v2.6-pro",
218
+ name: "MiMo-V2.6-Pro",
219
+ context: 1_048_576,
220
+ maxOutput: 131_072,
221
+ input: ["text", "image", "audio", "video"],
222
+ cost: cost(0.435, 0.87, 0.003625),
223
+ intelligence: 46.3,
224
+ design: 62,
225
+ designEvidence: "curated",
226
+ tier: 2,
227
+ monthlyAllowanceUsd: 15,
228
+ notes: "High intelligence for its price. Narrow monthly allowance.",
229
+ },
230
+
231
+ // ---------------------------------------------------------------------------
232
+ // OpenCode Go: premium
233
+ // ---------------------------------------------------------------------------
234
+ {
235
+ key: "opencode-go/glm-5.3",
236
+ providerID: "opencode-go",
237
+ modelID: "glm-5.3",
238
+ name: "GLM-5.3",
239
+ context: 1_000_000,
240
+ maxOutput: 131_072,
241
+ input: ["text"],
242
+ cost: cost(1.4, 4.4, 0.26),
243
+ intelligence: 44.8,
244
+ design: 80,
245
+ designEvidence: "curated",
246
+ premium: true,
247
+ tier: 3,
248
+ monthlyAllowanceUsd: 15,
249
+ notes: "Premium. Text only, so it can never receive screenshots.",
250
+ },
251
+ {
252
+ key: "opencode-go/kimi-k3",
253
+ providerID: "opencode-go",
254
+ modelID: "kimi-k3",
255
+ name: "Kimi K3",
256
+ context: 1_048_576,
257
+ maxOutput: 131_072,
258
+ input: ["text", "image", "video"],
259
+ cost: cost(3, 15, 0.3, 3),
260
+ intelligence: 43.6,
261
+ design: 72,
262
+ designEvidence: "curated",
263
+ premium: true,
264
+ tier: 3,
265
+ monthlyAllowanceUsd: 15,
266
+ },
267
+ {
268
+ key: "opencode-go/grok-4.7",
269
+ providerID: "opencode-go",
270
+ modelID: "grok-4.7",
271
+ name: "Grok 4.7",
272
+ context: 500_000,
273
+ maxOutput: 500_000,
274
+ input: ["text", "image", "pdf"],
275
+ cost: tieredCost(cost(2, 6, 0.5)[0]!, 200_000, { input: 4, output: 12, read: 1, write: 0 }),
276
+ intelligence: 46.4,
277
+ design: 75,
278
+ designEvidence: "curated",
279
+ premium: true,
280
+ tier: 3,
281
+ monthlyAllowanceUsd: 15,
282
+ },
283
+ {
284
+ key: "opencode-go/qwen3.8-max",
285
+ providerID: "opencode-go",
286
+ modelID: "qwen3.8-max",
287
+ name: "Qwen3.8 Max",
288
+ context: 1_000_000,
289
+ maxOutput: 131_072,
290
+ input: ["text", "image", "video"],
291
+ cost: cost(2, 6, 0.25, 2.5),
292
+ intelligence: 40.2,
293
+ design: 70,
294
+ designEvidence: "curated",
295
+ premium: true,
296
+ tier: 3,
297
+ monthlyAllowanceUsd: 15,
298
+ },
299
+ {
300
+ key: "opencode-go/step-5-preview",
301
+ providerID: "opencode-go",
302
+ modelID: "step-5-preview",
303
+ name: "Step 5 Preview",
304
+ context: 1_000_000,
305
+ maxOutput: 65_536,
306
+ input: ["text", "image", "video"],
307
+ cost: cost(1, 2.7, 0.1),
308
+ intelligence: 43.7,
309
+ design: 70,
310
+ designEvidence: "curated",
311
+ premium: true,
312
+ tier: 3,
313
+ monthlyAllowanceUsd: 15,
314
+ },
315
+
316
+ // ---------------------------------------------------------------------------
317
+ // Command Code GOAT: standard
318
+ // ---------------------------------------------------------------------------
319
+ {
320
+ key: "commandcode/deepseek/deepseek-v4.1-flash",
321
+ providerID: "commandcode",
322
+ modelID: "deepseek/deepseek-v4.1-flash",
323
+ name: "DeepSeek V4.1 Flash (GOAT)",
324
+ context: 1_000_000,
325
+ maxOutput: 384_000,
326
+ input: ["text", "image"],
327
+ cost: cost(0.15, 0.6, 0.003),
328
+ peakPricing: COMMAND_CODE_DEEPSEEK_PEAK,
329
+ intelligence: 39.5,
330
+ design: 65,
331
+ designEvidence: "observed",
332
+ tier: 2,
333
+ monthlyAllowanceUsd: 80,
334
+ notes: "Approved standard floor on Command Code. Off-peak list price; 2x during 01-04 and 06-10 UTC Mon-Fri.",
335
+ },
336
+ {
337
+ key: "commandcode/z-ai/glm-5.3-flash",
338
+ providerID: "commandcode",
339
+ modelID: "z-ai/glm-5.3-flash",
340
+ name: "GLM-5.3-Flash",
341
+ context: 1_000_000,
342
+ maxOutput: 131_072,
343
+ input: ["text", "image", "video", "pdf"],
344
+ cost: cost(0.15, 0.5, 0.03),
345
+ intelligence: 41.8,
346
+ design: 65,
347
+ designEvidence: "curated",
348
+ tier: 2,
349
+ monthlyAllowanceUsd: 80,
350
+ },
351
+ {
352
+ key: "commandcode/claude-haiku-5-5",
353
+ providerID: "commandcode",
354
+ modelID: "claude-haiku-5-5",
355
+ name: "Claude Haiku 5.5",
356
+ context: 1_000_000,
357
+ maxOutput: 128_000,
358
+ input: ["text", "image", "pdf"],
359
+ cost: tieredCost(cost(0.1, 0.5, 0.01, 0.125)[0]!, 100_000, { input: 0.5, output: 2.5, read: 0.05, write: 0.625 }),
360
+ intelligence: 43.4,
361
+ design: 70,
362
+ designEvidence: "curated",
363
+ tier: 2,
364
+ monthlyAllowanceUsd: 20,
365
+ },
366
+ {
367
+ key: "commandcode/gpt-6-luna",
368
+ providerID: "commandcode",
369
+ modelID: "gpt-6-luna",
370
+ name: "GPT-6 Luna",
371
+ context: 1_050_000,
372
+ maxOutput: 128_000,
373
+ input: ["text", "image", "pdf"],
374
+ cost: tieredCost(cost(0.1, 0.5, 0.01, 0.125)[0]!, 272_000, { input: 0.2, output: 0.75, read: 0.02, write: 0.25 }),
375
+ intelligence: 38.1,
376
+ design: 55,
377
+ designEvidence: "curated",
378
+ tier: 1,
379
+ monthlyAllowanceUsd: 20,
380
+ },
381
+
382
+ // ---------------------------------------------------------------------------
383
+ // Command Code GOAT: premium
384
+ // ---------------------------------------------------------------------------
385
+ {
386
+ key: "commandcode/claude-sonnet-5-5",
387
+ providerID: "commandcode",
388
+ modelID: "claude-sonnet-5-5",
389
+ name: "Claude Sonnet 5.5",
390
+ context: 1_000_000,
391
+ maxOutput: 128_000,
392
+ input: ["text", "image", "pdf"],
393
+ cost: cost(2, 10, 0.1, 2.5),
394
+ intelligence: 56,
395
+ design: 90,
396
+ designEvidence: "curated",
397
+ premium: true,
398
+ tier: 3,
399
+ monthlyAllowanceUsd: 10,
400
+ notes: "Premium design and architecture candidate. Very small monthly allowance.",
401
+ },
402
+ {
403
+ key: "commandcode/meta/muse-spark-1.3",
404
+ providerID: "commandcode",
405
+ modelID: "meta/muse-spark-1.3",
406
+ name: "Muse Spark 1.3",
407
+ context: 1_048_576,
408
+ maxOutput: 131_072,
409
+ input: ["text", "image", "video", "pdf", "audio"],
410
+ cost: cost(1.25, 4.25, 0.15),
411
+ intelligence: 48.1,
412
+ design: 82,
413
+ designEvidence: "curated",
414
+ premium: true,
415
+ tier: 3,
416
+ monthlyAllowanceUsd: 20,
417
+ },
418
+ {
419
+ key: "commandcode/google/gemini-4-argon",
420
+ providerID: "commandcode",
421
+ modelID: "google/gemini-4-argon",
422
+ name: "Gemini 4 Argon",
423
+ context: 1_000_000,
424
+ maxOutput: 65_536,
425
+ input: ["text", "image", "video", "audio", "pdf"],
426
+ cost: cost(2, 10, 0.1),
427
+ intelligence: 0,
428
+ design: 85,
429
+ designEvidence: "unverified",
430
+ premium: true,
431
+ tier: 3,
432
+ approved: false,
433
+ monthlyAllowanceUsd: 40,
434
+ notes: "Unscored in the current model cards. Excluded from automatic routing until qualified.",
435
+ },
436
+ {
437
+ key: "commandcode/xai/grok-4.7",
438
+ providerID: "commandcode",
439
+ modelID: "xai/grok-4.7",
440
+ name: "Grok 4.7",
441
+ context: 500_000,
442
+ maxOutput: 500_000,
443
+ input: ["text", "image", "pdf"],
444
+ cost: tieredCost(cost(2, 6, 0.5)[0]!, 200_000, { input: 4, output: 12, read: 1, write: 0 }),
445
+ intelligence: 46.4,
446
+ design: 75,
447
+ designEvidence: "curated",
448
+ premium: true,
449
+ tier: 3,
450
+ monthlyAllowanceUsd: 20,
451
+ },
452
+ {
453
+ key: "commandcode/Qwen/Qwen3.8-Max",
454
+ providerID: "commandcode",
455
+ modelID: "Qwen/Qwen3.8-Max",
456
+ name: "Qwen3.8 Max",
457
+ context: 1_000_000,
458
+ maxOutput: 131_072,
459
+ input: ["text", "image", "video", "pdf"],
460
+ cost: cost(2, 6, 0.25, 2.5),
461
+ intelligence: 40.2,
462
+ design: 70,
463
+ designEvidence: "curated",
464
+ premium: true,
465
+ tier: 3,
466
+ monthlyAllowanceUsd: 20,
467
+ },
468
+ {
469
+ key: "commandcode/stepfun/Step-5-Preview",
470
+ providerID: "commandcode",
471
+ modelID: "stepfun/Step-5-Preview",
472
+ name: "Step 5 Preview",
473
+ context: 1_000_000,
474
+ maxOutput: 1_000_000,
475
+ input: ["text", "image", "video"],
476
+ cost: cost(1, 2.7, 0.05),
477
+ intelligence: 43.7,
478
+ design: 70,
479
+ designEvidence: "curated",
480
+ premium: true,
481
+ tier: 3,
482
+ monthlyAllowanceUsd: 20,
483
+ },
484
+
485
+ // ---------------------------------------------------------------------------
486
+ // Known but deliberately unapproved models. They are discovered so the user
487
+ // can qualify them explicitly, but automatic routing never selects them.
488
+ // ---------------------------------------------------------------------------
489
+ {
490
+ key: "commandcode/claude-opus-5-5",
491
+ providerID: "commandcode",
492
+ modelID: "claude-opus-5-5",
493
+ name: "Claude Opus 5.5",
494
+ context: 1_000_000,
495
+ maxOutput: 128_000,
496
+ input: ["text", "image", "pdf"],
497
+ cost: cost(4, 20, 0.2, 5),
498
+ intelligence: 0,
499
+ design: 92,
500
+ designEvidence: "unverified",
501
+ premium: true,
502
+ tier: 3,
503
+ approved: false,
504
+ monthlyAllowanceUsd: 10,
505
+ notes: "Unscored in the current model cards. Explicit approval required.",
506
+ },
507
+ {
508
+ key: "commandcode/gpt-6.1-sol",
509
+ providerID: "commandcode",
510
+ modelID: "gpt-6.1-sol",
511
+ name: "GPT-6.1 Sol",
512
+ context: 1_050_000,
513
+ maxOutput: 128_000,
514
+ input: ["text", "image", "pdf"],
515
+ cost: tieredCost(cost(2, 10, 0.1, 2.5)[0]!, 272_000, { input: 4, output: 15, read: 0.2, write: 5 }),
516
+ intelligence: 55,
517
+ design: 88,
518
+ designEvidence: "unverified",
519
+ capabilities: { coding: 56, debugging: 65, agentic: 41, architecture: 86 },
520
+ premium: true,
521
+ tier: 3,
522
+ approved: true,
523
+ monthlyAllowanceUsd: 20,
524
+ notes:
525
+ "Intelligence 55 on Artificial Analysis v5.0.1 (2026-11-06). Capabilities: Terminal-Bench 4.0 56 percent, AutomationBench 65 percent, FrontierCode 2.0 41 percent, same index and configuration. Long-context tier doubles input to 4 and raises output to 15 above 272K. Auto-approved for tier-3 escalation by owner instruction 2026-11-06; the Command Code gateway advertises 1.05M but that window is unverified, so treat it as pending a passed probe.",
526
+ },
527
+ {
528
+ key: "commandcode/gpt-6-astra",
529
+ providerID: "commandcode",
530
+ modelID: "gpt-6-astra",
531
+ name: "GPT-6 Astra",
532
+ context: 1_050_000,
533
+ maxOutput: 128_000,
534
+ input: ["text", "image", "pdf"],
535
+ cost: tieredCost(cost(10, 50, 1, 12.5)[0]!, 272_000, { input: 20, output: 75, read: 2, write: 25 }),
536
+ intelligence: 0,
537
+ design: 88,
538
+ designEvidence: "unverified",
539
+ premium: true,
540
+ tier: 3,
541
+ approved: false,
542
+ monthlyAllowanceUsd: 10,
543
+ notes: "Frontier-priced model. Never selected automatically without explicit approval.",
544
+ },
545
+ {
546
+ key: "commandcode/claude-fable-5-1",
547
+ providerID: "commandcode",
548
+ modelID: "claude-fable-5-1",
549
+ name: "Claude Fable 5.1",
550
+ context: 1_000_000,
551
+ maxOutput: 128_000,
552
+ input: ["text", "image", "pdf"],
553
+ cost: cost(10, 50, 0.25, 12.5),
554
+ intelligence: 0,
555
+ design: 90,
556
+ designEvidence: "unverified",
557
+ premium: true,
558
+ tier: 3,
559
+ approved: false,
560
+ monthlyAllowanceUsd: 10,
561
+ notes: "Frontier-priced model. Never selected automatically without explicit approval.",
562
+ },
563
+ {
564
+ key: "opencode-go/gemini-4-argon",
565
+ providerID: "opencode-go",
566
+ modelID: "gemini-4-argon",
567
+ name: "Gemini 4 Argon",
568
+ context: 1_048_576,
569
+ maxOutput: 65_536,
570
+ input: ["text", "image", "video", "audio", "pdf"],
571
+ cost: cost(2, 10, 0.1),
572
+ intelligence: 0,
573
+ design: 85,
574
+ designEvidence: "unverified",
575
+ premium: true,
576
+ tier: 3,
577
+ approved: false,
578
+ monthlyAllowanceUsd: 120,
579
+ notes: "Unscored in the current model cards. Explicit approval required.",
580
+ },
581
+ {
582
+ key: "opencode-go/kimi-k3.1-pro",
583
+ providerID: "opencode-go",
584
+ modelID: "kimi-k3.1-pro",
585
+ name: "Kimi K3.1 Pro",
586
+ context: 1_048_576,
587
+ maxOutput: 131_072,
588
+ input: ["text", "image", "video"],
589
+ cost: cost(2, 10, 0.2, 2),
590
+ intelligence: 0,
591
+ design: 75,
592
+ designEvidence: "unverified",
593
+ premium: true,
594
+ tier: 3,
595
+ approved: false,
596
+ monthlyAllowanceUsd: 60,
597
+ notes: "Unscored in the current model cards. Explicit approval required.",
598
+ },
599
+ {
600
+ key: "commandcode/meta/muse-spark-1.3-contributor",
601
+ providerID: "commandcode",
602
+ modelID: "meta/muse-spark-1.3-contributor",
603
+ name: "Muse Spark 1.3 (Contributor)",
604
+ context: 1_048_576,
605
+ maxOutput: 131_072,
606
+ input: ["text", "image", "video", "pdf", "audio"],
607
+ cost: cost(0.1, 0.2, 0.002),
608
+ intelligence: 0,
609
+ design: 80,
610
+ designEvidence: "unverified",
611
+ training: true,
612
+ tier: 1,
613
+ approved: false,
614
+ monthlyAllowanceUsd: 20,
615
+ notes: "Training-enabled contributor tier. Blocked unless privacy.allowTrainingModels is true.",
616
+ },
617
+ {
618
+ key: "opencode-go/muse-spark-1.3-contributor",
619
+ providerID: "opencode-go",
620
+ modelID: "muse-spark-1.3-contributor",
621
+ name: "Muse Spark 1.3 Contributor",
622
+ context: 1_048_576,
623
+ maxOutput: 131_072,
624
+ input: ["text", "image", "video", "pdf", "audio"],
625
+ cost: cost(0.1, 0.2, 0.002),
626
+ intelligence: 0,
627
+ design: 80,
628
+ designEvidence: "unverified",
629
+ training: true,
630
+ tier: 1,
631
+ approved: false,
632
+ monthlyAllowanceUsd: 120,
633
+ notes: "Training-enabled contributor tier. Blocked unless privacy.allowTrainingModels is true.",
634
+ },
635
+ {
636
+ key: "opencode-go/iceman-contributor-free",
637
+ providerID: "opencode-go",
638
+ modelID: "iceman-contributor-free",
639
+ name: "Iceman Contributor Free",
640
+ context: 262_144,
641
+ maxOutput: 131_072,
642
+ input: ["text"],
643
+ cost: cost(0, 0, 0),
644
+ intelligence: 0,
645
+ design: 0,
646
+ designEvidence: "unverified",
647
+ training: true,
648
+ free: true,
649
+ tier: 1,
650
+ approved: false,
651
+ monthlyAllowanceUsd: 0,
652
+ notes: "Free model that trains on data. Blocked by default.",
653
+ },
654
+ {
655
+ key: "opencode-go/beam-free",
656
+ providerID: "opencode-go",
657
+ modelID: "beam-free",
658
+ name: "Beam Free",
659
+ context: 1_048_576,
660
+ maxOutput: 131_072,
661
+ input: ["text"],
662
+ cost: cost(0, 0, 0),
663
+ intelligence: 0,
664
+ design: 0,
665
+ designEvidence: "unverified",
666
+ free: true,
667
+ tier: 1,
668
+ approved: false,
669
+ monthlyAllowanceUsd: 0,
670
+ notes: "Free promotional model. Not approved for automatic work.",
671
+ },
672
+ {
673
+ key: "opencode-go/deepseek-v4-pro",
674
+ providerID: "opencode-go",
675
+ modelID: "deepseek-v4-pro",
676
+ name: "DeepSeek V4 Pro",
677
+ context: 1_000_000,
678
+ maxOutput: 384_000,
679
+ input: ["text"],
680
+ cost: cost(0.66, 1.98, 0.022),
681
+ intelligence: 36,
682
+ design: 55,
683
+ designEvidence: "curated",
684
+ tier: 2,
685
+ approved: false,
686
+ monthlyAllowanceUsd: 60,
687
+ notes: "Below the current standard floor and text only. Not approved automatically.",
688
+ },
689
+ ]
690
+
691
+ /**
692
+ * OpenDesign: the models served by the OpenDesign gateway.
693
+ *
694
+ * These entries are generated from the provider catalog so the published
695
+ * credit multipliers live in exactly one place. The gateway's `GET /v1/models`
696
+ * response is authoritative for entitlement and for the usable context window,
697
+ * and the discovery adapter merges it over these values at runtime.
698
+ *
699
+ * Which funding pool a model draws from is decided by the plan catalog. A
700
+ * Design Plan model carries its multiplier; a plan model does not, because
701
+ * the multiplier does not follow it into the plan model pool.
702
+ */
703
+ const OPENDESIGN_SEED_MODELS: ReadonlyArray<SeedModel> = OPENDESIGN_MODELS.map((model) => ({
704
+ key: `opendesign/${model.modelID}`,
705
+ providerID: "opendesign",
706
+ modelID: model.modelID,
707
+ name: model.name,
708
+ context: model.context,
709
+ maxOutput: model.maxOutput,
710
+ input: [...model.input],
711
+ tools: true,
712
+ cost: model.cost.map((tier) => ({ ...tier, cache: { ...tier.cache } })),
713
+ // The multiplier only applies to the Design Plan pool. A plan model is
714
+ // billed at plain usage value from the separate plan model pool, so it
715
+ // must not carry a Design Plan multiplier into cost estimation.
716
+ ...(OPENDESIGN_DESIGN_PLAN_MODELS.has(model.modelID) ? { creditMultiplier: model.creditMultiplier } : {}),
717
+ escalationOnly: !OPENDESIGN_DESIGN_PLAN_MODELS.has(model.modelID),
718
+ intelligence: model.intelligence,
719
+ design: model.design,
720
+ designEvidence: model.designEvidence,
721
+ // Per-kind benchmark evidence passes through with its provenance intact.
722
+ ...(model.capabilities ? { capabilities: { ...model.capabilities } } : {}),
723
+ tier: model.tier,
724
+ approved: model.approved,
725
+ // Plan models (Sonnet, Sol, Opus, Astra) are premium: they draw from the
726
+ // plan-model pool, which premium policy and its budget govern. Design Plan
727
+ // models are ordinary allowance, never premium.
728
+ premium: !OPENDESIGN_DESIGN_PLAN_MODELS.has(model.modelID),
729
+ // Every OpenDesign allowance is a shared provider-level pool, so no model
730
+ // carries its own monthly allowance.
731
+ monthlyAllowanceUsd: 0,
732
+ notes: model.notes,
733
+ }))
734
+
735
+ /**
736
+ * Local models served by Ollama.
737
+ *
738
+ * These are deliberately *not* approved for automatic online routing. A 4B
739
+ * local model scoring in the high 30s would be competitive with the hosted
740
+ * standard floor on paper, and the router would happily send real work to it,
741
+ * which is not what the owner wants when connected. Offline mode reaches them
742
+ * through the offline allow-list instead, where the choice is explicit.
743
+ *
744
+ * Cost is zero and there is no allowance, because inference runs on hardware
745
+ * the owner already paid for. `free: true` would route them through the
746
+ * privacy guard for promotional models, which is the wrong concept, so it is
747
+ * left unset.
748
+ */
749
+ const LOCAL_SEED_MODELS: ReadonlyArray<SeedModel> = [
750
+ {
751
+ key: "ollama/qwen3.5:4b-q4_K_M",
752
+ providerID: "ollama",
753
+ modelID: "qwen3.5:4b-q4_K_M",
754
+ name: "Qwen3.5 4B (local)",
755
+ // Matches offline.model.contextTokens. A larger declared window would let
756
+ // the router believe it can take a transcript the server is configured to
757
+ // truncate.
758
+ context: 8_192,
759
+ maxOutput: 2_048,
760
+ input: ["text", "image"],
761
+ tools: true,
762
+ cost: [{ input: 0, output: 0, cache: { read: 0, write: 0 } }],
763
+ // Scored below the hosted standard floor on purpose: these numbers describe
764
+ // real capability, and reporting them low keeps the model out of any online
765
+ // automatic decision even if someone approves it later.
766
+ intelligence: 30,
767
+ design: 40,
768
+ designEvidence: "unverified",
769
+ tier: 1,
770
+ approved: false,
771
+ monthlyAllowanceUsd: 0,
772
+ notes:
773
+ "Local Ollama model for offline development. Vision and tool calling. Not for online routing: the intelligence and design scores are deliberately below the hosted floor because a 4B model should not silently replace a hosted standard model when the network is available.",
774
+ },
775
+ ]
776
+
777
+ export const SEED_MODELS: ReadonlyArray<SeedModel> = [
778
+ ...BASE_SEED_MODELS,
779
+ ...OPENDESIGN_SEED_MODELS,
780
+ ...LOCAL_SEED_MODELS,
781
+ ]