opendesign 0.1.6: each model is asked on the API amr-link thinks on, and reasons at max too (#141, sryimnoob123)

sryimnoob123 measured a streaming request to every model on each of
amr-link's three APIs: chat completions carries the thinking of most,
claude-haiku-5.5 and deepseek-v4-pro think longer on Responses, and
glm-5.3-flash thinks only on Anthropic's messages. The vendor also names
max beside low and high. #141 was written against 0.1.4 and conflicted
with 0.1.5 (#137's levels), so it is ported onto main here:

- WIRE/MODEL_WIRE/wireOf as the PR had them; the provider default is
  chat completions, and a live list's and the seed's models each carry
  api.npm/provider.npm, which magpie's host reads per model.
- The config hook sets every model's wire again over a kept copy, so a
  model 0.1.5 left on the Responses API moves to its own.
- max joins every measured level list.

Run: bun test in packages/opendesign, 22 pass (a new test holds a kept
0.1.5 model moving to its wire; the old Responses-only expectations were
changed to the measured ones). Not tried against a real amr-link account.

Co-authored-by: sryimnoob <314134180+sryimnoob123@users.noreply.github.com>
This commit is contained in:
yetone
2026-10-16 00:53:37 +08:00
co-authored by sryimnoob
parent b549b40b14
commit ffc06aca49
5 changed files with 91 additions and 36 deletions
+6 -3
View File
@@ -81,9 +81,12 @@ The script keeps the names and measured levels already there — the catalog
carries neither — and reads nothing else: no secret is written to the file or
printed.
Requests go to the **Responses** API (`@ai-sdk/openai` at
`https://amr-link.open-design.ai/v1`), which is what an Open Design API key
page recommends for Codex-style clients and what keeps thinking intact.
Requests go to `https://amr-link.open-design.ai/v1`, each model on the API
amr-link answers its thinking on (measured, plugins#141): chat completions
(`@ai-sdk/openai-compatible`) for most, the Responses API (`@ai-sdk/openai`)
for `claude-haiku-5.5` and `deepseek-v4-pro`, and Anthropic's messages
(`@ai-sdk/anthropic`) for `glm-5.3-flash`. Every model reasons at `low`,
`high` and `max`.
## Where the sign-in is kept
+35 -4
View File
@@ -21,7 +21,28 @@ import { MODELS } from "./models.mjs"
const ID = "opendesign"
const CONTROL = "https://amr-api.open-design.ai"
const LINK = "https://amr-link.open-design.ai/v1"
const NPM = "@ai-sdk/openai" // the Responses API, at LINK
// WHICH API each model is asked on: magpie reads the protocol off the AI SDK
// package a model declares (its api.npm) — "@ai-sdk/openai" is the Responses
// API, "@ai-sdk/anthropic" Anthropic's messages, the compatible package chat
// completions. amr-link answers thinking on a different one per model
// (sryimnoob123's measurements, plugins#141: a streaming request to each model
// on each of the three): chat completions carries the thinking of ten of the
// eleven; deepseek-v4-pro and claude-haiku-5.5 think longer on Responses, and
// glm-5.3-flash only thinks on Anthropic's messages among the two others.
const WIRE = {
chat: "@ai-sdk/openai-compatible",
responses: "@ai-sdk/openai",
anthropic: "@ai-sdk/anthropic",
}
const MODEL_WIRE = {
"claude-haiku-5.5": "responses",
"deepseek-v4-pro": "responses",
"glm-5.3-flash": "anthropic",
}
const wireOf = (id) => WIRE[MODEL_WIRE[id]] ?? WIRE.chat
// the provider's own default: a model this plugin doesn't name is asked on
// chat completions, where ten of the eleven thought
const NPM = WIRE.chat
const SOURCE = "opencode-opendesign-auth/" + pkg.version // as the manifest has it
const CLI_VERSION = "0.1.4" // what the sign-in says it is, as the CLI does
const TIMEOUT = 20_000
@@ -261,6 +282,9 @@ function modelOf(id, m) {
tool_call: true,
reasoning: thinking,
...(levels.length && { variants: Object.fromEntries(levels.map((e) => [e, { reasoningEffort: e }])) }),
// the API magpie asks this model on (WIRE above), per model
api: { npm: wireOf(id) },
provider: { npm: wireOf(id) },
...(rate && { rate }),
limit: {
context: Number.isFinite(context) && context > 0 ? context : 200_000,
@@ -284,7 +308,7 @@ function servedOf(id, m) {
return {
id,
name: c.name,
api: { id, url: LINK, npm: NPM },
api: { id, url: LINK, npm: wireOf(id) },
status: "active",
headers: {},
options: {},
@@ -400,12 +424,19 @@ 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
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) } }
}
cfg.provider[ID] = {
name: "Open Design",
npm: NPM,
api: LINK,
...was,
models: { ...seed(), ...(was.models ?? {}) },
npm: NPM,
models,
}
},
// the plan decides which models an account gets, so the list is read
+37 -17
View File
@@ -150,7 +150,7 @@ test("the account's list is the vendor's own, live", () => {
expect(models["gpt-6-luna"]).toEqual({
id: "gpt-6-luna",
name: "GPT-6 Luna",
api: { id: "gpt-6-luna", url: "https://amr-link.open-design.ai/v1", npm: "@ai-sdk/openai" },
api: { id: "gpt-6-luna", url: "https://amr-link.open-design.ai/v1", npm: "@ai-sdk/openai-compatible" },
status: "active",
headers: {},
options: {},
@@ -180,12 +180,13 @@ test("the account's list is the vendor's own, live", () => {
})
})
// #137 (sryimnoob123): amr-link took reasoning_effort low and high on all 11
// #137 (sryimnoob123): amr-link took reasoning_effort low and high (max too,
// plugins#141) on all 11
// models, and every one but GPT-6 Luna thought at it, "standard" or not
test("a signed-in account's models reason at the levels amr-link took (#137)", () => {
const models = I.modelsOf(CATALOG)
expect(asMagpieReads(models["deepseek-v4-pro"])).toEqual({ reasoning: true, variants: ["low", "high"], image: false })
expect(models["deepseek-v4-pro"].variants).toEqual({ low: { reasoningEffort: "low" }, high: { reasoningEffort: "high" } })
expect(asMagpieReads(models["deepseek-v4-pro"])).toEqual({ reasoning: true, variants: ["low", "high", "max"], image: false })
expect(models["deepseek-v4-pro"].variants).toEqual({ low: { reasoningEffort: "low" }, high: { reasoningEffort: "high" }, max: { reasoningEffort: "max" } })
// took the level and never thought at it
expect(asMagpieReads(models["gpt-6-luna"])).toEqual({ reasoning: false, variants: [], image: true })
// "advanced" but never measured: it reasons, at no level said for it
@@ -194,7 +195,7 @@ test("a signed-in account's models reason at the levels amr-link took (#137)", (
const standard = I.modelsOf({
data: ["claude-haiku-5.5", "deepseek-v4-flash", "deepseek-v4-flash-vision-exp", "mimo-v2.6-flash"].map((id) => ({ id, metadata: { capability: "standard" } })),
})
for (const m of Object.values(standard)) expect(asMagpieReads(m)).toMatchObject({ reasoning: true, variants: ["low", "high"] })
for (const m of Object.values(standard)) expect(asMagpieReads(m)).toMatchObject({ reasoning: true, variants: ["low", "high", "max"] })
})
test("the seed's models carry the measured levels as the config's variants", async () => {
@@ -204,17 +205,17 @@ test("the seed's models carry the measured levels as the config's variants", asy
const models = cfg.provider.opendesign.models
const levels = Object.fromEntries(Object.entries(models).map(([id, m]) => [id, m.reasoning ? Object.keys(m.variants ?? {}) : null]))
expect(levels).toEqual({
"claude-haiku-5.5": ["low", "high"],
"deepseek-v4-flash": ["low", "high"],
"deepseek-v4-flash-vision-exp": ["low", "high"],
"deepseek-v4-pro": ["low", "high"],
"deepseek-v4.1-flash": ["low", "high"],
"glm-5.3-flash": ["low", "high"],
"glm-5.3-flashx": ["low", "high"],
"claude-haiku-5.5": ["low", "high", "max"],
"deepseek-v4-flash": ["low", "high", "max"],
"deepseek-v4-flash-vision-exp": ["low", "high", "max"],
"deepseek-v4-pro": ["low", "high", "max"],
"deepseek-v4.1-flash": ["low", "high", "max"],
"glm-5.3-flash": ["low", "high", "max"],
"glm-5.3-flashx": ["low", "high", "max"],
"gpt-6-luna": null,
"kimi-k2.7-code": ["low", "high"],
"mimo-v2.6-flash": ["low", "high"],
"mimo-v2.6-pro": ["low", "high"],
"kimi-k2.7-code": ["low", "high", "max"],
"mimo-v2.6-flash": ["low", "high", "max"],
"mimo-v2.6-pro": ["low", "high", "max"],
})
expect(models["claude-haiku-5.5"].variants.high).toEqual({ reasoningEffort: "high" })
})
@@ -224,6 +225,23 @@ test("an empty catalog is no models", () => {
expect(I.modelsOf(null)).toEqual({})
})
test("each model is asked on the API amr-link thinks on (plugins#141)", async () => {
expect(I.modelsOf(CATALOG)["deepseek-v4-pro"].api.npm).toBe("@ai-sdk/openai")
expect(I.modelsOf(CATALOG)["gpt-6-luna"].api.npm).toBe("@ai-sdk/openai-compatible")
// a model kept from 0.1.5, which put every model on the Responses API,
// is moved to its own wire
const kept = { "glm-5.3-flash": { id: "glm-5.3-flash", name: "GLM", provider: { npm: "@ai-sdk/openai" }, api: { npm: "@ai-sdk/openai" } } }
const cfg = { provider: { opendesign: { npm: "@ai-sdk/openai", models: kept } } }
await (await OpenDesignAuthPlugin({})).config(cfg)
const p = cfg.provider.opendesign
expect(p.npm).toBe("@ai-sdk/openai-compatible")
expect(p.models["glm-5.3-flash"].provider.npm).toBe("@ai-sdk/anthropic")
expect(p.models["glm-5.3-flash"].api.npm).toBe("@ai-sdk/anthropic")
expect(p.models["glm-5.3-flash"].name).toBe("GLM")
expect(p.models["claude-haiku-5.5"].provider.npm).toBe("@ai-sdk/openai")
expect(p.models["kimi-k2.7-code"].provider.npm).toBe("@ai-sdk/openai-compatible")
})
// ---- what magpie is given ----------------------------------------------------
test("the plugin declares the provider and answers its methods", async () => {
@@ -232,7 +250,7 @@ test("the plugin declares the provider and answers its methods", async () => {
await hooks.config(cfg)
expect(cfg.provider.opendesign).toMatchObject({
name: "Open Design",
npm: "@ai-sdk/openai",
npm: "@ai-sdk/openai-compatible",
api: "https://amr-link.open-design.ai/v1",
})
// the seed models.mjs carries, which a signed-in account's list replaces
@@ -240,10 +258,12 @@ test("the plugin declares the provider and answers its methods", async () => {
expect(cfg.provider.opendesign.models["deepseek-v4.1-flash"]).toEqual({
id: "deepseek-v4.1-flash",
name: "DeepSeek V4.1 Flash",
api: { npm: "@ai-sdk/openai-compatible" },
provider: { npm: "@ai-sdk/openai-compatible" },
attachment: true,
tool_call: true,
reasoning: true,
variants: { low: { reasoningEffort: "low" }, high: { reasoningEffort: "high" } },
variants: { low: { reasoningEffort: "low" }, high: { reasoningEffort: "high" }, max: { reasoningEffort: "max" } },
rate: "x0.5",
limit: { context: 1048000, output: 232000 },
modalities: { input: ["text", "image"], output: ["text"] },
+12 -11
View File
@@ -8,18 +8,19 @@
// 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.
// 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"] },
"deepseek-v4-flash": { name: "DeepSeek V4 Flash", context: 1048000, output: 232000, cost: "medium", capability: "standard", efforts: ["low", "high"] },
"deepseek-v4-flash-vision-exp": { name: "DeepSeek V4 Flash Vision (exp)", context: 1048000, output: 232000, input: ["image"], cost: "medium", capability: "standard", efforts: ["low", "high"] },
"deepseek-v4-pro": { name: "DeepSeek V4 Pro", context: 1048000, output: 232000, cost: "high", capability: "advanced", efforts: ["low", "high"] },
"deepseek-v4.1-flash": { name: "DeepSeek V4.1 Flash", context: 1048000, output: 232000, input: ["image"], cost: "low", capability: "advanced", efforts: ["low", "high"] },
"glm-5.3-flash": { name: "GLM 5.3 Flash", context: 1048000, output: 232000, input: ["image", "video"], cost: "low", capability: "advanced", efforts: ["low", "high"] },
"glm-5.3-flashx": { name: "GLM 5.3 FlashX", context: 1000000, output: 232000, input: ["image", "file", "video"], cost: "medium", capability: "advanced", efforts: ["low", "high"] },
"claude-haiku-5.5": { name: "Claude Haiku 5.5", context: 1000000, output: 132000, input: ["image", "file"], cost: "low", capability: "standard", efforts: ["low", "high", "max"] },
"deepseek-v4-flash": { name: "DeepSeek V4 Flash", context: 1048000, output: 232000, cost: "medium", capability: "standard", efforts: ["low", "high", "max"] },
"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"] },
"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: [] },
"kimi-k2.7-code": { name: "Kimi K2.7 Code", context: 262000, output: 262000, input: ["image"], cost: "medium", capability: "advanced", efforts: ["low", "high"] },
"mimo-v2.6-flash": { name: "MiMo V2.6 Flash", context: 1048000, output: 232000, input: ["image", "audio", "video"], cost: "low", capability: "standard", efforts: ["low", "high"] },
"mimo-v2.6-pro": { name: "MiMo V2.6 Pro", context: 1048000, output: 232000, input: ["image", "audio", "video"], cost: "medium", capability: "advanced", efforts: ["low", "high"] },
"kimi-k2.7-code": { name: "Kimi K2.7 Code", context: 262000, output: 262000, input: ["image"], cost: "medium", capability: "advanced", efforts: ["low", "high", "max"] },
"mimo-v2.6-flash": { name: "MiMo V2.6 Flash", context: 1048000, output: 232000, input: ["image", "audio", "video"], cost: "low", capability: "standard", efforts: ["low", "high", "max"] },
"mimo-v2.6-pro": { name: "MiMo V2.6 Pro", context: 1048000, output: 232000, input: ["image", "audio", "video"], cost: "medium", capability: "advanced", efforts: ["low", "high", "max"] },
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@magpie-community/opencode-opendesign-auth",
"version": "0.1.5",
"version": "0.1.6",
"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": "./index.mjs",