@gtrabanco/pi-nan-provider 1.5.4 → 1.5.6

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.
@@ -15,7 +15,9 @@
15
15
  * models.dev value in place.
16
16
  *
17
17
  * Fields override the models.dev-derived entry one-for-one:
18
- * name, reasoning, input, cost, contextWindow, maxTokens.
18
+ * name, reasoning, input, cost, contextWindow, maxTokens, reasoningEffortValues,
19
+ * thinkingLevelMap. `maxTokensField` is the exception: it lands on the entry's
20
+ * `compat` (see the field docs below).
19
21
  *
20
22
  * An override may also act as a pin — a value models.dev already agrees with,
21
23
  * kept so an upstream regression cannot silently drop a confirmed capability.
@@ -61,51 +63,34 @@ export interface ManualModelOverride {
61
63
  }
62
64
 
63
65
  /**
64
- * Manual reasoning effort values sourced from the NaN docs
65
- * (https://nan.builders/docs/models #controlling-reasoning, checked 2026-09-29).
66
+ * Reasoning effort values are NOT a separate table: every model declares its own
67
+ * `reasoningEffortValues` (and `thinkingLevelMap`) inside MANUAL_OVERRIDES below,
68
+ * next to the provenance note that justifies the list. models.dev exposes no
69
+ * `reasoning_effort_values` field — only `reasoning_options` — so these lists
70
+ * are hand-maintained from https://nan.builders/docs/models#controlling-reasoning.
66
71
  *
67
- * models.dev has NO `reasoning_effort_values` field — only `reasoning_options`
68
- * (which is [{type:"toggle"}] or []), so this mapping must be hand-maintained
69
- * from the docs. The values flow through MANUAL_OVERRIDES.reasoningEffortValues
70
- * and appear in GeneratedModelEntry.reasoningEffortValues, where the pi
71
- * model-selector can read them to show the correct granularity.
72
+ * One source only: `scripts/generate-models.ts` reads them from the override and
73
+ * has no fallback map of its own.
72
74
  *
73
- * Per-model contract from the docs, corrected by live measurement where the
74
- * two disagree (maintainer instruction: the measurement wins over the docs):
75
- * - glm5.3, glm5.3-flash: fully controllable (low/medium/high/max)
76
- * + minimal also accepted (issue #16, measured 2026-09-27): minimal
77
- * yields 38 reasoning tokens vs 2,288 for high — the docs simply
78
- * omitted it because it was not originally advertised, but it IS
79
- * accepted and effective by the gateway.
80
- * - qwen3.6, gemma4: none/minimal skip reasoning, others cap depth
81
- * (2,048 / 8,192 / 16,384 / 32,768).
82
- * - deepseek-v4-flash: `none` reproducibly disables reasoning (0 reasoning
83
- * tokens, full answer); every other value — `minimal`, `low`, `high` and
84
- * omitting the parameter — leaves it ON (issue #16, 2026-09-27,
85
- * re-confirmed live 2026-10-14: none 0 / low 57 / omitted 63 reasoning
86
- * tokens). The docs say "any value (no effect)"; the measurement wins, so
87
- * the catalog declares only ["none"].
88
- * - mimo-v2.6-flash: the docs list it as "accepted, depth not adjustable",
89
- * but the live re-probe (2026-10-14) shows `none` → 0 reasoning tokens
90
- * while `low` → 22 and omission → 17. Adjustable at the off end, so it
91
- * carries `thinkingLevelMap { off: "none" }`.
92
- * - qwen3.8-flash: the docs say "accepted, depth not adjustable"; the live
93
- * probe measured 0 reasoning tokens for `none` (2026-10-14) but no other
94
- * value was sampled, so no `thinkingLevelMap` is declared — the docs state
95
- * its default is reasoning ON, so `off` sends nothing and the model decides.
75
+ * A model with `reasoningEffortValues: []` accepts the parameter but manages its
76
+ * own reasoning depth — it is never an error to send a value. `thinkingLevelMap.off`
77
+ * is the load-bearing field: pi maps `reasoning: "off"` to `reasoningEffort:
78
+ * undefined`, and pi-ai only emits `reasoning_effort` when that map supplies a
79
+ * value. The effort list itself is catalog documentation (pi and pi-ai do not
80
+ * read it; checked against pi-ai/pi 1.5.1).
96
81
  *
97
- * (mimo-v2.5, which used to share that last row, was removed by NaN — absent
98
- * from the docs and from openapi.json, checked 2026-09-29.)
99
- *
100
- * A model with reasoning_effort_values=[] means the parameter is accepted but
101
- * the model manages its own reasoning depth — it is never an error.
82
+ * `xhigh` and `max` need an entry of their own. pi-ai treats both as OPT-IN:
83
+ * `getSupportedThinkingLevels()` only lists them when the map carries a non-null
84
+ * entry (pi-ai 1.5.1 `dist/models.js`, and its README: "`xhigh` and `max` are
85
+ * opt-in and require a non-null map entry"). Without it pi clamps a requested
86
+ * `max` down to `high` and the gateway never sees it, even though NaN accepts it.
87
+ * So every model whose docs declare a ladder up to `max` carries the identity
88
+ * entries `{ xhigh: "xhigh", max: "max" }`: the strings are what pi-ai would
89
+ * send anyway, so the map only widens what pi offers. Models whose docs document
90
+ * nothing but `none` plus a default (`hy4`, `hy4-flash`, `qwen3.8-max`) and the
91
+ * two outside the reasoning contract (`kimi-k3.1-pro`, `deepseek-v4-pro`) keep
92
+ * `off` alone and stay at `off`…`high`.
102
93
  */
