From 2170a3781e22346ec4f95de34dc824ef4afe6e16 Mon Sep 17 00:00:00 2001 From: yetone Date: Wed, 14 Oct 2026 17:53:22 +0800 Subject: [PATCH] factory 0.1.27: droid's Fast Mode models, and fast asked of their base model goes to them (#119) psylch on #119 (plugin 0.1.26): claude-opus-5-5-fast answered "Factory: Not found.", and Opus 5.5 asked with speed "fast" was recorded as tier_asked fast, tier_served standard, with nothing said. The plugin now offers droid 0.240.0's Fast Mode models: Opus 5.5/5/4.8 Fast on Anthropic's API, GPT-5.5/5.4/5.3-Codex Fast on Responses, each at its base model's limits and efforts. They go out as droid 0.240.0 sends them (read from its binary, saved in testdata/droid-0.240.0-fast.txt): the Fast Mode id itself as the model, with speed "fast" and the fast-mode-2026-02-01 beta for anthropicFastMode models, at service_tier "priority" for the GPT ones (their apiRequest Ee). A request asking a base model for fast (speed "fast" on Messages, service_tier "priority" on Responses) is sent to its Fast Mode model, as droid's fast toggle switches to it. A model with no Fast Mode model is sent as asked. Left out: Opus 4.6/4.7 Fast and GPT-5.4 Mini Fast (base not offered), GPT-5.6 Sol Fast (unreleased:!0), GLM-5.2 Fast (feature flag, a Baseten id). Run: the full bun test (1222 pass, 0 fail) with a sandbox HOME; the new fast.test.mjs and the picker test fail on the old index.mjs (4 fail). Not tried: a real Factory account (none signed in here), so whether Factory serves the Fast Mode ids at fast speed to a plan, and what its usage says about speed, is unverified. A non-stream request magpie translates for a plugin account drops speed before the plugin sees it, so there only the -fast ids reach fast. --- packages/factory/README.md | 14 ++- packages/factory/fast.test.mjs | 101 ++++++++++++++++++ packages/factory/index.mjs | 62 ++++++++++- packages/factory/models.test.mjs | 6 +- packages/factory/package.json | 2 +- .../factory/testdata/droid-0.240.0-fast.txt | 19 ++++ 6 files changed, 197 insertions(+), 7 deletions(-) create mode 100644 packages/factory/fast.test.mjs create mode 100644 packages/factory/testdata/droid-0.240.0-fast.txt diff --git a/packages/factory/README.md b/packages/factory/README.md index 535e9e1..8824ec5 100644 --- a/packages/factory/README.md +++ b/packages/factory/README.md @@ -63,8 +63,8 @@ Each model is served on the one API droid uses for it: | API | Models | |---|---| -| Anthropic Messages (`/api/llm/a`) | Fable 5.1, Fable 5, Opus 5.5, Opus 5, Opus 4.8, Sonnet 5.5, Sonnet 5, Sonnet 4.6, Haiku 5.5, Haiku 4.5, MiniMax M2.7 | -| OpenAI Responses (`/api/llm/o/v1`) | GPT-6.1 Sol, GPT-6 Sol/Astra/Luna, GPT-5.6 Sol/Terra/Luna, GPT-5.5, GPT-5.4, GPT-5.3-Codex, Grok 4.7, Grok 4.6 | +| Anthropic Messages (`/api/llm/a`) | Fable 5.1, Fable 5, Opus 5.5, Opus 5, Opus 4.8 (each also in Fast Mode), Sonnet 5.5, Sonnet 5, Sonnet 4.6, Haiku 5.5, Haiku 4.5, MiniMax M2.7 | +| OpenAI Responses (`/api/llm/o/v1`) | GPT-6.1 Sol, GPT-6 Sol/Astra/Luna, GPT-5.6 Sol/Terra/Luna, GPT-5.5, GPT-5.4, GPT-5.3-Codex (each also in Fast Mode), Grok 4.7, Grok 4.6 | | Chat completions (`/api/llm/o/v1`) | GLM-5.3, GLM-5.3-Flash, GLM-5.2, Kimi K3, DeepSeek V4.1 Flash, Qwen3.8 Max, MiniMax M3, Mistral Large 4, Mistral Medium 3.5, Nemotron 3 Ultra | | Gemini generate (`/api/llm/g/v1/generate`) | Gemini 4 Argon, Gemini 3.1 Pro, Gemini 3.8/3.7/3.6/3.5 Flash, Gemini 3 Flash | @@ -78,6 +78,16 @@ body, droid's line opening the system instruction. Gemini 4 Argon is behind a Factory feature flag in droid 0.241.1, so an account it isn't on for may be refused it. +A Fast Mode model (`claude-opus-5-5-fast`, `gpt-5.5-fast`, …) is its base +model served faster, for more of the plan's credits. It goes out as droid +sends it: its own id, with `speed: "fast"` and the `fast-mode-2026-02-01` +beta on Anthropic's API, at `service_tier: "priority"` on OpenAI's. A request +that asks the base model for fast (Claude Code's `speed: "fast"`, a +Responses request's `service_tier: "priority"`) is sent to its Fast Mode +model, as droid's own fast toggle does: asked of the base model, Factory +answered at standard speed (#119). Opus 4.6/4.7 Fast, GPT-5.4 Mini Fast, GPT-5.6 Sol Fast (unreleased) +and GLM-5.2 Fast (behind a feature flag) are not included. + auto is not included: droid picks it on the client side. ## Requests too large diff --git a/packages/factory/fast.test.mjs b/packages/factory/fast.test.mjs new file mode 100644 index 0000000..d2a34c8 --- /dev/null +++ b/packages/factory/fast.test.mjs @@ -0,0 +1,101 @@ +// 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 real = globalThis.fetch +afterEach(() => (globalThis.fetch = real)) + +function entry(id) { + 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"] + +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", "gpt-5.6-sol-fast", "glm-5.2-fast"]) expect(models[id]).toBeUndefined() + expect(entry("gpt-5.6-sol-fast")).toContain("unreleased:!0") + expect(entry("glm-5.2-fast")).toContain("featureFlag:") +}) + +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-sol", service_tier: "priority", input: "hi" }) }) + sent = JSON.parse(seen[2].body) + expect(sent.model).toBe("gpt-6-sol") + expect(sent.service_tier).toBe("priority") +}) diff --git a/packages/factory/index.mjs b/packages/factory/index.mjs index fe2f1a1..205dc5b 100644 --- a/packages/factory/index.mjs +++ b/packages/factory/index.mjs @@ -45,13 +45,20 @@ const E4 = ["low", "medium", "high", "xhigh"] // (explicitOptInRequirement). Gemini's are droid 0.241.1's, as magpie's // built-in has them (yetone/magpie#2080); Gemini 4 Argon is behind a // feature flag of Factory's there, so an account it isn't on for may be -// refused it. +// refused it. The Fast Mode models are droid 0.240.0's (fastBody; testdata/ +// droid-0.240.0-fast.txt), at their base model's limits and efforts as +// droid has them. Left out: Opus 4.6/4.7 Fast and GPT-5.4 Mini Fast (their +// base models aren't offered), GPT-5.6 Sol Fast (unreleased:!0) and +// GLM-5.2 Fast (behind a feature flag, on a Baseten model id of its own). const MODELS = [ ["claude-fable-5.1", "Fable 5.1", ANTHROPIC, "anthropic", 867000, 128000, E5, true], ["claude-fable-5", "Fable 5", ANTHROPIC, "anthropic", 867000, 128000, E5, true], ["claude-opus-5-5", "Opus 5.5", ANTHROPIC, "anthropic", 872000, 128000, E5, true], + ["claude-opus-5-5-fast", "Opus 5.5 Fast Mode", ANTHROPIC, "anthropic", 872000, 128000, E5, true], ["claude-opus-5", "Opus 5", ANTHROPIC, "anthropic", 867000, 128000, E5, true], + ["claude-opus-5-fast", "Opus 5 Fast Mode", ANTHROPIC, "anthropic", 867000, 128000, E5, true], ["claude-opus-4-8", "Opus 4.8", ANTHROPIC, "anthropic", 867000, 128000, E5, true], + ["claude-opus-4-8-fast", "Opus 4.8 Fast Mode", ANTHROPIC, "anthropic", 867000, 128000, E5, true], ["claude-sonnet-5-5", "Sonnet 5.5", ANTHROPIC, "anthropic", 872000, 128000, E5, true], ["claude-sonnet-5", "Sonnet 5", ANTHROPIC, "anthropic", 872000, 128000, E5, true], ["claude-sonnet-4-6", "Sonnet 4.6", ANTHROPIC, "anthropic", 931000, 64000, ["low", "medium", "high", "max"], true], @@ -65,8 +72,11 @@ const MODELS = [ ["gpt-5.6-terra", "GPT-5.6 Terra", RESPONSES, "openai", 1050000, 128000, E6, true], ["gpt-5.6-luna", "GPT-5.6 Luna", RESPONSES, "openai", 1050000, 128000, E6, true], ["gpt-5.5", "GPT-5.5", RESPONSES, "openai", 1050000, 128000, E4, true], + ["gpt-5.5-fast", "GPT-5.5 Fast Mode", RESPONSES, "openai", 1050000, 128000, E4, true], ["gpt-5.4", "GPT-5.4", RESPONSES, "openai", 1050000, 128000, E4, true], + ["gpt-5.4-fast", "GPT-5.4 Fast Mode", RESPONSES, "openai", 1050000, 128000, E4, true], ["gpt-5.3-codex", "GPT-5.3-Codex", RESPONSES, "openai", 400000, 128000, E4, true], + ["gpt-5.3-codex-fast", "GPT-5.3-Codex Fast Mode", RESPONSES, "openai", 400000, 128000, E4, true], ["grok-4.7", "Grok 4.7", RESPONSES, "xai", 500000, 63356, E4, true], ["grok-4.6", "Grok 4.6", RESPONSES, "xai", 200000, 63356, E4, true], // reasoning is mandatory on GLM-5.3 and GLM-5.3-Flash (Fireworks turns @@ -94,6 +104,46 @@ const MODELS = [ const byId = new Map(MODELS.map((m) => [m.id, m])) +// A Fast Mode model is its base model served faster for more credits. +// droid sends the Fast Mode id itself as the model; on Anthropic's wire with +// speed "fast" and the fast-mode beta (anthropicFastMode), on OpenAI's with +// service_tier "priority" (its apiRequest). FAST_OF is a base model's Fast +// Mode id. +const FAST_BETA = "fast-mode-2026-02-01" +const FAST_OF = new Map(MODELS.filter((m) => m.id.endsWith("-fast")).map((m) => [m.id.slice(0, -"-fast".length), m.id])) + +// fastBody sends a Fast Mode model as droid does. A request that asks its +// base model for fast (Claude Code's speed "fast", or service_tier +// "priority" on Responses) goes to the base model's Fast Mode model, as +// droid's own fast toggle switches to it: asked of the base model, Factory +// answered at standard speed, fast asked and standard served with nothing +// said (#119). Beta is +// whether the request needs the fast-mode beta. +function fastBody(path, body) { + const anthropic = path.includes("/llm/a/") && path.endsWith("/messages") + const responses = path.includes("/llm/o/") && path.endsWith("/responses") + if (!anthropic && !responses) return { body, beta: false } + const text = bodyText(body) + if (text == null) return { body, beta: false } + let m + try { + m = JSON.parse(text) + } catch { + return { body, beta: false } + } + if (!m || typeof m !== "object" || Array.isArray(m) || typeof m.model !== "string") return { body, beta: false } + const asked = anthropic ? m.speed === "fast" : m.service_tier === "priority" + const model = asked && FAST_OF.has(m.model) ? FAST_OF.get(m.model) : m.model + const fast = byId.get(model) + if (!fast || !model.endsWith("-fast") || fast.wire !== (anthropic ? ANTHROPIC : RESPONSES)) return { body, beta: false } + if (anthropic && model === m.model && m.speed === "fast") return { body, beta: true } + if (responses && model === m.model && m.service_tier === "priority") return { body, beta: false } + m.model = model + if (anthropic) m.speed = "fast" + else m.service_tier = "priority" + return { body: JSON.stringify(m), beta: anthropic } +} + // variant is what the AI SDK package a model is on is given for an effort. function variant(npm, effort) { if (npm === ANTHROPIC.npm) return { effort } @@ -1595,8 +1645,14 @@ export const FactoryAuthPlugin = async ({ client }) => { // the AI SDK's Google package's, with OpenCode's placeholder key h.delete("x-goog-api-key") factoryHeaders(h, c) - const model = byId.get(bodyModel(body)) const path = new URL(url).pathname + const sped = fastBody(path, body) + body = sped.body + if (sped.beta) { + const betas = (h.get("anthropic-beta") ?? "").split(",").map((b) => b.trim()).filter(Boolean) + if (!betas.includes(FAST_BETA)) h.set("anthropic-beta", [...betas, FAST_BETA].join(",")) + } + const model = byId.get(bodyModel(body)) const upstream = model ? model.upstream : path.includes("/llm/o/") ? "openai" : "anthropic" h.set("x-api-provider", upstream) h.set("x-session-id", session) @@ -1672,4 +1728,4 @@ export const FactoryAuthPlugin = async ({ client }) => { } // for tests -export const _internal = { limitWindows, windowEnd, dollars, vendorError, CORE, droidBody, DROID_LINE, geminiBody, leaveOutAttachments, LEFT_OUT, TOO_LARGE_HINT } +export const _internal = { fastBody, FAST_BETA, limitWindows, windowEnd, dollars, vendorError, CORE, droidBody, DROID_LINE, geminiBody, leaveOutAttachments, LEFT_OUT, TOO_LARGE_HINT } diff --git a/packages/factory/models.test.mjs b/packages/factory/models.test.mjs index 511809b..c6aff99 100644 --- a/packages/factory/models.test.mjs +++ b/packages/factory/models.test.mjs @@ -71,8 +71,12 @@ test("every model in droid 0.240.0's picker is offered, or left out for a reason "gpt-5.2-codex": "older", "gpt-5.1-codex-max": "older", "grok-4.5": "older", "kimi-k2.5": "older", "glm-5.1": "older", "glm-5": "older", "glm-4.7": "older", "deepseek-v4-flash-0731": "older", "deepseek-v4-pro": "older", + // Fast Mode models whose base model isn't offered, unreleased, or + // behind a feature flag (fast.test.mjs) + "claude-opus-4-7-fast": "older", "claude-opus-4-6-fast": "older", "gpt-5.4-mini-fast": "older", + "gpt-5.6-sol-fast": "unreleased", "glm-5.2-fast": "flag", } - const missing = picker.filter((id) => !got[id] && !reason[id] && !/-fast$/.test(id)) + const missing = picker.filter((id) => !got[id] && !reason[id]) expect(missing).toEqual([]) expect(entry("gpt-6-astra-ultrafast")).toContain('explicitOptInRequirement:{kind:"high_cost"') expect(got["gpt-6-astra-ultrafast"]).toBeUndefined() diff --git a/packages/factory/package.json b/packages/factory/package.json index fd71156..040f459 100644 --- a/packages/factory/package.json +++ b/packages/factory/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-factory-auth", - "version": "0.1.26", + "version": "0.1.27", "description": "Sign in to a Factory (Droid) subscription from OpenCode or magpie", "type": "module", "main": "./index.mjs", diff --git a/packages/factory/testdata/droid-0.240.0-fast.txt b/packages/factory/testdata/droid-0.240.0-fast.txt new file mode 100644 index 0000000..24bb0b7 --- /dev/null +++ b/packages/factory/testdata/droid-0.240.0-fast.txt @@ -0,0 +1,19 @@ +// Excerpts, byte for byte, of droid 0.240.0 (@factory/cli-darwin-arm64@0.240.0, +// bin/droid): its fast-mode registry entries (each up to matchPatterns), +// the request code that sends an Anthropic fast model at speed fast with +// its beta, and the OpenAI request config its GPT fast models carry. +// The body's model is the entry's own id (model:_e, the picked id). +"claude-opus-4-6-fast":{id:"claude-opus-4-6-fast",newUntil:new Date("2000-01-01T00:00:00Z"),name:"Opus 4.6 Fast Mode",shortName:"Opus 4.6 Fast Mode",baseVariant:"claude-opus-4-6",provider:"anthropic",apiProviders:["anthropic"],apiProviderConfig:{snowflake:{modelId:"claude-opus-4-6"}},reasoningEffort:{supported:["off","low","medium","high","max"],default:"high"},tier:"premium",pdf:!0,contextLimits:b,thinking:(o)=>ne(o,{supportsDisabledThinking:!0}),anthropicFastMode:!0,deprecation:{date:"2026-06-29",hard:{fallbackModelId:"claude-opus-4-6"}},disabledForPilots:!0,cost:{tokenMultiplier:12}, +"claude-opus-4-7-fast":{id:"claude-opus-4-7-fast",newUntil:new Date("2000-01-01T00:00:00Z"),name:"Opus 4.7 Fast Mode",shortName:"Opus 4.7 Fast Mode",baseVariant:"claude-opus-4-7",provider:"anthropic",apiProviders:["anthropic"],reasoningEffort:{supported:["off","low","medium","high","xhigh","max"],default:"high"},tier:"premium",pdf:!0,systemPromptReminders:ae,contextLimits:te({thinkingConsumesContext:!1,maxInputTokens:867000,maxOutputTokens:128000}),thinking:(o)=>ne(o,{display:"summarized",supportsDisabledThinking:!0}),anthropicFastMode:!0,deprecation:{date:"2026-07-24",hard:{fallbackModelId:"claude-opus-4-7"}},disabledForPilots:!0,cost:{tokenMultiplier:12},regionOverrides:{us:S}, +"claude-opus-4-8-fast":{id:"claude-opus-4-8-fast",newUntil:new Date("2000-01-01T00:00:00Z"),name:"Opus 4.8 Fast Mode",shortName:"Opus 4.8 Fast Mode",baseVariant:"claude-opus-4-8",provider:"anthropic",apiProviders:["anthropic"],reasoningEffort:{supported:["off","low","medium","high","xhigh","max"],default:"high"},tier:"premium",pdf:!0,systemPromptReminders:ae,contextLimits:b,thinking:(o)=>U(o,!0),anthropicFastMode:!0,supportsMidConversationToolChanges:!0,disabledForPilots:!1,cost:{tokenMultiplier:4}, +"claude-opus-5-fast":{id:"claude-opus-5-fast",name:"Opus 5 Fast Mode",shortName:"Opus 5 Fast Mode",baseVariant:"claude-opus-5",provider:"anthropic",apiProviders:["anthropic"],reasoningEffort:{supported:["off","low","medium","high","xhigh","max"],default:"high"},tier:"premium",pdf:!0,systemPromptReminders:["no-comments","plain-prose"],contextLimits:b,thinking:(o)=>U(o,!0),anthropicFastMode:!0,supportsMidConversationToolChanges:!0,disabledForPilots:!1,cost:{tokenMultiplier:4}, +"claude-opus-5-5-fast":{id:"claude-opus-5-5-fast",name:"Opus 5.5 Fast Mode",shortName:"Opus 5.5 Fast Mode",baseVariant:"claude-opus-5-5",provider:"anthropic",apiProviders:["anthropic"],reasoningEffort:{supported:["low","medium","high","xhigh","max"],default:"medium"},tier:"premium",pdf:!0,systemPromptReminders:["no-comments","plain-prose"],contextLimits:ce,thinking:io,compactThroughLatestSignedThinking:!0,anthropicFastMode:!0,supportsMidConversationToolChanges:!0,disabledForPilots:!1,cost:{tokenMultiplier:3.2,cacheReadTokenMultiplier:0.05,outputTokenMultiplier:5}, +"gpt-5.3-codex-fast":{id:"gpt-5.3-codex-fast",newUntil:new Date("2000-01-01T00:00:00Z"),name:"GPT-5.3-Codex Fast Mode",shortName:"GPT-5.3-Codex Fast",baseVariant:"gpt-5.3-codex",provider:"openai",apiProviders:["openai"],reasoningEffort:{supported:["low","medium","high","xhigh"],default:"medium"},tier:"standard",pdf:!0,compatibilityGroup:"gpt5-family",supportsVerbosity:!0,contextLimits:le,apiRequest:Ee,disabledForPilots:!1,cost:{tokenMultiplier:1.4,outputTokenMultiplier:8,promotions:[T]},regionOverrides:{us:S}, +"gpt-5.4-fast":{id:"gpt-5.4-fast",newUntil:new Date("2000-01-01T00:00:00Z"),name:"GPT-5.4 Fast Mode",shortName:"GPT-5.4 Fast Mode",baseVariant:"gpt-5.4",provider:"openai",apiProviders:["openai","azure_openai"],routingConfig:g.GPT54,reasoningEffort:{supported:["low","medium","high","xhigh"],default:"medium"},tier:"standard",pdf:!0,compatibilityGroup:"gpt5-family",supportsVerbosity:!0,supportsMidConversationToolChanges:!0,contextLimits:M,apiRequest:Ee,disabledForPilots:!1,cost:{tokenMultiplier:2,outputTokenMultiplier:6,promotions:[T]}, +"gpt-5.4-mini-fast":{id:"gpt-5.4-mini-fast",newUntil:new Date("2000-01-01T00:00:00Z"),name:"GPT-5.4 Mini Fast Mode",shortName:"GPT-5.4 Mini Fast Mode",baseVariant:"gpt-5.4-mini",provider:"openai",apiProviders:["openai","azure_openai"],routingConfig:g.GPT54_MINI,reasoningEffort:{supported:["low","medium","high","xhigh"],default:"high"},tier:"standard",pdf:!0,compatibilityGroup:"gpt5-family",supportsVerbosity:!0,supportsMidConversationToolChanges:!0,contextLimits:le,apiRequest:Ee,disabledForPilots:!1,cost:{tokenMultiplier:0.6,outputTokenMultiplier:6,promotions:[T]}, +"gpt-5.5-fast":{id:"gpt-5.5-fast",newUntil:new Date("2000-01-01T00:00:00Z"),name:"GPT-5.5 Fast Mode",shortName:"GPT-5.5 Fast Mode",baseVariant:"gpt-5.5",provider:"openai",apiProviders:["openai","azure_openai"],routingConfig:g.GPT55,reasoningEffort:{supported:["low","medium","high","xhigh"],default:"medium"},tier:"premium",pdf:!0,compatibilityGroup:"gpt5-family",supportsVerbosity:!0,supportsMidConversationToolChanges:!0,contextLimits:M,apiRequest:Ee,disabledForPilots:!1,cost:{tokenMultiplier:5,outputTokenMultiplier:6,promotions:[T]}, +"gpt-5.6-sol-fast":{id:"gpt-5.6-sol-fast",name:"GPT-5.6 Sol Fast Mode",shortName:"GPT-5.6 Sol Fast Mode",baseVariant:"gpt-5.6-sol",provider:"openai",apiProviders:["openai","azure_openai"],routingConfig:g.GPT56_SOL,reasoningEffort:{supported:["none","low","medium","high","xhigh","max"],default:"medium"},tier:"premium",pdf:!0,compatibilityGroup:"gpt5-family",supportsVerbosity:!0,supportsMidConversationToolChanges:!0,unreleased:!0,contextLimits:M,apiRequest:Ee,disabledForPilots:!1,cost:{tokenMultiplier:4,outputTokenMultiplier:5,promotions:[T,Pt]}, +"glm-5.2-fast":{id:"glm-5.2-fast",name:"GLM-5.2 Fast",shortName:"GLM-5.2 Fast",baseVariant:"glm-5.2",provider:"factory",apiModelProvider:"generic-chat-completion-api",apiProviders:["baseten"],apiProviderConfig:{baseten:{...Se,modelId:"zai-org/GLM-5.2-Fast"}},routingConfig:g.GLM_5_2_FAST,reasoningEffort:{supported:["off","high","max"],default:"high"},chatCompletionRequest:V(),tier:"standard",billingPool:"core",featureFlag:J.Glm52Fast,images:!1,pdf:!1,contextLimits:P(524288,131072),disabledForPilots:!1,cost:{tokenMultiplier:0.84,outputTokenMultiplier:3.2},usesUSBasedInference:!0,newUntil:new Date("2026-07-07T00:00:00Z"), +"auto-fast":{id:"auto-fast",newUntil:new Date("2000-01-01T00:00:00Z"),kind:"router",name:mQ,shortName:mQ,baseVariant:"auto",provider:"factory",apiProviders:h,reasoningEffort:{supported:["none"],default:"none"},tier:"standard",featureFlag:J.FactoryRouterFast,pdf:!1,contextLimits:R({maxInputTokens:1e6,maxOutputTokens:64000}),disabledForPilots:!1,cost:{tokenMultiplier:1}}});function Ct(o){return Object.hasOwn(Fe,o)}var Lt="*",Hi=/^\d{8}$/;function Ot(o){return o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function wi(o){let t=o.split(/[.-]/);if(t.length>1&&Hi.test(t.at(-1)??""))t.pop();return t.map(Number)}function Ki(o,t){for(let a=0;a0)return[];let l=new RegExp(`^${Ot(t)}(\\d+(?:[.-]\\d+)*)${Ot(a)}$`),p=[];for(let _ of Object.values(On)){if(_.availableInCLI===!1)continue;if(_.unreleased||_.kind==="router")continue;let{id:c}=_,m=_.deprecation?.hard;if(m&&!m.featureFlag)continue;let I=l.exec(c)?.[1];if(I!==void 0)p.push({id:c,version:wi(I)})}return p.sort((_,c)=>Ki(_.version,c.version)).map((_)=>_.id)}function ht(o){return!o.startsWith("custom:")&&o.includes(Lt)}function Co(o){return Ct(o)||ht(o)}function qi(o){if(Ct(o))return Fe[o];if(ht(o))return Bi(o);return}function tu(o,t){return qi(o)?.find(t)}function wt(o){if(Co(o) +if(t?.anthropicFastMode){if(_.speed="fast",!f.betaFlags.includes("fast-mode-2026-02-01"))f.betaFlags=[...f.betaFlags,"fast-mode-2026-02-01"]} +Ee=C({parallelToolCalls:!0,extendedCache:!0,safetyId:!0,verbosity:"low",serviceTier:"priority"})