opencode-zen-freex 0.2.12 → 0.2.14

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/MAINTAINING.md CHANGED
@@ -22,13 +22,25 @@ small. `deepseek-v4.1-flash-free` is declared 200000/32000 while
22
22
  `deepseek-v4.1-flash` — the paid id serving the same upstream model, which
23
23
  `x-opencode-upstream-model-id` confirms — is declared 1000000/384000 in that
24
24
  same catalogue, and `mimo-v2.6-flash-free` is declared 200000/32000 against a
25
- model whose own vendor publishes 1048576/131072.
26
-
27
- Both numbers are acted on. The window decides when a conversation is compacted
28
- and how much of it is ever sent; the output cap is sent as `max_tokens` on every
29
- request, so a reply is cut at it with a finish reason that reads like the
30
- model's own decision. A window that is too small is never refused, it is just
31
- quietly never used, which is why this stayed invisible for so long.
25
+ model whose own vendor publishes 1048576/131072. The ids the tier added on
26
+ 2026-10-16 were under-reported the same way on the day they appeared:
27
+ `ll-alpha-free` names a 262144-token completion ceiling in its own refusal
28
+ against a declared 65536, and `glm-5.3-flash-free` is declared 200000/32000
29
+ while its paid twin `glm-5.3-flash` is declared 1000000/131072 in the same
30
+ catalogue — and a 232685-token prompt was served through the free id, which the
31
+ declared window does not allow. `space-bunny-free` under-reports on a third
32
+ axis, its `input`: the catalogue derives that number from its own pair
33
+ (`context − output`, 524288) while prompts of 535,110, 935,110 and 979,550
34
+ tokens were served through the free id, and the axis is what a host that shows
35
+ a window shows — magpie's `context_window` and `max_input_tokens` both follow
36
+ it, so the derivation was on screen as half a window.
37
+
38
+ All of these numbers are acted on. The window decides when a conversation is
39
+ compacted and how much of it is ever sent; the output cap is sent as
40
+ `max_tokens` on every request, so a reply is cut at it with a finish reason that
41
+ reads like the model's own decision; the `input` axis is the size a
42
+ window-showing host displays. A window that is too small is never refused, it is
43
+ just quietly never used, which is why this stayed invisible for so long.
32
44
 
33
45
  `limits.mjs` holds what was measured, per axis, with the catalogue value it was
34
46
  measured against. Each axis carries `samples` and `how`; the short of it:
@@ -42,6 +54,10 @@ measured against. Each axis carries `samples` and `how`; the short of it:
42
54
  | `big-pickle` | output | 131072 | the ceiling the route names when it is asked for too much |
43
55
  | `nemotron-3.5-lightning-free` | context | 1000000 | the route's own refusal, in its own words |
44
56
  | `longcat-2.5-preview-free` | output | 262144 | the ceiling the route names when it is asked for too much |
57
+ | `ll-alpha-free` | output | 262144 | the ceiling the route's own refusal names, against a declared 65536 |
58
+ | `glm-5.3-flash-free` | context | 1000000 | what this route declares for the same upstream model, with a 232685-token prompt served as witness |
59
+ | `glm-5.3-flash-free` | output | 131072 | what this route declares for the same upstream model |
60
+ | `space-bunny-free` | input | 1048576 | the window this route declares for the same id, with prompts of up to nearly twice the declared input served |
45
61
 
46
62
  A prompt sized just over the window is refused with
47
63
 
@@ -65,6 +81,14 @@ figure is a rough one (characters, not tokens) and must not be read as a count.
65
81
  A second upstream words the same fact as "This endpoint's maximum context length
66
82
  is …" and breaks the request into text input, tool input and output.
67
83
 
84
+ **The input**, the third axis: nothing cheap names it — the refusals on this
85
+ route name the window, and this id's own refusal names nothing at all — so it is
86
+ measured by serving. A prompt sized past the declared input is the measurement
87
+ (535,110, 935,110 and 979,550-token prompts each came back with the needle at
88
+ their end echoed, and `usage.prompt_tokens` is the count that says how much was
89
+ served), and the window the catalogue declares for the same id bounds the value
90
+ from above: a request placed over it is refused.
91
+
68
92
  The ceiling, which is cheaper than the window: ask for `max_tokens: 1000000` on a
