@magpie-community/opencode-factory-auth 0.1.43 → 0.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/index.mjs +40 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,6 +59,16 @@ see [Claude Code through magpie](#claude-code-through-magpie) below.
|
|
|
59
59
|
|
|
60
60
|
## Models
|
|
61
61
|
|
|
62
|
+
In magpie's Factory plugin options, enable **Group models by company** to
|
|
63
|
+
list Anthropic's Fable, Opus, Sonnet and Haiku families together, followed
|
|
64
|
+
by OpenAI, Google and the other model makers. Versions within each family
|
|
65
|
+
sort newest first; Fast Mode follows its base model. This groups by model
|
|
66
|
+
maker, not the API hosting company. Refresh the model list after changing
|
|
67
|
+
the option. It is off by default, preserving the existing order and default
|
|
68
|
+
first 24 models; enabling it also changes which models occupy those slots.
|
|
69
|
+
Names with the same version sort in descending natural name order, for
|
|
70
|
+
example GPT-5.6 Terra before Sol and GLM-5.3-Flash before GLM-5.3.
|
|
71
|
+
|
|
62
72
|
Each model is served on the one API droid uses for it:
|
|
63
73
|
|
|
64
74
|
| API | Models |
|
package/index.mjs
CHANGED
|
@@ -117,6 +117,8 @@ const MODELS = [
|
|
|
117
117
|
// after the rest, as the Fast Mode models are: first, it would push
|
|
118
118
|
// GLM-5.3-Flash out of magpie's first 24 (#119)
|
|
119
119
|
["claude-fable-5.2", "Fable 5.2", ANTHROPIC, "anthropic", 867000, 128000, E5, true, 3.2],
|
|
120
|
+
// Droid 1.7.1 adds Carbon behind Factory's Gemini4Carbon feature flag.
|
|
121
|
+
["gemini-4-carbon", "Gemini 4 Carbon", GEMINI, "google", 1000000, 65536, ["low", "medium", "high"], true, 1.6],
|
|
120
122
|
// The Fast Mode models come last: magpie shows a provider with no models
|
|
121
123
|
// picked only the first 24 of its list, and placed beside their base
|
|
122
124
|
// models in 0.1.27 they pushed GPT-5.3-Codex, Grok 4.7, Grok 4.6, GLM-5.3
|
|
@@ -135,6 +137,28 @@ const MODELS = [
|
|
|
135
137
|
["glm-5.2-fast", "GLM-5.2 Fast", CHAT, "baseten", 524288, 131072, ["none", "high", "max"], false, 0.84],
|
|
136
138
|
].map(([id, name, wire, upstream, context, output, efforts, images, rate]) => ({ id, name, wire, upstream, context, output, efforts, images, rate }))
|
|
137
139
|
|
|
140
|
+
// Model makers, not API hosts: e.g. GLM and Kimi both use Fireworks.
|
|
141
|
+
const MODEL_FAMILIES = [
|
|
142
|
+
"claude-fable-", "claude-opus-", "claude-sonnet-", "claude-haiku-",
|
|
143
|
+
"gpt-", "gemini-", "grok-", "glm-", "kimi-", "deepseek-", "qwen",
|
|
144
|
+
"minimax-", "mistral-", "nemotron-", "muse-", "inkling", "beam-",
|
|
145
|
+
]
|
|
146
|
+
const MODEL_ORDER = "group_models_by_company"
|
|
147
|
+
function groupedModels(models) {
|
|
148
|
+
const family = (id) => {
|
|
149
|
+
const index = MODEL_FAMILIES.findIndex((prefix) => id.startsWith(prefix))
|
|
150
|
+
return index < 0 ? MODEL_FAMILIES.length : index
|
|
151
|
+
}
|
|
152
|
+
const base = (id) => id.replace(/-fast$/, "")
|
|
153
|
+
return Object.fromEntries(Object.entries(models).sort(([a], [b]) => {
|
|
154
|
+
const group = family(a) - family(b)
|
|
155
|
+
if (group) return group
|
|
156
|
+
const aa = base(a), bb = base(b)
|
|
157
|
+
if (aa === bb) return Number(a.endsWith("-fast")) - Number(b.endsWith("-fast"))
|
|
158
|
+
return bb.localeCompare(aa, "en", { numeric: true })
|
|
159
|
+
}))
|
|
160
|
+
}
|
|
161
|
+
|
|
138
162
|
const byId = new Map(MODELS.map((m) => [m.id, m]))
|
|
139
163
|
|
|
140
164
|
// A Fast Mode model is its base model served faster for more credits.
|
|
@@ -195,6 +219,7 @@ const PROMOTIONS = [
|
|
|
195
219
|
{ id: "gpt-5.6-sol-fast", discount: 0.2, from: "2026-08-22T00:00:00Z", to: "2026-11-22T00:00:00Z" },
|
|
196
220
|
{ id: "mistral-large-4", discount: 0.5, from: "2026-10-06T00:00:00Z", to: "2026-10-20T00:00:00Z" },
|
|
197
221
|
{ id: "gemini-4-argon", discount: 0.5, from: "2026-10-13T16:00:00Z", to: "2026-12-01T08:00:00Z" },
|
|
222
|
+
{ id: "gemini-4-carbon", discount: 0.5, from: "2026-11-10T16:00:00Z", to: "2026-12-01T08:00:00Z" },
|
|
198
223
|
{ id: "gemini-3.8-flash", discount: 0.5, from: "2026-08-17T21:10:19Z", to: "2027-01-01T08:00:00Z" },
|
|
199
224
|
{ id: "gemini-3.7-flash", discount: 0.5, from: "2026-08-17T21:10:19Z", to: "2027-01-01T08:00:00Z" },
|
|
200
225
|
]
|
|
@@ -1779,6 +1804,14 @@ export const FactoryAuthPlugin = async ({ client, magpie }) => {
|
|
|
1779
1804
|
return false
|
|
1780
1805
|
}
|
|
1781
1806
|
}
|
|
1807
|
+
const orderModels = (models) => {
|
|
1808
|
+
try {
|
|
1809
|
+
if (magpie?.option?.(PROVIDER, MODEL_ORDER) === true) return groupedModels(models)
|
|
1810
|
+
} catch {
|
|
1811
|
+
// Hosts without plugin options keep the existing picker order.
|
|
1812
|
+
}
|
|
1813
|
+
return models
|
|
1814
|
+
}
|
|
1782
1815
|
// the session id this process's requests carry
|
|
1783
1816
|
const session = crypto.randomUUID()
|
|
1784
1817
|
// serializes checking, rotating and saving tokens: WorkOS rotates the
|
|
@@ -2001,7 +2034,7 @@ export const FactoryAuthPlugin = async ({ client, magpie }) => {
|
|
|
2001
2034
|
provider: {
|
|
2002
2035
|
id: PROVIDER,
|
|
2003
2036
|
async models(provider) {
|
|
2004
|
-
return providerModels(provider)
|
|
2037
|
+
return orderModels(providerModels(provider))
|
|
2005
2038
|
},
|
|
2006
2039
|
},
|
|
2007
2040
|
config: async (config) => {
|
|
@@ -2012,7 +2045,7 @@ export const FactoryAuthPlugin = async ({ client, magpie }) => {
|
|
|
2012
2045
|
npm: CHAT.npm,
|
|
2013
2046
|
api: CHAT.api,
|
|
2014
2047
|
...was,
|
|
2015
|
-
models: { ...configModels(), ...(was.models ?? {}) },
|
|
2048
|
+
models: orderModels({ ...configModels(), ...(was.models ?? {}) }),
|
|
2016
2049
|
}
|
|
2017
2050
|
},
|
|
2018
2051
|
auth: {
|
|
@@ -2029,6 +2062,11 @@ export const FactoryAuthPlugin = async ({ client, magpie }) => {
|
|
|
2029
2062
|
// magpie's own switches (input.magpie.option), read at each usage
|
|
2030
2063
|
// reading
|
|
2031
2064
|
options: [
|
|
2065
|
+
{
|
|
2066
|
+
key: MODEL_ORDER,
|
|
2067
|
+
label: "Group models by company",
|
|
2068
|
+
description: "Groups models by maker: Anthropic, OpenAI, Google, then others. Newer versions come first within each family, with Fast Mode beside its base model. Off preserves the default order and first 24 models. Refresh the model list after changing this option.",
|
|
2069
|
+
},
|
|
2032
2070
|
{
|
|
2033
2071
|
key: STANDARD_ONLY,
|
|
2034
2072
|
label: "Standard usage only",
|