@magpie-community/opencode-factory-auth 0.1.30 → 0.1.32
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 +8 -0
- package/index.mjs +139 -51
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -73,6 +73,14 @@ Flash, Kimi K3 and GLM-5.2 have `none`, droid's "off": they stop thinking.
|
|
|
73
73
|
Reasoning is mandatory on GLM-5.3 and GLM-5.3-Flash (Fireworks turns `none`
|
|
74
74
|
away), so `low` is their least.
|
|
75
75
|
|
|
76
|
+
A model's price is its token multiplier in droid's registry
|
|
77
|
+
(`cost.tokenMultiplier`), which magpie shows beside the model as its rate
|
|
78
|
+
(`0.8×`), so a cheap one is picked without opening droid. A promotion running
|
|
79
|
+
comes off it, with the multiplier before the discount struck through beside
|
|
80
|
+
the price (`rateWas`): Mistral Large 4's launch discount, Gemini 4 Argon's,
|
|
81
|
+
Gemini 3.8/3.7 Flash's and GPT-5.6 Sol's, each while droid's own dates for it
|
|
82
|
+
hold. A promotion that has ended is no discount at all.
|
|
83
|
+
|
|
76
84
|
Gemini's requests go to Factory's generate route with the model in the
|
|
77
85
|
body, droid's line opening the system instruction. Gemini 4 Argon is behind
|
|
78
86
|
a Factory feature flag in droid 0.241.1, so an account it isn't on for may
|
package/index.mjs
CHANGED
|
@@ -56,62 +56,62 @@ const E4 = ["low", "medium", "high", "xhigh"]
|
|
|
56
56
|
// base models aren't offered), GPT-5.6 Sol Fast (unreleased:!0) and
|
|
57
57
|
// GLM-5.2 Fast (behind a feature flag, on a Baseten model id of its own).
|
|
58
58
|
const MODELS = [
|
|
59
|
-
["claude-fable-5.1", "Fable 5.1", ANTHROPIC, "anthropic", 867000, 128000, E5, true],
|
|
60
|
-
["claude-fable-5", "Fable 5", ANTHROPIC, "anthropic", 867000, 128000, E5, true],
|
|
61
|
-
["claude-opus-5-5", "Opus 5.5", ANTHROPIC, "anthropic", 872000, 128000, E5, true],
|
|
62
|
-
["claude-opus-5", "Opus 5", ANTHROPIC, "anthropic", 867000, 128000, E5, true],
|
|
63
|
-
["claude-opus-4-8", "Opus 4.8", ANTHROPIC, "anthropic", 867000, 128000, E5, true],
|
|
64
|
-
["claude-sonnet-5-5", "Sonnet 5.5", ANTHROPIC, "anthropic", 872000, 128000, E5, true],
|
|
65
|
-
["claude-sonnet-5", "Sonnet 5", ANTHROPIC, "anthropic", 872000, 128000, E5, true],
|
|
66
|
-
["claude-sonnet-4-6", "Sonnet 4.6", ANTHROPIC, "anthropic", 931000, 64000, ["low", "medium", "high", "max"], true],
|
|
67
|
-
["claude-haiku-5-5", "Haiku 5.5", ANTHROPIC, "anthropic", 872000, 128000, E5, true],
|
|
68
|
-
["claude-haiku-4-5-20251001", "Haiku 4.5", ANTHROPIC, "anthropic", 0, 0, ["low", "medium", "high"], true],
|
|
69
|
-
["gpt-6.1-sol", "GPT-6.1 Sol", RESPONSES, "openai", 1050000, 128000, E5, true],
|
|
70
|
-
["gpt-6-sol", "GPT-6 Sol", RESPONSES, "openai", 1050000, 128000, E6, true],
|
|
71
|
-
["gpt-6-astra", "GPT-6 Astra", RESPONSES, "openai", 1050000, 128000, E5, true],
|
|
72
|
-
["gpt-6-luna", "GPT-6 Luna", RESPONSES, "openai", 1050000, 128000, E6, true],
|
|
73
|
-
["gpt-5.6-sol", "GPT-5.6 Sol", RESPONSES, "openai", 1050000, 128000, E6, true],
|
|
74
|
-
["gpt-5.6-terra", "GPT-5.6 Terra", RESPONSES, "openai", 1050000, 128000, E6, true],
|
|
75
|
-
["gpt-5.6-luna", "GPT-5.6 Luna", RESPONSES, "openai", 1050000, 128000, E6, true],
|
|
76
|
-
["gpt-5.5", "GPT-5.5", RESPONSES, "openai", 1050000, 128000, E4, true],
|
|
77
|
-
["gpt-5.4", "GPT-5.4", RESPONSES, "openai", 1050000, 128000, E4, true],
|
|
78
|
-
["gpt-5.3-codex", "GPT-5.3-Codex", RESPONSES, "openai", 400000, 128000, E4, true],
|
|
79
|
-
["grok-4.7", "Grok 4.7", RESPONSES, "xai", 500000, 63356, E4, true],
|
|
80
|
-
["grok-4.6", "Grok 4.6", RESPONSES, "xai", 200000, 63356, E4, true],
|
|
59
|
+
["claude-fable-5.1", "Fable 5.1", ANTHROPIC, "anthropic", 867000, 128000, E5, true, 4],
|
|
60
|
+
["claude-fable-5", "Fable 5", ANTHROPIC, "anthropic", 867000, 128000, E5, true, 4],
|
|
61
|
+
["claude-opus-5-5", "Opus 5.5", ANTHROPIC, "anthropic", 872000, 128000, E5, true, 1.6],
|
|
62
|
+
["claude-opus-5", "Opus 5", ANTHROPIC, "anthropic", 867000, 128000, E5, true, 2],
|
|
63
|
+
["claude-opus-4-8", "Opus 4.8", ANTHROPIC, "anthropic", 867000, 128000, E5, true, 2],
|
|
64
|
+
["claude-sonnet-5-5", "Sonnet 5.5", ANTHROPIC, "anthropic", 872000, 128000, E5, true, 0.8],
|
|
65
|
+
["claude-sonnet-5", "Sonnet 5", ANTHROPIC, "anthropic", 872000, 128000, E5, true, 0.8],
|
|
66
|
+
["claude-sonnet-4-6", "Sonnet 4.6", ANTHROPIC, "anthropic", 931000, 64000, ["low", "medium", "high", "max"], true, 1.2],
|
|
67
|
+
["claude-haiku-5-5", "Haiku 5.5", ANTHROPIC, "anthropic", 872000, 128000, E5, true, 0.04],
|
|
68
|
+
["claude-haiku-4-5-20251001", "Haiku 4.5", ANTHROPIC, "anthropic", 0, 0, ["low", "medium", "high"], true, 0.4],
|
|
69
|
+
["gpt-6.1-sol", "GPT-6.1 Sol", RESPONSES, "openai", 1050000, 128000, E5, true, 0.8],
|
|
70
|
+
["gpt-6-sol", "GPT-6 Sol", RESPONSES, "openai", 1050000, 128000, E6, true, 0.8],
|
|
71
|
+
["gpt-6-astra", "GPT-6 Astra", RESPONSES, "openai", 1050000, 128000, E5, true, 4],
|
|
72
|
+
["gpt-6-luna", "GPT-6 Luna", RESPONSES, "openai", 1050000, 128000, E6, true, 0.04],
|
|
73
|
+
["gpt-5.6-sol", "GPT-5.6 Sol", RESPONSES, "openai", 1050000, 128000, E6, true, 2],
|
|
74
|
+
["gpt-5.6-terra", "GPT-5.6 Terra", RESPONSES, "openai", 1050000, 128000, E6, true, 0.8],
|
|
75
|
+
["gpt-5.6-luna", "GPT-5.6 Luna", RESPONSES, "openai", 1050000, 128000, E6, true, 0.08],
|
|
76
|
+
["gpt-5.5", "GPT-5.5", RESPONSES, "openai", 1050000, 128000, E4, true, 2],
|
|
77
|
+
["gpt-5.4", "GPT-5.4", RESPONSES, "openai", 1050000, 128000, E4, true, 1],
|
|
78
|
+
["gpt-5.3-codex", "GPT-5.3-Codex", RESPONSES, "openai", 400000, 128000, E4, true, 0.7],
|
|
79
|
+
["grok-4.7", "Grok 4.7", RESPONSES, "xai", 500000, 63356, E4, true, 0.8],
|
|
80
|
+
["grok-4.6", "Grok 4.6", RESPONSES, "xai", 200000, 63356, E4, true, 0.8],
|
|
81
81
|
// reasoning is mandatory on GLM-5.3 and GLM-5.3-Flash (Fireworks turns
|
|
82
82
|
// none away): low is their least. GLM-5.2, Kimi K3 and DeepSeek V4.1
|
|
83
83
|
// Flash stop thinking at none, droid's "off" (yetone/magpie#899).
|
|
84
|
-
["glm-5.3", "GLM-5.3", CHAT, "fireworks", 1040000, 131072, ["low", "high", "max"], false],
|
|
85
|
-
["glm-5.3-flash", "GLM-5.3-Flash", CHAT, "fireworks", 1048576, 131072, ["low", "high", "max"], true],
|
|
86
|
-
["glm-5.2", "GLM-5.2", CHAT, "baseten", 1040000, 131072, ["none", "high", "max"], false],
|
|
87
|
-
["kimi-k3", "Kimi K3", CHAT, "fireworks", 262144, 65536, ["none", "low", "high", "max"], true],
|
|
88
|
-
["deepseek-v4.1-flash", "DeepSeek V4.1 Flash", CHAT, "fireworks", 1040000, 131072, ["none", "low", "high", "max"], true],
|
|
89
|
-
["qwen3.8-max", "Qwen3.8 Max", CHAT, "fireworks", 262144, 131072, ["low", "medium", "xhigh"], false],
|
|
90
|
-
["minimax-m3", "MiniMax M3", CHAT, "fireworks", 512000, 64000, ["high"], true],
|
|
91
|
-
["minimax-m2.7", "MiniMax M2.7", ANTHROPIC, "fireworks", 196600, 64000, ["high"], false],
|
|
92
|
-
["mistral-large-4", "Mistral Large 4", CHAT, "mistral", 524288, 64000, ["high"], true],
|
|
93
|
-
["mistral-medium-3.5", "Mistral Medium 3.5", CHAT, "mistral", 256000, 64000, ["high"], true],
|
|
94
|
-
["nemotron-3-ultra", "Nemotron 3 Ultra", CHAT, "baseten", 202000, 65536, ["high"], false],
|
|
95
|
-
["gemini-4-argon", "Gemini 4 Argon", GEMINI, "google", 1000000, 65536, ["low", "medium", "high"], true],
|
|
96
|
-
["gemini-3.1-pro-preview", "Gemini 3.1 Pro", GEMINI, "google", 1000000, 65536, ["low", "medium", "high"], true],
|
|
97
|
-
["gemini-3.8-flash", "Gemini 3.8 Flash", GEMINI, "google", 1000000, 65536, ["low", "medium", "high"], true],
|
|
98
|
-
["gemini-3.7-flash", "Gemini 3.7 Flash", GEMINI, "google", 1000000, 65536, ["low", "medium", "high"], true],
|
|
99
|
-
["gemini-3.6-flash", "Gemini 3.6 Flash", GEMINI, "google", 1000000, 65536, ["low", "medium", "high"], true],
|
|
100
|
-
["gemini-3.5-flash", "Gemini 3.5 Flash", GEMINI, "google", 1000000, 65536, ["minimal", "low", "medium", "high"], true],
|
|
101
|
-
["gemini-3-flash-preview", "Gemini 3 Flash", GEMINI, "google", 1000000, 65536, ["minimal", "low", "medium", "high"], true],
|
|
84
|
+
["glm-5.3", "GLM-5.3", CHAT, "fireworks", 1040000, 131072, ["low", "high", "max"], false, 0.56],
|
|
85
|
+
["glm-5.3-flash", "GLM-5.3-Flash", CHAT, "fireworks", 1048576, 131072, ["low", "high", "max"], true, 0.06],
|
|
86
|
+
["glm-5.2", "GLM-5.2", CHAT, "baseten", 1040000, 131072, ["none", "high", "max"], false, 0.56],
|
|
87
|
+
["kimi-k3", "Kimi K3", CHAT, "fireworks", 262144, 65536, ["none", "low", "high", "max"], true, 1.2],
|
|
88
|
+
["deepseek-v4.1-flash", "DeepSeek V4.1 Flash", CHAT, "fireworks", 1040000, 131072, ["none", "low", "high", "max"], true, 0.12],
|
|
89
|
+
["qwen3.8-max", "Qwen3.8 Max", CHAT, "fireworks", 262144, 131072, ["low", "medium", "xhigh"], false, 0.8],
|
|
90
|
+
["minimax-m3", "MiniMax M3", CHAT, "fireworks", 512000, 64000, ["high"], true, 0.12],
|
|
91
|
+
["minimax-m2.7", "MiniMax M2.7", ANTHROPIC, "fireworks", 196600, 64000, ["high"], false, 0.12],
|
|
92
|
+
["mistral-large-4", "Mistral Large 4", CHAT, "mistral", 524288, 64000, ["high"], true, 0.544],
|
|
93
|
+
["mistral-medium-3.5", "Mistral Medium 3.5", CHAT, "mistral", 256000, 64000, ["high"], true, 0.6],
|
|
94
|
+
["nemotron-3-ultra", "Nemotron 3 Ultra", CHAT, "baseten", 202000, 65536, ["high"], false, 0.24],
|
|
95
|
+
["gemini-4-argon", "Gemini 4 Argon", GEMINI, "google", 1000000, 65536, ["low", "medium", "high"], true, 1.6],
|
|
96
|
+
["gemini-3.1-pro-preview", "Gemini 3.1 Pro", GEMINI, "google", 1000000, 65536, ["low", "medium", "high"], true, 0.8],
|
|
97
|
+
["gemini-3.8-flash", "Gemini 3.8 Flash", GEMINI, "google", 1000000, 65536, ["low", "medium", "high"], true, 0.6],
|
|
98
|
+
["gemini-3.7-flash", "Gemini 3.7 Flash", GEMINI, "google", 1000000, 65536, ["low", "medium", "high"], true, 0.6],
|
|
99
|
+
["gemini-3.6-flash", "Gemini 3.6 Flash", GEMINI, "google", 1000000, 65536, ["low", "medium", "high"], true, 0.6],
|
|
100
|
+
["gemini-3.5-flash", "Gemini 3.5 Flash", GEMINI, "google", 1000000, 65536, ["minimal", "low", "medium", "high"], true, 0.6],
|
|
101
|
+
["gemini-3-flash-preview", "Gemini 3 Flash", GEMINI, "google", 1000000, 65536, ["minimal", "low", "medium", "high"], true, 0.2],
|
|
102
102
|
// The Fast Mode models come last: magpie shows a provider with no models
|
|
103
103
|
// picked only the first 24 of its list, and placed beside their base
|
|
104
104
|
// models in 0.1.27 they pushed GPT-5.3-Codex, Grok 4.7, Grok 4.6, GLM-5.3
|
|
105
105
|
// and GLM-5.3-Flash out of it (#119, psylch). A Fast Mode model costs more credits, so it is the one
|
|
106
106
|
// to pick; asking its base model for fast reaches it all the same
|
|
107
107
|
// (fastBody).
|
|
108
|
-
["claude-opus-5-5-fast", "Opus 5.5 Fast Mode", ANTHROPIC, "anthropic", 872000, 128000, E5, true],
|
|
109
|
-
["claude-opus-5-fast", "Opus 5 Fast Mode", ANTHROPIC, "anthropic", 867000, 128000, E5, true],
|
|
110
|
-
["claude-opus-4-8-fast", "Opus 4.8 Fast Mode", ANTHROPIC, "anthropic", 867000, 128000, E5, true],
|
|
111
|
-
["gpt-5.5-fast", "GPT-5.5 Fast Mode", RESPONSES, "openai", 1050000, 128000, E4, true],
|
|
112
|
-
["gpt-5.4-fast", "GPT-5.4 Fast Mode", RESPONSES, "openai", 1050000, 128000, E4, true],
|
|
113
|
-
["gpt-5.3-codex-fast", "GPT-5.3-Codex Fast Mode", RESPONSES, "openai", 400000, 128000, E4, true],
|
|
114
|
-
].map(([id, name, wire, upstream, context, output, efforts, images]) => ({ id, name, wire, upstream, context, output, efforts, images }))
|
|
108
|
+
["claude-opus-5-5-fast", "Opus 5.5 Fast Mode", ANTHROPIC, "anthropic", 872000, 128000, E5, true, 3.2],
|
|
109
|
+
["claude-opus-5-fast", "Opus 5 Fast Mode", ANTHROPIC, "anthropic", 867000, 128000, E5, true, 4],
|
|
110
|
+
["claude-opus-4-8-fast", "Opus 4.8 Fast Mode", ANTHROPIC, "anthropic", 867000, 128000, E5, true, 4],
|
|
111
|
+
["gpt-5.5-fast", "GPT-5.5 Fast Mode", RESPONSES, "openai", 1050000, 128000, E4, true, 5],
|
|
112
|
+
["gpt-5.4-fast", "GPT-5.4 Fast Mode", RESPONSES, "openai", 1050000, 128000, E4, true, 2],
|
|
113
|
+
["gpt-5.3-codex-fast", "GPT-5.3-Codex Fast Mode", RESPONSES, "openai", 400000, 128000, E4, true, 1.4],
|
|
114
|
+
].map(([id, name, wire, upstream, context, output, efforts, images, rate]) => ({ id, name, wire, upstream, context, output, efforts, images, rate }))
|
|
115
115
|
|
|
116
116
|
const byId = new Map(MODELS.map((m) => [m.id, m]))
|
|
117
117
|
|
|
@@ -162,9 +162,35 @@ function variant(npm, effort) {
|
|
|
162
162
|
return { reasoningEffort: effort }
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
|
|
165
|
+
// Factory's running promotions, as droid's registry keeps them
|
|
166
|
+
// (cost.promotions): while one runs, a model's price is its token multiplier
|
|
167
|
+
// less the promotion's discount. magpie shows the price now with the price
|
|
168
|
+
// before it struck through (rateWas), as it does for WorkBuddy's credits and
|
|
169
|
+
// Qoder's price factors, so a cheap model is picked without opening droid. A
|
|
170
|
+
// promotion that has ended is no discount at all.
|
|
171
|
+
const PROMOTIONS = [
|
|
172
|
+
{ id: "gpt-5.6-sol", discount: 0.2, from: "2026-08-22T00:00:00Z", to: "2026-11-22T00:00:00Z" },
|
|
173
|
+
{ id: "mistral-large-4", discount: 0.5, from: "2026-10-06T00:00:00Z", to: "2026-10-20T00:00:00Z" },
|
|
174
|
+
{ id: "gemini-4-argon", discount: 0.5, from: "2026-10-13T16:00:00Z", to: "2026-12-01T08:00:00Z" },
|
|
175
|
+
{ id: "gemini-3.8-flash", discount: 0.5, from: "2026-08-17T21:10:19Z", to: "2027-01-01T08:00:00Z" },
|
|
176
|
+
{ id: "gemini-3.7-flash", discount: 0.5, from: "2026-08-17T21:10:19Z", to: "2027-01-01T08:00:00Z" },
|
|
177
|
+
]
|
|
178
|
+
|
|
179
|
+
// rateOf is a model's price as magpie keeps it: rate, the token multiplier a
|
|
180
|
+
// request costs now, and rateWas, the multiplier before a promotion running
|
|
181
|
+
// now (0: none). droid reads it the same way (ib(cost, now)): the first
|
|
182
|
+
// promotion that has started and not ended takes its discount off the
|
|
183
|
+
// multiplier.
|
|
184
|
+
function rateOf(m, now = Date.now()) {
|
|
185
|
+
const p = PROMOTIONS.find((p) => p.id === m.id && now >= Date.parse(p.from) && now < Date.parse(p.to))
|
|
186
|
+
if (!p) return { rate: m.rate, rateWas: 0 }
|
|
187
|
+
return { rate: Number((m.rate * (1 - p.discount)).toFixed(4)), rateWas: m.rate }
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function configModels(now = Date.now()) {
|
|
166
191
|
const out = {}
|
|
167
192
|
for (const m of MODELS) {
|
|
193
|
+
const { rate, rateWas } = rateOf(m, now)
|
|
168
194
|
out[m.id] = {
|
|
169
195
|
id: m.id,
|
|
170
196
|
name: m.name,
|
|
@@ -172,16 +198,62 @@ function configModels() {
|
|
|
172
198
|
reasoning: m.efforts.length > 0,
|
|
173
199
|
attachment: m.images,
|
|
174
200
|
tool_call: true,
|
|
175
|
-
temperature
|
|
201
|
+
// OpenAI's reasoning models take no temperature (droidBody)
|
|
202
|
+
temperature: m.upstream !== "openai",
|
|
176
203
|
modalities: { input: m.images ? ["text", "image"] : ["text"], output: ["text"] },
|
|
177
204
|
cost: { input: 0, output: 0 },
|
|
178
205
|
limit: { context: m.context, output: m.output },
|
|
206
|
+
// magpie's own: the token multiplier a request costs now, and the
|
|
207
|
+
// multiplier before a promotion running now (0: none)
|
|
208
|
+
rate,
|
|
209
|
+
rateWas,
|
|
179
210
|
variants: Object.fromEntries(m.efforts.map((e) => [e, variant(m.wire.npm, e)])),
|
|
180
211
|
}
|
|
181
212
|
}
|
|
182
213
|
return out
|
|
183
214
|
}
|
|
184
215
|
|
|
216
|
+
// providerModel is a model as magpie's provider hook keeps it: the same model
|
|
217
|
+
// configModels gives OpenCode, in magpie's shape. magpie reads a provider's
|
|
218
|
+
// models from this hook, and a config hook's models without the price beside
|
|
219
|
+
// them, so the token multiplier droid shows a model by (rateOf) is carried
|
|
220
|
+
// here.
|
|
221
|
+
function providerModel(provider, m, now = Date.now()) {
|
|
222
|
+
const { rate, rateWas } = rateOf(m, now)
|
|
223
|
+
return {
|
|
224
|
+
id: m.id,
|
|
225
|
+
providerID: provider.id,
|
|
226
|
+
name: m.name,
|
|
227
|
+
api: { id: m.id, url: m.wire.api, npm: m.wire.npm },
|
|
228
|
+
status: "active",
|
|
229
|
+
headers: {},
|
|
230
|
+
options: {},
|
|
231
|
+
cost: { input: 0, output: 0, cache: { read: 0, write: 0 } },
|
|
232
|
+
limit: { context: m.context, output: m.output },
|
|
233
|
+
capabilities: {
|
|
234
|
+
temperature: true,
|
|
235
|
+
reasoning: m.efforts.length > 0,
|
|
236
|
+
attachment: m.images,
|
|
237
|
+
toolcall: true,
|
|
238
|
+
input: { text: true, image: m.images, audio: false, video: false, pdf: false },
|
|
239
|
+
output: { text: true, image: false, audio: false, video: false, pdf: false },
|
|
240
|
+
interleaved: false,
|
|
241
|
+
},
|
|
242
|
+
release_date: "",
|
|
243
|
+
variants: Object.fromEntries(m.efforts.map((e) => [e, variant(m.wire.npm, e)])),
|
|
244
|
+
free: false,
|
|
245
|
+
// magpie's own: the token multiplier a request costs now, and the
|
|
246
|
+
// multiplier before a promotion running now (0: none)
|
|
247
|
+
rate,
|
|
248
|
+
rateWas,
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// providerModels is the list the provider hook answers with, at now.
|
|
253
|
+
function providerModels(provider, now = Date.now()) {
|
|
254
|
+
return Object.fromEntries(MODELS.map((m) => [m.id, providerModel(provider, m, now)]))
|
|
255
|
+
}
|
|
256
|
+
|
|
185
257
|
// ---- tokens -----------------------------------------------------------------
|
|
186
258
|
|
|
187
259
|
class FactoryStatus extends Error {
|
|
@@ -474,11 +546,18 @@ function droidBody(path, body) {
|
|
|
474
546
|
if (path.endsWith("/responses")) {
|
|
475
547
|
const v = m.instructions
|
|
476
548
|
if (v !== undefined && v !== null && typeof v !== "string") return body // not something droid sends
|
|
549
|
+
// OpenAI's reasoning models turn temperature and top_p away with a 400,
|
|
550
|
+
// and droid sends neither (Nowledge Mem on gpt-6.1-sol, magpie's Discord)
|
|
551
|
+
const sampled = byId.get(m.model)?.upstream === "openai" && ("temperature" in m || "top_p" in m)
|
|
552
|
+
if (sampled) {
|
|
553
|
+
delete m.temperature
|
|
554
|
+
delete m.top_p
|
|
555
|
+
}
|
|
477
556
|
const opened = promptOpenings(m.input)
|
|
478
557
|
const ins = promptText(v ?? "")
|
|
479
558
|
if (!ins.startsWith(DROID_LINE)) m.instructions = ins.trim() === "" ? DROID_LINE : DROID_LINE + "\n" + ins
|
|
480
559
|
else if (ins !== v || opened) m.instructions = ins
|
|
481
|
-
else return body
|
|
560
|
+
else if (!sampled) return body
|
|
482
561
|
} else if (path.endsWith("/chat/completions")) {
|
|
483
562
|
if (!Array.isArray(m.messages)) return body
|
|
484
563
|
const opened = promptOpenings(m.messages, true)
|
|
@@ -1613,6 +1692,15 @@ export const FactoryAuthPlugin = async ({ client }) => {
|
|
|
1613
1692
|
}
|
|
1614
1693
|
|
|
1615
1694
|
return {
|
|
1695
|
+
// magpie's list for this provider: the same models configModels gives
|
|
1696
|
+
// OpenCode, each with the token multiplier droid shows it by, which
|
|
1697
|
+
// magpie shows beside the model as its rate
|
|
1698
|
+
provider: {
|
|
1699
|
+
id: PROVIDER,
|
|
1700
|
+
async models(provider) {
|
|
1701
|
+
return providerModels(provider)
|
|
1702
|
+
},
|
|
1703
|
+
},
|
|
1616
1704
|
config: async (config) => {
|
|
1617
1705
|
config.provider ??= {}
|
|
1618
1706
|
const was = config.provider[PROVIDER] ?? {}
|
|
@@ -1778,4 +1866,4 @@ export const FactoryAuthPlugin = async ({ client }) => {
|
|
|
1778
1866
|
}
|
|
1779
1867
|
|
|
1780
1868
|
// for tests
|
|
1781
|
-
export const _internal = { fastBody, FAST_BETA, limitWindows, windowEnd, dollars, vendorError, CORE, droidBody, DROID_LINE, geminiBody, leaveOutAttachments, LEFT_OUT, TOO_LARGE_HINT }
|
|
1869
|
+
export const _internal = { fastBody, FAST_BETA, limitWindows, windowEnd, dollars, vendorError, CORE, droidBody, DROID_LINE, geminiBody, leaveOutAttachments, LEFT_OUT, TOO_LARGE_HINT, MODELS, PROMOTIONS, rateOf, configModels, providerModel, providerModels }
|