dsh-keys-manager 0.2.6 → 0.2.9
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 +52 -0
- package/README.md +219 -269
- package/README.zh-CN.md +142 -136
- package/lib/client/format.d.ts +27 -3
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/types.d.ts +10 -2
- package/lib/client.js +155 -7
- package/lib/domain.d.ts +30 -5
- package/lib/index.d.ts +66 -5
- package/lib/index.js +295 -78
- package/lib/index.js.map +1 -1
- package/lib/quota/cache.d.ts +61 -0
- package/lib/quota/cache.js +88 -0
- package/lib/quota/cache.js.map +1 -0
- package/lib/quota/fetch.d.ts +33 -0
- package/lib/quota/fetch.js +36 -0
- package/lib/quota/fetch.js.map +1 -0
- package/lib/quota/model.d.ts +60 -0
- package/lib/quota/model.js +62 -0
- package/lib/quota/model.js.map +1 -0
- package/lib/quota/providers.d.ts +89 -0
- package/lib/quota/providers.js +533 -0
- package/lib/quota/providers.js.map +1 -0
- package/locale/en.json +7 -1
- package/locale/zh.json +7 -1
- package/package.json +15 -15
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/dsh-keys-manager)
|
|
4
4
|
[](LICENSE)
|
|
5
5
|
[](https://www.npmjs.com/package/dsh-keys-manager)
|
|
6
|
-
[](https://www.npmjs.com/package/@deepseek-ai/dsh-llm)
|
|
7
7
|
|
|
8
8
|
**English** | [简体中文](README.zh-CN.md)
|
|
9
9
|
|
|
@@ -12,101 +12,50 @@ It extends the Models page rather than replacing it: providers, models, and the
|
|
|
12
12
|
model picker stay where they are; only the API-key source moves behind the
|
|
13
13
|
manager.
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## What it does
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
- One key pinned to a session, with round-robin selection for new sessions.
|
|
19
|
-
- Bounded retry on the same key, then automatic failover to another key.
|
|
20
|
-
- Exponential cooldown recovery, capped at seven days.
|
|
21
|
-
- A search-driven Keys Manager page on the plugin's own detail page.
|
|
22
|
-
- A "managed by Keys Manager" badge inside the existing Models provider cards.
|
|
23
|
-
- Extra built-in providers installed as ordinary `llm-pi-ai` routes.
|
|
24
|
-
- OAuth account sign-in for seven pi-ai-backed providers, stored beside
|
|
25
|
-
the API keys.
|
|
26
|
-
- A companion transport component for providers the vendored pi-ai cannot
|
|
27
|
-
speak — four routes: Cursor (`cursor`), Devin (`devin`), Google Gemini CLI
|
|
28
|
-
(`google-gemini-cli`) and Google Antigravity (`google-antigravity`) —
|
|
29
|
-
installed with the plugin.
|
|
30
|
-
|
|
31
|
-
### Extra providers
|
|
17
|
+
**Pool and routing**
|
|
32
18
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<summary>All 35 extra providers</summary>
|
|
19
|
+
- Several keys per provider, each with an alias and a health state.
|
|
20
|
+
- One key pinned to a session, round-robin for new sessions; a failing request
|
|
21
|
+
is retried on its key, then moved to another key.
|
|
22
|
+
- Exponential cooldown recovery, capped at seven days.
|
|
38
23
|
|
|
39
|
-
|
|
40
|
-
|---|---|---|
|
|
41
|
-
| DeepInfra | `deepinfra` | `DEEPINFRA_API_KEY` |
|
|
42
|
-
| Novita | `novita` | `NOVITA_API_KEY` |
|
|
43
|
-
| StepFun | `stepfun` | `STEPFUN_API_KEY` |
|
|
44
|
-
| SambaNova | `sambanova` | `SAMBANOVA_API_KEY` |
|
|
45
|
-
| Qianfan | `qianfan` | `QIANFAN_API_KEY` |
|
|
46
|
-
| GMI Cloud | `gmi-cloud` | `GMI_API_KEY` |
|
|
47
|
-
| Synthetic | `synthetic` | `SYNTHETIC_API_KEY` |
|
|
48
|
-
| ZenMux | `zenmux` | `ZENMUX_API_KEY` |
|
|
49
|
-
| Kilo Gateway | `kilo` | `KILO_API_KEY` |
|
|
50
|
-
| NanoGPT | `nanogpt` | `NANO_GPT_API_KEY` |
|
|
51
|
-
| Venice AI | `venice` | `VENICE_API_KEY` |
|
|
52
|
-
| AIML API | `aimlapi` | `AIMLAPI_API_KEY` |
|
|
53
|
-
| AI& | `aiand` | `AIAND_API_KEY` |
|
|
54
|
-
| Helmcode | `helmcode` | `HELMCODE_API_KEY` |
|
|
55
|
-
| Alibaba Coding Plan | `alibaba-coding-plan` | `ALIBABA_CODING_PLAN_API_KEY` |
|
|
56
|
-
| MiniMax Coding (Global) | `minimax-code` | `MINIMAX_CODE_API_KEY` |
|
|
57
|
-
| MiniMax Coding (CN) | `minimax-code-cn` | `MINIMAX_CODE_CN_API_KEY` |
|
|
58
|
-
| Umans AI Coding Plan | `umans` | `UMANS_AI_CODING_PLAN_API_KEY` |
|
|
59
|
-
| Sakana AI | `sakana` | `SAKANA_API_KEY` |
|
|
60
|
-
| CoralBricks | `coralbricks` | `CORAL_API_KEY` |
|
|
61
|
-
| Wafer Serverless | `wafer-serverless` | `WAFER_SERVERLESS_API_KEY` |
|
|
62
|
-
| Alibaba Token Plan | `alibaba-token-plan` | `ALIBABA_TOKEN_PLAN_API_KEY` |
|
|
63
|
-
| Alibaba Token Plan (CN) | `alibaba-token-plan-cn` | `BAILIAN_TOKEN_PLAN_API_KEY` |
|
|
64
|
-
| Charm Hyper | `charm-hyper` | `CHARM_HYPER_API_KEY`, `HYPER_API_KEY` |
|
|
65
|
-
| LiteLLM Proxy | `litellm` | `LITELLM_API_KEY` |
|
|
66
|
-
| SiliconFlow | `siliconflow` | `SILICONFLOW_API_KEY` |
|
|
67
|
-
| SiliconFlow (CN) | `siliconflow-cn` | `SILICONFLOW_CN_API_KEY` |
|
|
68
|
-
| Zhipu Coding Plan | `zhipu-coding-plan` | `ZHIPU_API_KEY` |
|
|
69
|
-
| Abliteration | `abliteration` | `ABLITERATION_API_KEY`, `ABLIT_KEY` |
|
|
70
|
-
| ClinePass | `cline-pass` | `CLINE_API_KEY` |
|
|
71
|
-
| Command Code | `commandcode` | `COMMAND_CODE_API_KEY`, `COMMANDCODE_API_KEY` |
|
|
72
|
-
| CoreWeave Serverless Inference | `coreweave` | `COREWEAVE_API_KEY` |
|
|
73
|
-
| Fire Pass | `firepass` | `FIREPASS_API_KEY` |
|
|
74
|
-
| Ollama Cloud | `ollama-cloud` | `OLLAMA_CLOUD_API_KEY` |
|
|
75
|
-
| Yolo Auto | `yolo-auto` | `YOLO_AUTO_API_KEY` |
|
|
24
|
+
**Accounts and sign-in**
|
|
76
25
|
|
|
77
|
-
|
|
26
|
+
- Seven pi-ai OAuth providers can join the pool as an account instead of a
|
|
27
|
+
pasted key.
|
|
28
|
+
- Two more sign in through the plugin's own bundled clients: Kilo and Z.AI
|
|
29
|
+
Coding Plan.
|
|
30
|
+
- Seven companion transport routes for providers the vendored pi-ai cannot
|
|
31
|
+
speak: Cursor, Devin, the two Google routes, Factory Droid, and the two
|
|
32
|
+
GitLab Duo routes.
|
|
78
33
|
|
|
79
|
-
|
|
34
|
+
**Interface**
|
|
80
35
|
|
|
81
|
-
|
|
36
|
+
- A search-driven Keys Manager page on the plugin's own detail page.
|
|
37
|
+
- A "managed by Keys Manager" badge inside the existing Models provider cards.
|
|
38
|
+
- Extra built-in providers installed as ordinary `llm-pi-ai` routes — 35 of
|
|
39
|
+
them, listed under [Provider coverage](#provider-coverage).
|
|
82
40
|
|
|
83
41
|
## Quick start
|
|
84
42
|
|
|
85
|
-
### Install
|
|
86
|
-
|
|
87
|
-
In the DeepSeek Harness Desktop or Web app, open **Plugins**, click
|
|
88
|
-
**Add plugin**, enter `dsh-keys-manager` in the package field, and click
|
|
89
|
-
**Install**. When the install finishes, choose **Enable now** so the plugin is
|
|
90
|
-
switched on.
|
|
43
|
+
### Install
|
|
91
44
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
### Install — published package
|
|
45
|
+
In the Desktop or Web app, open **Plugins → Add plugin**, enter `dsh-keys-manager`,
|
|
46
|
+
click **Install**, then **Enable now**. This installs the same published package
|
|
47
|
+
as the CLI path, already carrying its built bundle.
|
|
97
48
|
|
|
98
49
|
```sh
|
|
99
50
|
dsh plugin --profile web add dsh-keys-manager
|
|
100
51
|
```
|
|
101
52
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
`llm-omp-transports`. Enable both: the manager owns credentials and routing,
|
|
106
|
-
the transport component owns the wire protocols of its four routes (Cursor,
|
|
107
|
-
Devin, and the two Google routes).
|
|
53
|
+
One install yields both bundles, `dsh-keys-manager` and `llm-omp-transports`;
|
|
54
|
+
enable both — the manager owns credentials and routing, the transport the seven
|
|
55
|
+
routes' wire protocols. Refresh the Web page afterwards for the browser half.
|
|
108
56
|
|
|
109
|
-
|
|
57
|
+
<details>
|
|
58
|
+
<summary>Install from a local checkout</summary>
|
|
110
59
|
|
|
111
60
|
```sh
|
|
112
61
|
git clone https://github.com/btspoony/dsh-keys-manager
|
|
@@ -115,25 +64,19 @@ pnpm i
|
|
|
115
64
|
dsh plugin --profile web link .
|
|
116
65
|
```
|
|
117
66
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
ships the built `lib/` and the client bundle. The local
|
|
121
|
-
`dsh plugin --profile web link .` path runs `prepare` during `pnpm i`, which
|
|
122
|
-
builds `lib/` and the client bundle, so the clone flow above includes that
|
|
123
|
-
build step; `prepack` builds the same output when the package is packed or
|
|
124
|
-
published.
|
|
67
|
+
`add` installs the published tarball with its built `lib/` and client bundle;
|
|
68
|
+
`link .` builds them via `prepare` during `pnpm i`, as does `prepack` when packing.
|
|
125
69
|
|
|
126
|
-
|
|
70
|
+
</details>
|
|
127
71
|
|
|
128
|
-
##
|
|
72
|
+
## Use it
|
|
129
73
|
|
|
130
|
-
|
|
131
|
-
`Plugins → 密钥管理 → 查看` in the Chinese locale). The manager renders on the
|
|
132
|
-
plugin's detail page, between its description and its included rows, matching
|
|
133
|
-
the shipped plugin configuration cards.
|
|
74
|
+
### Take over a provider and add keys
|
|
134
75
|
|
|
135
|
-
1. Search for a provider.
|
|
136
|
-
|
|
76
|
+
1. Search for a provider. Open **Plugins → Keys Manager → View** (`Plugins →
|
|
77
|
+
密钥管理 → 查看` in the Chinese locale); the manager renders on the plugin's
|
|
78
|
+
detail page. Existing DSH providers appear first; the plugin also ships the
|
|
79
|
+
curated extra catalog described under [Provider coverage](#provider-coverage).
|
|
137
80
|
2. Adopt a provider. For an existing provider the manager imports the
|
|
138
81
|
currently resolved credential, writes a broker reference into the provider
|
|
139
82
|
profile, and leaves the original key in the credential store so release can
|
|
@@ -146,152 +89,90 @@ the shipped plugin configuration cards.
|
|
|
146
89
|
5. Tune retry count (1–3), base cooldown, and recovery grace in the settings
|
|
147
90
|
card.
|
|
148
91
|
|
|
149
|
-
###
|
|
92
|
+
### Accounts and sign-in
|
|
150
93
|
|
|
151
94
|
Providers that ship a native OAuth sign-in offer two ways to join the pool:
|
|
152
|
-
**Add key** stores a static API key, while **Add account** runs the
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
refuses image blocks with a typed error instead of dropping them.
|
|
223
|
-
- The client is unofficial and presents Cursor's vendor-internal OAuth
|
|
224
|
-
identity. Read the [transports package docs](packages/llm-omp/README.md)
|
|
225
|
-
before relying on it; the risks and limits are listed there.
|
|
226
|
-
|
|
227
|
-
### Devin transport
|
|
228
|
-
|
|
229
|
-
Devin is the second route served by the same `dsh-llm-omp-transports`
|
|
230
|
-
component, on its own `devin` route with the same one-grant record at
|
|
231
|
-
`llm-omp-transports/devin`.
|
|
232
|
-
|
|
233
|
-
- Sign in from the **Transport accounts** section. omp finishes this login
|
|
234
|
-
through a loopback listener that only Bun provides, so this plugin opens the
|
|
235
|
-
authorize page and asks you to paste back the address the browser landed on
|
|
236
|
-
(the full URL or `code#state`). Nothing listens on the redirect port, so the
|
|
237
|
-
page itself fails to load and the code stays in the address bar.
|
|
238
|
-
- **There is no refresh.** The record is a static bearer whose expiry is
|
|
239
|
-
derived from the token (JWT `exp` minus five minutes, else one year). A
|
|
240
|
-
grant with no `expires` is served as a static bearer and reported `active`
|
|
241
|
-
with no expiry cell; once a readable expiry passes, sign in again by hand.
|
|
242
|
-
- Models come from the pinned catalog (two rows, `swe-1-6` and `swe-1-6-fast`)
|
|
243
|
-
generated into the transport at build time.
|
|
244
|
-
- The client is unofficial and presents the released Devin CLI identity; the
|
|
245
|
-
real endpoints and protocol behavior are unverified. Read the
|
|
246
|
-
[transports package known limits](packages/llm-omp/docs/known-limits.md)
|
|
247
|
-
before relying on it.
|
|
248
|
-
|
|
249
|
-
### Google transports
|
|
250
|
-
|
|
251
|
-
Two Google routes are served by the same `dsh-llm-omp-transports` component.
|
|
252
|
-
They share one generated `lib/omp/google.mjs` artifact and the provider inside
|
|
253
|
-
it dispatches on the model, but each route is separate everywhere else:
|
|
254
|
-
`google-gemini-cli` and `google-antigravity`, each with its own one-grant
|
|
255
|
-
record at `llm-omp-transports/<route>`, its own account row and its own model
|
|
256
|
-
catalog.
|
|
257
|
-
|
|
258
|
-
- Sign in from the **Transport accounts** section. This login finishes in the
|
|
259
|
-
plugin itself: a `node:http` listener on `127.0.0.1` receives the browser
|
|
260
|
-
redirect (`8085` `/oauth2callback` for `google-gemini-cli`, `51121`
|
|
261
|
-
`/oauth-callback` for `google-antigravity`, with a free-port fallback when
|
|
262
|
-
the default is taken). The same dialog always offers the paste path — the
|
|
263
|
-
full address the browser landed on, or `code#state` — for a browser that
|
|
264
|
-
cannot reach the listener.
|
|
265
|
-
- The grant is `{access, refresh, expires, projectId, email?}` and refreshes
|
|
266
|
-
on the credential seam, so an expired token is renewed without re-login
|
|
267
|
-
while the refresh token stays valid. Sign-in also resolves the Google Cloud
|
|
268
|
-
project the route bills and sends.
|
|
269
|
-
- Models come from the pinned catalog at build time: seven rows for
|
|
270
|
-
`google-gemini-cli`, 22 for `google-antigravity`.
|
|
271
|
-
- The clients are unofficial and present vendor-internal OAuth identities; the
|
|
272
|
-
first live turn on either route is a manual smoke check. Read the
|
|
273
|
-
[Known limits](docs/known-limits.md) for the listener, the antigravity
|
|
274
|
-
version read and the 401/403 posture before relying on them.
|
|
95
|
+
**Add key** stores a static API key, while **Add account** runs the provider's
|
|
96
|
+
OAuth sign-in flow and stores the result as an account row in the same pool.
|
|
97
|
+
Nine routes join as an **account**: seven through pi-ai's own flows, `kilo` and
|
|
98
|
+
`zai` through the plugin's bundled clients (device code, pasted `zcode://`
|
|
99
|
+
redirect), which mint a **static** credential renewed only by **Sign in again**.
|
|
100
|
+
|
|
101
|
+
| Route group | How it joins | Refresh / renew |
|
|
102
|
+
|---|---|---|
|
|
103
|
+
| 9 OAuth accounts | **Add account** — seven pi-ai flows, two plugin clients | provider-managed for the seven; **Sign in again** for the two static credentials |
|
|
104
|
+
| 7 transport routes | **Transport accounts** — one grant per route | see [Transport routes](#transport-routes) |
|
|
105
|
+
|
|
106
|
+
**API keys form the selection ring** — sticky sessions, round-robin, retry
|
|
107
|
+
failover and cooldowns operate across the provider's keys — while **one
|
|
108
|
+
projected OAuth grant serves its provider**, and an account row's counters
|
|
109
|
+
reflect only that account's own successes and failures. Per-account ranking is
|
|
110
|
+
future work. When the projected grant fails, the account cools down and the
|
|
111
|
+
pool falls back to its keys, or stops serving on an OAuth-only route until a
|
|
112
|
+
manual re-login.
|
|
113
|
+
|
|
114
|
+
**`muse-code` needs no transport or account row of its own**: the vendored pi-ai
|
|
115
|
+
`meta` route (`openai-responses` on `https://api.meta.ai/v1`) serves it, the
|
|
116
|
+
agreement check was static, and the first live call is a manual smoke check per
|
|
117
|
+
[Known limits](docs/known-limits.md).
|
|
118
|
+
|
|
119
|
+
### Transport routes
|
|
120
|
+
|
|
121
|
+
Providers the vendored pi-ai cannot speak are served by the companion
|
|
122
|
+
`dsh-llm-omp-transports` component:
|
|
123
|
+
|
|
124
|
+
- One grant per route, at `llm-omp-transports/<route>` — no key pool and no
|
|
125
|
+
per-account rotation. Sign-in happens in the **Transport accounts** section of
|
|
126
|
+
the Keys Manager page.
|
|
127
|
+
- Models are generated from the pinned `@oh-my-pi/pi-catalog@18.12.3` table when
|
|
128
|
+
the transport is built, and the clients are unofficial: read the
|
|
129
|
+
[transports package docs](packages/llm-omp/README.md) and its
|
|
130
|
+
[known limits](packages/llm-omp/docs/known-limits.md) before relying on them.
|
|
131
|
+
|
|
132
|
+
| Route | Sign-in | Refresh | Model rows |
|
|
133
|
+
|---|---|---|---|
|
|
134
|
+
| `cursor` | browser page + poll | on the credential seam | 123 |
|
|
135
|
+
| `devin` | paste the landed callback URL | none — sign in again | 2 |
|
|
136
|
+
| `google-gemini-cli` | loopback `8085` + paste fallback | on the credential seam | 7 |
|
|
137
|
+
| `google-antigravity` | loopback `51121` + paste fallback | on the credential seam | 22 |
|
|
138
|
+
| `factory-droid` | WorkOS device code (URL + user code) | one refresh in a 60 s window, keeps `orgId`/`region` | 62 |
|
|
139
|
+
| `gitlab-duo` | PKCE loopback `localhost:8080/callback`, no port fallback, paste fallback | one refresh in a 60 s window | 16 |
|
|
140
|
+
| `gitlab-duo-agent` | paste the `vscode://` URL | one refresh, echoes the `vscode` redirect | 1 |
|
|
141
|
+
|
|
142
|
+
<details>
|
|
143
|
+
<summary>Per-route notes</summary>
|
|
144
|
+
|
|
145
|
+
- **Cursor** — streams text and reasoning and hands tool calls to DSH's tool
|
|
146
|
+
loop; images are refused with a typed error. The client presents Cursor's
|
|
147
|
+
vendor-internal OAuth identity.
|
|
148
|
+
- **Devin** — no refresh: a static bearer whose expiry is derived from the token
|
|
149
|
+
(JWT `exp` minus five minutes, else one year), and without a readable expiry
|
|
150
|
+
the row shows `active` with a blank countdown column.
|
|
151
|
+
- **Google routes** — both share one generated `lib/omp/google.mjs` artifact yet
|
|
152
|
+
keep separate grants, account rows and catalogs. The grant is
|
|
153
|
+
`{access, refresh, expires, projectId, email?}`; sign-in resolves the Cloud
|
|
154
|
+
project the route bills, and a `legacy-tier` or paid account whose project
|
|
155
|
+
cannot be discovered fails `AUTH_FAILED` until `GOOGLE_CLOUD_PROJECT` (or
|
|
156
|
+
`GOOGLE_CLOUD_PROJECT_ID`) is set.
|
|
157
|
+
- **Factory Droid** — four wires behind one proxy, chosen by model id inside the
|
|
158
|
+
artifact; rows carry no base URL and the account's residency
|
|
159
|
+
(`orgId`/`region`) survives refresh.
|
|
160
|
+
- **GitLab Duo pair** — `gitlab-duo`'s direct-access token cache is keyed on the
|
|
161
|
+
GitLab token, so a rotated token misses it; `gitlab-duo-agent` re-seeds a
|
|
162
|
+
workflow per request and replays the transcript rather than resuming a socket.
|
|
163
|
+
|
|
164
|
+
</details>
|
|
275
165
|
|
|
276
166
|
### Selection and failure policy
|
|
277
167
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
while cooling, or within `recoveryGraceMs` after recovery, doubles the
|
|
287
|
-
next cooldown. A long healthy gap resets the escalation. The hard cap is
|
|
288
|
-
seven days.
|
|
289
|
-
- **Recovery**: the key is automatically selectable again when its cooldown
|
|
290
|
-
expires; no manual reset is required.
|
|
291
|
-
- **Delegation**: request-shaped failures such as
|
|
292
|
-
`CONTEXT_WINDOW_EXCEEDED` and cancellation never cool a key. When no
|
|
293
|
-
alternate key exists, the manager delegates to the composition's normal
|
|
294
|
-
retry/fallback policy.
|
|
168
|
+
| Mechanism | Behaviour |
|
|
169
|
+
|---|---|
|
|
170
|
+
| Sticky session | The first request of a session selects a key and binds it for that session/provider pair. Later requests reuse it. |
|
|
171
|
+
| Round robin | A new session advances the provider cursor and takes the next healthy key. |
|
|
172
|
+
| Retry | A failing request is retried on the same key `retryCount` times. Request-shaped failures such as `CONTEXT_WINDOW_EXCEEDED` and cancellation never cool a key. |
|
|
173
|
+
| Switch | After the retry budget is spent, the failing key is marked cooling, and the session is rebound to another healthy key. When no alternate key exists, the manager delegates to the composition's normal retry/fallback policy. |
|
|
174
|
+
| Cooldown | The first failure cools a key for `baseCooldownMs`. A failure while cooling, or within `recoveryGraceMs` after recovery, doubles the next cooldown; a long healthy gap resets the escalation. The hard cap is seven days. |
|
|
175
|
+
| Recovery | The key is automatically selectable again when its cooldown expires; no manual reset is required. |
|
|
295
176
|
|
|
296
177
|
## Configuration & data
|
|
297
178
|
|
|
@@ -303,8 +184,10 @@ $DSH_HOME/keys-manager/state.json
|
|
|
303
184
|
|
|
304
185
|
with owner-only permissions. It contains aliases, credential references,
|
|
305
186
|
health counters, session bindings, and provider adoption facts. API key
|
|
306
|
-
literals live only in the Harness credential store
|
|
307
|
-
|
|
187
|
+
literals live only in the Harness credential store; an account row follows the
|
|
188
|
+
same rule behind its `grantRef`, with only non-sensitive metadata (email,
|
|
189
|
+
account id, expiry) in the state. The file is written atomically through a
|
|
190
|
+
temporary file and a rename.
|
|
308
191
|
|
|
309
192
|
Each managed provider profile points its `apiKeyEnv` at a broker reference
|
|
310
193
|
such as `KEYSMGR_ZAI_CODING_CN_3FA2C1`. The Host credential layer answers that
|
|
@@ -312,7 +195,8 @@ reference per request with the session's selected key. The Models page sees
|
|
|
312
195
|
the profile as configured; writing directly to the broker reference is
|
|
313
196
|
refused with a pointer to the manager.
|
|
314
197
|
|
|
315
|
-
|
|
198
|
+
<details>
|
|
199
|
+
<summary>OAuth2 extension point</summary>
|
|
316
200
|
|
|
317
201
|
The state shape already distinguishes `kind: "api-key"` from `kind: "oauth"`
|
|
318
202
|
and keeps a nullable `oauth` object beside the credential reference. A future
|
|
@@ -321,42 +205,111 @@ rewriting existing rows. Providers whose only authentication is OAuth are
|
|
|
321
205
|
reported as unsupported in this version rather than being treated as API-key
|
|
322
206
|
providers.
|
|
323
207
|
|
|
324
|
-
|
|
208
|
+
</details>
|
|
209
|
+
|
|
210
|
+
## Provider coverage
|
|
325
211
|
|
|
326
|
-
|
|
212
|
+
Four groups, one pool:
|
|
327
213
|
|
|
328
|
-
- **DSH built-in**
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
- **
|
|
214
|
+
- **DSH built-in** — routes from the shipped DSH pi-ai catalog. The set follows
|
|
215
|
+
your installed DSH version, so the Models page is the authoritative list; four
|
|
216
|
+
of them are outside single-key pooling (below).
|
|
217
|
+
- **Plugin extra built-in** — 35 routes this plugin adds as ordinary
|
|
218
|
+
`llm-pi-ai` routes.
|
|
219
|
+
- **OAuth accounts** — 9 routes that join as an account instead of a pasted key:
|
|
220
|
+
seven use pi-ai's own flows, `kilo` and `zai` are signed in by the plugin's
|
|
221
|
+
bundled clients.
|
|
222
|
+
- **Transport routes** — 7 routes the vendored pi-ai cannot speak, served by
|
|
223
|
+
`dsh-llm-omp-transports`.
|
|
332
224
|
|
|
333
|
-
|
|
225
|
+
<details>
|
|
226
|
+
<summary>Supported — every plugin extra, OAuth account and transport route</summary>
|
|
227
|
+
|
|
228
|
+
**Plugin extra built-in — 35** — from
|
|
229
|
+
[oh-my-pi](https://github.com/can1357/oh-my-pi)'s provider catalog (MIT):
|
|
230
|
+
|
|
231
|
+
| Provider | Route id | API key env |
|
|
232
|
+
|---|---|---|
|
|
233
|
+
| DeepInfra | `deepinfra` | `DEEPINFRA_API_KEY` |
|
|
234
|
+
| Novita | `novita` | `NOVITA_API_KEY` |
|
|
235
|
+
| StepFun | `stepfun` | `STEPFUN_API_KEY` |
|
|
236
|
+
| SambaNova | `sambanova` | `SAMBANOVA_API_KEY` |
|
|
237
|
+
| Qianfan | `qianfan` | `QIANFAN_API_KEY` |
|
|
238
|
+
| GMI Cloud | `gmi-cloud` | `GMI_API_KEY` |
|
|
239
|
+
| Synthetic | `synthetic` | `SYNTHETIC_API_KEY` |
|
|
240
|
+
| ZenMux | `zenmux` | `ZENMUX_API_KEY` |
|
|
241
|
+
| Kilo Gateway | `kilo` | `KILO_API_KEY` |
|
|
242
|
+
| NanoGPT | `nanogpt` | `NANO_GPT_API_KEY` |
|
|
243
|
+
| Venice AI | `venice` | `VENICE_API_KEY` |
|
|
244
|
+
| AIML API | `aimlapi` | `AIMLAPI_API_KEY` |
|
|
245
|
+
| AI& | `aiand` | `AIAND_API_KEY` |
|
|
246
|
+
| Helmcode | `helmcode` | `HELMCODE_API_KEY` |
|
|
247
|
+
| Alibaba Coding Plan | `alibaba-coding-plan` | `ALIBABA_CODING_PLAN_API_KEY` |
|
|
248
|
+
| MiniMax Coding (Global) | `minimax-code` | `MINIMAX_CODE_API_KEY` |
|
|
249
|
+
| MiniMax Coding (CN) | `minimax-code-cn` | `MINIMAX_CODE_CN_API_KEY` |
|
|
250
|
+
| Umans AI Coding Plan | `umans` | `UMANS_AI_CODING_PLAN_API_KEY` |
|
|
251
|
+
| Sakana AI | `sakana` | `SAKANA_API_KEY` |
|
|
252
|
+
| CoralBricks | `coralbricks` | `CORAL_API_KEY` |
|
|
253
|
+
| Wafer Serverless | `wafer-serverless` | `WAFER_SERVERLESS_API_KEY` |
|
|
254
|
+
| Alibaba Token Plan | `alibaba-token-plan` | `ALIBABA_TOKEN_PLAN_API_KEY` |
|
|
255
|
+
| Alibaba Token Plan (CN) | `alibaba-token-plan-cn` | `BAILIAN_TOKEN_PLAN_API_KEY` |
|
|
256
|
+
| Charm Hyper | `charm-hyper` | `CHARM_HYPER_API_KEY`, `HYPER_API_KEY` |
|
|
257
|
+
| LiteLLM Proxy | `litellm` | `LITELLM_API_KEY` |
|
|
258
|
+
| SiliconFlow | `siliconflow` | `SILICONFLOW_API_KEY` |
|
|
259
|
+
| SiliconFlow (CN) | `siliconflow-cn` | `SILICONFLOW_CN_API_KEY` |
|
|
260
|
+
| Zhipu Coding Plan | `zhipu-coding-plan` | `ZHIPU_API_KEY` |
|
|
261
|
+
| Abliteration | `abliteration` | `ABLITERATION_API_KEY`, `ABLIT_KEY` |
|
|
262
|
+
| ClinePass | `cline-pass` | `CLINE_API_KEY` |
|
|
263
|
+
| Command Code | `commandcode` | `COMMAND_CODE_API_KEY`, `COMMANDCODE_API_KEY` |
|
|
264
|
+
| CoreWeave Serverless Inference | `coreweave` | `COREWEAVE_API_KEY` |
|
|
265
|
+
| Fire Pass | `firepass` | `FIREPASS_API_KEY` |
|
|
266
|
+
| Ollama Cloud | `ollama-cloud` | `OLLAMA_CLOUD_API_KEY` |
|
|
267
|
+
| Yolo Auto | `yolo-auto` | `YOLO_AUTO_API_KEY` |
|
|
268
|
+
|
|
269
|
+
Where two variables are listed, either is accepted; the first is the primary.
|
|
270
|
+
CoreWeave Serverless Inference also needs `COREWEAVE_PROJECT=<team>/<project>` in
|
|
271
|
+
the DSH process environment before it is added.
|
|
272
|
+
|
|
273
|
+
**OAuth accounts — 9**
|
|
274
|
+
|
|
275
|
+
| Provider | Route | Sign-in client |
|
|
276
|
+
|---|---|---|
|
|
277
|
+
| Anthropic | `anthropic` | pi-ai |
|
|
278
|
+
| GitHub Copilot | `github-copilot` | pi-ai |
|
|
279
|
+
| Kimi Coding | `kimi-coding` | pi-ai |
|
|
280
|
+
| OpenAI Codex | `openai-codex` | pi-ai |
|
|
281
|
+
| OpenRouter | `openrouter` | pi-ai |
|
|
282
|
+
| Radius | `radius` | pi-ai |
|
|
283
|
+
| xAI | `xai` | pi-ai |
|
|
284
|
+
| Kilo | `kilo` | plugin bundled client — device code + poll |
|
|
285
|
+
| Z.AI Coding Plan | `zai` | plugin bundled client — pasted `zcode://` redirect |
|
|
286
|
+
|
|
287
|
+
The two plugin-signed credentials are static, tagged `signin:kilo` /
|
|
288
|
+
`signin:zai-coding-plan`, and nothing is written to `llm-pi-ai/<provider>`; the
|
|
289
|
+
seven pi-ai rows are the provider's own grants. `kilo` is listed twice on
|
|
290
|
+
purpose: the same route takes an API key as an extra built-in and an account
|
|
291
|
+
through its bundled client.
|
|
292
|
+
|
|
293
|
+
**Transport routes — 7** — `cursor`, `devin`, `google-gemini-cli`,
|
|
294
|
+
`google-antigravity`, `factory-droid`, `gitlab-duo`, `gitlab-duo-agent`; sign-in,
|
|
295
|
+
refresh and model detail live in [Transport routes](#transport-routes).
|
|
296
|
+
|
|
297
|
+
</details>
|
|
298
|
+
|
|
299
|
+
<details>
|
|
300
|
+
<summary>Not pooled — 4 DSH built-ins</summary>
|
|
334
301
|
|
|
335
302
|
| Provider | Why |
|
|
336
303
|
|---|---|
|
|
337
304
|
| `amazon-bedrock` | AWS credential chain (profile, IAM keys, ECS/IRSA/EC2), not one API key |
|
|
338
305
|
| `cloudflare-ai-gateway` | API key plus a Cloudflare account ID and gateway ID |
|
|
339
306
|
| `cloudflare-workers-ai` | API key plus a Cloudflare account ID |
|
|
340
|
-
| `openai-codex` | ChatGPT OAuth sign-in only; no API-key credential — usable as an [OAuth account](#
|
|
341
|
-
|
|
342
|
-
All other DSH catalog routes expose an API-key credential. Providers that
|
|
343
|
-
also support OAuth (Anthropic, GitHub Copilot, Kimi Coding, OpenAI Codex,
|
|
344
|
-
OpenRouter, Radius, xAI) remain manageable through their API-key path, and
|
|
345
|
-
their OAuth sign-in is available as [OAuth accounts](#oauth-accounts).
|
|
346
|
-
|
|
347
|
-
## Repository layout
|
|
348
|
-
|
|
349
|
-
This repository is a pnpm workspace with two published packages:
|
|
307
|
+
| `openai-codex` | ChatGPT OAuth sign-in only; no API-key credential — usable as an [OAuth account](#accounts-and-sign-in) instead of a key |
|
|
350
308
|
|
|
351
|
-
|
|
352
|
-
|---|---|---|
|
|
353
|
-
| root | `dsh-keys-manager` | Host plugin, Keys Manager Web client, bundle patch |
|
|
354
|
-
| `packages/llm-omp` | `dsh-llm-omp-transports` | Cursor, Devin and Google transport component |
|
|
309
|
+
</details>
|
|
355
310
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
it. Both packages are released together and carry the same version; see
|
|
359
|
-
[Release](docs/release.md).
|
|
311
|
+
Every other DSH catalog route exposes an API-key credential; a route you declare
|
|
312
|
+
yourself in the profile (`自定义` / Custom) is pooled like any built-in.
|
|
360
313
|
|
|
361
314
|
## Documentation
|
|
362
315
|
|
|
@@ -364,14 +317,11 @@ it. Both packages are released together and carry the same version; see
|
|
|
364
317
|
|---|---|
|
|
365
318
|
| [Development](docs/development.md) | build and dev workflow, repository layout |
|
|
366
319
|
| [Release](docs/release.md) | CI checks and the npm release flow |
|
|
367
|
-
| [Known limits](docs/known-limits.md) | current design boundaries, including
|
|
320
|
+
| [Known limits](docs/known-limits.md) | current design boundaries, including the seven transport routes |
|
|
368
321
|
| [Transports package](packages/llm-omp/README.md) | Transport routes: support status, risks, build/test, release |
|
|
369
322
|
|
|
370
|
-
Chinese
|
|
371
|
-
files in `docs/` — [开发](docs/development.zh-CN.md) ·
|
|
323
|
+
Chinese: [README.zh-CN.md](README.zh-CN.md) · [开发](docs/development.zh-CN.md) ·
|
|
372
324
|
[发布](docs/release.zh-CN.md) · [已知限制](docs/known-limits.zh-CN.md).
|
|
373
|
-
Current design boundaries at a glance:
|
|
374
|
-
[Known limits](docs/known-limits.md).
|
|
375
325
|
|
|
376
326
|
## License
|
|
377
327
|
|