@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.
- package/CHANGELOG.md +286 -0
- package/CONTRIBUTING.md +103 -0
- package/LICENSE +21 -0
- package/README.md +425 -2
- package/SECURITY.md +174 -0
- package/config.example.json +107 -0
- package/dist/npm/index.js +40 -0
- package/docs/ARCHITECTURE.md +104 -0
- package/docs/DEBUGGING-GUI.md +70 -0
- package/docs/INSTALL.md +151 -0
- package/docs/LIMITATIONS.md +230 -0
- package/docs/MODELS.md +124 -0
- package/docs/OPENDESIGN-INTEGRATION.md +635 -0
- package/docs/QA.md +142 -0
- package/docs/SHARED-CORE.md +114 -0
- package/install +75 -0
- package/package.json +94 -4
- package/scripts/install.sh +324 -0
- package/scripts/uninstall.sh +91 -0
- package/src/allowance.ts +135 -0
- package/src/core/classify/classifier.ts +305 -0
- package/src/core/config-writer.ts +167 -0
- package/src/core/config.ts +1047 -0
- package/src/core/context/strategy.ts +188 -0
- package/src/core/context-health.ts +39 -0
- package/src/core/failures.ts +398 -0
- package/src/core/history/opencode.ts +173 -0
- package/src/core/models/protocol.ts +22 -0
- package/src/core/models/registry.ts +204 -0
- package/src/core/models/seed.ts +781 -0
- package/src/core/offline/mode.ts +321 -0
- package/src/core/plan-page.ts +390 -0
- package/src/core/plans/catalog.ts +487 -0
- package/src/core/policy/calibration.ts +259 -0
- package/src/core/policy/eligibility.ts +630 -0
- package/src/core/providers/enablement.ts +143 -0
- package/src/core/providers/opendesign-credits.ts +206 -0
- package/src/core/providers/opendesign-models.ts +654 -0
- package/src/core/providers/opendesign.ts +474 -0
- package/src/core/quota/calibration.ts +166 -0
- package/src/core/quota/commandcode.ts +471 -0
- package/src/core/quota/credentials.ts +490 -0
- package/src/core/quota/ledger.ts +1304 -0
- package/src/core/quota/opencode-go.ts +148 -0
- package/src/core/quota/opendesign.ts +1043 -0
- package/src/core/quota/reconcile.ts +155 -0
- package/src/core/quota/report.ts +261 -0
- package/src/core/quota/service.ts +273 -0
- package/src/core/reprompt.ts +48 -0
- package/src/core/routing/engine.ts +978 -0
- package/src/core/types.ts +866 -0
- package/src/core/ui.ts +236 -0
- package/src/core/util.ts +114 -0
- package/src/gui/index.tsx +1675 -0
- package/src/gui/viewmodel.ts +456 -0
- package/src/index.ts +33 -0
- package/src/rpc.ts +204 -0
- package/src/server/containment.ts +131 -0
- package/src/server/controller.ts +3405 -0
- package/src/server/route-tracker.ts +60 -0
- package/src/server/shared-core.ts +701 -0
- package/src/tui/index.tsx +168 -0
package/docs/MODELS.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Approved model registry
|
|
2
|
+
|
|
3
|
+
The router starts from a curated seed and merges live metadata from OpenCode. A model is eligible only when it is approved here, present in the connected provider catalog, and meets every task requirement.
|
|
4
|
+
|
|
5
|
+
## Scoring
|
|
6
|
+
|
|
7
|
+
- **Intelligence** is a curated coding-intelligence score. Where available it comes from Command Code's published model cards. The standard floor is **39.5**, the DeepSeek V4.1 Flash score. It is not a general "best model" score.
|
|
8
|
+
- **Design** is a separate curated score for front-end and UX quality. It is not benchmarked by the same method as intelligence.
|
|
9
|
+
- **Vision** means the model accepts native image input in the live catalog.
|
|
10
|
+
- **Premium** is a policy label for high-cost models. A premium model is never selected for economy or ordinary standard work.
|
|
11
|
+
- **Monthly allowance** is public-rate usage included by the subscription. OpenCode Go values come from the plan catalog's Go table (Go Plus is a separate, larger table); selecting the wrong tier overstates capacity by roughly 2x. Command Code values are the GOAT per-model allowances. Provider-reported totals override these numbers for the plan-level balance.
|
|
12
|
+
- **Time-of-day pricing** is applied only where documented. Command Code DeepSeek V4.1 Flash is listed at off-peak rates and charges 2x from 01:00 to 04:00 and 06:00 to 10:00 UTC, Monday through Friday; the router applies that multiplier to input, output, cache-read, and cache-loss estimates. Models without documented peak metadata use flat catalog rates.
|
|
13
|
+
|
|
14
|
+
These scores are planning inputs, not marketing claims. Models marked **unverified** or **unscored** are not approved for automatic substantive work.
|
|
15
|
+
|
|
16
|
+
## Economy (Tier 1)
|
|
17
|
+
|
|
18
|
+
Used only for narrow, mechanically verifiable work with an explicit scope and deterministic validation.
|
|
19
|
+
|
|
20
|
+
| Provider / model | Intelligence | Design | Vision | Monthly allowance |
|
|
21
|
+
|---|---:|---:|---|---:|
|
|
22
|
+
| `opencode-go/gpt-6-luna` | 38.1 | 55 | text, image, PDF | $60 |
|
|
23
|
+
| `opencode-go/mimo-v2.6-flash` | 37.9 | 50 | text, image, audio, video | $120 |
|
|
24
|
+
| `opencode-go/hy3` | 25.3 | 45 | text | $240 |
|
|
25
|
+
| `opencode-go/longcat-2.0` | 19.1 | 40 | text | $240 |
|
|
26
|
+
| `commandcode/gpt-6-luna` | 38.1 | 55 | text, image, PDF | $20 |
|
|
27
|
+
|
|
28
|
+
These models are below the standard intelligence floor. They cannot be selected for feature work, debugging, refactoring, architecture, security, or tests.
|
|
29
|
+
|
|
30
|
+
## Standard (Tier 2)
|
|
31
|
+
|
|
32
|
+
The default for substantive software engineering. Every model here meets or exceeds the DeepSeek V4.1 Flash floor.
|
|
33
|
+
|
|
34
|
+
| Provider / model | Intelligence | Design | Vision | Monthly allowance |
|
|
35
|
+
|---|---:|---:|---|---:|
|
|
36
|
+
| `opencode-go/deepseek-v4.1-flash` | 39.5 | 65 | text, image | $160 |
|
|
37
|
+
| `opencode-go/glm-5.3-flash` | 41.8 | 65 | text, image, video | $180 |
|
|
38
|
+
| `opencode-go/minimax-m3.1-flash` | 42.7 | 60 | text, image, video | $80 |
|
|
39
|
+
| `opencode-go/claude-haiku-5-5` | 43.4 | 70 | text, image, PDF | $60 |
|
|
40
|
+
| `opencode-go/mimo-v2.6-pro` | 46.3 | 62 | text, image, audio, video | $60 |
|
|
41
|
+
| `commandcode/deepseek-v4.1-flash` | 39.5 | 65 | text, image | $80 |
|
|
42
|
+
| `commandcode/z-ai/glm-5.3-flash` | 41.8 | 65 | text, image, video, PDF | $80 |
|
|
43
|
+
| `commandcode/claude-haiku-5-5` | 43.4 | 70 | text, image, PDF | $20 |
|
|
44
|
+
|
|
45
|
+
Design-intensive work requires at least a 60 design score. Sophisticated design work requires at least 75. A standard model below 75 still requires premium approval for sophisticated design.
|
|
46
|
+
|
|
47
|
+
Claude Haiku 5.5 (**43.4** intelligence, **70** design) is a concrete example of why intelligence and design are separate gates. It clears the 39.5 intelligence floor, so it is valid for ordinary feature work and standard design. It does **not** clear the 75 sophisticated-design floor. When no sophisticated-qualified model is available, the router may use it only as an explicitly labeled standard-design fallback:
|
|
48
|
+
|
|
49
|
+
> `Standard design route: design 70 is below the sophisticated 75 threshold`
|
|
50
|
+
|
|
51
|
+
It is never reported as meeting every hard requirement for sophisticated design, and a premium design route still requires approval.
|
|
52
|
+
|
|
53
|
+
## Premium (Tier 3)
|
|
54
|
+
|
|
55
|
+
Premium models are available only when:
|
|
56
|
+
|
|
57
|
+
- the task is premium-tier or the user explicitly asks for a premium model,
|
|
58
|
+
- `premium.mode` is not `off`,
|
|
59
|
+
- and either a one-shot approval is active for the session or Premium Allowed mode has a remaining configured budget.
|
|
60
|
+
|
|
61
|
+
They are never used for trivial or ordinary standard work. They are never selected silently.
|
|
62
|
+
|
|
63
|
+
| Provider / model | Intelligence | Design | Vision | Monthly allowance |
|
|
64
|
+
|---|---:|---:|---|---:|
|
|
65
|
+
| `opencode-go/glm-5.3` | 44.8 | 80 | text | $120 |
|
|
66
|
+
| `opencode-go/kimi-k3` | 43.6 | 72 | text, image, video | $60 |
|
|
67
|
+
| `opencode-go/grok-4.7` | 46.4 | 75 | text, image, PDF | $60 |
|
|
68
|
+
| `opencode-go/qwen3.8-max` | 40.2 | 70 | text, image, video | $60 |
|
|
69
|
+
| `opencode-go/step-5-preview` | 43.7 | 70 | text, image, video | $60 |
|
|
70
|
+
| `commandcode/claude-sonnet-5-5` | 56.0 | 90 | text, image, PDF | $10 |
|
|
71
|
+
| `commandcode/meta/muse-spark-1.3` | 48.1 | 82 | text, image, video, PDF, audio | $20 |
|
|
72
|
+
| `commandcode/xai/grok-4.7` | 46.4 | 75 | text, image, PDF | $20 |
|
|
73
|
+
| `commandcode/Qwen/Qwen3.8-Max` | 40.2 | 70 | text, image, video, PDF | $20 |
|
|
74
|
+
| `commandcode/stepfun/Step-5-Preview` | 43.7 | 70 | text, image, video | $20 |
|
|
75
|
+
|
|
76
|
+
`opencode-go/glm-5.3` is text-only and can never receive a screenshot, even if its intelligence would otherwise qualify. This is enforced as a hard vision rule.
|
|
77
|
+
|
|
78
|
+
## Known but unapproved
|
|
79
|
+
|
|
80
|
+
These models are discovered but deliberately excluded from automatic routing:
|
|
81
|
+
|
|
82
|
+
- `commandcode/google/gemini-4-argon`, `opencode-go/gemini-4-argon`: unscored in the current model cards.
|
|
83
|
+
- `commandcode/claude-opus-5-5`, `commandcode/gpt-6.1-sol`, `commandcode/gpt-6-astra`, `commandcode/claude-fable-5-1`: frontier-priced and unscored here. They require explicit user qualification.
|
|
84
|
+
- `opencode-go/kimi-k3.1-pro`: unscored.
|
|
85
|
+
- `opencode-go/deepseek-v4-pro`: below the current floor and text only.
|
|
86
|
+
- `commandcode/deepseek/deepseek-v4.1-flash`: duplicate route for the same upstream model; the GOAT ID is approved instead.
|
|
87
|
+
- `meta/muse-spark-1.3-contributor`, `opencode-go/muse-spark-1.3-contributor`, `opencode-go/iceman-contributor-free`: training-enabled. Blocked unless `privacy.allowTrainingModels` is explicitly enabled.
|
|
88
|
+
- `opencode-go/beam-free`: free promotional model, not qualified for automatic work.
|
|
89
|
+
|
|
90
|
+
## Changing the registry
|
|
91
|
+
|
|
92
|
+
Use `/router-exclude provider/model` to remove a model from automatic routing. To approve a discovered model, add its exact key to `models.approved` in `~/.config/opencode/smart-router.json` and assign it a tier in `models.tierOverrides`. A discovered model without a tier remains unapproved.
|
|
93
|
+
|
|
94
|
+
Do not approve a model solely because it is cheaper or newer. Qualify it on real tasks first.
|
|
95
|
+
|
|
96
|
+
## User-defined model definitions
|
|
97
|
+
|
|
98
|
+
If a provider exposes a model that is not in the seed, qualify it explicitly in `models.definitions`. A definition is metadata, not a new provider or a proxy. The model still comes from the connected provider catalog.
|
|
99
|
+
|
|
100
|
+
```jsonc
|
|
101
|
+
{
|
|
102
|
+
"models": {
|
|
103
|
+
"definitions": [
|
|
104
|
+
{
|
|
105
|
+
"key": "acme/coder-v2",
|
|
106
|
+
"providerID": "acme",
|
|
107
|
+
"modelID": "coder-v2",
|
|
108
|
+
"name": "Acme Coder V2",
|
|
109
|
+
"context": 200000,
|
|
110
|
+
"maxOutput": 32768,
|
|
111
|
+
"input": ["text", "image"],
|
|
112
|
+
"cost": [{ "input": 0.2, "output": 0.8, "cache": { "read": 0.02, "write": 0 } }],
|
|
113
|
+
"intelligence": 41.0,
|
|
114
|
+
"design": 60,
|
|
115
|
+
"tier": 2,
|
|
116
|
+
"approved": true,
|
|
117
|
+
"monthlyAllowanceUsd": 100
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Definitions are merged with the seed and live catalog. `tier` is required; `approved` defaults to true only because the definition itself is an explicit qualification. Do not add a definition for a model you have not tested.
|