@route_33/opencode 0.4.5 → 0.4.7-rc.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 +71 -81
- package/dist/cli/production-smoke/production-smoke.js +1649 -0
- package/dist/index.js +3705 -1294
- package/dist/tui-entry/index.js +6987 -0
- package/dist/v2-entry/index.js +4203 -0
- package/package.json +38 -42
- package/LICENSE +0 -21
- package/dist/index.d.ts +0 -23
- package/dist/tui/index.d.ts +0 -5
- package/dist/tui/index.js +0 -542
- package/docs/gateway-limits-variants-broadcast.md +0 -146
- package/docs/gateway-pricing-proposal.md +0 -96
package/README.md
CHANGED
|
@@ -1,105 +1,95 @@
|
|
|
1
1
|
# @route_33/opencode
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Route 33 plugin for OpenCode: sign in with your browser, pick who pays for
|
|
4
|
+
usage, and use the route_33 models — no API keys to paste, ever.
|
|
4
5
|
|
|
5
6
|
## Install
|
|
6
7
|
|
|
7
|
-
```
|
|
8
|
-
opencode plugin @route_33/opencode
|
|
8
|
+
```sh
|
|
9
|
+
opencode plugin add @route_33/opencode
|
|
9
10
|
```
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
Restart OpenCode afterwards — plugins load at startup.
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
// opencode.json — server plugin (model discovery, cost/limit enrichment, auth)
|
|
15
|
-
{
|
|
16
|
-
"plugin": ["@route_33/opencode"]
|
|
17
|
-
}
|
|
18
|
-
```
|
|
14
|
+
Prefer config? Add the package to `opencode.jsonc` instead:
|
|
19
15
|
|
|
20
16
|
```jsonc
|
|
21
|
-
|
|
22
|
-
{
|
|
23
|
-
"plugin": ["@route_33/opencode"]
|
|
24
|
-
}
|
|
17
|
+
{ "plugins": ["@route_33/opencode"] }
|
|
25
18
|
```
|
|
26
19
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
## Auth
|
|
30
|
-
|
|
31
|
-
Run `opencode auth login` and choose `route_33`, or set the `ROUTE33_API_KEY` environment variable. Without a key, the TUI wizard offers to save one: per-project inside a git workspace, global otherwise. A globally stored key applies only outside git workspaces — inside a workspace, keys resolve from the environment, the workspace config, or `.opencode/route33.key` (per-project keys are the metering boundary). Skipping the project-key wizard snoozes it for 7 days — "Skip" for that workspace only, "Skip for all workspaces" everywhere (both live in opencode's TUI kv store; remove `project-key-prompt.dismissed-at*` from `~/.local/state/opencode/kv.json` to re-arm sooner). `ROUTE33_BASE_URL` overrides the default gateway URL; `ROUTE33_TUI_PROMPT=0` disables the wizard.
|
|
32
|
-
|
|
33
|
-
Your key is never written into the resolved provider configuration: authentication is attached per request at fetch time, so `opencode debug config` output contains no credential material. One inert exception: the options carry the non-secret marker `__route33_fetch_shim_auth__` as `apiKey`, because the native per-model SDKs used for `anthropic/`, `openai/`, and `mistralai/` models (`@ai-sdk/anthropic`, `@ai-sdk/openai`, `@ai-sdk/mistral`) refuse to construct a request without one — the marker satisfies that null check, never authenticates anything (the gateway reads only the request-time `Authorization` header, which the fetch shim injects), and no vendor env var (`ANTHROPIC_API_KEY` etc.) is needed or consulted. The marker is skipped by key resolution and never overrides an `apiKey` you authored yourself; it is visible in config dumps precisely because it is not a secret.
|
|
34
|
-
|
|
35
|
-
## Model catalog
|
|
36
|
-
|
|
37
|
-
The catalog is discovered dynamically. The plugin calls `GET {baseURL}/models` with your resolved API key, caches the response on disk, and injects only the models that key can see. The refresh ladder is:
|
|
38
|
-
|
|
39
|
-
1. Return the fresh on-disk cache if it has not expired.
|
|
40
|
-
2. Fetch live from the gateway and update the cache.
|
|
41
|
-
3. If the live fetch fails, return the stale cache.
|
|
42
|
-
4. If there is no cache and no live response, preserve existing generated entries and inject no replacement models.
|
|
43
|
-
|
|
44
|
-
The plugin does not embed or serve a static catalog. The on-disk cache is keyed by gateway URL **and** API key, so the same key pointed at a different gateway (`ROUTE33_BASE_URL`, e.g. a local cluster) never shares a cache with production. Catalog cache envelopes are versioned; cache files from older plugin versions are ignored after an upgrade and repopulated from the gateway.
|
|
45
|
-
|
|
46
|
-
If discovery yields no catalog, the plugin logs exactly one warning:
|
|
20
|
+
## First run
|
|
47
21
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
22
|
+
1. Pick any route_33 model (or run `/connect` and choose **Route 33**).
|
|
23
|
+
2. Open the sign-in link — your browser finishes at a Route 33 confirmation
|
|
24
|
+
page.
|
|
25
|
+
3. Connect again and pick **who pays for usage in this folder**: one of your
|
|
26
|
+
Route 33 projects, or your personal key.
|
|
27
|
+
4. The route_33 models appear. Done.
|
|
51
28
|
|
|
52
|
-
|
|
29
|
+
To change who pays later, connect again and pick another option. `/r33` shows
|
|
30
|
+
the current state at any time.
|
|
53
31
|
|
|
54
|
-
##
|
|
32
|
+
## Commands
|
|
55
33
|
|
|
56
|
-
|
|
34
|
+
| Command | Effect |
|
|
35
|
+
| ------------- | --------------------------------------------------------- |
|
|
36
|
+
| `/r33` | Show who pays, the active key, and its rotation state |
|
|
37
|
+
| `/r33 rotate` | Rotate the key immediately |
|
|
38
|
+
| `/r33 reset` | Clear who pays — connect again to pick a different option |
|
|
57
39
|
|
|
58
|
-
|
|
59
|
-
- **Limits**: the gateway's broadcast `limits` win; `models.dev` fills in when the gateway broadcasts none. Limits are omitted entirely when neither source knows them; the plugin never fabricates them.
|
|
60
|
-
- **Modalities**: gateway `modalities.input` / `modalities.output` are passed through to opencode. Invalid modality values and malformed modality objects are omitted per model.
|
|
61
|
-
- **Attachment**: gateway `attachment` wins whenever present. `models.dev` supplies it only when the gateway omits the field.
|
|
62
|
-
- **Capabilities**: the broadcast `reasoning` and `tool_support` flags win (`tool_support` is mapped to `tool_call`); `models.dev` always backfills any capability flag left undefined.
|
|
63
|
-
- **Variants**: R33 broadcast variants are passed verbatim (for example, `kimi-k3`'s `max` `reasoningEffort` variant).
|
|
40
|
+
A browser is required for every sign-in; restarts afterwards sign in silently.
|
|
64
41
|
|
|
65
|
-
|
|
42
|
+
## Keys
|
|
66
43
|
|
|
67
|
-
|
|
44
|
+
One key per workspace: each project folder uses its own Route 33 key, and
|
|
45
|
+
every request carries the key of its own workspace — connecting another
|
|
46
|
+
folder never changes who this one bills for. Keys are short-lived and rotate
|
|
47
|
+
automatically; nothing secret is ever written to your project, logs, or
|
|
48
|
+
terminal.
|
|
68
49
|
|
|
69
|
-
|
|
50
|
+
## Direct key mode
|
|
70
51
|
|
|
71
|
-
|
|
52
|
+
Set `ROUTE33_API_KEY` to a gateway key and the wizard is bypassed entirely —
|
|
53
|
+
no sign-in, no attribution pick, no browser, no per-workspace keys. This is
|
|
54
|
+
the right choice for autonomous, headless, or remote sessions where no human
|
|
55
|
+
is present or the machine has no browser. Key rotation is your responsibility.
|
|
72
56
|
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
"models": {
|
|
76
|
-
"openai/gpt-5.5": { "variants": { "fast": { "temperature": 0 } } },
|
|
77
|
-
"custom/internal": { "name": "Internal model" }
|
|
78
|
-
}
|
|
79
|
-
}
|
|
57
|
+
```sh
|
|
58
|
+
export ROUTE33_API_KEY=r33_sk_...
|
|
80
59
|
```
|
|
81
60
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
##
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
61
|
+
## Auto-connect
|
|
62
|
+
|
|
63
|
+
When a folder is not yet connected, the wizard auto-starts at OpenCode launch:
|
|
64
|
+
the browser sign-in opens immediately and the project picker follows — no
|
|
65
|
+
command needed. Suppress this with `ROUTE33_AUTOCONNECT=0` and use `/connect`
|
|
66
|
+
(v2) or `/r33` (v1) manually instead. On remote or headless machines, use
|
|
67
|
+
`ROUTE33_API_KEY` instead of the wizard.
|
|
68
|
+
|
|
69
|
+
## OpenCode v1
|
|
70
|
+
|
|
71
|
+
On OpenCode v1, `/r33` in the TUI signs in with the browser, opens the
|
|
72
|
+
project picker, and leases this folder's key; the models load after a
|
|
73
|
+
restart. The wizard auto-starts at TUI launch when the folder is
|
|
74
|
+
unconnected. The auto-start does not intercept the first prompt because
|
|
75
|
+
v1's TUI API offers no pre-prompt hook — the wizard runs in parallel.
|
|
76
|
+
|
|
77
|
+
## Troubleshooting
|
|
78
|
+
|
|
79
|
+
| Symptom | What to do |
|
|
80
|
+
| --------------------------------------------- | -------------------------------------------------------------------------------- |
|
|
81
|
+
| No route_33 models after start | `/connect` → Route 33 — the silent sign-in expired; sign in once and they return |
|
|
82
|
+
| "This Route 33 build has no OAuth client id" | Update the plugin to a released build, or set `ROUTE33_CLIENT_ID` and restart |
|
|
83
|
+
| "needs a Git worktree" | Open a Git repository (or `git init`) in the folder, then connect again |
|
|
84
|
+
| Sign-in link never appears / SSH-only machine | Sign-in needs a browser on the same machine — there is no device-flow fallback |
|
|
85
|
+
|
|
86
|
+
## Configuration
|
|
87
|
+
|
|
88
|
+
| Variable | Purpose | Default |
|
|
89
|
+
| --------------------- | -------------------------------------------- | -------------------------------- |
|
|
90
|
+
| `ROUTE33_API_KEY` | Pre-shared gateway key (bypasses the wizard) | not set (wizard mode) |
|
|
91
|
+
| `ROUTE33_AUTOCONNECT` | Opt out of the auto-start wizard | `1` (auto-start enabled) |
|
|
92
|
+
| `ROUTE33_CLIENT_ID` | OAuth client identifier | included in released builds |
|
|
93
|
+
| `ROUTE33_AUTH_ISSUER` | OAuth issuer | `https://auth.route33.ai` |
|
|
94
|
+
| `ROUTE33_API_BASE` | Management API base | `https://mapi.route33.ai/api/v1` |
|
|
95
|
+
| `ROUTE33_BASE_URL` | Gateway models base | `https://api.route33.ai/v1` |
|