opencode-jev-model-router 0.1.0 → 0.1.2
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
|
@@ -2,17 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
Automatic per-turn model picking for [OpenCode](https://opencode.ai), powered by [Jev](https://typesafe.ai). Built for **[OpenCode Go](https://opencode.ai/docs/go/)**: easy turns burn generous models; hard turns get Luna.
|
|
4
4
|
|
|
5
|
+
[npm](https://www.npmjs.com/package/opencode-jev-model-router) · [GitHub](https://github.com/aaronshaf/opencode-jev-model-router)
|
|
6
|
+
|
|
5
7
|
## Quick start
|
|
6
8
|
|
|
7
9
|
**1. Install the plugin**
|
|
8
10
|
|
|
9
11
|
```bash
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
opencode plugin opencode-jev-model-router -g
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or add it to `~/.config/opencode/opencode.json`:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"plugin": ["opencode-jev-model-router"]
|
|
20
|
+
}
|
|
14
21
|
```
|
|
15
22
|
|
|
23
|
+
Pin a version if you prefer: `"opencode-jev-model-router@0.1.2"`.
|
|
24
|
+
|
|
16
25
|
**2. Add your Jev key** (OpenCode usually does not see shell `export`s)
|
|
17
26
|
|
|
18
27
|
```bash
|
|
@@ -20,10 +29,16 @@ printf '%s\n' "$JEV_KEY" > ~/.config/opencode/opencode-jev-router.key
|
|
|
20
29
|
chmod 600 ~/.config/opencode/opencode-jev-router.key
|
|
21
30
|
```
|
|
22
31
|
|
|
23
|
-
**3. Optional
|
|
32
|
+
**3. Optional config** — built-in defaults are **OpenCode Go only** (Muse / DeepSeek Flash / Luna). Copy an example only if you want to change that:
|
|
24
33
|
|
|
25
34
|
```bash
|
|
26
|
-
|
|
35
|
+
# Go-only (same as built-in defaults)
|
|
36
|
+
curl -fsSL https://raw.githubusercontent.com/aaronshaf/opencode-jev-model-router/main/opencode-jev-router.example.json \
|
|
37
|
+
-o ~/.config/opencode/opencode-jev-router.json
|
|
38
|
+
|
|
39
|
+
# Go + Claude + Codex (see below)
|
|
40
|
+
curl -fsSL https://raw.githubusercontent.com/aaronshaf/opencode-jev-model-router/main/opencode-jev-router.go-claude-codex.example.json \
|
|
41
|
+
-o ~/.config/opencode/opencode-jev-router.json
|
|
27
42
|
```
|
|
28
43
|
|
|
29
44
|
**4. Restart OpenCode**, then check:
|
|
@@ -34,13 +49,19 @@ cp opencode-jev-router.example.json ~/.config/opencode/opencode-jev-router.json
|
|
|
34
49
|
|
|
35
50
|
You want: `Jev key present; routing ON; …`
|
|
36
51
|
|
|
52
|
+
## How routing picks models
|
|
53
|
+
|
|
54
|
+
Jev chooses a **tier** (`fast` / `balanced` / `strong` / `long`). The plugin then picks the first eligible model from that tier’s `model` + `fallbacks` in the plugin config (or the built-in Go defaults if you have no config file).
|
|
55
|
+
|
|
56
|
+
If your current model is **not** in that list, the turn is **pinned** — no routing. So Claude/Codex only participate after you add them to a tier (or use the example above).
|
|
57
|
+
|
|
37
58
|
## Day to day
|
|
38
59
|
|
|
39
|
-
1.
|
|
60
|
+
1. Start on a **managed** model (one listed in the defaults or your config). Unlisted models pin.
|
|
40
61
|
2. Chat as usual.
|
|
41
62
|
3. Watch for a toast such as `Routed to opencode-go/muse-spark-1.3-contributor · jev fast 98% 280ms`.
|
|
42
63
|
|
|
43
|
-
| Kind of ask | Typical tier | Default model |
|
|
64
|
+
| Kind of ask | Typical tier | Default model (Go) |
|
|
44
65
|
|---|---|---|
|
|
45
66
|
| Typo, rename, “say hi” | `fast` | Muse Spark |
|
|
46
67
|
| Normal feature / fix | `balanced` | DeepSeek V4.1 Flash |
|
|
@@ -49,6 +70,12 @@ You want: `Jev key present; routing ON; …`
|
|
|
49
70
|
|
|
50
71
|
If Jev is unreachable, your current model stays put.
|
|
51
72
|
|
|
73
|
+
### Also using Claude or Codex?
|
|
74
|
+
|
|
75
|
+
Connect them in OpenCode (`/connect`), then use a config that lists those models under a tier — e.g. [opencode-jev-router.go-claude-codex.example.json](./opencode-jev-router.go-claude-codex.example.json): Go stays primary for fast/balanced; `strong` falls back to Sonnet then Codex if Luna is unavailable.
|
|
76
|
+
|
|
77
|
+
Adjust the `anthropic/…` and `openai/…` IDs to whatever `/models` shows for your account.
|
|
78
|
+
|
|
52
79
|
### Force a tier in the prompt
|
|
53
80
|
|
|
54
81
|
```text
|
|
@@ -62,7 +89,7 @@ use balanced for this endpoint
|
|
|
62
89
|
|
|
63
90
|
- `/jev-off` — stay on whatever model you picked
|
|
64
91
|
- `/jev-on` — turn automatic routing back on
|
|
65
|
-
- Or pick an unmanaged model (
|
|
92
|
+
- Or pick an unmanaged model (not in your tier lists) to **pin**
|
|
66
93
|
|
|
67
94
|
### When a model hits its Go allowance
|
|
68
95
|
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://github.com/aaronshaf/opencode-jev-model-router/schemas/config.schema.json",
|
|
3
|
+
"enabled": true,
|
|
4
|
+
"allowProjectModels": false,
|
|
5
|
+
"tiers": {
|
|
6
|
+
"fast": {
|
|
7
|
+
"model": "opencode-go/muse-spark-1.3-contributor",
|
|
8
|
+
"aliases": ["fast", "flash", "muse"],
|
|
9
|
+
"fallbacks": [
|
|
10
|
+
"opencode-go/mimo-v2.5",
|
|
11
|
+
"opencode-go/deepseek-v4.1-flash",
|
|
12
|
+
"opencode-go/glm-5.3-flash"
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
"balanced": {
|
|
16
|
+
"model": "opencode-go/deepseek-v4.1-flash",
|
|
17
|
+
"aliases": ["balanced"],
|
|
18
|
+
"fallbacks": [
|
|
19
|
+
"opencode-go/muse-spark-1.3-contributor",
|
|
20
|
+
"opencode-go/mimo-v2.5",
|
|
21
|
+
"opencode-go/qwen3.7-plus"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
"strong": {
|
|
25
|
+
"model": "opencode-go/gpt-5.6-luna",
|
|
26
|
+
"aliases": ["strong", "luna", "sonnet", "opus", "codex"],
|
|
27
|
+
"fallbacks": [
|
|
28
|
+
"anthropic/claude-sonnet-4-20250514",
|
|
29
|
+
"openai/gpt-5.1-codex",
|
|
30
|
+
"opencode-go/kimi-k2.7-code",
|
|
31
|
+
"opencode-go/qwen3.7-plus"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
"long": {
|
|
35
|
+
"model": "opencode-go/kimi-k3",
|
|
36
|
+
"enabled": false,
|
|
37
|
+
"aliases": ["long", "kimi", "k3"],
|
|
38
|
+
"fallbacks": ["opencode-go/kimi-k2.7-code"]
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"routing": {
|
|
42
|
+
"failOpen": true,
|
|
43
|
+
"maxPromptBytes": 16384,
|
|
44
|
+
"timeoutMs": 1500,
|
|
45
|
+
"deadlineMs": 3000,
|
|
46
|
+
"maxRetries": 1,
|
|
47
|
+
"minimumConfidence": 0.3,
|
|
48
|
+
"uncertainCeiling": "balanced",
|
|
49
|
+
"downgradeMaxContextTokens": 20000
|
|
50
|
+
},
|
|
51
|
+
"quota": {
|
|
52
|
+
"cooldownHours": 5
|
|
53
|
+
},
|
|
54
|
+
"history": {
|
|
55
|
+
"enabled": true,
|
|
56
|
+
"retainPrompt": false,
|
|
57
|
+
"maxEntries": 20
|
|
58
|
+
},
|
|
59
|
+
"echoRouting": true
|
|
60
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-jev-model-router",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Jev-based automatic per-turn model routing for OpenCode",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"dist",
|
|
23
23
|
"schemas",
|
|
24
24
|
"opencode-jev-router.example.json",
|
|
25
|
+
"opencode-jev-router.go-claude-codex.example.json",
|
|
25
26
|
"README.md",
|
|
26
27
|
"LICENSE"
|
|
27
28
|
],
|