droid 1.7.0's new models in the Factory plugin: Fable 5.2, Kimi K3.1 Pro, MiniMax M3.1 Flash, Nemotron 3.5 Super, Inkling, Muse Spark 1.2, Beam 1.0, and GPT-6 Sol/Luna, GPT-5.6 Sol and GLM-5.2 Fast. Each is at droid's limits, efforts, images and token multiplier, with apiProviders[0] as the upstream. gpt-6-sol/gpt-6-luna at service_tier "priority" now go to their Fast Mode models. GLM-5.2 Fast is its own chat model and is not a tier of GLM-5.2. GPT-5.6 Sol Fast Mode gets Sol's 20% promotion until 2026-11-22. Muse Spark 1.2 is left out of CORE (no billingPool "core"). GPT-6.1 Terra, Muse Spark Open, GPT-6.1 Sol Ultra Fast and Muse Spark 1.3 are left out, each with a reason. The first 24 models are unchanged (#119). Review at 9524dcfc6e45b7c2c15245bd1e200d72aeebe17f: - droid 1.7.0 linux-x64 downloaded in WSL (magpie-desktop). SHA-256 4700746f52ec88e3758a18737be13bb74519276de97bc329054e8dae08f15f42 matches. All 24 excerpt lines of testdata/droid-1.7.0-models.txt are in the binary byte for byte (grep -F). The base entries gpt-6-sol (0.8), gpt-6-luna (0.04), gpt-5.6-sol (2) and glm-5.2 match the plugin's. - Each new row was checked against its entry: id, context/output, efforts (off dropped, or kept as none only for GLM-5.2 Fast), images, multiplier, upstream and wire. - First 24 ids are equal on main and the PR, and main's order is kept. CORE gains exactly kimi-k3.1-pro, minimax-m3.1-flash, nemotron-3.5-super, inkling, beam-1.0 and glm-5.2-fast. - In WSL, bun 1.4.2, HOME a temp dir: `bun test packages/factory` gave 193 pass, 0 fail. `bun scripts/check.mjs` passes. - Broken by hand. main's index.mjs with the new tests: 14 fail. Muse kept in CORE: 7 fail. The Sol Fast promotion removed: 2 fail. Fable 5.2 moved first: the first-24 test fails. Luna Fast at 0.04: 3 fail. Beam with images: 1 fails. Not tried: real requests to Factory. Kimi K3.1 Pro, Nemotron 3.5 Super, MiniMax M3.1 Flash, Beam 1.0, GLM-5.2 Fast and Fable 5.2 are behind statsig gates whose default is off in the binary. The author's account listed them, but other accounts may not, as with Gemini 4 Argon. Co-authored-by: garry569 <garry569@users.noreply.github.com>
146 lines
8.1 KiB
JavaScript
146 lines
8.1 KiB
JavaScript
// magpie-community/plugins#119 (psylch, plugin 0.1.26): Factory sells Opus
|
|
// 5.5 Fast and Opus 5 Fast, and droid offers them, but the plugin had no
|
|
// -fast model ("Factory: Not found."), and Opus 5.5 asked with speed "fast"
|
|
// was served at standard speed with nothing said. The cases are droid
|
|
// 0.240.0's own entries and request code, saved byte for byte in testdata.
|
|
import { afterEach, expect, test } from "bun:test"
|
|
import { readFileSync } from "node:fs"
|
|
import { FactoryAuthPlugin } from "./index.mjs"
|
|
|
|
const DROID = readFileSync(new URL("./testdata/droid-0.240.0-fast.txt", import.meta.url), "utf8")
|
|
const DROID_170 = readFileSync(new URL("./testdata/droid-1.7.0-models.txt", import.meta.url), "utf8")
|
|
const real = globalThis.fetch
|
|
afterEach(() => (globalThis.fetch = real))
|
|
|
|
function entry(id, droid = DROID) {
|
|
const line = droid.split("\n").find((l) => l.startsWith(`"${id}":{id:"${id}",`))
|
|
if (!line) throw new Error(`${id} is not in the fixture`)
|
|
return line
|
|
}
|
|
|
|
async function plugin() {
|
|
const seen = []
|
|
globalThis.fetch = async (url, init) => {
|
|
seen.push({ url: String(url), ...init })
|
|
return new Response("{}", { headers: { "content-type": "application/json" } })
|
|
}
|
|
const auth = { type: "oauth", access: "factory-token", expires: Date.now() + 3_600_000, activeOrganizationId: "org_A" }
|
|
const hooks = await FactoryAuthPlugin({ client: { auth: { set: async () => {} } } })
|
|
const cfg = { provider: {} }
|
|
await hooks.config(cfg)
|
|
return { models: cfg.provider.factory.models, l: await hooks.auth.loader(async () => auth), seen }
|
|
}
|
|
|
|
const OFFERED = ["claude-opus-5-5-fast", "claude-opus-5-fast", "claude-opus-4-8-fast", "gpt-5.5-fast", "gpt-5.4-fast", "gpt-5.3-codex-fast"]
|
|
// droid 1.7.0's, offered as it lists them (index.mjs, above MODELS)
|
|
const OFFERED_170 = ["gpt-6-sol-fast", "gpt-6-luna-fast", "gpt-5.6-sol-fast", "glm-5.2-fast"]
|
|
|
|
test("droid's Fast Mode models are offered at their base model's limits and efforts", async () => {
|
|
const { models } = await plugin()
|
|
for (const id of OFFERED) {
|
|
const text = entry(id)
|
|
const base = text.match(/baseVariant:"([^"]+)"/)[1]
|
|
const m = models[id]
|
|
expect(m).toBeDefined()
|
|
expect(m.name).toBe(text.match(/,name:"([^"]+)"/)[1])
|
|
expect(m.limit).toEqual(models[base].limit)
|
|
expect(m.provider).toEqual(models[base].provider)
|
|
const efforts = JSON.parse(text.match(/reasoningEffort:\{supported:(\[[^\]]*\])/)[1]).filter((e) => e !== "off")
|
|
expect(Object.keys(m.variants)).toEqual(efforts)
|
|
}
|
|
// left out, each for its reason (index.mjs, above MODELS)
|
|
for (const id of ["claude-opus-4-6-fast", "claude-opus-4-7-fast", "gpt-5.4-mini-fast"]) expect(models[id]).toBeUndefined()
|
|
})
|
|
|
|
test("droid 1.7.0's GPT Fast Mode models are offered at their base model's limits and efforts, GLM-5.2 Fast at its own", async () => {
|
|
const { models } = await plugin()
|
|
for (const id of OFFERED_170) {
|
|
const text = entry(id, DROID_170)
|
|
const base = text.match(/baseVariant:"([^"]+)"/)[1]
|
|
const m = models[id]
|
|
expect(m).toBeDefined()
|
|
expect(m.name).toBe(text.match(/,name:"([^"]+)"/)[1])
|
|
expect(m.provider).toEqual(models[base].provider)
|
|
expect(m.variants).toEqual(models[base].variants)
|
|
if (id.startsWith("gpt-")) {
|
|
expect(text).toContain("contextLimits:E,apiRequest:pe,")
|
|
expect(m.limit).toEqual(models[base].limit)
|
|
}
|
|
}
|
|
expect(DROID_170).toContain('pe=C({parallelToolCalls:!0,extendedCache:!0,safetyId:!0,verbosity:"low",serviceTier:"priority"})')
|
|
expect(DROID_170).toContain("E=g(1050000,128000)")
|
|
expect(entry("glm-5.2-fast", DROID_170)).toContain("contextLimits:g(524288,131072)")
|
|
expect(models["glm-5.2-fast"].limit).toEqual({ context: 524288, output: 131072 })
|
|
})
|
|
|
|
test("an Opus Fast Mode model goes out as droid sends it: its own id, speed fast and the fast-mode beta", async () => {
|
|
const { l, seen } = await plugin()
|
|
expect(entry("claude-opus-5-5-fast")).toContain("anthropicFastMode:!0")
|
|
expect(DROID).toContain('if(t?.anthropicFastMode){if(_.speed="fast",!f.betaFlags.includes("fast-mode-2026-02-01"))')
|
|
const url = "https://api.factory.ai/api/llm/a/v1/messages"
|
|
await l.fetch(url, { method: "POST", headers: { "anthropic-beta": "client-beta" }, body: JSON.stringify({ model: "claude-opus-5-5-fast", max_tokens: 8, messages: [{ role: "user", content: "hi" }] }) })
|
|
let sent = JSON.parse(seen[0].body)
|
|
expect(sent.model).toBe("claude-opus-5-5-fast")
|
|
expect(sent.speed).toBe("fast")
|
|
expect(seen[0].headers.get("anthropic-beta")).toBe("client-beta,fast-mode-2026-02-01")
|
|
expect(seen[0].headers.get("x-api-provider")).toBe("anthropic")
|
|
|
|
// the issue's second case: Opus 5.5 asked for fast reaches Opus 5.5 Fast
|
|
await l.fetch(url, { method: "POST", headers: { "anthropic-beta": "fast-mode-2026-02-01" }, body: JSON.stringify({ model: "claude-opus-5-5", speed: "fast", max_tokens: 8, messages: [{ role: "user", content: "hi" }] }) })
|
|
sent = JSON.parse(seen[1].body)
|
|
expect(sent.model).toBe("claude-opus-5-5-fast")
|
|
expect(sent.speed).toBe("fast")
|
|
expect(seen[1].headers.get("anthropic-beta")).toBe("fast-mode-2026-02-01")
|
|
|
|
// not asked for fast: Opus 5.5 as it was
|
|
await l.fetch(url, { method: "POST", body: JSON.stringify({ model: "claude-opus-5-5", max_tokens: 8, messages: [{ role: "user", content: "hi" }] }) })
|
|
sent = JSON.parse(seen[2].body)
|
|
expect(sent.model).toBe("claude-opus-5-5")
|
|
expect("speed" in sent).toBe(false)
|
|
expect(seen[2].headers.get("anthropic-beta")).toBeNull()
|
|
})
|
|
|
|
test("a GPT Fast Mode model goes out as droid sends it: its own id at the priority tier", async () => {
|
|
const { l, seen } = await plugin()
|
|
expect(entry("gpt-5.5-fast")).toContain("apiRequest:Ee,")
|
|
expect(DROID).toContain('Ee=C({parallelToolCalls:!0,extendedCache:!0,safetyId:!0,verbosity:"low",serviceTier:"priority"})')
|
|
const url = "https://api.factory.ai/api/llm/o/v1/responses"
|
|
await l.fetch(url, { method: "POST", body: JSON.stringify({ model: "gpt-5.5-fast", input: "hi" }) })
|
|
let sent = JSON.parse(seen[0].body)
|
|
expect(sent.model).toBe("gpt-5.5-fast")
|
|
expect(sent.service_tier).toBe("priority")
|
|
expect(seen[0].headers.get("x-api-provider")).toBe("openai")
|
|
expect(seen[0].headers.get("anthropic-beta")).toBeNull()
|
|
// GPT-5.5 at the priority tier is its Fast Mode model
|
|
await l.fetch(url, { method: "POST", body: JSON.stringify({ model: "gpt-5.5", service_tier: "priority", input: "hi" }) })
|
|
sent = JSON.parse(seen[1].body)
|
|
expect(sent.model).toBe("gpt-5.5-fast")
|
|
// a model with no Fast Mode model is left as it was asked
|
|
await l.fetch(url, { method: "POST", body: JSON.stringify({ model: "gpt-6.1-sol", service_tier: "priority", input: "hi" }) })
|
|
sent = JSON.parse(seen[2].body)
|
|
expect(sent.model).toBe("gpt-6.1-sol")
|
|
expect(sent.service_tier).toBe("priority")
|
|
// GPT-6 Sol's is droid 1.7.0's
|
|
await l.fetch(url, { method: "POST", body: JSON.stringify({ model: "gpt-6-sol", service_tier: "priority", input: "hi" }) })
|
|
sent = JSON.parse(seen[3].body)
|
|
expect(sent.model).toBe("gpt-6-sol-fast")
|
|
expect(sent.service_tier).toBe("priority")
|
|
// GLM-5.2 Fast is a model of its own on chat completions, not a tier of GLM-5.2's
|
|
const chat = "https://api.factory.ai/api/llm/o/v1/chat/completions"
|
|
await l.fetch(chat, { method: "POST", body: JSON.stringify({ model: "glm-5.2", service_tier: "priority", messages: [{ role: "user", content: "hi" }] }) })
|
|
expect(JSON.parse(seen[4].body).model).toBe("glm-5.2")
|
|
})
|
|
|
|
// #119 (psylch, 0.1.27): magpie shows a provider with nothing picked only
|
|
// the first 24 models of its list. Placed beside their base models, the Fast
|
|
// Mode models pushed GPT-5.3-Codex, Grok and GLM out of those 24; listed
|
|
// last, the first 24 are 0.1.26's again.
|
|
test("the Fast Mode models come after every other model, so magpie's first 24 are the ones it showed before", async () => {
|
|
const { models } = await plugin()
|
|
const ids = Object.keys(models)
|
|
const first = ids.findIndex((id) => id.endsWith("-fast"))
|
|
expect(ids.slice(first).every((id) => id.endsWith("-fast"))).toBe(true)
|
|
expect(ids.slice(first)).toEqual([...OFFERED, ...OFFERED_170])
|
|
for (const id of ["gpt-5.3-codex", "grok-4.7", "grok-4.6", "glm-5.3", "glm-5.3-flash"]) expect(ids.slice(0, 24)).toContain(id)
|
|
})
|