@magpie-community/opencode-opendesign-auth 0.1.8 → 0.1.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/README.md CHANGED
@@ -58,9 +58,9 @@ is there for a machine that can't open the approval page.
58
58
  Nothing is listed per account at request time from anywhere but the vendor:
59
59
  magpie calls the plugin's `provider.models`, which reads `amr-link`'s live
60
60
  `/v1/models` at that account's key on every listing, so what a signed-in
61
- account is offered is what its plan entitles it to right now. Limits, input
62
- modalities and the vendor's own cost words (`rate`, e.g. `x0.5` for "low")
63
- come from that same catalog.
61
+ account is offered is what its plan entitles it to right now. Limits and
62
+ input modalities come from that same catalog; the quota multiplier (`rate`)
63
+ comes from `rates.mjs`, the plan's own table (below).
64
64
 
65
65
  Reasoning levels are not in the catalog, so `models.mjs` records the ones
66
66
  measured against `amr-link` (#137): every model took `reasoning_effort`
@@ -69,6 +69,33 @@ catalog calls `standard` too. Those models reason at `low` and `high`;
69
69
  GPT-6 Luna has no levels. A model the seed doesn't know reasons when its
70
70
  vendor tier is `advanced`, with no levels until it is measured.
71
71
 
72
+ `deepseek-v4.1-flash-eco` is the same model on the low-priority, high-quota
73
+ schedule (the vendor's announcement: 模型效果完全无损), so `models.mjs` gives
74
+ it DeepSeek V4.1 Flash's limits, input kinds and levels; only the quota
75
+ multiplier differs (0.27× against 0.5×).
76
+
77
+ ### Quota multipliers
78
+
79
+ `rate` is the plan's deduction multiplier — what one dollar of model spend
80
+ takes out of the Design Plan allowance — not the catalog's cost word. The
81
+ table in `rates.mjs` is the vendor's published one,
82
+ [模型额度与使用说明](https://open-design.ai/zh/model-credits/) (read
83
+ 2026-11-06; Go, Plus, Pro and Max carry the same table):
84
+
85
+ | Model | Rate |
86
+ | --- | --- |
87
+ | DeepSeek V4.1 Flash | 0.5× |
88
+ | DeepSeek V4.1 Flash Eco | 0.27× |
89
+ | DeepSeek V4 Flash, DeepSeek V4 Flash Vision Exp, DeepSeek V4 Pro, GLM-5.3 Flash, Hy4 Preview, Kimi K2.7 Code, MiMo V2.6 Flash, MiMo V2.6 Pro, MiniMax M3.1 Flash | 1× |
90
+ | Claude Haiku 5.5, GLM-5.3 Flash-X | 2× |
91
+ | GPT-6 Luna | 4× |
92
+
93
+ The catalog's own cost words stay as the fallback for a model the table
94
+ doesn't name yet; they disagree with the plan for most models (Claude Haiku
95
+ 5.5 and GPT-6 Luna are "low" there but 2× and 4× here). DeepSeek V4.1
96
+ Flash's 0.25× "限时谷价" row is a time-limited promotional price, not a
97
+ second model id, so the model keeps 0.5×.
98
+
72
99
  `models.mjs` is the seed the provider has *before* anyone signs in. Refresh
73
100
  it from the live catalog with:
74
101
 
package/index.mjs CHANGED
@@ -17,6 +17,7 @@ import { hostname } from "node:os"
17
17
  import pkg from "./package.json" with { type: "json" }
18
18
 
19
19
  import { MODELS } from "./models.mjs"
20
+ import { RATES } from "./rates.mjs"
20
21
 
21
22
  const ID = "opendesign"
22
23
  const CONTROL = "https://amr-api.open-design.ai"
@@ -49,11 +50,21 @@ const TIMEOUT = 20_000
49
50
  const HOUR = 3600
50
51
  const WEEK = 7 * 24 * HOUR
51
52
 
52
- // The vendor's spending words as magpie's rate, and its quality words as
53
+ // The vendor's spending words as magpie's rate — the fallback only now: the
54
+ // plan's real deduction multipliers are the table rates.mjs holds, and the
55
+ // catalog's words disagree with it for most models. Its quality words say
53
56
  // whether the model thinks before it answers.
54
57
  const COST = { low: "x0.5", medium: "x1", high: "x2", very_high: "x4" }
55
58
  const THINKING = { advanced: true, standard: false }
56
59
 
60
+ // rateOf is a model's quota multiplier as magpie reads a rate ("x0.5"): the
61
+ // plan's own multiplier when rates.mjs names the model, and its catalog cost
62
+ // word for one the table doesn't name yet.
63
+ const rateOf = (id, m) => {
64
+ const named = RATES[id]
65
+ return named === undefined ? COST[text(m?.cost)] : "x" + named
66
+ }
67
+
57
68
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms))
58
69
  const text = (v) => (typeof v === "string" && v.trim() ? v.trim() : "")