103
- export const REASONING_EFFORT_VALUES: Record<string, string[]> = {
104
- "glm5.3": ["low", "medium", "high", "max"],
105
- "glm5.3-flash": ["minimal", "low", "medium", "high", "max"],
106
- "qwen3.6": ["none", "minimal", "low", "medium", "high", "max"],
107
- "gemma4": ["none", "minimal", "low", "medium", "high", "max"],
108
- };
109
94
 
110
95
  /**
111
96
  * Provenance for the manual-only mimo-v2.6-flash entry, shared by
@@ -116,42 +101,75 @@ const MANUAL_ONLY_NOTE =
116
101
  "omnimodal model (text, image, audio input) served by NaN; limits and modalities from https://nan.builders/docs/models#mimo-v2-6-flash (checked 2026-09-25, quotas re-checked 2026-09-29): 1,048,576 context / 131,072 max output / 1.0B monthly quota per member. Tool calling: yes. Streaming: yes. Input modalities (pi-representable): text, image (audio not representable in pi's Model type). Fallback entry: emitted only while models.dev provider nan does not list the model — models.dev started listing it on 2026-09-29, so the generator then keeps the models.dev values and attaches this note to that entry instead of emitting a second one.";
117
102
 
118
103
  /**
119
- * NaN external-provider models launched 2026-11-10 (ZDR, served through
120
- * external providers). models.dev provider nan does not list them, the NaN
121
- * docs/openapi do not mention them yet, but the live `GET /v1/models` does
122
- * (checked 2026-11-10, a non-premium key sees all four). Values per spec S2 of
123
- * odd/tasks/nan-external-models-2026-11.md; nothing here is a guess:
124
- * - contextWindow: NaN's pricing page card says "1M context" for each model
125
- * (maintainer screenshot, 2026-11-10); NaN's convention for 1M is 1,048,576
126
- * (https://nan.builders/docs/pi). qwen3.8-max uses the first-party vendor value
127
- * 1,000,000 (models.dev provider alibaba), the smaller of the two.
128
- * - maxTokens 32,768: https://nan.builders/docs/pi declares maxTokens 32768 for
129
- * every 1M-context NaN model; every vendor limit is >= 65,536 (models.dev
130
- * moonshotai / alibaba / deepseek / tencent-tokenhub), and NaN's gateway
131
- * already rejected a high max_tokens once (issue #20).
132
- * - input: first-party vendor modalities on models.dev (moonshotai/kimi-k3.1-pro,
133
- * alibaba/qwen3.8-max, deepseek/deepseek-v4-pro, tencent-tokenhub/hy4)
134
- * restricted to pi's text/image.
135
- * - reasoning true: all four are reasoning models per their vendors.
136
- * reasoningEffortValues [] and NO thinkingLevelMap: how NaN's gateway
137
- * translates reasoning_effort for external providers is unmeasured.
138
- * - cost 0: maintainer decision (NaN is quota/credit based).
104
+ * NaN's larger models (the NaN docs' own label). Four of them entered the
105
+ * catalog on 2026-11-10 as "external, undocumented" — ZDR models served
106
+ * through external providers — and `qwen4-max`/`hy4-flash` are newer still.
107
+ *
108
+ * https://nan.builders/docs/models now documents every one of them (checked
109
+ * 2026-11-17): context, "Max answer", input modalities and reasoning behaviour.
110
+ * models.dev provider `nan` lists the four from 2026-11-10 but neither
111
+ * `qwen4-max` nor `hy4-flash`, so the whole block keeps its entries: they are
112
+ * what makes these values survive a models.dev refresh, and the manual-only
113
+ * detail keeps the two undocumented ids in the catalog even though models.dev
114
+ * has no row for them at all.
115
+ *
116
+ * Values and their sources (docs win; models.dev first-party vendor entries
117
+ * only break ties the docs leave open — the 1M = 1,048,576 vs 1,000,000 one):
118
+ * - qwen4-max: 1M context (vendor 1,000,000), "Max answer 131K", text+image,
119
+ * `reasoning_effort` none…max with `none` off, `max_tokens` bounds the total.
120
+ * - hy4-flash: 1M context, "Max answer 64K", text+image, reasons by default with
121
+ * no default level, `none` turns it off, `max_tokens` bounds the total.
122
+ * - hy4: 1M context, "Max answer 64K", text+image, default level `low`,
123
+ * aliases mapped.
124
+ * - qwen3.8-max: 1M context (vendor 1,000,000), "Max answer 131K", text+image,
125
+ * `none` off, and `max_completion_tokens` caps the total while `max_tokens`
126
+ * bounds only the visible answer (issue #34's quota failure mode).
127
+ * - kimi-k3.1-pro: 1M context, "Max answer 1M", text+image, reasoning model
128
+ * with no documented level contract and aliases NOT mapped.
129
+ * - deepseek-v4-pro: 1M context, "Max answer 393K", text only, same caveat.
130
+ * - cost 0: maintainer decision (NaN bills credits, not per-token USD).
139
131
  */
140
- const EXTERNAL_MODEL_NOTE_SUFFIX =
141
- " Existence: live GET https://api.nan.builders/v1/models (checked 2026-11-10); the docs https://nan.builders/docs/models, https://nan.builders/docs/pi and https://nan.builders/openapi.json do not list it yet. reasoningEffortValues [] and no thinkingLevelMap: the gateway's reasoning_effort handling for external providers is unmeasured. cost 0 per maintainer decision.";
132
+ const LARGER_MODEL_NOTE_SUFFIX =
133
+ " Cost 0 per maintainer decision (NaN bills credits, not per-token USD).";
142
134
 
