opendesign 0.1.13: each model says the two other APIs amr-link serves it on

gaubeebangeel on X: OpenDesign's Anthropic request to an Open Design
Cloud model went upstream as chat completions. Each model is declared on
one wire (the thinking choice of plugins#141), and magpie translated any
other API's request to it, though amr-link serves every model on chat
completions, Responses and Anthropic's messages (plugins#888).

Each model (the config seed, a kept copy, the models hook's) now lists
the other two packages as `also`. magpie from the matching release reads
it (plugin.Model.Also) and relays a client's request on any of the three
as it was sent; the declared wire stays the model's own, which a request
on another API is translated to. signFor already signs by the request's
path. An older magpie ignores the field.

Run: bun test packages/opendesign (32 pass) with a temp HOME on mote;
root bun test with a temp HOME on mote: 8704 pass, 20 skip, 0 fail.
This commit is contained in:
yetone
2026-11-14 02:05:31 +08:00
parent 418d81d896
commit 397da020de
3 changed files with 24 additions and 2 deletions
+8 -1
View File
@@ -42,6 +42,11 @@ const MODEL_WIRE = {
"glm-5.3-flash": "anthropic",
}
const wireOf = (id) => WIRE[MODEL_WIRE[id]] ?? WIRE.chat
// alsoOf are the two APIs besides its own a model is served on (below),
// which magpie relays a client's request to as it was sent rather than
// translating it to the declared one (m.also; gaubeebangeel on X:
// OpenDesign's Anthropic request to a chat model went as chat completions)
const alsoOf = (id) => Object.values(WIRE).filter((w) => w !== wireOf(id))
// The API a model is declared on is only its default: amr-link serves
// every model on all three (keyblues, plugins#888: each of the fourteen
// answered on chat completions and Responses at /v1 and on Anthropic's
@@ -346,6 +351,7 @@ function modelOf(id, m) {
// the API magpie asks this model on (WIRE above), per model
api: { npm: wireOf(id) },
provider: { npm: wireOf(id) },
also: alsoOf(id),
...(rate && { rate }),
limit: {
context: Number.isFinite(context) && context > 0 ? context : 200_000,
@@ -370,6 +376,7 @@ function servedOf(id, m) {
id,
name: c.name,
api: { id, url: LINK, npm: wireOf(id) },
also: alsoOf(id),
status: "active",
headers: {},
options: {},
@@ -528,7 +535,7 @@ export const OpenDesignAuthPlugin = async () => {
// catalog's 232000 for glm-5.3-flash, which amr-link refuses (CAP)
const out = Number(m.limit?.output)
const limit = CAP[id] && !(out > 0 && out <= CAP[id]) ? { limit: { ...(m.limit ?? {}), output: CAP[id] } } : {}
models[id] = { ...m, ...limit, api: { ...(m.api ?? {}), npm: wireOf(id) }, provider: { ...(m.provider ?? {}), npm: wireOf(id) }, ...(rate && { rate }) }
models[id] = { ...m, ...limit, api: { ...(m.api ?? {}), npm: wireOf(id) }, provider: { ...(m.provider ?? {}), npm: wireOf(id) }, also: alsoOf(id), ...(rate && { rate }) }
}
cfg.provider[ID] = {
name: "Open Design",
+15
View File
@@ -153,6 +153,7 @@ test("the account's list is the vendor's own, live", () => {
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-compatible" },
also: ["@ai-sdk/openai", "@ai-sdk/anthropic"],
status: "active",
headers: {},
options: {},
@@ -365,6 +366,19 @@ test("each model is asked on the API amr-link thinks on (plugins#141)", async ()
expect(p.models["kimi-k2.7-code"].provider.npm).toBe("@ai-sdk/openai-compatible")
})
test("each model says the two other APIs amr-link serves it on (plugins#888)", async () => {
// magpie relays a client's request on any of them as it was sent: an
// Anthropic request to a chat model went upstream as chat completions
// (gaubeebangeel on X)
const models = I.modelsOf(CATALOG)
expect(models["gpt-6-luna"].also).toEqual(["@ai-sdk/openai", "@ai-sdk/anthropic"])
expect(models["deepseek-v4-pro"].also).toEqual(["@ai-sdk/openai-compatible", "@ai-sdk/anthropic"])
const cfg = {}
await (await OpenDesignAuthPlugin({})).config(cfg)
expect(cfg.provider.opendesign.models["glm-5.3-flash"].also).toEqual(["@ai-sdk/openai-compatible", "@ai-sdk/openai"])
expect(cfg.provider.opendesign.models["deepseek-v4.1-flash"].also).toEqual(["@ai-sdk/openai", "@ai-sdk/anthropic"])
})
// ---- what magpie is given ----------------------------------------------------
test("the plugin declares the provider and answers its methods", async () => {
@@ -383,6 +397,7 @@ test("the plugin declares the provider and answers its methods", async () => {
name: "DeepSeek V4.1 Flash",
api: { npm: "@ai-sdk/openai-compatible" },
provider: { npm: "@ai-sdk/openai-compatible" },
also: ["@ai-sdk/openai", "@ai-sdk/anthropic"],
attachment: true,
tool_call: true,
reasoning: true,
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@magpie-community/opencode-opendesign-auth",
"version": "0.1.12",
"version": "0.1.13",
"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",