dsh-sub2api 0.3.0 → 0.4.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 +23 -0
- package/README.md +17 -5
- package/lib/adapter.js +4 -4
- package/lib/client.js +545 -348
- package/lib/commands.js +6 -6
- package/lib/constants.js +1 -1
- package/lib/index.js +2 -2
- package/lib/pay.js +5 -1
- package/lib/sub2api/auth.js +1 -1
- package/lib/sub2api/session.js +1 -1
- package/lib/tools.js +4 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
- The panel shows the site as **Psapi** instead of Sub2API, matching the
|
|
6
|
+
rebranded site. Internal identifiers are untouched: the provider id stays
|
|
7
|
+
`sub2api`, so existing sessions and model selections keep working.
|
|
8
|
+
- The account card no longer shows the concurrency limit.
|
|
9
|
+
- The pay-centre error matcher accepts either spelling, since the gateway and
|
|
10
|
+
the billing page are deployed separately and can drift.
|
|
11
|
+
|
|
12
|
+
## 0.4.0 — panel rebuilt around what people actually check
|
|
13
|
+
|
|
14
|
+
- A status header answers "connected? funded? how many models?" in one line,
|
|
15
|
+
with 刷新 and 充值 where the eye lands. Everything else is folded below it.
|
|
16
|
+
- Sections collapse: 模型 open by default (that is what people change), 充值
|
|
17
|
+
opens itself when the balance hits zero, 密钥 / 账户 / 诊断 stay out of the way.
|
|
18
|
+
Each collapsed header still carries the fact you would open it for — the masked
|
|
19
|
+
key, the email, the balance.
|
|
20
|
+
- Per-action pending state: refreshing models no longer greys out the whole page.
|
|
21
|
+
- Toasts confirm what happened (copied, synced N models, selection saved, key
|
|
22
|
+
rebuilt, redeemed).
|
|
23
|
+
- The redeem field moved behind 有兑换码?, so the common path is two clicks.
|
|
24
|
+
- Diagnostics no longer owns a card of its own on first paint.
|
|
25
|
+
|
|
3
26
|
## 0.3.0
|
|
4
27
|
|
|
5
28
|
- **Balance badge in the chat input's bottom-right corner**
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# dsh-sub2api
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
把自建的 **Psapi**(`sub.pscly.cc`,网关软件是开源的 [sub2api](https://github.com/Wei-Shaw/sub2api))接进 DeepSeek Harness(DSH)。
|
|
4
4
|
|
|
5
|
-
装完之后,在 **设置 →
|
|
5
|
+
装完之后,在 **设置 → Psapi** 里填一次邮箱和密码就能用:插件自己判断该登录还是注册,注册后自动创建名为 `dsh` 的 API 密钥、写进本机凭据库,并把上游模型同步进模型选择器。余额、用量、订阅、兑换码、充值和技术支持都在同一个面板里。
|
|
6
6
|
|
|
7
7
|
```
|
|
8
8
|
npm: dsh-sub2api https://www.npmjs.com/package/dsh-sub2api
|
|
@@ -33,7 +33,7 @@ dsh plugin --profile web add dsh-sub2api
|
|
|
33
33
|
|
|
34
34
|
也可以直接在 **插件 → 添加插件** 里搜 `dsh-sub2api`。
|
|
35
35
|
|
|
36
|
-
重启后打开 **设置 →
|
|
36
|
+
重启后打开 **设置 → Psapi**。
|
|
37
37
|
|
|
38
38
|
### 从 GitHub 装
|
|
39
39
|
|
|
@@ -82,9 +82,21 @@ dsh plugin add dsh-sub2api
|
|
|
82
82
|
|
|
83
83
|
## 面板
|
|
84
84
|
|
|
85
|
+
打开就是一行状态:**连接状态、余额、可用模型数**,右边两个按钮「刷新」「充值」。下面按需要展开:
|
|
86
|
+
|
|
87
|
+
| 区块 | 默认 | 里面有什么 |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| 模型 | **展开** | 已选几个、刷新、管理(勾选 + 逐模型上下文容量) |
|
|
90
|
+
| 充值 | 余额为 0 时自动展开 | 金额预设、预计到账、去支付、兑换码(默认收起) |
|
|
91
|
+
| API 密钥 | 收起 | 掩码、复制、重建 |
|
|
92
|
+
| 账户与用量 | 收起 | 今日/累计用量、订阅进度条、退出登录 |
|
|
93
|
+
| 诊断 | 收起 | 六项检查 |
|
|
94
|
+
|
|
95
|
+
操作有回执:复制、刷新、保存选择、兑换、重建密钥都会在右上角弹一条提示;每个按钮只管自己的忙碌状态,不会因为别处刷新就整页变灰。
|
|
96
|
+
|
|
85
97
|
### 账户
|
|
86
98
|
|
|
87
|
-
|
|
99
|
+
邮箱、余额、今日/累计用量,以及订阅进度条(日/周/月)。并发数不展示(站点侧也已对用户隐藏)。未登录时是登录表单:一个邮箱 + 一个密码 + 一个「继续」按钮。
|
|
88
100
|
|
|
89
101
|
**一个表单两种结果**:先试登录,只有「凭据错误」才自动注册。所以
|
|
90
102
|
|
|
@@ -191,7 +203,7 @@ Agent 工具(只读):`sub2api_status`、`sub2api_models`。模型可以回
|
|
|
191
203
|
|
|
192
204
|
### 2. 余额为 0 拿不到模型,到账后自动同步
|
|
193
205
|
|
|
194
|
-
|
|
206
|
+
Psapi 的网关对 `/v1/models` 有余额门槛,零余额直接 `403 INSUFFICIENT_BALANCE`:
|
|
195
207
|
|
|
196
208
|
```
|
|
197
209
|
[200] POST /api/v1/keys → 正常返回明文 key
|
package/lib/adapter.js
CHANGED
|
@@ -87,7 +87,7 @@ export class Sub2ApiAdapter extends LlmAdapter {
|
|
|
87
87
|
connections: liveRef(() => [
|
|
88
88
|
{
|
|
89
89
|
id: PROVIDER,
|
|
90
|
-
name: "
|
|
90
|
+
name: "Psapi",
|
|
91
91
|
baseUrl: `${deps.apiBase()}/v1`,
|
|
92
92
|
apiKeyRef: deps.apiKeyEnv(),
|
|
93
93
|
},
|
|
@@ -95,7 +95,7 @@ export class Sub2ApiAdapter extends LlmAdapter {
|
|
|
95
95
|
llmRoutes: liveRef(() => [
|
|
96
96
|
{
|
|
97
97
|
id: PROVIDER,
|
|
98
|
-
name: "
|
|
98
|
+
name: "Psapi",
|
|
99
99
|
connection: PROVIDER,
|
|
100
100
|
models: deps.catalog.llmModels(),
|
|
101
101
|
maxCompletionTokens: false,
|
|
@@ -116,7 +116,7 @@ export class Sub2ApiAdapter extends LlmAdapter {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
providerInfo(provider) {
|
|
119
|
-
return { id: provider, name: "
|
|
119
|
+
return { id: provider, name: "Psapi" };
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
async listModels(provider) {
|
|
@@ -155,7 +155,7 @@ export class Sub2ApiAdapter extends LlmAdapter {
|
|
|
155
155
|
// An empty `models` array still yields a route object; without this check
|
|
156
156
|
// the transport would build a request with no model and fail at the wire.
|
|
157
157
|
if (route === undefined || route.models.length === 0) {
|
|
158
|
-
throw new Sub2ApiError("尚未同步到可用模型,请先在
|
|
158
|
+
throw new Sub2ApiError("尚未同步到可用模型,请先在 Psapi 面板登录或刷新模型", {
|
|
159
159
|
code: "no_models",
|
|
160
160
|
});
|
|
161
161
|
}
|