143
- const EXTERNAL_MODELS: Record<string, ManualModelOverride> = {
135
+ const LARGER_MODELS: Record<string, ManualModelOverride> = {
136
+ "qwen4-max": {
137
+ name: "Qwen4 Max",
138
+ input: ["text", "image"],
139
+ reasoning: true,
140
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
141
+ contextWindow: 1_000_000,
142
+ maxTokens: 131_072,
143
+ reasoningEffortValues: ["none", "minimal", "low", "medium", "high", "xhigh", "max"],
144
+ thinkingLevelMap: { off: "none", xhigh: "xhigh", max: "max" },
145
+ note:
146
+ "Qwen4 Max, Alibaba's Qwen 4 flagship, documented in https://nan.builders/docs/models (checked 2026-11-17) and listed by the live GET https://api.nan.builders/v1/models (checked 2026-11-17); models.dev provider nan does not list it, so it enters as a manual-only entry. contextWindow 1,000,000: the card says '1M token context' and both first-party vendor entries on models.dev (vercel/alibaba/qwen4-max and openrouter/qwen/qwen4-max) say 1,000,000 — the smaller of that and NaN's 1M = 1,048,576 convention (https://nan.builders/docs/pi), the same rule qwen3.8-max follows. maxTokens 131,072: the card says 'Max answer 131K tokens' and the reasoning section says 'max_tokens bounds the total, reasoning plus answer, up to 131,000'. input text+image and reasoning true per the card. Reasoning: the card says 'reasoning_effort: none turns it off · minimal to max', and the reasoning section repeats that none turns it off on this model, so reasoningEffortValues declares the documented ladder and thinkingLevelMap { off: 'none' } supplies the off switch when pi maps reasoning:'off' to undefined." +
147
+ LARGER_MODEL_NOTE_SUFFIX,
148
+ },
149
+ "hy4-flash": {
150
+ name: "Hy4 Flash",
151
+ input: ["text", "image"],
152
+ reasoning: true,
153
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
154
+ contextWindow: 1_048_576,
155
+ maxTokens: 65_536,
156
+ reasoningEffortValues: ["none"],
157
+ thinkingLevelMap: { off: "none" },
158
+ note:
159
+ "Hy4 Flash, Tencent's fast Hunyuan 4, documented in https://nan.builders/docs/models (checked 2026-11-17) and listed by the live GET https://api.nan.builders/v1/models (checked 2026-11-17); models.dev provider nan does not list it, so it enters as a manual-only entry. contextWindow 1,048,576: the card says '1M token context' and NaN's 1M convention is 1,048,576 (https://nan.builders/docs/pi), which the first-party models.dev entry openrouter/tencent/hy4-flash also reports. maxTokens 65,536: the card says 'Max answer 64K tokens' (64K = 65,536), and its reasoning section says 'max_tokens bounds reasoning plus answer, up to 64,000', so the classic max_tokens field stays. input text+image and reasoning true per the card ('Tool calling and reasoning'). The docs keep this model out of the effort table ('Reasons by default, with no default level applied ... To turn reasoning off send reasoning_effort: none; the model ignores enable_thinking on its own'), so reasoningEffortValues declares only the documented off value and thinkingLevelMap { off: 'none' } puts it on the wire." +
160
+ LARGER_MODEL_NOTE_SUFFIX,
161
+ },
144
162
  "kimi-k3.1-pro": {
145
163
  name: "Kimi K3.1 Pro",
146
164
  input: ["text", "image"],
147
165
  reasoning: true,
148
166
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
149
167
  contextWindow: 1_048_576,
150
- maxTokens: 32_768,
168
+ maxTokens: 1_048_576,
151
169
  reasoningEffortValues: [],
152
170
  note:
153
- "NaN external-provider model launched 2026-11-10. contextWindow 1,048,576: NaN pricing page card '1M context' (maintainer screenshot, 2026-11-10) with NaN's 1M = 1,048,576 convention (https://nan.builders/docs/pi). maxTokens 32,768: https://nan.builders/docs/pi declares 32768 for every 1M-context NaN model (vendor limit 1,048,576 on models.dev provider moonshotai). input text+image per models.dev provider moonshotai (kimi-k3.1-pro), reasoning model per the vendor." +
154
- EXTERNAL_MODEL_NOTE_SUFFIX,
171
+ "Kimi K3.1 Pro, documented in https://nan.builders/docs/models (checked 2026-11-17; models.dev provider nan lists it since 2026-11-10). contextWindow 1,048,576 ('1M token context') and maxTokens 1,048,576 ('Max answer 1M tokens', which models.dev nan reports as limit.output) — pi-ai clamps the outgoing budget with clampMaxTokensToContext, so declaring the documented maximum never sends an over-context max_tokens. input text+image per the card. Reasoning: the card only says 'Reasoning model', and the docs keep this model out of the effort contract while stating that the `none` aliases are NOT mapped on it, so no reasoningEffortValues and no thinkingLevelMap are declared: pi sends no reasoning_effort and the model's own behaviour decides." +
172
+ LARGER_MODEL_NOTE_SUFFIX,
155
173
  },
156
174
  "qwen3.8-max": {
157
175
  name: "Qwen3.8 Max",
@@ -159,11 +177,13 @@ const EXTERNAL_MODELS: Record<string, ManualModelOverride> = {
159
177
  reasoning: true,
160
178
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
161
179
  contextWindow: 1_000_000,
162
- maxTokens: 32_768,
163
- reasoningEffortValues: [],
180
+ maxTokens: 131_072,
181
+ maxTokensField: "max_completion_tokens",
182
+ reasoningEffortValues: ["none"],
183
+ thinkingLevelMap: { off: "none" },
164
184
  note:
165
- "NaN external-provider model launched 2026-11-10. contextWindow 1,000,000: NaN pricing page card says '1M context' (maintainer screenshot, 2026-11-10); the first-party vendor value on models.dev provider alibaba (qwen3.8-max) is 1,000,000, the smaller of it and NaN's 1M = 1,048,576 convention (https://nan.builders/docs/pi), so the vendor value is used. maxTokens 32,768: https://nan.builders/docs/pi declares 32768 for every 1M-context NaN model (vendor limit 131,072 on models.dev provider alibaba). input text+image per models.dev provider alibaba (qwen3.8-max), reasoning model per the vendor." +
166
- EXTERNAL_MODEL_NOTE_SUFFIX,
185
+ "Qwen3.8 Max, documented in https://nan.builders/docs/models (checked 2026-11-17; models.dev provider nan lists it since 2026-11-10). contextWindow 1,000,000: the card says '1M token context' and the first-party vendor value on models.dev provider alibaba (qwen3.8-max) is 1,000,000 — the smaller of that and NaN's 1M = 1,048,576 convention (https://nan.builders/docs/pi). maxTokens 131,072: the card says 'Max answer 131K tokens'. maxTokensField 'max_completion_tokens': the docs state that on this model 'max_tokens only bounds the visible answer: the reasoning comes on top of it. To cap the total (reasoning plus answer, and so the cost) use max_completion_tokens' — the quota blowout issue #34 fixed for qwen3.8-flash, same fix, same sanitizer exemption (SanitizerOptions.preserveMaxCompletionTokens, wired from compat.maxTokensField in src/provider-factory.ts). input text+image per the card. Reasoning: the docs say 'none turns it off' for this model, so reasoningEffortValues declares 'none' and thinkingLevelMap { off: 'none' } sends it when pi maps reasoning:'off' to undefined." +
186
+ LARGER_MODEL_NOTE_SUFFIX,
167
187
  },
168
188
  "deepseek-v4-pro": {
169
189
  name: "DeepSeek V4-Pro (0813 version)",
@@ -171,11 +191,11 @@ const EXTERNAL_MODELS: Record<string, ManualModelOverride> = {
171
191
  reasoning: true,
172
192
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
173
193
  contextWindow: 1_048_576,
174
- maxTokens: 32_768,
194
+ maxTokens: 393_216,
175
195
  reasoningEffortValues: [],
176
196
  note:
177
- "NaN external-provider model launched 2026-11-10 (NaN pricing page name 'DeepSeek V4-Pro (0813 version)'). contextWindow 1,048,576: NaN pricing page card '1M context' (maintainer screenshot, 2026-11-10) with NaN's 1M = 1,048,576 convention (https://nan.builders/docs/pi). maxTokens 32,768: https://nan.builders/docs/pi declares 32768 for every 1M-context NaN model (vendor limit 393,216 on models.dev provider deepseek). input text only per models.dev provider deepseek (deepseek-v4-pro), reasoning model per the vendor." +
178
- EXTERNAL_MODEL_NOTE_SUFFIX,
197
+ "DeepSeek V4-Pro (0813 version), documented in https://nan.builders/docs/models (checked 2026-11-17; models.dev provider nan lists it since 2026-11-10). contextWindow 1,048,576 ('1M token context'). maxTokens 393,216: the card says 'Max answer 393K tokens', the same 393,216 the docs clamp deepseek-v4-flash to; models.dev nan reports 384,000, so the docs value wins (maintainer instruction: docs are the source of truth). input text only per the card ('text generation & chat · reasoning'). Reasoning: the card only says 'Reasoning model', and the docs state the `none` aliases are NOT mapped on this model, so no reasoningEffortValues and no thinkingLevelMap are declared." +
198
+ LARGER_MODEL_NOTE_SUFFIX,
179
199
  },
180
200
  hy4: {
181
201
  name: "Hy4",
@@ -183,16 +203,17 @@ const EXTERNAL_MODELS: Record<string, ManualModelOverride> = {
183
203
  reasoning: true,
184
204
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
185
205
  contextWindow: 1_048_576,
186
- maxTokens: 32_768,
187
- reasoningEffortValues: [],
206
+ maxTokens: 65_536,
207
+ reasoningEffortValues: ["none"],
208
+ thinkingLevelMap: { off: "none" },
188
209
  note:
189
- "NaN external-provider model launched 2026-11-10. contextWindow 1,048,576: NaN pricing page card '1M context' (maintainer screenshot, 2026-11-10) with NaN's 1M = 1,048,576 convention (https://nan.builders/docs/pi). maxTokens 32,768: https://nan.builders/docs/pi declares 32768 for every 1M-context NaN model (vendor limit 65,536 on models.dev provider tencent-tokenhub). input text+image per models.dev provider tencent-tokenhub (hy4), reasoning model per the vendor." +
190
- EXTERNAL_MODEL_NOTE_SUFFIX,
210
+ "Hy4, Tencent's Hunyuan 4, documented in https://nan.builders/docs/models (checked 2026-11-17; models.dev provider nan lists it since 2026-11-10). contextWindow 1,048,576 ('1M token context'). maxTokens 65,536: the card says 'Max answer 64K tokens' and models.dev provider nan reports the same 65,536, so it is no longer the flat 32,768 default. input text+image, reasoning true. Reasoning: the card says 'Reasons by default; if you send no reasoning_effort (nor an alias) we apply low, and your own value always wins', and the aliases ARE mapped on this model, so thinkingLevelMap { off: 'none' } supplies the documented off switch ('To turn reasoning off, send none ... it works on every model except GLM'). No other level is documented for it, so reasoningEffortValues declares only 'none'." +
211
+ LARGER_MODEL_NOTE_SUFFIX,
191
212
  },
192
213
  };
193
214
 
194
- const EXTERNAL_MODEL_DETAIL =
195
- "NaN external-provider model launched 2026-11-10, listed by the live GET /v1/models but absent from models.dev provider nan and the NaN docs";
215
+ const LARGER_MODEL_DETAIL =
216
+ "NaN larger model documented in https://nan.builders/docs/models (checked 2026-11-17) and listed by the live GET https://api.nan.builders/v1/models (checked 2026-11-17), but absent from models.dev provider nan";
196
217
 
197
218
  /**
198
219
  * Models NaN serves that models.dev provider nan may not list. Mirrors the
@@ -203,7 +224,7 @@ const EXTERNAL_MODEL_DETAIL =
203
224
  */
204
225
  export const MANUAL_ONLY_MODEL_IDS: Record<string, string> = {
205
226
  "mimo-v2.6-flash": MANUAL_ONLY_NOTE,
206
- ...Object.fromEntries(Object.keys(EXTERNAL_MODELS).map((id) => [id, EXTERNAL_MODEL_DETAIL])),
227
+ ...Object.fromEntries(Object.keys(LARGER_MODELS).map((id) => [id, LARGER_MODEL_DETAIL])),
207
228
  };
208
229
 
209
230
  /**
@@ -220,80 +241,107 @@ export const MANUAL_ONLY_MODELS: Record<string, ManualModelOverride> = {
220
241
  maxTokens: 131_072,
221
242
  note: MANUAL_ONLY_NOTE,
222
243
  },
223
- ...EXTERNAL_MODELS,
244
+ ...LARGER_MODELS,
224
245
  };
225
246
 
226
247
  /**
227
248
  * Manual overrides keyed by model id. Fields override the models.dev-derived
228
249
  * entry one-for-one. Every override carries a provenance note.
229
250
  *
230
- * Issue #16 (measured 2026-09-27 against live gateway, repro included):
231
- * - deepseek-v4-flash: reasoning_effort_values=["none"] (only "none" suppresses);
232
- * thinkingLevelMap={off:"none"} (supplies reasoning_effort when pi maps
233
- * reasoning:"off" → undefined).
234
- * - glm5.3-flash: reasoningEffortValues includes "minimal" (not documented but
235
- * effective); thinkingLevelMap={off:"minimal"} (supplies reasoning_effort
236
- * when pi maps reasoning:"off" → undefined).
237
- * - qwen3.6, gemma4: the NaN docs already document `none` as "skip the
238
- * reasoning phase entirely" and state that with no parameter the model
239
- * defaults to reasoning ON (16,384-token budget), so off must send
240
- * `none` explicitly — thinkingLevelMap={off:"none"} (NaN docs
241
- * #controlling-reasoning, checked 2026-10-01). No measurement needed: the
242
- * docs are explicit about both the default and the `none` behavior.
251
+ * Every model declares its own `reasoningEffortValues` here (models.dev has no
252
+ * such field), and the ones pi must be able to switch off also declare
253
+ * `thinkingLevelMap.off`: pi maps `reasoning: "off"` to `reasoningEffort:
254
+ * undefined` and pi-ai only emits `reasoning_effort` when that map supplies a
255
+ * value, so the map is what makes `thinking: off` reach the gateway.
256
+ *
257
+ * Per-model contract (https://nan.builders/docs/models#controlling-reasoning,
258
+ * checked 2026-11-17), with the 2026-09-27/2026-10-14 measurements recorded on
259
+ * the entries they still govern:
260
+ * - qwen3.6, gemma4: `none`/`minimal` skip reasoning, the rest cap the phase
261
+ * (2,048 / 8,192 / 16,384 / 32,768 tokens).
262
+ * - deepseek-v4-flash: `none` disables reasoning (measured: 0 reasoning
263
+ * tokens with a full answer), the rest only steer it (measured 57 / 63 / 109
264
+ * reasoning tokens for low / omitted / minimal).
265
+ * - mimo-v2.6-flash: `none` off; `minimal` is applied as `low`, `xhigh` as
266
+ * `max`.
267
+ * - glm5.3, glm5.3-flash: cannot stop reasoning; `none` is applied as
268
+ * `minimal`, which is what `off` maps to.
269
+ * - qwen3.8-flash, qwen4-max: `none` off (fully), `minimal`…`max` steer.
270
+ * - hy4: reasons by default, the gateway applies `low` when no level is sent;
271
+ * `none` off.
272
+ * - hy4-flash: reasons by default with no default level; `none` off.
273
+ * - qwen3.8-max: `none` off.
274
+ * - kimi-k3.1-pro, deepseek-v4-pro: the docs keep them out of the contract and
275
+ * the `none` aliases are not mapped on them, so nothing is declared and
276
+ * nothing is sent.
243
277
  */
244
278
  export const MANUAL_OVERRIDES: Record<string, ManualModelOverride> = {
245
- ...EXTERNAL_MODELS,
279
+ ...LARGER_MODELS,
246
280
  "glm5.3": {
247
281
  name: "GLM 5.3",
248
- input: ["text", "image"],
282
+ input: ["text"],
249
283
  contextWindow: 1_048_576,
250
284
  maxTokens: 131_072,
251
- reasoningEffortValues: ["low", "medium", "high", "max"],
252
- thinkingLevelMap: { off: "low" },
285
+ reasoningEffortValues: ["minimal", "low", "medium", "high", "xhigh", "max"],
286
+ thinkingLevelMap: { off: "minimal", xhigh: "xhigh", max: "max" },
253
287
  note:
254
- "general catalog model since 2026-11-10: NaN announced it no longer has tier-exclusive models ('a partir de ahora ya NO habrá modelos exclusivos por tier'), and the live GET https://api.nan.builders/v1/models lists glm5.3 for a non-premium key (checked 2026-11-10); it used to be premium live-only. The values are the ones it carried as live-only, from https://nan.builders/docs/models (checked 2026-10-14; docs win over models.dev): contextWindow 1,048,576 ('1M token context'; models.dev lists the rounded 1,000,000); input text+image (multimodal; pi represents only text and image — models.dev lists text only, a stale divergence); maxTokens 131,072 (the confirmed maximum models.dev documents; the docs give the same 131K figure for glm5.3-flash and no lower bound); reasoningEffortValues low/medium/high/max per the docs' effort list; name 'GLM 5.3' per the docs (models.dev says 'GLM-5.3'). thinkingLevelMap { off: \"low\" }: the docs list low as the shallowest level, so `thinking: off` sends the shallowest supported effort; glm5.3 itself was never measured (issue #16 covered glm5.3-flash, whose shallowest effective value is 'minimal'), 'low' is the documented floor.",
288
+ "general catalog model since 2026-11-10: NaN announced it no longer has tier-exclusive models ('a partir de ahora ya NO habrá modelos exclusivos por tier'), and the live GET https://api.nan.builders/v1/models lists glm5.3 for a non-premium key (checked 2026-11-10). " +
289
+ "input text only: the model card says 'Text only: text in, text out, with no image, audio, video or file input; a request carrying one answers 400, earlier turns of the conversation included', and https://nan.builders/docs/pi declares the same 'input': ['text'] (https://nan.builders/docs/models, checked 2026-11-17). The earlier override declared text+image from the 2026-10-14 card; models.dev also lists it text-only now, so this is a correction of a stale value, not a divergence. " +
290
+ "contextWindow 1,048,576 ('1M token context'). maxTokens 131,072: models.dev's documented maximum; the docs' own pi/OpenCode blocks publish 32,768 and describe that field as 'a client-side budget rather than a server cap' (https://nan.builders/docs/opencode), so the larger model maximum stays. " +
291
+ "reasoningEffortValues minimal..max and thinkingLevelMap { off: 'minimal' }: the card says 'reasoning_effort: minimal to max; always reasons, none is applied as minimal' (checked 2026-11-17), so `thinking: off` sends the shortest reasoning the gateway honours. The previous map sent 'low' because the stale docs listed low as the floor. name 'GLM 5.3' per the docs (models.dev says 'GLM-5.3').",
255
292
  },
256
293
  "qwen3.8-flash": {
257
294
  contextWindow: 1_048_576,
258
295
  maxTokensField: "max_completion_tokens",
296
+ reasoningEffortValues: ["none", "minimal", "low", "medium", "high", "xhigh", "max"],
297
+ thinkingLevelMap: { off: "none", xhigh: "xhigh", max: "max" },
259
298
  note:
260
- "contextWindow 1,048,576: NaN docs state '1M token context (1,048,576 tokens)' and 'Max answer 131K tokens' (https://nan.builders/docs/models, checked 2026-10-14) — models.dev still lists 262,144. The earlier override was withdrawn 2026-09-07 when the docs read '262K token context, the model's native window'; the docs now state 1M and they are the source of truth (maintainer instruction: docs win over models.dev, which a user updates later). maxTokens stays 131,072, which models.dev already matches and the docs confirm as the 131K max answer. " +
261
- "maxTokensField 'max_completion_tokens' (issue #34, NaN maintainer confirmation received 2026-11-11, quoted verbatim in the issue): on this model max_tokens does NOT bound the reasoning phase, the excess bills against the quota (it explained the 796M tokens against the 500M cap in the 2026-09-27 /v1/usage survey), and max_completion_tokens IS respected as the interim bound. The published OpenAPI schema still documents only max_tokens, so the strict-schema sanitizer exempts this model from its max_completion_tokens→max_tokens rename at request time (SanitizerOptions.preserveMaxCompletionTokens, wired from compat.maxTokensField in src/provider-factory.ts). REVERT: once NaN ships their prepared gateway fix, remove this override — test/issue-34-max-completion-tokens.test.ts fails on purpose until it is removed; accepting max_completion_tokens on the other flash models is unverified live (permission-gated probe needed), so the scope stays this one model.",
299
+ "contextWindow 1,048,576: NaN docs state '1M token context (1,048,576 tokens)' and 'Max answer 131K tokens' (https://nan.builders/docs/models, checked 2026-11-17) — models.dev still lists 262,144. The earlier override was withdrawn 2026-09-07 when the docs read '262K token context, the model's native window'; the docs now state 1M and they are the source of truth (maintainer instruction: docs win over models.dev, which a user updates later). maxTokens stays 131,072, which models.dev already matches and the docs confirm as the 131K max answer. " +
300
+ "maxTokensField 'max_completion_tokens' (issue #34, NaN maintainer confirmation received 2026-11-11, quoted verbatim in the issue): on this model max_tokens does NOT bound the reasoning phase, the excess bills against the quota (it explained the 796M tokens against the 500M cap in the 2026-09-27 /v1/usage survey), and max_completion_tokens IS respected as the interim bound. The published OpenAPI schema still documents only max_tokens, so the strict-schema sanitizer exempts this model from its max_completion_tokens→max_tokens rename at request time (SanitizerOptions.preserveMaxCompletionTokens, wired from compat.maxTokensField in src/provider-factory.ts). REVERT: once NaN ships their prepared gateway fix, remove this override — test/issue-34-max-completion-tokens.test.ts is the tripwire. " +
301
+ "reasoningEffortValues none..max and thinkingLevelMap { off: 'none' }: the card says 'Reasoning on by default (reasoning_effort: none turns it off · minimal to max)' and the contract table says 'Off. No reasoning tokens' for `none` (https://nan.builders/docs/models, checked 2026-11-17), so `thinking: off` now actually disables reasoning. The earlier note said the parameter was 'accepted, depth not adjustable' with no map, which was true of the 2026-10-14 docs; the model card and the contract table now state the opposite and the docs win.",
262
302
  },
263
303
  "deepseek-v4-flash": {
264
304
  input: ["text", "image"],
265
305
  contextWindow: 1_048_576,
266
306
  maxTokens: 32_768,
267
- reasoningEffortValues: ["none"],
268
- thinkingLevelMap: { off: "none" },
307
+ reasoningEffortValues: ["none", "minimal", "low", "medium", "high", "xhigh", "max"],
308
+ thinkingLevelMap: { off: "none", xhigh: "xhigh", max: "max" },
269
309
  note:
270
- "contextWindow 1,048,576: NaN docs state '1M token context' for this model (https://nan.builders/docs/models, checked 2026-10-14). models.dev lists 1,000,000, a rounded form of the same window; the docs value is authoritative (maintainer instruction: docs win over models.dev, which a user updates later). " +
271
- "input includes image: NaN serves the Vision-Exp variant ('takes images as input', https://nan.builders/docs/models; the image_url content-parts in https://nan.builders/openapi.json list deepseek-v4-flash among the vision models). models.dev provider nan also lists text+image now (DeepSeek V4.1 Flash entry, checked 2026-09-13), so this stays a pin for the vision capability rather than a divergence. " +
272
- "maxTokens 32768 per the official NaN pi docs (https://nan.builders/docs/pi, 'the same set the NaN CLI writes', checked 2026-10-02) closing issue #20 — the gateway now rejects max_tokens above ~256k for this model with 403 permission_error (measured 2026-10-02: 256,000 → 200; 262,143 → 403), and the previous models.dev-derived 384000 made every pi request fail since pi-ai sends max_tokens = model.maxTokens when no cap is set. models.dev still lists 384000, so this override pins the documented value. " +
273
- "reasoning_effort_values=[\"none\"] (issue #16, measured 2026-09-27 against live gateway, repro included in the issue): only \"none\" deterministically disables reasoning (0 reasoning tokens, answer produced). Every other value leaves 13-14K reasoning tokens and causes runaway reasoning (finish_reason:\"length\" with ZERO answer text). The catalog declares only [\"none\"] because the remaining values are useless noise. " +
274
- "docs vs measurement (re-probed live 2026-10-14): https://nan.builders/docs/models#controlling-reasoning documents the parameter as 'any value (no effect) — the model decides per request', but the live gateway contradicts that: `none` gave 0 reasoning tokens / 0 reasoning chars / a 134-char answer, while `low` gave 57 reasoning tokens and omitting the parameter gave 63 (`minimal` gave 109). The docs are stale here; the measurement wins (maintainer instruction), so the measured behavior is kept. " +
310
+ "contextWindow 1,048,576: NaN docs state '1M token context' for this model (https://nan.builders/docs/models, checked 2026-11-17). models.dev lists 1,000,000, a rounded form of the same window; the docs value is authoritative (maintainer instruction: docs win over models.dev, which a user updates later). " +
311
+ "input includes image: NaN serves the Vision-Exp variant ('takes images as input', https://nan.builders/docs/models; the image_url content-parts in https://nan.builders/openapi.json list deepseek-v4-flash among the vision models). models.dev provider nan also lists text+image, so this stays a pin for the vision capability rather than a divergence. " +
312
+ "maxTokens 32768 per the official NaN pi docs (https://nan.builders/docs/pi, 'the same set the NaN CLI writes', checked 2026-10-02) closing issue #20 — the gateway rejects max_tokens above ~256k for this model with 403 permission_error (measured 2026-10-02: 256,000 → 200; 262,143 → 403), and the previous models.dev-derived 384000 made every pi request fail because pi-ai sends max_tokens = model.maxTokens by default. models.dev still lists 384000, so this override pins the documented value. " +
313
+ "reasoningEffortValues: the docs say 'none turns it off · minimal to max' and the contract table says the other values 'steer how much it reasons. They are hints the model follows, not hard caps' (https://nan.builders/docs/models#controlling-reasoning, checked 2026-11-17), so the documented ladder is declared. The measurement behind issue #16 stays the load-bearing fact and is unchanged: only \"none\" suppresses reasoning (0 reasoning tokens with a full answer; `low` 57, omitted 63, `minimal` 109 — re-probed live 2026-10-14), which is why thinkingLevelMap.off is \"none\". " +
275
314
  "thinkingLevelMap { off: \"none\" } (issue #16, measured 2026-09-27): when pi maps reasoning:\"off\" to reasoningEffort:undefined, the thinkingLevelMap.off=\"none\" supplies the effort so the gateway receives reasoning_effort:\"none\" and does NOT enter runaway reasoning mode.",
276
315
  },
277
316
  "glm5.3-flash": {
278
317
  contextWindow: 1_048_576,
279
- thinkingLevelMap: { off: "minimal" },
318
+ maxTokens: 131_072,
319
+ reasoningEffortValues: ["minimal", "low", "medium", "high", "xhigh", "max"],
320
+ thinkingLevelMap: { off: "minimal", xhigh: "xhigh", max: "max" },
280
321
  note:
281
- "contextWindow 1,048,576: NaN docs state '1M token context' for this model (https://nan.builders/docs/models, checked 2026-10-14). models.dev lists 1,000,000, a rounded form of the same window; the docs value is authoritative (maintainer instruction: docs win over models.dev, which a user updates later). " +
282
- "thinkingLevelMap { off: \"minimal\" } (issue #16, measured 2026-09-27 against live gateway, repro included in the issue): when pi maps reasoning:\"off\" to reasoningEffort:undefined, the thinkingLevelMap.off=\"minimal\" supplies the effort so the gateway receives reasoning_effort:\"minimal\" (38 reasoning tokens + answer). Note: \"none\" does NOT suppress reasoning on glm5.3-flash (13,382 tokens) — only \"minimal\" was measured to be effective. " +
283
- "reasoning_effort_values includes \"minimal\" (the docs' glm row lists low/medium/high/max, but the 2026-09-27 measurement shows minimal is accepted and effective, issue #16).",
322
+ "contextWindow 1,048,576 ('1M token context') and maxTokens 131,072: the docs state that an output budget above this model's maximum is lowered to 131072, so 131,072 is its documented ceiling (https://nan.builders/docs/models, checked 2026-11-17); models.dev lists the rounded 1,000,000 window. " +
323
+ "thinkingLevelMap { off: \"minimal\" }: the card says 'reasoning_effort: minimal to max; always reasons, none is applied as minimal' — the gateway never stops reasoning on this model. issue #16 measured the same effect on 2026-09-27: 'minimal' yields ~38 reasoning tokens with an answer, while 'none' does not suppress it (13,382 tokens). " +
324
+ "reasoningEffortValues minimal..max per the card, xhigh included (the docs' value ladder runs none, minimal, low, medium, high, xhigh, max).",
284
325
  },
285
326
  "mimo-v2.6-flash": {
286
- thinkingLevelMap: { off: "none" },
327
+ reasoningEffortValues: ["none", "low", "medium", "high", "max"],
328
+ thinkingLevelMap: { off: "none", xhigh: "xhigh", max: "max" },
287
329
  note:
288
- "thinkingLevelMap { off: \"none\" } (live re-probe 2026-10-14): the docs list this model as 'accepted, depth not adjustable', but the gateway makes the parameter effective at the off end — `none` gave 0 reasoning tokens / a full answer, while `low` gave 22 reasoning tokens and omitting the parameter gave 17. Measured behavior wins over the docs, so `thinking: off` now sends reasoning_effort:\"none\" and actually disables reasoning. No other level was sampled, so only `off` is mapped.",
330
+ "reasoningEffortValues none/low/medium/high/max: the card says 'reasoning_effort: none turns it off · low to max', and the contract table says 'minimal is applied as low and xhigh as max' (https://nan.builders/docs/models#controlling-reasoning, checked 2026-11-17), so only the values with their own meaning are declared. " +
331
+ "thinkingLevelMap { off: \"none\" } (live re-probe 2026-10-14): the 2026-10-14 docs called the parameter 'accepted, depth not adjustable', but the gateway makes it effective at the off end — `none` gave 0 reasoning tokens / a full answer, while `low` gave 22 reasoning tokens and omitting the parameter gave 17. Measured behavior wins over the docs, so `thinking: off` sends reasoning_effort:\"none\" and actually disables reasoning.",
289
332
  },
290
333
  "qwen3.6": {
291
- thinkingLevelMap: { off: "none" }, note:
292
- "thinkingLevelMap { off: \"none\" } (issue #16): NaN docs state that with no reasoning_effort parameter every model uses its own default and that default is reasoning ON for qwen3.6 (16,384-token budget), while `none` and `minimal` skip the reasoning phase entirely (https://nan.builders/docs/models#controlling-reasoning, checked 2026-10-01). pi maps reasoning:\"off\" to reasoningEffort:undefined, so without this map `thinking: off` sent no parameter and the model reasoned anyway; the map sends reasoning_effort:\"none\" and actually disables reasoning.",
334
+ reasoningEffortValues: ["none", "minimal", "low", "medium", "high", "xhigh", "max"],
335
+ thinkingLevelMap: { off: "none", xhigh: "xhigh", max: "max" },
336
+ note:
337
+ "thinkingLevelMap { off: \"none\" } (issue #16): NaN docs state that with no reasoning_effort parameter every model uses its own default and that default is reasoning ON for qwen3.6 (16,384-token budget), while `none` and `minimal` skip the reasoning phase entirely (https://nan.builders/docs/models#controlling-reasoning, checked 2026-11-17). pi maps reasoning:\"off\" to reasoningEffort:undefined, so without this map `thinking: off` sent no parameter and the model reasoned anyway; the map sends reasoning_effort:\"none\" and actually disables reasoning. " +
338
+ "reasoningEffortValues: the contract table documents the whole ladder (low 2,048, medium 8,192, high 16,384, xhigh and max 32,768 reasoning tokens on Chat Completions).",
293
339
  },
294
340
  "gemma4": {
295
- thinkingLevelMap: { off: "none" },
341
+ reasoningEffortValues: ["none", "minimal", "low", "medium", "high", "xhigh", "max"],
342
+ thinkingLevelMap: { off: "none", xhigh: "xhigh", max: "max" },
296
343
  note:
297
- "thinkingLevelMap { off: \"none\" } (issue #16): NaN docs state that with no reasoning_effort parameter gemma4 defaults to reasoning ON (16,384-token budget), while `none`/`minimal` skip reasoning entirely (https://nan.builders/docs/models#controlling-reasoning, checked 2026-10-01). pi maps reasoning:\"off\" to reasoningEffort:undefined, so without this map `thinking: off` sent no parameter and the model reasoned anyway; the map sends reasoning_effort:\"none\" and actually disables reasoning.",
344
+ "thinkingLevelMap { off: \"none\" } (issue #16): NaN docs state that with no reasoning_effort parameter gemma4 defaults to reasoning ON (16,384-token budget), while `none`/`minimal` skip reasoning entirely (https://nan.builders/docs/models#controlling-reasoning, checked 2026-11-17). pi maps reasoning:\"off\" to reasoningEffort:undefined, so without this map `thinking: off` sent no parameter and the model reasoned anyway; the map sends reasoning_effort:\"none\" and actually disables reasoning. " +
345
+ "reasoningEffortValues: the contract table documents the whole ladder (low 2,048, medium 8,192, high 16,384, xhigh and max 32,768 reasoning tokens on Chat Completions).",
298
346
  },
299
347
  };