From 6549b6335d6031ad589801a14552330740a84b09 Mon Sep 17 00:00:00 2001 From: Bernardxu123 <290490870@163.com> Date: Fri, 6 Nov 2026 20:18:20 +0800 Subject: [PATCH] opendesign 0.1.9: the plan's own credit multipliers, and V4.1 Flash Eco (#794) A model's rate is now the Design Plan's own deduction multiplier from open-design.ai/zh/model-credits/ (rates.mjs), not amr-link's catalog cost word, which disagreed for seven models (Claude Haiku 5.5 2x, GPT-6 Luna 4x, DeepSeek V4 Pro 1x, ...). A model the table doesn't name keeps its catalog word. deepseek-v4.1-flash-eco joins the seed with V4.1 Flash's limits and levels at 0.27x. Reviewed at 0335afb86a9afb53a576813445c0b6cb4705cfeb: - rates.mjs checked row by row against the vendor page, fetched 2026-11-06; the 0.25x row is the 10-20..10-27 promo, over. - mote, HOME=$(mktemp -d), Bun 1.4.2: bun test packages/opendesign 27 pass; bun scripts/check.mjs opendesign ok; npm pack has rates.mjs and the packed plugin imports. - Broken by hand: rateOf ignoring the table (2 red), config hook not re-declaring rate (1 red), eco seed line removed (3 red). - magpie's host builds config models without rate and never writes a hook's result back, so the re-declared rate overrides nothing a user set. - npm had 0.1.8; 0.1.9 is next. Not tried: a real Open Design account; the live ids of hy4-preview and minimax-m3.1-flash (not in the seed). --- packages/opendesign/README.md | 33 ++++++++++- packages/opendesign/index.mjs | 27 ++++++--- packages/opendesign/index.test.mjs | 77 +++++++++++++++++++++++++- packages/opendesign/models.mjs | 12 ++-- packages/opendesign/package.json | 3 +- packages/opendesign/rates.mjs | 34 ++++++++++++ packages/opendesign/refresh-models.mjs | 7 ++- 7 files changed, 172 insertions(+), 21 deletions(-) create mode 100644 packages/opendesign/rates.mjs diff --git a/packages/opendesign/README.md b/packages/opendesign/README.md index 9068fa6..1a73752 100644 --- a/packages/opendesign/README.md +++ b/packages/opendesign/README.md @@ -58,9 +58,9 @@ is there for a machine that can't open the approval page. Nothing is listed per account at request time from anywhere but the vendor: magpie calls the plugin's `provider.models`, which reads `amr-link`'s live `/v1/models` at that account's key on every listing, so what a signed-in -account is offered is what its plan entitles it to right now. Limits, input -modalities and the vendor's own cost words (`rate`, e.g. `x0.5` for "low") -come from that same catalog. +account is offered is what its plan entitles it to right now. Limits and +input modalities come from that same catalog; the quota multiplier (`rate`) +comes from `rates.mjs`, the plan's own table (below). Reasoning levels are not in the catalog, so `models.mjs` records the ones 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`; GPT-6 Luna has no levels. A model the seed doesn't know reasons when its vendor tier is `advanced`, with no levels until it is measured. +`deepseek-v4.1-flash-eco` is the same model on the low-priority, high-quota +schedule (the vendor's announcement: 模型效果完全无损), so `models.mjs` gives +it DeepSeek V4.1 Flash's limits, input kinds and levels; only the quota +multiplier differs (0.27× against 0.5×). + +### Quota multipliers + +`rate` is the plan's deduction multiplier — what one dollar of model spend +takes out of the Design Plan allowance — not the catalog's cost word. The +table in `rates.mjs` is the vendor's published one, +[模型额度与使用说明](https://open-design.ai/zh/model-credits/) (read +2026-11-06; Go, Plus, Pro and Max carry the same table): + +| Model | Rate | +| --- | --- | +| DeepSeek V4.1 Flash | 0.5× | +| DeepSeek V4.1 Flash Eco | 0.27× | +| 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× | +| Claude Haiku 5.5, GLM-5.3 Flash-X | 2× | +| GPT-6 Luna | 4× | + +The catalog's own cost words stay as the fallback for a model the table +doesn't name yet; they disagree with the plan for most models (Claude Haiku +5.5 and GPT-6 Luna are "low" there but 2× and 4× here). DeepSeek V4.1 +Flash's 0.25× "限时谷价" row is a time-limited promotional price, not a +second model id, so the model keeps 0.5×. + `models.mjs` is the seed the provider has *before* anyone signs in. Refresh it from the live catalog with: diff --git a/packages/opendesign/index.mjs b/packages/opendesign/index.mjs index 23bb1e1..1da8e11 100644 --- a/packages/opendesign/index.mjs +++ b/packages/opendesign/index.mjs @@ -17,6 +17,7 @@ import { hostname } from "node:os" import pkg from "./package.json" with { type: "json" } import { MODELS } from "./models.mjs" +import { RATES } from "./rates.mjs" const ID = "opendesign" const CONTROL = "https://amr-api.open-design.ai" @@ -49,11 +50,21 @@ const TIMEOUT = 20_000 const HOUR = 3600 const WEEK = 7 * 24 * HOUR -// The vendor's spending words as magpie's rate, and its quality words as +// The vendor's spending words as magpie's rate — the fallback only now: the +// plan's real deduction multipliers are the table rates.mjs holds, and the +// catalog's words disagree with it for most models. Its quality words say // whether the model thinks before it answers. const COST = { low: "x0.5", medium: "x1", high: "x2", very_high: "x4" } const THINKING = { advanced: true, standard: false } +// rateOf is a model's quota multiplier as magpie reads a rate ("x0.5"): the +// plan's own multiplier when rates.mjs names the model, and its catalog cost +// word for one the table doesn't name yet. +const rateOf = (id, m) => { + const named = RATES[id] + return named === undefined ? COST[text(m?.cost)] : "x" + named +} + const sleep = (ms) => new Promise((r) => setTimeout(r, ms)) const text = (v) => (typeof v === "string" && v.trim() ? v.trim() : "") @@ -275,7 +286,7 @@ function levelsOf(m) { // "advanced". variants are its levels as @ai-sdk/openai options: magpie // shows a model's levels only from its variants, and only when it reasons. function modelOf(id, m) { - const rate = COST[text(m?.cost)] + const rate = rateOf(id, m) const levels = levelsOf(m) const thinking = levels.length > 0 || (THINKING[text(m?.capability)] ?? !!m?.reasoning) const context = Number(m?.context) @@ -430,12 +441,14 @@ export const OpenDesignAuthPlugin = async () => { config: async (cfg) => { cfg.provider ??= {} const was = cfg.provider[ID] ?? {} - // the wire is this plugin's to declare, never a kept copy's: magpie - // hands back what the hook last wrote, and a model kept from 0.1.5 - // would otherwise stay on the Responses API it chose for every model + // the wire and the quota multiplier are this plugin's to declare, never + // a kept copy's: magpie hands back what the hook last wrote, and a model + // kept from an earlier version would otherwise stay on the Responses API + // it chose for every model, or on a rate the plan no longer charges const models = { ...seed(), ...(was.models ?? {}) } for (const [id, m] of Object.entries(models)) { - models[id] = { ...m, api: { ...(m.api ?? {}), npm: wireOf(id) }, provider: { ...(m.provider ?? {}), npm: wireOf(id) } } + const rate = RATES[id] === undefined ? undefined : "x" + RATES[id] + models[id] = { ...m, api: { ...(m.api ?? {}), npm: wireOf(id) }, provider: { ...(m.provider ?? {}), npm: wireOf(id) }, ...(rate && { rate }) } } cfg.provider[ID] = { name: "Open Design", @@ -505,4 +518,4 @@ export const OpenDesignAuthPlugin = async () => { // _internal is what the tests read through; magpie calls every exported // function as a plugin, so only the plugin itself is exported bare. -export const _internal = { authOf, allowances, controlKeyOf, credits, modelsOf, money, runtimeKeyOf, said, startDevice, thePlan, usedPercent, waitForDevice, windowName, when, workspaceOf } +export const _internal = { authOf, allowances, controlKeyOf, credits, modelsOf, money, rateOf, runtimeKeyOf, said, startDevice, thePlan, usedPercent, waitForDevice, windowName, when, workspaceOf } diff --git a/packages/opendesign/index.test.mjs b/packages/opendesign/index.test.mjs index e84beca..16860db 100644 --- a/packages/opendesign/index.test.mjs +++ b/packages/opendesign/index.test.mjs @@ -3,6 +3,8 @@ import { _internal as I, OpenDesignAuthPlugin, } from "./index.mjs" +import { MODELS } from "./models.mjs" +import { RATES } from "./rates.mjs" // bun test runs every package's files in one process: a fetch left // stubbed here answers every test file after this one @@ -167,9 +169,9 @@ test("the account's list is the vendor's own, live", () => { }, release_date: "", variants: {}, - rate: "x0.5", + rate: "x4", }) - expect(models["deepseek-v4-pro"]).toMatchObject({ rate: "x2", limit: { context: 1048000, output: 232000 } }) + expect(models["deepseek-v4-pro"]).toMatchObject({ rate: "x1", limit: { context: 1048000, output: 232000 } }) // a model the seed doesn't know is named by its id, and a catalog entry // without limits still gets a workable entry expect(models["brand-new-9"]).toMatchObject({ @@ -210,6 +212,7 @@ test("the seed's models carry the measured levels as the config's variants", asy "deepseek-v4-flash-vision-exp": ["low", "high", "max"], "deepseek-v4-pro": ["low", "high", "max"], "deepseek-v4.1-flash": ["low", "high", "max"], + "deepseek-v4.1-flash-eco": ["low", "high", "max"], "glm-5.3-flash": ["low", "high", "max"], "glm-5.3-flashx": ["low", "high", "max"], "gpt-6-luna": null, @@ -220,6 +223,67 @@ test("the seed's models carry the measured levels as the config's variants", asy expect(models["claude-haiku-5.5"].variants.high).toEqual({ reasoningEffort: "high" }) }) +test("the seed gives the eco schedule the model V4.1 Flash is", () => { + const { "deepseek-v4.1-flash": flash, "deepseek-v4.1-flash-eco": eco } = MODELS + expect(eco).toEqual({ ...flash, name: "DeepSeek V4.1 Flash Eco" }) + expect(Object.keys(MODELS)).toContain("deepseek-v4.1-flash-eco") +}) + +// the plan's deduction multipliers, "额度扣除倍率", published at +// https://open-design.ai/zh/model-credits/ (read 2026-11-06) +test("the plan's multipliers are the vendor's own table, not the catalog's cost words", () => { + expect(RATES).toEqual({ + "claude-haiku-5.5": 2, + "deepseek-v4-flash": 1, + "deepseek-v4-flash-vision-exp": 1, + "deepseek-v4-pro": 1, + "deepseek-v4.1-flash": 0.5, + "deepseek-v4.1-flash-eco": 0.27, + "glm-5.3-flash": 1, + "glm-5.3-flashx": 2, + "gpt-6-luna": 4, + "hy4-preview": 1, + "kimi-k2.7-code": 1, + "mimo-v2.6-flash": 1, + "mimo-v2.6-pro": 1, + "minimax-m3.1-flash": 1, + }) + // each seed model is rated by the table; a model it doesn't name keeps the + // catalog's word (brand-new-9 below, and any model the vendor adds later) + const WORD = { + "claude-haiku-5.5": ["low", "x2"], + "gpt-6-luna": ["low", "x4"], + "glm-5.3-flash": ["low", "x1"], + "glm-5.3-flashx": ["medium", "x2"], + "deepseek-v4-pro": ["high", "x1"], + "deepseek-v4.1-flash": ["low", "x0.5"], + "deepseek-v4.1-flash-eco": ["low", "x0.27"], + "brand-new-9": ["high", "x2"], + } + const models = I.modelsOf({ data: Object.entries(WORD).map(([id, [cost]]) => ({ id, metadata: { cost } })) }) + for (const [id, [, rate]] of Object.entries(WORD)) expect([id, models[id].rate]).toEqual([id, rate]) +}) + +test("a kept model's rate is re-declared, so a charge an earlier version wrote can't linger", async () => { + const kept = { + provider: { + opendesign: { + models: { + "gpt-6-luna": { id: "gpt-6-luna", name: "GPT-6 Luna", rate: "x0.5" }, + "brand-new-9": { id: "brand-new-9", name: "brand-new-9", rate: "x1" }, + }, + }, + }, + } + await (await OpenDesignAuthPlugin({})).config(kept) + const models = kept.provider.opendesign.models + expect(models["gpt-6-luna"].rate).toBe("x4") + // a kept name is still kept + expect(models["gpt-6-luna"].name).toBe("GPT-6 Luna") + // a model the table doesn't name keeps the rate it had + expect(models["brand-new-9"].rate).toBe("x1") +}) + test("an empty catalog is no models", () => { expect(I.modelsOf({ data: [] })).toEqual({}) expect(I.modelsOf(null)).toEqual({}) @@ -254,7 +318,7 @@ test("the plugin declares the provider and answers its methods", async () => { api: "https://amr-link.open-design.ai/v1", }) // the seed models.mjs carries, which a signed-in account's list replaces - expect(Object.keys(cfg.provider.opendesign.models)).toHaveLength(11) + expect(Object.keys(cfg.provider.opendesign.models)).toHaveLength(12) expect(cfg.provider.opendesign.models["deepseek-v4.1-flash"]).toEqual({ id: "deepseek-v4.1-flash", name: "DeepSeek V4.1 Flash", @@ -268,6 +332,13 @@ test("the plugin declares the provider and answers its methods", async () => { limit: { context: 1048000, output: 232000 }, modalities: { input: ["text", "image"], output: ["text"] }, }) + // the eco schedule is the same model: same limits, same levels, its own 0.27× + expect(cfg.provider.opendesign.models["deepseek-v4.1-flash-eco"]).toEqual({ + ...cfg.provider.opendesign.models["deepseek-v4.1-flash"], + id: "deepseek-v4.1-flash-eco", + name: "DeepSeek V4.1 Flash Eco", + rate: "x0.27", + }) expect(hooks.auth.provider).toBe("opendesign") expect(hooks.auth.methods.map((m) => m.type)).toEqual(["oauth", "api"]) expect(hooks.provider.id).toBe("opendesign") diff --git a/packages/opendesign/models.mjs b/packages/opendesign/models.mjs index aa78ad0..c6b4b56 100644 --- a/packages/opendesign/models.mjs +++ b/packages/opendesign/models.mjs @@ -6,10 +6,11 @@ // // name: what the model is called; context/output: its token limits; input: // the non-text modalities it takes; cost and capability: the vendor's own -// words, which the plugin turns into magpie's rate and thinking flags; -// efforts: the reasoning levels amr-link was seen to take and think at, -// measured, not read (#137; max too, plugins#141: the vendor names low, high -// and max when asked for one it doesn't take), so a refresh keeps them. +// words, which the plugin turns into magpie's thinking flag (the rate is +// rates.mjs's, the plan's own deduction multiplier); efforts: the reasoning +// levels amr-link was seen to take and think at, measured, not read (#137; +// max too, plugins#141: the vendor names low, high and max when asked for one +// it doesn't take), so a refresh keeps them. export const MODELS = { "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 = { "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"] }, "deepseek-v4-pro": { name: "DeepSeek V4 Pro", context: 1048000, output: 232000, cost: "high", capability: "advanced", efforts: ["low", "high", "max"] }, "deepseek-v4.1-flash": { name: "DeepSeek V4.1 Flash", context: 1048000, output: 232000, input: ["image"], cost: "low", capability: "advanced", efforts: ["low", "high", "max"] }, + // the same model on the low-priority, high-quota schedule: same limits, same + // measured levels as the line above (its rate, 0.27×, is rates.mjs's) + "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"] }, "glm-5.3-flash": { name: "GLM 5.3 Flash", context: 1048000, output: 232000, input: ["image", "video"], cost: "low", capability: "advanced", efforts: ["low", "high", "max"] }, "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"] }, "gpt-6-luna": { name: "GPT-6 Luna", context: 1050000, output: 304000, input: ["image", "file"], cost: "low", capability: "standard", efforts: [] }, diff --git a/packages/opendesign/package.json b/packages/opendesign/package.json index 393b218..78832b2 100644 --- a/packages/opendesign/package.json +++ b/packages/opendesign/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-opendesign-auth", - "version": "0.1.8", + "version": "0.1.9", "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", "type": "module", "main": "./opencode.mjs", @@ -9,6 +9,7 @@ "opencode.mjs", "opencode2.mjs", "models.mjs", + "rates.mjs", "refresh-models.mjs", "README.md" ], diff --git a/packages/opendesign/rates.mjs b/packages/opendesign/rates.mjs new file mode 100644 index 0000000..feb14e4 --- /dev/null +++ b/packages/opendesign/rates.mjs @@ -0,0 +1,34 @@ +// The Design Plan's own deduction multipliers — the "额度扣除倍率" table that +// https://open-design.ai/zh/model-credits/ publishes (read 2026-11-06; Go, +// Plus, Pro and Max carry the same table). A rate is what one dollar of model +// spend takes out of the plan's allowance: 0.27× is cheaper than 1×, 4× is +// four times dearer. +// +// The catalog's cost words are a different thing, and mostly disagree: +// amr-link calls Claude Haiku 5.5 and GPT-6 Luna "low" while the plan charges +// 2× and 4× for them, calls GLM-5.3 Flash and MiMo V2.6 Flash "low" while the +// plan charges 1×, and calls DeepSeek V4 Pro "high" and GLM-5.3 Flash-X +// "medium" while the plan charges 1× and 2×. So a rate read off those words is +// wrong for most models; the table below wins, and only a model it doesn't +// name (a new one) falls back to its catalog word. +// +// DeepSeek V4.1 Flash's 0.25× "限时谷价" / "Off-peak promo" row is a +// time-limited promotional price, not a second model id; the model keeps 0.5×. +// DeepSeek V4.1 Flash Eco is the same model on the low-priority, high-quota +// schedule (the vendor's announcement: 模型效果完全无损), charged 0.27×. +export const RATES = { + "claude-haiku-5.5": 2, + "deepseek-v4-flash": 1, + "deepseek-v4-flash-vision-exp": 1, + "deepseek-v4-pro": 1, + "deepseek-v4.1-flash": 0.5, + "deepseek-v4.1-flash-eco": 0.27, + "glm-5.3-flash": 1, + "glm-5.3-flashx": 2, + "gpt-6-luna": 4, + "hy4-preview": 1, + "kimi-k2.7-code": 1, + "mimo-v2.6-flash": 1, + "mimo-v2.6-pro": 1, + "minimax-m3.1-flash": 1, +} diff --git a/packages/opendesign/refresh-models.mjs b/packages/opendesign/refresh-models.mjs index 33e2df0..6e7783c 100644 --- a/packages/opendesign/refresh-models.mjs +++ b/packages/opendesign/refresh-models.mjs @@ -95,9 +95,10 @@ const header = `// The models an account is offered before anyone has signed in // // name: what the model is called; context/output: its token limits; input: // the non-text modalities it takes; cost and capability: the vendor's own -// words, which the plugin turns into magpie's rate and thinking flags; -// efforts: the reasoning levels amr-link was seen to take and think at, -// measured, not read (#137), so a refresh keeps them. +// words, which the plugin turns into magpie's thinking flag (the rate is +// rates.mjs's, the plan's own deduction multiplier); efforts: the reasoning +// levels amr-link was seen to take and think at, measured, not read (#137), +// so a refresh keeps them. export const MODELS = { ${lines.join("\n")}