@magpie-community/opencode-qoder-auth 0.2.45 → 0.2.47
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 +21 -0
- package/index.mjs +33 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -208,6 +208,14 @@ app's Fast from 2026-10-12:
|
|
|
208
208
|
|
|
209
209
|
Every model speaks chat completions (`@ai-sdk/openai-compatible`).
|
|
210
210
|
|
|
211
|
+
Every model a site ships also says, either way, whether it takes images:
|
|
212
|
+
`attachment` and `modalities.input` are set on every `config` entry, image
|
|
213
|
+
or no image. A kind left out is not "text only" to magpie but "the vendor
|
|
214
|
+
didn't say", and magpie then falls back to models.dev's vote by bare model
|
|
215
|
+
ID — where a same-named model of another vendor may take images, so this
|
|
216
|
+
one gets sent them. QwenWork's three models and Qoder CN's Lite shipped no
|
|
217
|
+
image key; since 0.2.47 they say text alone.
|
|
218
|
+
|
|
211
219
|
## Qoder CN
|
|
212
220
|
|
|
213
221
|
`qoder-cn` is for accounts on [qoder.cn](https://qoder.cn), the China site.
|
|
@@ -472,6 +480,19 @@ the plugin factory and its pieces, for another service on this same
|
|
|
472
480
|
protocol (QwenWork ships here; a future one can too). Its shape is not a
|
|
473
481
|
stable API — it changes as the packages on it need.
|
|
474
482
|
|
|
483
|
+
## Free models when the credits run out
|
|
484
|
+
|
|
485
|
+
Qoder serves its free models after the credits are used up: "When Credits
|
|
486
|
+
run out, you can continue using free basic models, subject to daily and
|
|
487
|
+
monthly limits" ([docs.qoder.com/Credits](https://docs.qoder.com/Credits);
|
|
488
|
+
the zh page says the same). So the credit windows the usage hook gives
|
|
489
|
+
(Qoder and Qoder CN, since 0.2.46) name the account's free models in
|
|
490
|
+
`notModels`: a model listed at 0× (not a discount's 0 for a while), from the
|
|
491
|
+
account's own model list. magpie then doesn't count those models as spent
|
|
492
|
+
on a used-up account, or on a free account's "0 credits left". A list that
|
|
493
|
+
can't be read leaves every model counted. QwenWork reads its usage
|
|
494
|
+
elsewhere and is not changed.
|
|
495
|
+
|
|
475
496
|
## Not here
|
|
476
497
|
|
|
477
498
|
- Qoder's usage and quota display.
|
package/index.mjs
CHANGED
|
@@ -674,10 +674,20 @@ async function fetchListing(site, cred) {
|
|
|
674
674
|
}
|
|
675
675
|
|
|
676
676
|
function configModel(m) {
|
|
677
|
+
const images = !!m.images
|
|
677
678
|
return {
|
|
678
679
|
name: m.name,
|
|
679
680
|
limit: { context: m.context ?? 0, output: 0 },
|
|
680
|
-
|
|
681
|
+
// Said either way, image or no image. A kind left out is not "text only"
|
|
682
|
+
// to magpie: it is "the vendor didn't say", and magpie then falls back to
|
|
683
|
+
// models.dev's vote by bare model id — where a same-named model of
|
|
684
|
+
// another vendor may take images, so a text-only one here is sent them
|
|
685
|
+
// (the same mistake codearts 0.2.3 made, fixed there in 0.2.4). The list
|
|
686
|
+
// a site ships is what magpie has before anyone signs in, and what it
|
|
687
|
+
// keeps when a listing can't be fetched (provider.models falls back to
|
|
688
|
+
// it), so those models are the ones most likely to be asked for an image.
|
|
689
|
+
attachment: images,
|
|
690
|
+
modalities: { input: images ? ["text", "image"] : ["text"], output: ["text"] },
|
|
681
691
|
...(m.efforts?.length ? { reasoning: true, variants: Object.fromEntries(m.efforts.map((e) => [e, { reasoningEffort: e }])) } : {}),
|
|
682
692
|
tool_call: true,
|
|
683
693
|
}
|
|
@@ -2515,6 +2525,26 @@ const makePlugin = (site) => async ({ client }) => {
|
|
|
2515
2525
|
return dt.token
|
|
2516
2526
|
})
|
|
2517
2527
|
|
|
2528
|
+
// spareFree has the credit windows not count the models that cost none
|
|
2529
|
+
// (notModels): Qoder's own docs say "When Credits run out, you can
|
|
2530
|
+
// continue using free basic models, subject to daily and monthly limits"
|
|
2531
|
+
// (docs.qoder.com/Credits; the zh page the same: "Credits 用尽后,仍可使用
|
|
2532
|
+
// 免费基础模型"). Counted, a plan used up (or a free account's "0 credits
|
|
2533
|
+
// left") put the account last for Qwen3.8-Flash and DeepSeek-Flash too,
|
|
2534
|
+
// which it still serves (coeo91 on Discord). Free is the listing's own
|
|
2535
|
+
// price (freeOf: 0×, not a discount's 0 for a while). A listing that can't
|
|
2536
|
+
// be read leaves every model counted, as before. Qoder and Qoder CN only:
|
|
2537
|
+
// QwenWork reads its usage elsewhere and says nothing of free models.
|
|
2538
|
+
const spareFree = async (cred, out) => {
|
|
2539
|
+
if (!out?.windows?.length) return out
|
|
2540
|
+
let free = []
|
|
2541
|
+
try {
|
|
2542
|
+
free = (await models(cred)).filter((m) => m.free).map((m) => m.key)
|
|
2543
|
+
} catch {}
|
|
2544
|
+
if (free.length) for (const w of out.windows) w.notModels = free
|
|
2545
|
+
return out
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2518
2548
|
// usage is the account's allowance, magpie's own hook. signIn is what the read means for the sign-in, as the built-in's did:
|
|
2519
2549
|
// a refused job refresh marks it, a renewed one clears it, and nothing
|
|
2520
2550
|
// else does — not a clean read, nor a refused device token, which serves
|
|
@@ -2562,7 +2592,7 @@ const makePlugin = (site) => async ({ client }) => {
|
|
|
2562
2592
|
// no second token here to rotate and retry with.
|
|
2563
2593
|
if (cred.patAuth && !cred.deviceToken) {
|
|
2564
2594
|
const env = await fetchUsage(siteOf(site, cred), cred.access)
|
|
2565
|
-
return { ...parseUsage(env), signIn }
|
|
2595
|
+
return { ...(await spareFree(cred, parseUsage(env))), signIn }
|
|
2566
2596
|
}
|
|
2567
2597
|
let env
|
|
2568
2598
|
try {
|
|
@@ -2571,7 +2601,7 @@ const makePlugin = (site) => async ({ client }) => {
|
|
|
2571
2601
|
if (!(e instanceof UsageStatus) || (e.status !== 401 && e.status !== 403)) throw e
|
|
2572
2602
|
env = await fetchUsage(siteOf(site, cred), await deviceToken(getAuth, cred.deviceToken))
|
|
2573
2603
|
}
|
|
2574
|
-
return { ...parseUsage(env), signIn }
|
|
2604
|
+
return { ...(await spareFree(cred, parseUsage(env))), signIn }
|
|
2575
2605
|
} catch (e) {
|
|
2576
2606
|
return { error: e?.message ?? String(e), signIn: e?.expired ? "expired" : signIn }
|
|
2577
2607
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magpie-community/opencode-qoder-auth",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.47",
|
|
4
4
|
"description": "Qoder and QwenWork (千问办公) subscriptions in OpenCode and magpie: qoder.com, qoder.cn, gateway.qwenwork.cn and the enterprise flagship (VPC)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.mjs",
|