59
70
 
@@ -275,7 +286,7 @@ function levelsOf(m) {
275
286
  // "advanced". variants are its levels as @ai-sdk/openai options: magpie
276
287
  // shows a model's levels only from its variants, and only when it reasons.
277
288
  function modelOf(id, m) {
278
- const rate = COST[text(m?.cost)]
289
+ const rate = rateOf(id, m)
279
290
  const levels = levelsOf(m)
280
291
  const thinking = levels.length > 0 || (THINKING[text(m?.capability)] ?? !!m?.reasoning)
281
292
  const context = Number(m?.context)
@@ -430,12 +441,14 @@ export const OpenDesignAuthPlugin = async () => {
430
441
  config: async (cfg) => {
431
442
  cfg.provider ??= {}
432
443
  const was = cfg.provider[ID] ?? {}
433
- // the wire is this plugin's to declare, never a kept copy's: magpie
434
- // hands back what the hook last wrote, and a model kept from 0.1.5
435
- // would otherwise stay on the Responses API it chose for every model
444
+ // the wire and the quota multiplier are this plugin's to declare, never
445
+ // a kept copy's: magpie hands back what the hook last wrote, and a model
446
+ // kept from an earlier version would otherwise stay on the Responses API
447
+ // it chose for every model, or on a rate the plan no longer charges
436
448
  const models = { ...seed(), ...(was.models ?? {}) }
437
449
  for (const [id, m] of Object.entries(models)) {
438
- models[id] = { ...m, api: { ...(m.api ?? {}), npm: wireOf(id) }, provider: { ...(m.provider ?? {}), npm: wireOf(id) } }
450
+ const rate = RATES[id] === undefined ? undefined : "x" + RATES[id]
451
+ models[id] = { ...m, api: { ...(m.api ?? {}), npm: wireOf(id) }, provider: { ...(m.provider ?? {}), npm: wireOf(id) }, ...(rate && { rate }) }
439
452
  }
440
453
  cfg.provider[ID] = {
441
454
  name: "Open Design",
@@ -505,4 +518,4 @@ export const OpenDesignAuthPlugin = async () => {
505
518
 
506
519
  // _internal is what the tests read through; magpie calls every exported
507
520
  // function as a plugin, so only the plugin itself is exported bare.
508
- export const _internal = { authOf, allowances, controlKeyOf, credits, modelsOf, money, runtimeKeyOf, said, startDevice, thePlan, usedPercent, waitForDevice, windowName, when, workspaceOf }
521
+ export const _internal = { authOf, allowances, controlKeyOf, credits, modelsOf, money, rateOf, runtimeKeyOf, said, startDevice, thePlan, usedPercent, waitForDevice, windowName, when, workspaceOf }
package/models.mjs CHANGED
@@ -6,10 +6,11 @@
6
6
  //
7
7
  // name: what the model is called; context/output: its token limits; input:
8
8
  // the non-text modalities it takes; cost and capability: the vendor's own
9
- // words, which the plugin turns into magpie's rate and thinking flags;
10
- // efforts: the reasoning levels amr-link was seen to take and think at,
11
- // measured, not read (#137; max too, plugins#141: the vendor names low, high
12
- // and max when asked for one it doesn't take), so a refresh keeps them.
9
+ // words, which the plugin turns into magpie's thinking flag (the rate is
10
+ // rates.mjs's, the plan's own deduction multiplier); efforts: the reasoning
11
+ // levels amr-link was seen to take and think at, measured, not read (#137;
12
+ // max too, plugins#141: the vendor names low, high and max when asked for one
13
+ // it doesn't take), so a refresh keeps them.
13
14
 
14
15
  export const MODELS = {
15
16
  "claude-haiku-5.5": { name: "Claude Haiku 5.5", context: 1000000, output: 132000, input: ["image", "file"], cost: "low", capability: "standard", efforts: ["low", "high", "max"] },
@@ -17,6 +18,9 @@ export const MODELS = {
17
18
  "deepseek-v4-flash-vision-exp": { name: "DeepSeek V4 Flash Vision (exp)", context: 1048000, output: 232000, input: ["image"], cost: "medium", capability: "standard", efforts: ["low", "high", "max"] },
18
19
  "deepseek-v4-pro": { name: "DeepSeek V4 Pro", context: 1048000, output: 232000, cost: "high", capability: "advanced", efforts: ["low", "high", "max"] },
19
20
  "deepseek-v4.1-flash": { name: "DeepSeek V4.1 Flash", context: 1048000, output: 232000, input: ["image"], cost: "low", capability: "advanced", efforts: ["low", "high", "max"] },
21
+ // the same model on the low-priority, high-quota schedule: same limits, same
22
+ // measured levels as the line above (its rate, 0.27×, is rates.mjs's)
23
+ "deepseek-v4.1-flash-eco": { name: "DeepSeek V4.1 Flash Eco", context: 1048000, output: 232000, input: ["image"], cost: "low", capability: "advanced", efforts: ["low", "high", "max"] },
20
24
  "glm-5.3-flash": { name: "GLM 5.3 Flash", context: 1048000, output: 232000, input: ["image", "video"], cost: "low", capability: "advanced", efforts: ["low", "high", "max"] },
21
25
  "glm-5.3-flashx": { name: "GLM 5.3 FlashX", context: 1000000, output: 232000, input: ["image", "file", "video"], cost: "medium", capability: "advanced", efforts: ["low", "high", "max"] },
22
26
  "gpt-6-luna": { name: "GPT-6 Luna", context: 1050000, output: 304000, input: ["image", "file"], cost: "low", capability: "standard", efforts: [] },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-opendesign-auth",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Open Design Cloud (Design Plan) in OpenCode and magpie: the account's device sign-in, its models, and the plan's 5-hour and 7-day allowance",
5
5
  "type": "module",
6
6
  "main": "./opencode.mjs",
@@ -9,6 +9,7 @@
9
9
  "opencode.mjs",
10
10
  "opencode2.mjs",
11
11
  "models.mjs",
12
+ "rates.mjs",
12
13
  "refresh-models.mjs",
13
14
  "README.md"
14
15
  ],
package/rates.mjs ADDED
@@ -0,0 +1,34 @@
1
+ // The Design Plan's own deduction multipliers — the "额度扣除倍率" table that
2
+ // https://open-design.ai/zh/model-credits/ publishes (read 2026-11-06; Go,
3
+ // Plus, Pro and Max carry the same table). A rate is what one dollar of model
4
+ // spend takes out of the plan's allowance: 0.27× is cheaper than 1×, 4× is
5
+ // four times dearer.
6
+ //
7
+ // The catalog's cost words are a different thing, and mostly disagree:
8
+ // amr-link calls Claude Haiku 5.5 and GPT-6 Luna "low" while the plan charges
9
+ // 2× and 4× for them, calls GLM-5.3 Flash and MiMo V2.6 Flash "low" while the
10
+ // plan charges 1×, and calls DeepSeek V4 Pro "high" and GLM-5.3 Flash-X
11
+ // "medium" while the plan charges 1× and 2×. So a rate read off those words is
12
+ // wrong for most models; the table below wins, and only a model it doesn't
13
+ // name (a new one) falls back to its catalog word.
14
+ //
15
+ // DeepSeek V4.1 Flash's 0.25× "限时谷价" / "Off-peak promo" row is a
16
+ // time-limited promotional price, not a second model id; the model keeps 0.5×.
17
+ // DeepSeek V4.1 Flash Eco is the same model on the low-priority, high-quota
18
+ // schedule (the vendor's announcement: 模型效果完全无损), charged 0.27×.
19
+ export const RATES = {
20
+ "claude-haiku-5.5": 2,
21
+ "deepseek-v4-flash": 1,
22
+ "deepseek-v4-flash-vision-exp": 1,
23
+ "deepseek-v4-pro": 1,
24
+ "deepseek-v4.1-flash": 0.5,
25
+ "deepseek-v4.1-flash-eco": 0.27,
26
+ "glm-5.3-flash": 1,
27
+ "glm-5.3-flashx": 2,
28
+ "gpt-6-luna": 4,
29
+ "hy4-preview": 1,
30
+ "kimi-k2.7-code": 1,
31
+ "mimo-v2.6-flash": 1,
32
+ "mimo-v2.6-pro": 1,
33
+ "minimax-m3.1-flash": 1,
34
+ }
@@ -95,9 +95,10 @@ const header = `// The models an account is offered before anyone has signed in
95
95
  //
96
96
  // name: what the model is called; context/output: its token limits; input:
97
97
  // the non-text modalities it takes; cost and capability: the vendor's own
98
- // words, which the plugin turns into magpie's rate and thinking flags;
99
- // efforts: the reasoning levels amr-link was seen to take and think at,
100
- // measured, not read (#137), so a refresh keeps them.
98
+ // words, which the plugin turns into magpie's thinking flag (the rate is
99
+ // rates.mjs's, the plan's own deduction multiplier); efforts: the reasoning
100
+ // levels amr-link was seen to take and think at, measured, not read (#137),
101
+ // so a refresh keeps them.
101
102
 
102
103
  export const MODELS = {
103
104
  ${lines.join("\n")}