@magpie-community/opencode-zcode-auth 0.1.13 → 0.1.14
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 +4 -1
- package/index.mjs +13 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -120,7 +120,10 @@ minutes. When the config can't be read, the plugin falls back to this list:
|
|
|
120
120
|
| GLM-5.2 | 1M | 128K | none, high, max |
|
|
121
121
|
| GLM-5-Turbo | 200K | 64K | none, high |
|
|
122
122
|
|
|
123
|
-
The Start Plan has all of these except GLM-5.3.
|
|
123
|
+
The Start Plan's config has all of these except GLM-5.3. An account
|
|
124
|
+
with no GLM Coding Plan also lists every model its gift plans serve under
|
|
125
|
+
the model's own name, as ZCode does (the Start Plan's GLM-5.3 bucket makes
|
|
126
|
+
GLM-5.3 a model), since all of its requests go to the gift anyway.
|
|
124
127
|
|
|
125
128
|
A gift plan's models appear again as `<model>-Trial` entries, so a
|
|
126
129
|
request can spend the gift's quota on purpose. A trial entry is listed
|
package/index.mjs
CHANGED
|
@@ -1421,12 +1421,22 @@ export async function ZCodeAuthPlugin({ client }) {
|
|
|
1421
1421
|
if (fell) ms = start ? START_MODELS : MODELS
|
|
1422
1422
|
const url = s.base + "/v1"
|
|
1423
1423
|
const out = Object.fromEntries(ms.map((m) => [m.id, model(m, url)]))
|
|
1424
|
-
const details = [...ms, ...modelsOf(cfg, planID(START_BASE)), ...
|
|
1424
|
+
const details = [...ms, ...modelsOf(cfg, planID(START_BASE)), ...modelsOf(cfg, planID(ZAI_BASE)), ...MODELS]
|
|
1425
|
+
const about = (raw) => details.find((m) => m.id.toLowerCase() === raw.toLowerCase()) ?? { efforts: [] }
|
|
1426
|
+
const has = new Set(Object.keys(out).map((id) => id.toLowerCase()))
|
|
1425
1427
|
for (const raw of giftNames(gift)) {
|
|
1428
|
+
// a gift-only account's models are its gift's, by their own
|
|
1429
|
+
// names, as ZCode lists them (its Start Plan's GLM-5.3, which the
|
|
1430
|
+
// plan's config leaves out): every request of it goes to the gift
|
|
1431
|
+
// anyway, and the card counts them by that name too (#1261)
|
|
1432
|
+
if (start && !has.has(raw.toLowerCase())) {
|
|
1433
|
+
const plain = about(raw).id ?? raw
|
|
1434
|
+
has.add(raw.toLowerCase())
|
|
1435
|
+
out[plain] = model({ ...about(raw), id: plain }, url)
|
|
1436
|
+
}
|
|
1426
1437
|
const id = giftID(raw)
|
|
1427
1438
|
if (out[id]) continue
|
|
1428
|
-
|
|
1429
|
-
out[id] = model({ ...m, id }, url)
|
|
1439
|
+
out[id] = model({ ...about(raw), id }, url)
|
|
1430
1440
|
}
|
|
1431
1441
|
if (fell) out[Symbol.for("magpie.fellBack")] = true
|
|
1432
1442
|
return out
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magpie-community/opencode-zcode-auth",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "OpenCode provider plugin: signs in to Z.ai's or BigModel's (智谱) GLM Coding Plan as ZCode does, including team seats and ZCode's Start Plan",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.mjs",
|