69
93
  short prompt and stop reading as soon as the answer starts. An upstream that
70
94
  validates the ceiling refuses and names it — `max_tokens is too large: 1000000.
@@ -95,7 +119,8 @@ own, which is the intended end state.
95
119
  that model's window for the rest of the process. The list is rebuilt at every
96
120
  start and hourly after, so a route that changes the window it enforces is
97
121
  followed without anyone editing this file. Nothing is persisted: a restart falls
98
- back to what is measured here.
122
+ back to what is measured here. The `input` axis has no live form: the refusals
123
+ this route sends name a window and a completion ceiling, and never an input cap.
99
124
 
100
125
  **The same shape on a second upstream.** `mimo-v2.6-flash-free` is declared
101
126
  200000/32000 here too, and its window is a route figure like the one above — an
package/README.md CHANGED
@@ -45,9 +45,9 @@ magpie plugin login opencode-zen-free
45
45
 
46
46
  插件会去发现 Zen 当前的免费模型,包括它们的上下文窗口和思考(reasoning)等级。用 `opencode-zen-free/<模型名>`,例如 `opencode-zen-free/big-pickle`。
47
47
 
48
- 免费模型的目录上限有时被 Zen 少报,而少报的那一边没有谁会报错:`deepseek-v4.1-flash-free` 在目录里是 20 万上下文 / 3.2 万输出,而同一上游模型的付费 id 是 100 万 / 38.4 万。上下文窗口太小只会让宿主安静地早点压缩,输出上限太小会把回复截断成看起来像模型自己停下的样子,所以插件对这类模型按实测与路由自述对齐(依据与复测方法见 `MAINTAINING.md` 的 “Limits Zen under-reports”),并在运行中采用上游自报的窗口。
48
+ 免费模型的目录上限有时被 Zen 少报,而少报的那一边没有谁会报错:`deepseek-v4.1-flash-free` 在目录里是 20 万上下文 / 3.2 万输出,而同一上游模型的付费 id 是 100 万 / 38.4 万。上下文窗口太小只会让宿主安静地早点压缩,输出上限太小会把回复截断成看起来像模型自己停下的样子;`input` 这一轴同样会被少报——有些宿主显示的「上下文窗口」取的就是它(magpie 如此),而 `space-bunny-free` 的 `input` 是目录自己按 `context − output` 推出的 52.4 万,实测 97.9 万 token 的 prompt 都被完整服务、结尾的暗号原样复述。所以插件对这类模型按实测与路由自述对齐(依据与复测方法见 `MAINTAINING.md` 的 “Limits Zen under-reports”),并在运行中采用上游自报的窗口。
49
49
 
50
- 已下线的模型和 SystemOne 模型会被排除。这份列表在宿主每次列举模型时重新获取(magpie 在启动时做一次,之后每小时一次):Zen 不再免费开放的模型会退出列表,新转为免费的模型会加入列表——**不等** OpenCode 的目录或文档写到它:只要 Zen 的列表里有、id 里带 `-free`,就按 provider 自己的协议(OpenAI 兼容 / chat)提供,目录晚一步也不影响。
50
+ 已下线的模型和 SystemOne 模型会被排除:「下线」指的是状态写着 `retired`/`disabled`,或带着已生效的退役日期。目录里标了 `deprecated` 但 Zen 的列表里还在的模型**照常提供**——`deprecated` 是预告,而「还在不在」由列表说了算(实测 2026-10-16:`muse-spark-1.2-contributor-free` 在目录里是 `deprecated`,Zen 仍在服务它,把它当退役就把一个能用的免费模型藏掉了)。这份列表在宿主每次列举模型时重新获取(magpie 在启动时做一次,之后每小时一次):Zen 不再免费开放的模型会退出列表,新转为免费的模型会加入列表——**不等** OpenCode 的目录或文档写到它:只要 Zen 的列表里有、id 里带 `-free`,就按 provider 自己的协议(OpenAI 兼容 / chat)提供,目录晚一步也不影响。
51
51
 
52
52
  目录或文档读不到时**不算 fallback**:Zen 的列表已经读到了,它就是当前该提供的东西;报成 fallback 会让宿主保守地沿用上一次完整读到的列表,于是读不到 `raw.githubusercontent.com` 或 `models.opencode.ai` 的机器永远看不到之后新转免费的模型。只有**列表本身**读不到才沿用上一次结果;第一次还没读到之前,用的是打包在插件里的那份,所以这个 provider 不会空着。请求一个当前并不免费的模型,会得到一个 404 并列出当时免费的模型;若某个模型是在上次列举之后才转免费的,请求会在重新获取列表后照常服务(最多每分钟一次)。可用性和限流由 Zen 决定,插件这边拿不到剩余额度。
53
53
 
package/limits.mjs CHANGED
@@ -12,9 +12,17 @@
12
12
  // output cap that is too small cuts replies off with a finish reason that looks
13
13
  // like the model's own decision.
14
14
  //
15
+ // The input axis is the third, and it fails the same way one layer out. A host
16
+ // that plans what to send reads it as the room a prompt has; a host that shows a
17
+ // model's window reads it as the window itself — measured 2026-10-16, magpie's
18
+ // `context_window` and `max_input_tokens` both follow `limit.input` when one is
19
+ // declared. So an input axis that under-reports is not only never used, it is
20
+ // what a user is shown as the model's size.
21
+ //
15
22
  // Only evidence moves a value here, and evidence is sorted:
16
23
  //
17
- // route the route's own refusal, in its own words
24
+ // route the route's own answer about its own limit: the words of a
25
+ // refusal, or what its own service demonstrates
18
26
  // route-twin what this route declares for the same upstream model
19
27
  // vendor the model vendor's published page
20
28
  // witnessed a generation somebody watched finish
@@ -96,20 +104,75 @@ export const LIMITS = {
96
104
  how: "\"Upstream request failed: [invalid_parameter] 参数校验失败: /max_tokens: 1000000 is not less or equal to 262144\" — the second wording namedOutputCap reads, where the ceiling is the number max_tokens has to stay under. Its context needs nothing: the catalogue's 1000000 is what that same refusal calls the endpoint's window.",
97
105
  },
98
106
  },
107
+ // The two the free tier added on 2026-10-16, each measured the day it was
108
+ // noticed. Both under-report in the catalogue the same way the older entries
109
+ // do, and both were checked on every axis: nothing below is what a refusal
110
+ // happened to say, it is all that was asked.
111
+ "ll-alpha-free": {
112
+ output: {
113
+ value: 262144,
114
+ source: "route",
115
+ declaredAt: 65536,
116
+ measured: "2026-10-16",
117
+ samples: "max_completion_tokens 1000000 and 300000 both refused, each naming 262144; nothing above 65536 watched — the ceiling is the route's own number, four times what the catalogue declares",
118
+ how: "\"Upstream request failed: [400] max_completion_tokens is too large: 300000.This model supports at most 262144 completion tokens.\" — the ceiling is the number the sentence names. Its context needs nothing: the same day's refusal, \"The input (341480 tokens) is longer than the model's context length (262144 tokens).\", is the window the catalogue already declares.",
119
+ },
120
+ },
121
+ "glm-5.3-flash-free": {
122
+ context: {
123
+ value: 1000000,
124
+ source: "route-twin",
125
+ declaredAt: 200000,
126
+ measured: "2026-10-16",
127
+ samples: "a 232685-token prompt was served and answered from (usage.prompt_tokens 232685), so the declared 200000 is already known to be small; nothing above it was refused, because this upstream refuses no max_tokens at all",
128
+ how: "glm-5.3-flash, the paid id serving the same upstream model — the catalogue's own canonical_model_id for this free id is zhipuai/glm-5.3-flash — is declared 1000000 in this same catalogue",
129
+ },
130
+ output: {
131
+ value: 131072,
132
+ source: "route-twin",
133
+ declaredAt: 32000,
134
+ measured: "2026-10-16",
135
+ samples: "max_tokens 4000000 was accepted with no refusal at all, which is the DeepSeek upstream's shape: silence here is not evidence of a ceiling either way, and nothing above 32000 was watched",
136
+ how: "the same paid twin declares 131072 on this axis",
137
+ },
138
+ },
139
+ // Measured the day a host's window for this id was reported half its size.
140
+ // Only the input axis moves: the window and the ceiling are what this route
141
+ // declares, and what was served agrees with both.
142
+ "space-bunny-free": {
143
+ input: {
144
+ value: 1048576,
145
+ source: "route",
146
+ declaredAt: 524288,
147
+ measured: "2026-10-16",
148
+ samples: "prompts of 535,110, 935,110 and 979,550 tokens served whole, each with the needle at the end of it echoed back and each counted by `usage.prompt_tokens`, so the declared 524288 is already known to be small; a prompt placed over the window was refused 400, in words that name nothing",
149
+ how: "the catalogue's 524288 is its own `context − output` (1048576 − 524288) read as a cap, and this route does not enforce it: the samples above run from just past the declared cap to nearly twice it, served whole, and the wall is the 1048576-token window this same catalogue declares for this id. A host that shows the input axis shows the window — magpie's `context_window` and `max_input_tokens` are both this field when one is declared — so a derivation left here is a wrong window on screen.",
150
+ },
151
+ },
99
152
  };
100
153
 
101
154
  // "This model's maximum context length is 1048576 tokens. However, you
102
155
  // requested 1422278 tokens (1038278 in the messages, 384000 in the
103
- // completion)." — the route's own words, and the only sentence seen on this
104
- // route that states a window. A second upstream phrases the same fact as "This
105
- // endpoint's maximum context length is ...", with the request broken into text
106
- // input, tool input and output; both are the route naming its own window, and
107
- // its "requested about" figure is a rough one (chars, not tokens) rather than
108
- // the count a served request reports in `usage.prompt_tokens`. A generic 400
109
- // says nothing attributable and is left alone; §7 of the measured notes has a
110
- // context overflow and an invalid parameter answering with byte-identical 400s
156
+ // completion)." — the route's own words, and the sentence seen most often on
157
+ // this route that states a window. A second upstream phrases the same fact as
158
+ // "This endpoint's maximum context length is ...", with the request broken into
159
+ // text input, tool input and output; both are the route naming its own window,
160
+ // and its "requested about" figure is a rough one (chars, not tokens) rather
161
+ // than the count a served request reports in `usage.prompt_tokens`. A generic
162
+ // 400 says nothing attributable and is left alone; §7 of the measured notes has
163
+ // a context overflow and an invalid parameter answering with byte-identical 400s
111
164
  // on another Zen model.
112
- const NAMED_CONTEXT = /maximum context length is (\d+) tokens/id;
165
+ //
166
+ // A third wording states the same fact as a parenthetical, and was missed until
167
+ // it was measured: "The input (341480 tokens) is longer than the model's context
168
+ // length (262144 tokens)." (`ll-alpha-free`, 2026-10-16). It names the same
169
+ // number in the same sentence, so it is read the same way — a window this file
170
+ // does not read is a window the plugin keeps under-declaring, which is the one
171
+ // failure it exists to remove.
172
+ const NAMED_CONTEXT = [
173
+ /maximum context length is (\d+) tokens/id,
174
+ /context length \((\d+) tokens?\)/id,
175
+ ];
113
176
 
114
177
  // "max_tokens is too large: 200000. This model supports at most 131072 completion
115
178
  // tokens, whereas you provided 200000." — an upstream that validates the ceiling
@@ -169,7 +232,7 @@ function describe({ kind, id, axis, value, measuredAgainst, declared }) {
169
232
  // The window a refusal names, or undefined when the body says nothing
170
233
  // attributable. Exported for the tests and for anyone reading a capture.
171
234
  export function namedContextWindow(text) {
172
- return namedFrom([NAMED_CONTEXT], text)?.value;
235
+ return namedFrom(NAMED_CONTEXT, text)?.value;
173
236
  }
174
237
 
175
238
  // The completion ceiling a refusal names, or undefined. Same rule as the window:
@@ -373,7 +436,7 @@ function digitsEnd(found) {
373
436
  // returned cannot be two answers.
374
437
  function namedAxes(text, limit, cut) {
375
438
  const head = text.slice(0, limit);
376
- const context = namedFrom([NAMED_CONTEXT], head);
439
+ const context = namedFrom(NAMED_CONTEXT, head);
377
440
  const output = namedFrom(NAMED_OUTPUT, head);
378
441
  const onCut = (found) => cut && found !== undefined && digitsEnd(found) >= head.length;
379
442
  return {
@@ -401,7 +464,7 @@ export function limitOverrides(
401
464
  // an object handed in as `table` carries — evidence for a model nobody
402
465
  // declared, from a table that never named it.
403
466
  const record = table && Object.hasOwn(table, id) ? table[id] : undefined;
404
- for (const axis of ["context", "output"]) {
467
+ for (const axis of ["context", "input", "output"]) {
405
468
  // Own property, like the table lookup two lines up: `declared` is handed in
406
469
  // by a caller, and a `context` inherited from a custom prototype — or from a
407
470
  // polluted `Object.prototype` — would otherwise be read as a declaration the
@@ -409,7 +472,12 @@ export function limitOverrides(
409
472
  // check with a number nobody declared.
410
473
  const declaredValue = declared && Object.hasOwn(declared, axis) ? declared[axis] : undefined;
411
474
  const entry = record?.[axis];
412
- const live = (axis === "context" ? observed : observedOutput)?.get(id);
475
+ // Only the axes a refusal names have a live form — a window and a
476
+ // completion ceiling. An input axis is answered from the table alone: the
477
+ // refusals this route sends name the window that bounds it, never an input
478
+ // cap of its own, so there is nothing to observe into it.
479
+ const live =
480
+ (axis === "context" ? observed : axis === "output" ? observedOutput : undefined)?.get(id);
413
481
  // A route statement made while this process was running is the same tier as
414
482
  // the table and newer than it, so it is taken as it stands. Everything else
415
483
  // has to have been measured against the catalogue in front of us now: the
package/models.mjs CHANGED
@@ -44,15 +44,23 @@ const hasValue = (value) => value !== null && value !== undefined;
44
44
  // offered. A status that is set — "active" included — is still read as itself.
45
45
  const isSet = (value) => hasValue(value) && String(value).trim() !== "";
46
46
 
47
+ // A status ends a model when it says the model is gone: "retired" and
48
+ // "disabled" are endings. "deprecated" is not one — it says the catalogue
49
+ // expects the model to go, and what decides whether it is still there is the
50
+ // list Zen serves, which discovery already reads: measured 2026-10-16,
51
+ // `muse-spark-1.2-contributor-free` is marked deprecated in the catalogue while
52
+ // Zen lists it and the free tier answers a request for it through this plugin,
53
+ // so reading that status as an ending hid a model that was being served.
54
+ const ENDED = ["retired", "disabled"];
55
+
47
56
  function isRetired(model) {
48
57
  return (
49
58
  model.deprecated === true ||
50
- ["deprecated", "retired", "disabled"].includes(
51
- isSet(model.status) ? model.status : model.lifecycle,
52
- ) ||
59
+ ENDED.includes(isSet(model.status) ? model.status : model.lifecycle) ||
53
60
  // Read through `isSet`, not `hasValue`: a blank `deprecated_at` is the empty
54
61
  // string the catalogue writes for a date it does not have, and reading it as
55
- // a date retired a model that was still on offer.
62
+ // a date retired a model that was still on offer. An effective date is an
63
+ // ending whatever the status beside it says.
56
64
  isSet(model.deprecated_at) ||
57
65
  isSet(model.retirement_date)
58
66
  );
@@ -191,10 +199,19 @@ export const bootstrapProtocols = {
191
199
  "nemotron-3.5-lightning-free": "chat",
192
200
  "muse-spark-1.3-contributor-free": "responses",
193
201
  "jev-1.13-free": "systemone",
202
+ // The free tier's list on 2026-10-16, when these five appeared: the four chat
203
+ // ones and the responses one below, whose paid twin the docs table names.
204
+ "deepseek-v4.1-flash-free": "chat",
205
+ "glm-5.3-flash-free": "chat",
206
+ "ll-alpha-free": "chat",
207
+ "nemotron-3.5-super-vl-free": "chat",
208
+ "muse-spark-1.2-contributor-free": "responses",
194
209
  };
195
210
 
196
- // Offline bootstrap metadata from the OpenCode catalog, 2026-10-06; the
197
- // free models listed since added on 2026-10-15.
211
+ // Offline bootstrap metadata from the OpenCode catalog, 2026-10-06; the free
212
+ // models listed since added on 2026-10-15, and the ids the tier was serving on
213
+ // 2026-10-16 added then. A host that reaches nothing on its first run offers
214
+ // these; the first discovery replaces the list.
198
215
  export const bootstrapProvider = {
199
216
  npm: SDK.chat,
200
217
  models: {
@@ -270,6 +287,66 @@ export const bootstrapProvider = {
270
287
  { type: "effort", values: ["minimal", "low", "medium", "high", "xhigh"] },
271
288
  ],
272
289
  },
290
+ // The free ids the tier was serving on 2026-10-16 and this snapshot did not
291
+ // carry. Their numbers are the catalogue's, as every other entry here is —
292
+ // `limits.mjs` is what corrects the ones the catalogue under-reports, and it
293
+ // carries entries for two of these.
294
+ "deepseek-v4.1-flash-free": {
295
+ name: "DeepSeek V4.1 Flash Free",
296
+ cost: { input: 0, output: 0 },
297
+ limit: { context: 200000, output: 32000 },
298
+ reasoning: true,
299
+ tool_call: true,
300
+ interleaved: { field: "reasoning_content" },
301
+ modalities: { input: ["text", "image"], output: ["text"] },
302
+ reasoning_options: [{ type: "effort", values: ["low", "high", "max"] }],
303
+ },
304
+ "glm-5.3-flash-free": {
305
+ name: "GLM-5.3-Flash Free",
306
+ cost: { input: 0, output: 0 },
307
+ limit: { context: 200000, output: 32000 },
308
+ reasoning: true,
309
+ tool_call: true,
310
+ interleaved: { field: "reasoning_content" },
311
+ modalities: { input: ["text", "image", "video", "pdf"], output: ["text"] },
312
+ reasoning_options: [{ type: "effort", values: ["low", "high", "max"] }],
313
+ },
314
+ "ll-alpha-free": {
315
+ name: "LL Alpha Free",
316
+ cost: { input: 0, output: 0 },
317
+ limit: { context: 262144, output: 65536 },
318
+ reasoning: true,
319
+ tool_call: true,
320
+ interleaved: { field: "reasoning_content" },
321
+ modalities: { input: ["text"], output: ["text"] },
322
+ reasoning_options: [
323
+ { type: "effort", values: ["low", "medium", "high", "xhigh", "max"] },
324
+ ],
325
+ },
326
+ "nemotron-3.5-super-vl-free": {
327
+ name: "Nemotron 3.5 Super VL Free",
328
+ cost: { input: 0, output: 0 },
329
+ limit: { context: 1048576, output: 131072 },
330
+ reasoning: true,
331
+ tool_call: true,
332
+ interleaved: { field: "reasoning_content" },
333
+ modalities: { input: ["text", "image"], output: ["text"] },
334
+ reasoning_options: [
335
+ { type: "effort", values: ["none", "minimal", "low", "medium", "high", "xhigh"] },
336
+ ],
337
+ },
338
+ "muse-spark-1.2-contributor-free": {
339
+ name: "Muse Spark 1.2 Free",
340
+ cost: { input: 0, output: 0 },
341
+ provider: { npm: SDK.responses },
342
+ limit: { context: 1048576, output: 131072 },
343
+ reasoning: true,
344
+ tool_call: true,
345
+ modalities: { input: ["text", "image", "video", "pdf", "audio"], output: ["text"] },
346
+ reasoning_options: [
347
+ { type: "effort", values: ["minimal", "low", "medium", "high", "xhigh"] },
348
+ ],
349
+ },
273
350
  },
274
351
  };
275
352
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-zen-freex",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "description": "OpenCode Zen's free models, for hosts that are not OpenCode: the public credential, automatic discovery and native streaming protocols",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",