@gtrabanco/pi-nan-provider 1.5.0 → 1.5.1
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/AGENTS.md +52 -16
- package/README.es.md +18 -6
- package/README.md +18 -6
- package/package.json +3 -3
- package/scripts/generate-models.ts +5 -27
- package/scripts/manual-overrides.ts +92 -0
- package/scripts/models.generated.ts +219 -6
- package/src/attribution.ts +2 -2
- package/src/fetch-models.ts +8 -62
- package/src/provider-factory.ts +5 -3
- package/src/usage.ts +9 -12
package/AGENTS.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# AGENTS.md — rules for any agent working on this repo
|
|
2
2
|
|
|
3
|
+
## AI-generated content must be signed
|
|
4
|
+
|
|
5
|
+
- **No AI stamp in code.** Never add yourself as co-author or author in source
|
|
6
|
+
files. Never use stamps like "Author: Pi" or "Generated by AI" inside code
|
|
7
|
+
or code-adjacent files (READMEs, configs, docs committed to the repo).
|
|
8
|
+
- **Sign public forge content.** When writing a GitHub comment, PR description,
|
|
9
|
+
or issue body, always append a line in the conversation language stating the
|
|
10
|
+
content was AI-assisted (e.g. "Automatically generated using AI" or similar).
|
|
11
|
+
The same policy applies to public forums, comments, and social media posts.
|
|
12
|
+
This is for transparency — the user must always know what was generated by AI.
|
|
13
|
+
- **Same language as the conversation.** The sign-off uses the language the user
|
|
14
|
+
asked in (Spanish, English, etc.). Precedence: explicit instruction > this line
|
|
15
|
+
> English.
|
|
16
|
+
|
|
3
17
|
## The One Rule
|
|
4
18
|
|
|
5
19
|
You must understand and be able to explain any code you write. If you cannot explain
|
|
@@ -190,8 +204,10 @@ Since 1.0.0 the package version **aligns its MAJOR.MINOR with the pi release lin
|
|
|
190
204
|
wrong. Every divergence or exclusion is recorded with provenance.
|
|
191
205
|
- **Which models exist**: https://nan.builders/docs/models is the source of
|
|
192
206
|
truth (maintainer instruction, reaffirmed 2026-09-29), cross-checked against
|
|
193
|
-
the `model` param description in https://nan.builders/openapi.json
|
|
194
|
-
|
|
207
|
+
the `model` param description in https://nan.builders/openapi.json, plus
|
|
208
|
+
(since 2026-11-10) the live `GET /v1/models` for models NaN launches before
|
|
209
|
+
the docs catch up (see "2026-11-10 external models" below). The original
|
|
210
|
+
seven documented chat models declare 1M-token windows where the docs say so —
|
|
195
211
|
`deepseek-v4-flash`, `glm5.3-flash`, `qwen3.8-flash` and `mimo-v2.6-flash` at
|
|
196
212
|
**1,048,576**, `qwen3.6` and `gemma4` at **262,144** — and the first three
|
|
197
213
|
carry a `MANUAL_OVERRIDES.contextWindow` because models.dev lagged (rounded
|
|
@@ -199,18 +215,36 @@ Since 1.0.0 the package version **aligns its MAJOR.MINOR with the pi release lin
|
|
|
199
215
|
2026-10-14).
|
|
200
216
|
Official chat models (checked 2026-10-14): community `deepseek-v4-flash`,
|
|
201
217
|
`mimo-v2.6-flash`, `qwen3.8-flash`, `glm5.3-flash`, `qwen3.6`, `gemma4`
|
|
202
|
-
(all text+image vision) +
|
|
203
|
-
(~753B MoE, multimodal text+image+audio+video input, 1M context
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
(issue #19's
|
|
218
|
+
(all text+image vision) + `glm5.3`
|
|
219
|
+
(~753B MoE, multimodal text+image+audio+video input, 1M context).
|
|
220
|
+
**glm5.3 is a general catalog model since 2026-11-10** (NaN announced "a
|
|
221
|
+
partir de ahora ya NO habrá modelos exclusivos por tier"; the live
|
|
222
|
+
`GET /v1/models` lists it for a non-premium key, checked 2026-11-10). It was
|
|
223
|
+
premium live-only before (`LIVE_ONLY_MODEL_IDS` in the generator and
|
|
224
|
+
`LIVE_ONLY_MODEL_DATA` in `src/fetch-models.ts`); both were REMOVED in
|
|
225
|
+
package 1.5.1 as dead code once nothing was tier-gated. Its values live in
|
|
226
|
+
`MANUAL_OVERRIDES["glm5.3"]` (1,048,576 / 131,072, text+image,
|
|
227
|
+
reasoningEffortValues low/medium/high/max, `thinkingLevelMap { off: "low" }`,
|
|
228
|
+
name "GLM 5.3") over the models.dev entry (text-only, 1,000,000). The
|
|
229
|
+
overlay/merge paths now treat it like any catalogued id (issue #19's
|
|
230
|
+
invariant is intact: the store decides which ids exist, the generated
|
|
231
|
+
catalog decides their capabilities). `src/usage.ts` no longer has a `premium`
|
|
232
|
+
flag (removed in 1.5.1 at the maintainer's request); its token windows are a
|
|
233
|
+
known follow-up, NaN moved to credits.
|
|
234
|
+
**2026-11-10 external models** (ZDR, "EXTERNAL PROVIDER" on NaN's pricing
|
|
235
|
+
page): `kimi-k3.1-pro`, `qwen3.8-max`, `deepseek-v4-pro`, `hy4`. Not in
|
|
236
|
+
models.dev provider `nan`, the docs, or openapi.json, but listed by the live
|
|
237
|
+
`GET /v1/models` (checked 2026-11-10). They enter through
|
|
238
|
+
`MANUAL_ONLY_MODEL_IDS` with values in `scripts/manual-overrides.ts`
|
|
239
|
+
(`EXTERNAL_MODELS`), each with a provenance note: contextWindow from the
|
|
240
|
+
pricing page "1M context" (1,048,576 per the NaN pi docs convention;
|
|
241
|
+
`qwen3.8-max` uses the first-party 1,000,000), maxTokens 32,768 per
|
|
242
|
+
https://nan.builders/docs/pi, input from first-party vendor modalities on
|
|
243
|
+
models.dev restricted to text/image, reasoning true, cost 0 (maintainer
|
|
244
|
+
decision), `reasoningEffortValues: []` and NO `thinkingLevelMap` — how the
|
|
245
|
+
gateway handles `reasoning_effort` for external providers is unmeasured
|
|
246
|
+
(needs a permission-gated live probe). When the docs or models.dev list
|
|
247
|
+
them, re-verify the values (docs win).
|
|
214
248
|
Removed by the provider: `glm5.2` (2026-09-05) and `mimo-v2.5` (checked
|
|
215
249
|
2026-09-29 — zero mentions in the docs and in openapi.json, and models.dev
|
|
216
250
|
dropped it too; superseded by `mimo-v2.6-flash`). models.dev may re-list a
|
|
@@ -224,7 +258,9 @@ Since 1.0.0 the package version **aligns its MAJOR.MINOR with the pi release lin
|
|
|
224
258
|
then skips the manual entry (attaching its note to the models.dev-derived
|
|
225
259
|
entry) so the id is never emitted twice.
|
|
226
260
|
Non-chat endpoints: qwen3-embedding, rerank, kokoro (TTS), whisper (STT),
|
|
227
|
-
flux-2-klein and qwen-image-2.1 (images)
|
|
261
|
+
flux-2-klein and qwen-image-2.1 (images) and `minimax-h3` (video; listed by
|
|
262
|
+
the live `/models` with owned_by "nan", models.dev output video, checked
|
|
263
|
+
2026-11-10) — MCP-bridge territory, not chat
|
|
228
264
|
catalog models. The classification is now applied at RUNTIME too:
|
|
229
265
|
`NON_CHAT_MODEL_IDS` is exported from `src/fetch-models.ts` (single source
|
|
230
266
|
of truth: id → provenance reason), imported by `scripts/generate-models.ts`
|
|
@@ -233,7 +269,7 @@ Since 1.0.0 the package version **aligns its MAJOR.MINOR with the pi release lin
|
|
|
233
269
|
defensively by `baselineModels`. The generator excluded `qwen-image-2.1` via
|
|
234
270
|
this constant before (it also sits on models.dev with `limit.output: 0`,
|
|
235
271
|
excluded instead of being flagged "needs manual verification" forever); all
|
|
236
|
-
|
|
272
|
+
seven ids are now under the same guard so they can never be emitted as chat
|
|
237
273
|
models or registered at runtime.
|
|
238
274
|
- NaN can close an SSE stream **before** `finish_reason`. The catalog sets
|
|
239
275
|
`supportsFinishReason: true` so pi-ai raises the retryable
|
package/README.es.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @gtrabanco/𝜋-nan-provider
|
|
2
2
|
|
|
3
3
|
[](https://opensource.org/licenses/MIT)
|
|
4
|
-
[](https://github.com/gtrabanco/pi-nan-provider/releases)
|
|
5
5
|
[](https://cloud.nan.builders/r/7GK06FX8)
|
|
6
6
|
|
|
7
7
|
[NaN Builders](https://cloud.nan.builders/r/7GK06FX8) model provider + MCP nativo para [pi](https://github.com/earendil-works/pi).
|
|
@@ -40,9 +40,9 @@ El proveedor utiliza un **catálogo de modelos de dos capas** para garantizar la
|
|
|
40
40
|
| **2. Fetch en vivo de `/models`** | NaN Runtime API | Obtiene los modelos disponibles en tiempo real según el tier de tu API key. Se combina con los datos del fallback. |
|
|
41
41
|
|
|
42
42
|
> [!IMPORTANT]
|
|
43
|
-
> **
|
|
43
|
+
> **Lista en vivo**: La lista en vivo es la autoridad. Desde el 2026-11-10 NaN ya no tiene modelos exclusivos por tier, así que todos los modelos del catálogo deben estar disponibles para cualquier clave; un modelo que `/models` en vivo no lista para tu clave sigue filtrándose.
|
|
44
44
|
|
|
45
|
-
Los ids no-chat que devuelve `/models` en vivo (embedding, rerank, TTS, STT, imagen) **no se registran** como modelos de chat — la clasificación es el único `NON_CHAT_MODEL_IDS` exportado desde `src/fetch-models.ts` (la misma fuente que usa el generador en build-time). La fusión salta sus marcadores y los coloca en un bucket observable `nonChat`; `baselineModels` también los filtra como capa defensiva. Esto evita que el selector de chat de pi ofrezca endpoints que no pueden servir chat (las peticiones devolverían 404).
|
|
45
|
+
Los ids no-chat que devuelve `/models` en vivo (embedding, rerank, TTS, STT, imagen, vídeo) **no se registran** como modelos de chat — la clasificación es el único `NON_CHAT_MODEL_IDS` exportado desde `src/fetch-models.ts` (la misma fuente que usa el generador en build-time). La fusión salta sus marcadores y los coloca en un bucket observable `nonChat`; `baselineModels` también los filtra como capa defensiva. Esto evita que el selector de chat de pi ofrezca endpoints que no pueden servir chat (las peticiones devolverían 404).
|
|
46
46
|
|
|
47
47
|
El registro es síncrono a propósito: el catálogo de fallback está disponible al instante, y el runtime de Models de pi dirige el refresco en vivo (refresco de red en el arranque interactivo y periódico, solo caché en el registro), persistiendo el overlay entre ejecuciones.
|
|
48
48
|
|
|
@@ -78,6 +78,8 @@ Puedes sobrescribir el `compat` de cualquier modelo en `~/.pi/agent/models.json`
|
|
|
78
78
|
|
|
79
79
|
> Poner `supportsFinishReason: false` restaura el antiguo stall silencioso — no recomendado.
|
|
80
80
|
|
|
81
|
+
**Escape hatches de compatibilidad de pi-ai 1.5.1** (`~/.pi/agent/models.json`, por modelo): `compat.requiresToolsWithToolHistory: true` restaura el envío de `tools: []` en conversaciones con historial de tools (pi-ai 1.5.1 lo omite por defecto, arreglando los rechazos `tools must not be an empty array` de vLLM 0.20+ detrás de LiteLLM); `compat.requiresNonNullAssistantContent: true` envía `""` en vez de `null` en mensajes de asistente que solo llevan tool calls; `compat.promptCacheKeyMode: "disabled"` garantiza que nunca se envíe `prompt_cache_key` al gateway (el valor por defecto `auto` ya nunca lo activa para NaN).
|
|
82
|
+
|
|
81
83
|
**Uso de tokens en streaming:** `supportsUsageInStreaming` es `true` por defecto. El esquema publicado de NaN no documenta `stream_options`, pero el gateway real lo acepta y lo aplica — medido el 2026-09-16 ([#7](https://github.com/gtrabanco/pi-nan-provider/issues/7)): dos llamadas de streaming idénticas por modelo, 0 chunks de usage sin el flag y exactamente 1 con él, en `deepseek-v4-flash`, `glm5.3-flash`, `qwen3.6`, `mimo-v2.5` y `gemma4`. Por eso pi muestra tokens reales de entrada/salida/reasoning/caché en lugar de ceros. Si un modelo resulta no devolver el usage en streaming, desactívalo por modelo — el sanitizer entonces elimina `stream_options` y el payload vuelve a ser estricto:
|
|
82
84
|
|
|
83
85
|
```json
|
|
@@ -310,7 +312,7 @@ MiMo V2.5:
|
|
|
310
312
|
[███░░░░░░░░░░░░░░░░░] 12.5% of monthly cap
|
|
311
313
|
Used: 125.0M / 1.0B (875.0M remaining) · 840 requests
|
|
312
314
|
|
|
313
|
-
GLM 5.3
|
|
315
|
+
GLM 5.3:
|
|
314
316
|
[████████░░░░░░░░░░░░] 40.0% of monthly cap
|
|
315
317
|
Used: 1.2B / 3.0B (1.8B remaining) · 2,400 requests
|
|
316
318
|
↳ rolling window: 400.0M / 4h (daily granularity — /usage cannot break it down)
|
|
@@ -339,7 +341,7 @@ Qwen 3.6 uncapped
|
|
|
339
341
|
Gemma 4 uncapped
|
|
340
342
|
Qwen 3.8 Flash 500.0M
|
|
341
343
|
GLM 5.3 Flash 2.0B
|
|
342
|
-
GLM 5.3 3.0B
|
|
344
|
+
GLM 5.3 3.0B (rolling 400.0M/4h)
|
|
343
345
|
|
|
344
346
|
💡 Set NAN_API_KEY or run `/login nan` to see real usage (GET /v1/usage).
|
|
345
347
|
```
|
|
@@ -362,8 +364,15 @@ Modelos de chat:
|
|
|
362
364
|
| `mimo-v2.6-flash` | 1,048,576 | 131,072 | texto, imagen | ✅ |
|
|
363
365
|
| `glm5.3-flash` | 1,048,576 | 131,072 | texto, imagen | ✅ |
|
|
364
366
|
| `qwen3.8-flash` | 1,048,576 | 131,072 | texto, imagen | ✅ |
|
|
367
|
+
| `glm5.3` | 1,048,576 | 131,072 | texto, imagen | ✅ |
|
|
368
|
+
| `kimi-k3.1-pro` | 1,048,576 | 32,768 | texto, imagen | ✅ |
|
|
369
|
+
| `qwen3.8-max` | 1,000,000 | 32,768 | texto, imagen | ✅ |
|
|
370
|
+
| `deepseek-v4-pro` | 1,048,576 | 32,768 | texto | ✅ |
|
|
371
|
+
| `hy4` | 1,048,576 | 32,768 | texto, imagen | ✅ |
|
|
365
372
|
|
|
366
|
-
> Las ventanas de la tabla son las **documentadas** en [los docs de NaN](https://nan.builders/docs/models) (comprobado 2026-10-14), que son la fuente de verdad; models.dev es un espejo que un humano actualiza más tarde y puede ir por detrás. `glm5.3`
|
|
373
|
+
> Las ventanas de la tabla son las **documentadas** en [los docs de NaN](https://nan.builders/docs/models) (comprobado 2026-10-14), que son la fuente de verdad; models.dev es un espejo que un humano actualiza más tarde y puede ir por detrás. `glm5.3` fue solo-premium y solo-en-vivo hasta que NaN eliminó los modelos exclusivos por tier el 2026-11-10; ahora está en el catálogo estático con los valores que tenía (texto+imagen, 1,048,576 / 131,072).
|
|
374
|
+
>
|
|
375
|
+
> `kimi-k3.1-pro`, `qwen3.8-max`, `deepseek-v4-pro` y `hy4` son los modelos de proveedor externo (ZDR) que NaN lanzó el 2026-11-10. Los docs y el OpenAPI de NaN todavía no los listan, pero el `GET /v1/models` en vivo sí (comprobado 2026-11-10). Sus valores salen de la página de precios de NaN ("1M context"), los docs de NaN para pi (`maxTokens` 32,768 en todos los modelos de 1M de contexto) y las entradas de los proveedores originales en models.dev (modalidades; `qwen3.8-max` usa la ventana de 1,000,000 del proveedor); el coste es 0 y no se declara mapeo de `reasoning_effort`, porque no se ha medido cómo lo trata la pasarela con proveedores externos. Cada entrada lleva su nota de procedencia en `scripts/models.generated.ts`.
|
|
367
376
|
>
|
|
368
377
|
> `*` El límite de salida de 32,768 en `deepseek-v4-flash` es el techo de los docs oficiales de NaN para pi (https://nan.builders/docs/pi, "the same set the NaN CLI writes", issue #20, 2026-10-02); models.dev sigue listando 384,000, pero la pasarela rechaza `max_tokens` por encima de ~256k con 403.
|
|
369
378
|
|
|
@@ -378,6 +387,8 @@ Modelos de imagen no-chat (disponibles vía `models.generateImages()` /
|
|
|
378
387
|
| `flux-2-klein` | texto, imagen | Text-to-image + image-to-image |
|
|
379
388
|
| `qwen-image-2.1` | texto | Text-to-image |
|
|
380
389
|
|
|
390
|
+
`minimax-h3` (generación de vídeo, listado por `/models` en vivo desde el 2026-11-10) también se clasifica como no-chat: nunca se registra como modelo de chat.
|
|
391
|
+
|
|
381
392
|
> [!NOTE]
|
|
382
393
|
> `mimo-v2.6-flash` está servido por NaN y desde el 2026-09-29 aparece también en models.dev (proveedor `nan`); la entrada manual que lo sostenía se conserva como fallback y su nota de procedencia sigue unida a la entrada generada.
|
|
383
394
|
>
|
|
@@ -397,6 +408,7 @@ El parámetro `reasoning_effort` de NaN controla cuánto piensa el modelo antes
|
|
|
397
408
|
| `qwen3.6`, `gemma4` | `none` · `minimal` · `low` · `medium` · `high` · `max` | `none`/`minimal` omiten el razonamiento por completo; otros valores limitan a 2K / 8K / 16K / 32K tokens. `thinking: "off"` envía `reasoning_effort: "none"` automáticamente vía el `thinkingLevelMap` del catálogo — los docs de NaN dicen que sin parámetro estos modelos razonan por defecto (presupuesto de 16,384 tokens), así que `off` debe ser explícito |
|
|
398
409
|
| `deepseek-v4-flash` | `none` (el catálogo declara ["none"]) | `none` deshabilita el razonamiento (0 tokens de razonamiento, respuesta completa); cualquier otro valor — incluido `minimal` y omitir el parámetro — lo deja ENCENDIDO (57 / 63 / 109 tokens de razonamiento), así que el catálogo solo declara `none`. Re-sondado en vivo 2026-10-14: los docs de NaN afirman "any value (no effect)", pero gana la medición. `thinking: "off"` envía `reasoning_effort: "none"` automáticamente vía el `thinkingLevelMap` del catálogo — sin él el modelo se descontrola hasta `finish_reason: "length"` sin respuesta (issue #16) |
|
|
399
410
|
| `qwen3.8-flash` | *(aceptado pero no ajustable)* | El parámetro es aceptado y nunca rechazado, pero el modelo gestiona su propia profundidad de razonamiento — nunca es un error enviar un valor que este modelo no ajusta |
|
|
411
|
+
| `kimi-k3.1-pro`, `qwen3.8-max`, `deepseek-v4-pro`, `hy4` | *(sin mapeo declarado)* | Modelos de proveedor externo lanzados el 2026-11-10; no se ha medido cómo traduce la pasarela `reasoning_effort` para ellos, así que el catálogo no declara valores de effort ni `thinkingLevelMap` (`thinking: "off"` no envía ningún parámetro) |
|
|
400
412
|
| `mimo-v2.6-flash` | `none` | Los docs lo llamaban "profundidad no ajustable", pero el gateway en vivo (2026-10-14) muestra que `none` da 0 tokens de razonamiento con respuesta completa mientras `low` da 22 y omitirlo 17 — así que `thinking: "off"` envía `reasoning_effort: "none"` vía el `thinkingLevelMap` del catálogo |
|
|
401
413
|
|
|
402
414
|
> [!NOTE]
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @gtrabanco/𝜋-nan-provider
|
|
2
2
|
|
|
3
3
|
[](https://opensource.org/licenses/MIT)
|
|
4
|
-
[](https://github.com/gtrabanco/pi-nan-provider/releases)
|
|
5
5
|
[](https://cloud.nan.builders/r/7GK06FX8)
|
|
6
6
|
|
|
7
7
|
[NaN Builders](https://cloud.nan.builders/r/7GK06FX8) model provider + a native MCP server for [pi](https://github.com/earendil-works/pi).
|
|
@@ -40,9 +40,9 @@ The provider uses a **two-layer model catalog** to ensure reliability:
|
|
|
40
40
|
| **2. Live `/models` Fetch** | NaN Runtime API | Fetches your real-time available models based on your API key's tier. Merged with fallback data. |
|
|
41
41
|
|
|
42
42
|
> [!IMPORTANT]
|
|
43
|
-
> **
|
|
43
|
+
> **Live list**: The live list is authoritative. Since 2026-11-10 NaN no longer has tier-exclusive models, so every catalog model is meant to be available to every key; a model the live `/models` response does not list for your key is still filtered out.
|
|
44
44
|
|
|
45
|
-
NaN's live `/models` also returns non-chat endpoint ids (embedding, rerank, TTS, STT, image). These are **not registered** as chat models — the classification is the single exported `NON_CHAT_MODEL_IDS` from `src/fetch-models.ts` (the same source used by the build-time generator). The merge skips their placeholders and places them in an observable `nonChat` bucket; `baselineModels` also filters them defensively. This prevents pi's chat picker from offering endpoints that cannot serve chat (requests would 404).
|
|
45
|
+
NaN's live `/models` also returns non-chat endpoint ids (embedding, rerank, TTS, STT, image, video). These are **not registered** as chat models — the classification is the single exported `NON_CHAT_MODEL_IDS` from `src/fetch-models.ts` (the same source used by the build-time generator). The merge skips their placeholders and places them in an observable `nonChat` bucket; `baselineModels` also filters them defensively. This prevents pi's chat picker from offering endpoints that cannot serve chat (requests would 404).
|
|
46
46
|
|
|
47
47
|
The registration is synchronous on purpose: the generated fallback catalog is available immediately, and pi's Models runtime drives the live refresh (network refresh at interactive startup and periodically, cache-only at registration), persisting the overlay between runs.
|
|
48
48
|
|
|
@@ -78,6 +78,8 @@ You can override any model's `compat` per-model in `~/.pi/agent/models.json` (pi
|
|
|
78
78
|
|
|
79
79
|
> Setting `supportsFinishReason: false` restores the old silent-stall behavior — not recommended.
|
|
80
80
|
|
|
81
|
+
**pi-ai 1.5.1 compat escape hatches** (`~/.pi/agent/models.json`, per model): `compat.requiresToolsWithToolHistory: true` restores sending `tools: []` in conversations with tool history (pi-ai 1.5.1 omits it by default, fixing vLLM 0.20+ `tools must not be an empty array` rejections behind LiteLLM); `compat.requiresNonNullAssistantContent: true` sends `""` instead of `null` in assistant messages that only carry tool calls; `compat.promptCacheKeyMode: "disabled"` guarantees `prompt_cache_key` is never sent to the gateway (the default `auto` already never enables it for NaN).
|
|
82
|
+
|
|
81
83
|
**Streaming token usage:** `supportsUsageInStreaming` is `true` by default. NaN's published schema does not document `stream_options`, but the live gateway honors it — measured 2026-09-16 ([#7](https://github.com/gtrabanco/pi-nan-provider/issues/7)): two identical streaming calls per model, 0 usage chunks without the flag and exactly 1 with it, on `deepseek-v4-flash`, `glm5.3-flash`, `qwen3.6`, `mimo-v2.5` and `gemma4`. pi therefore reports real input/output/reasoning/cache token counts instead of zeros. If a model turns out not to report streaming usage, opt out per model — the request sanitizer then strips `stream_options` and the payload stays strict:
|
|
82
84
|
|
|
83
85
|
```json
|
|
@@ -305,7 +307,7 @@ MiMo V2.5:
|
|
|
305
307
|
[███░░░░░░░░░░░░░░░░░] 12.5% of monthly cap
|
|
306
308
|
Used: 125.0M / 1.0B (875.0M remaining) · 840 requests
|
|
307
309
|
|
|
308
|
-
GLM 5.3
|
|
310
|
+
GLM 5.3:
|
|
309
311
|
[████████░░░░░░░░░░░░] 40.0% of monthly cap
|
|
310
312
|
Used: 1.2B / 3.0B (1.8B remaining) · 2,400 requests
|
|
311
313
|
↳ rolling window: 400.0M / 4h (daily granularity — /usage cannot break it down)
|
|
@@ -334,7 +336,7 @@ Qwen 3.6 uncapped
|
|
|
334
336
|
Gemma 4 uncapped
|
|
335
337
|
Qwen 3.8 Flash 500.0M
|
|
336
338
|
GLM 5.3 Flash 2.0B
|
|
337
|
-
GLM 5.3 3.0B
|
|
339
|
+
GLM 5.3 3.0B (rolling 400.0M/4h)
|
|
338
340
|
|
|
339
341
|
💡 Set NAN_API_KEY or run `/login nan` to see real usage (GET /v1/usage).
|
|
340
342
|
```
|
|
@@ -357,9 +359,16 @@ Chat models:
|
|
|
357
359
|
| `mimo-v2.6-flash` | 1,048,576 | 131,072 | text, image | ✅ |
|
|
358
360
|
| `glm5.3-flash` | 1,048,576 | 131,072 | text, image | ✅ |
|
|
359
361
|
| `qwen3.8-flash` | 1,048,576 | 131,072 | text, image | ✅ |
|
|
362
|
+
| `glm5.3` | 1,048,576 | 131,072 | text, image | ✅ |
|
|
363
|
+
| `kimi-k3.1-pro` | 1,048,576 | 32,768 | text, image | ✅ |
|
|
364
|
+
| `qwen3.8-max` | 1,000,000 | 32,768 | text, image | ✅ |
|
|
365
|
+
| `deepseek-v4-pro` | 1,048,576 | 32,768 | text | ✅ |
|
|
366
|
+
| `hy4` | 1,048,576 | 32,768 | text, image | ✅ |
|
|
360
367
|
|
|
361
368
|
> [!NOTE]
|
|
362
|
-
> Context windows above are the **documented** windows from [the NaN docs](https://nan.builders/docs/models) (checked 2026-10-14), which are the source of truth; models.dev is a downstream mirror a human updates later and may lag. `glm5.3`
|
|
369
|
+
> Context windows above are the **documented** windows from [the NaN docs](https://nan.builders/docs/models) (checked 2026-10-14), which are the source of truth; models.dev is a downstream mirror a human updates later and may lag. `glm5.3` was premium-only and live-only until NaN removed tier-exclusive models on 2026-11-10; it now ships in the static catalog with the values it carried (text+image, 1,048,576 / 131,072).
|
|
370
|
+
>
|
|
371
|
+
> `kimi-k3.1-pro`, `qwen3.8-max`, `deepseek-v4-pro` and `hy4` are NaN's external-provider (ZDR) models launched on 2026-11-10. NaN's docs and OpenAPI do not list them yet, but the live `GET /v1/models` does (checked 2026-11-10). Their values come from NaN's pricing page ("1M context"), the NaN pi docs (`maxTokens` 32,768 for every 1M-context model) and the first-party vendor entries on models.dev (modalities; `qwen3.8-max` uses the vendor's 1,000,000 window); cost is 0 and no `reasoning_effort` mapping is declared, because how the gateway handles it for external providers is unmeasured. Each entry carries its provenance note in `scripts/models.generated.ts`.
|
|
363
372
|
>
|
|
364
373
|
> `*` deepseek-v4-flash max output 32,768 is the ceiling from the official NaN pi docs (https://nan.builders/docs/pi, "the same set the NaN CLI writes", issue #20, 2026-10-02); models.dev still lists 384,000 but the gateway rejects `max_tokens` above ~256k with 403.
|
|
365
374
|
>
|
|
@@ -373,6 +382,8 @@ Non-chat image models (available through `models.generateImages()` /
|
|
|
373
382
|
| `flux-2-klein` | text, image | Text-to-image + image-to-image |
|
|
374
383
|
| `qwen-image-2.1` | text | Text-to-image |
|
|
375
384
|
|
|
385
|
+
`minimax-h3` (video generation, listed by the live `/models` since 2026-11-10) is classified as non-chat too: it is never registered as a chat model.
|
|
386
|
+
|
|
376
387
|
> [!NOTE]
|
|
377
388
|
> `mimo-v2.6-flash` is served by NaN and has been listed by models.dev provider `nan` since 2026-09-29. Before that it entered the catalog through a manual-only entry; that entry is kept as a fallback (re-emitted automatically if models.dev drops the model again) and its provenance note stays attached to the generated entry.
|
|
378
389
|
>
|
|
@@ -390,6 +401,7 @@ NaN's `reasoning_effort` parameter controls how much the model thinks before ans
|
|
|
390
401
|
| `qwen3.6`, `gemma4` | `none` · `minimal` · `low` · `medium` · `high` · `max` | `none`/`minimal` skip reasoning entirely; others cap at 2K / 8K / 16K / 32K tokens. `thinking: "off"` sends `reasoning_effort: "none"` automatically via the catalog's `thinkingLevelMap` — the NaN docs state that with no parameter these models reason by default (16,384-token budget), so off must be explicit |
|
|
391
402
|
| `deepseek-v4-flash` | `none` (catalog declares ["none"]) | `none` disables reasoning (0 reasoning tokens, a full answer); every other value — including `minimal` and omitting the parameter — leaves it ON (57 / 63 / 109 reasoning tokens), so the catalog declares only `none`. Re-probed live 2026-10-14: the NaN docs claim "any value (no effect)", but the measurement wins. `thinking: "off"` sends `reasoning_effort: "none"` automatically via the catalog's `thinkingLevelMap` — without it the model runs away to `finish_reason: "length"` with no answer (issue #16) |
|
|
392
403
|
| `qwen3.8-flash` | *(accepted but not adjustable)* | The parameter is accepted and never rejected, but the model manages its own reasoning depth — it is never an error to send a value this model doesn't adjust |
|
|
404
|
+
| `kimi-k3.1-pro`, `qwen3.8-max`, `deepseek-v4-pro`, `hy4` | *(no mapping declared)* | External-provider models launched 2026-11-10; how the gateway translates `reasoning_effort` for them is unmeasured, so the catalog declares no effort values and no `thinkingLevelMap` (`thinking: "off"` sends no parameter) |
|
|
393
405
|
| `mimo-v2.6-flash` | `none` | The docs called this "depth not adjustable", but the live gateway (2026-10-14) shows `none` gives 0 reasoning tokens with a full answer while `low` gives 22 and omitting the parameter 17 — so `thinking: "off"` sends `reasoning_effort: "none"` via the catalog's `thinkingLevelMap` |
|
|
394
406
|
> [!NOTE]
|
|
395
407
|
> `maxTokens` does NOT bound the reasoning phase on NaN models. The reasoning phase runs to completion (or is cut at NaN's reasoning-only stream limit: 45,000 reasoning characters, or 420 s without visible output) regardless of `maxTokens` — measured: `max_tokens=512` on deepseek-v4-flash still consumed 13,376 completion tokens, all reasoning (26x the ceiling). This is gateway behavior confirmed by issue #16 (measured 2026-09-27).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtrabanco/pi-nan-provider",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "NaN Builders (api.nan.builders) model provider for pi - OpenAI-compatible registration with a models.dev-generated fallback, tier-aware live catalog, and an optional community media MCP bridge",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@earendil-works/pi-coding-agent": "^1.4.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@earendil-works/pi-ai": "1.5.
|
|
51
|
-
"@earendil-works/pi-coding-agent": "1.5.
|
|
50
|
+
"@earendil-works/pi-ai": "1.5.1",
|
|
51
|
+
"@earendil-works/pi-coding-agent": "1.5.1",
|
|
52
52
|
"@types/bun": "1.4",
|
|
53
53
|
"typescript": "7"
|
|
54
54
|
},
|
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Sources of truth (maintainer instruction, reaffirmed 2026-09-29):
|
|
12
12
|
* - https://nan.builders/docs/models decides WHICH models exist — which ids
|
|
13
|
-
* belong in the chat catalog, which
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* belong in the chat catalog, which were removed by the provider, which
|
|
14
|
+
* are not chat models at all. Every exclusion cites it. (Models NaN
|
|
15
|
+
* launches before the docs catch up — e.g. the 2026-11-10 external
|
|
16
|
+
* models — enter through MANUAL_ONLY_MODEL_IDS with their own provenance.)
|
|
16
17
|
* - models.dev (provider "nan") supplies the numeric limits for the ids it
|
|
17
18
|
* documents; a divergence from the docs is recorded in MANUAL_OVERRIDES
|
|
18
19
|
* with a source note.
|
|
@@ -64,8 +65,7 @@ const FETCH_TIMEOUT_MS = 15_000;
|
|
|
64
65
|
|
|
65
66
|
/**
|
|
66
67
|
* Official community chat models per https://nan.builders/docs/models
|
|
67
|
-
* (checked 2026-09-29
|
|
68
|
-
* Each MUST reach the catalog — from models.dev or from a MANUAL_ONLY entry —
|
|
68
|
+
* (checked 2026-09-29). Each MUST reach the catalog — from models.dev or from a MANUAL_ONLY entry —
|
|
69
69
|
* or generation fails. The docs decide this set, not models.dev: models.dev
|
|
70
70
|
* dropped mimo-v2.5 together with the docs in 2026-09.
|
|
71
71
|
*/
|
|
@@ -102,21 +102,6 @@ const PROVIDER_REMOVED_MODEL_IDS: Record<string, string> = {
|
|
|
102
102
|
// the same classification. Here it feeds convertModel's exclusion and the
|
|
103
103
|
// exclusion-note list in GENERATED_CATALOG_META.notes.
|
|
104
104
|
|
|
105
|
-
/**
|
|
106
|
-
* Premium/tier-gated models that models.dev documents but that are deliberately
|
|
107
|
-
* kept OUT of the static fallback catalog. The static baseline is what pi
|
|
108
|
-
* registers with zero network, and it must not advertise a premium model to a
|
|
109
|
-
* key that cannot call it: NaN's live `/models` response is the tier
|
|
110
|
-
* authority, so premium keys still receive these models through the live
|
|
111
|
-
* refresh with conservative placeholder limits (UNKNOWN_MODEL_LIMITS).
|
|
112
|
-
* Excluded at generation time with the recorded reason so a regeneration
|
|
113
|
-
* cannot resurrect them into the baseline.
|
|
114
|
-
*/
|
|
115
|
-
const LIVE_ONLY_MODEL_IDS: Record<string, string> = {
|
|
116
|
-
"glm5.3":
|
|
117
|
-
"premium-tier model (models.dev now documents it with 1M context / 131,072 max output; NaN docs https://nan.builders/docs/models + https://nan.builders/openapi.json, checked 2026-09-13) kept live-only so a non-premium key never sees a model it cannot call when the live /models fetch is unavailable; premium keys still get it via the /models refresh with conservative placeholder limits",
|
|
118
|
-
};
|
|
119
|
-
|
|
120
105
|
/**
|
|
121
106
|
* LiteLLM compat confirmed against the live api.nan.builders gateway by the
|
|
122
107
|
* maintainer's working ~/.pi/agent/models.json config (2026-09-04) — the
|
|
@@ -251,10 +236,6 @@ function convertModel(modelId: string, m: ModelsDevModel): GeneratedModel | { sk
|
|
|
251
236
|
if (nonChatReason) {
|
|
252
237
|
return { skip: `non-chat: "${modelId}" excluded from the chat catalog (${nonChatReason})` };
|
|
253
238
|
}
|
|
254
|
-
const liveOnlyReason = LIVE_ONLY_MODEL_IDS[modelId];
|
|
255
|
-
if (liveOnlyReason) {
|
|
256
|
-
return { skip: `live-only: "${modelId}" kept out of the static catalog (${liveOnlyReason})` };
|
|
257
|
-
}
|
|
258
239
|
const contextWindow = m.limit?.context;
|
|
259
240
|
const maxTokens = m.limit?.output;
|
|
260
241
|
if (typeof contextWindow !== "number" || contextWindow <= 0) {
|
|
@@ -388,9 +369,6 @@ async function main(): Promise<void> {
|
|
|
388
369
|
...Object.entries(NON_CHAT_MODEL_IDS).map(
|
|
389
370
|
([id, reason]) => `non-chat: "${id}" excluded from the chat catalog (${reason})`,
|
|
390
371
|
),
|
|
391
|
-
...Object.entries(LIVE_ONLY_MODEL_IDS).map(
|
|
392
|
-
([id, reason]) => `live-only: "${id}" kept out of the static catalog (${reason})`,
|
|
393
|
-
),
|
|
394
372
|
...entries.flatMap((entry) => entry.notes ?? []),
|
|
395
373
|
]),
|
|
396
374
|
];
|
|
@@ -103,6 +103,85 @@ export const REASONING_EFFORT_VALUES: Record<string, string[]> = {
|
|
|
103
103
|
const MANUAL_ONLY_NOTE =
|
|
104
104
|
"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.";
|
|
105
105
|
|
|
106
|
+
/**
|
|
107
|
+
* NaN external-provider models launched 2026-11-10 (ZDR, served through
|
|
108
|
+
* external providers). models.dev provider nan does not list them, the NaN
|
|
109
|
+
* docs/openapi do not mention them yet, but the live `GET /v1/models` does
|
|
110
|
+
* (checked 2026-11-10, a non-premium key sees all four). Values per spec S2 of
|
|
111
|
+
* odd/tasks/nan-external-models-2026-11.md; nothing here is a guess:
|
|
112
|
+
* - contextWindow: NaN's pricing page card says "1M context" for each model
|
|
113
|
+
* (maintainer screenshot, 2026-11-10); NaN's convention for 1M is 1,048,576
|
|
114
|
+
* (https://nan.builders/docs/pi). qwen3.8-max uses the first-party vendor value
|
|
115
|
+
* 1,000,000 (models.dev provider alibaba), the smaller of the two.
|
|
116
|
+
* - maxTokens 32,768: https://nan.builders/docs/pi declares maxTokens 32768 for
|
|
117
|
+
* every 1M-context NaN model; every vendor limit is >= 65,536 (models.dev
|
|
118
|
+
* moonshotai / alibaba / deepseek / tencent-tokenhub), and NaN's gateway
|
|
119
|
+
* already rejected a high max_tokens once (issue #20).
|
|
120
|
+
* - input: first-party vendor modalities on models.dev (moonshotai/kimi-k3.1-pro,
|
|
121
|
+
* alibaba/qwen3.8-max, deepseek/deepseek-v4-pro, tencent-tokenhub/hy4)
|
|
122
|
+
* restricted to pi's text/image.
|
|
123
|
+
* - reasoning true: all four are reasoning models per their vendors.
|
|
124
|
+
* reasoningEffortValues [] and NO thinkingLevelMap: how NaN's gateway
|
|
125
|
+
* translates reasoning_effort for external providers is unmeasured.
|
|
126
|
+
* - cost 0: maintainer decision (NaN is quota/credit based).
|
|
127
|
+
*/
|
|
128
|
+
const EXTERNAL_MODEL_NOTE_SUFFIX =
|
|
129
|
+
" 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.";
|
|
130
|
+
|
|
131
|
+
const EXTERNAL_MODELS: Record<string, ManualModelOverride> = {
|
|
132
|
+
"kimi-k3.1-pro": {
|
|
133
|
+
name: "Kimi K3.1 Pro",
|
|
134
|
+
input: ["text", "image"],
|
|
135
|
+
reasoning: true,
|
|
136
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
137
|
+
contextWindow: 1_048_576,
|
|
138
|
+
maxTokens: 32_768,
|
|
139
|
+
reasoningEffortValues: [],
|
|
140
|
+
note:
|
|
141
|
+
"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." +
|
|
142
|
+
EXTERNAL_MODEL_NOTE_SUFFIX,
|
|
143
|
+
},
|
|
144
|
+
"qwen3.8-max": {
|
|
145
|
+
name: "Qwen3.8 Max",
|
|
146
|
+
input: ["text", "image"],
|
|
147
|
+
reasoning: true,
|
|
148
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
149
|
+
contextWindow: 1_000_000,
|
|
150
|
+
maxTokens: 32_768,
|
|
151
|
+
reasoningEffortValues: [],
|
|
152
|
+
note:
|
|
153
|
+
"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." +
|
|
154
|
+
EXTERNAL_MODEL_NOTE_SUFFIX,
|
|
155
|
+
},
|
|
156
|
+
"deepseek-v4-pro": {
|
|
157
|
+
name: "DeepSeek V4-Pro (0813 version)",
|
|
158
|
+
input: ["text"],
|
|
159
|
+
reasoning: true,
|
|
160
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
161
|
+
contextWindow: 1_048_576,
|
|
162
|
+
maxTokens: 32_768,
|
|
163
|
+
reasoningEffortValues: [],
|
|
164
|
+
note:
|
|
165
|
+
"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." +
|
|
166
|
+
EXTERNAL_MODEL_NOTE_SUFFIX,
|
|
167
|
+
},
|
|
168
|
+
hy4: {
|
|
169
|
+
name: "Hy4",
|
|
170
|
+
input: ["text", "image"],
|
|
171
|
+
reasoning: true,
|
|
172
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
173
|
+
contextWindow: 1_048_576,
|
|
174
|
+
maxTokens: 32_768,
|
|
175
|
+
reasoningEffortValues: [],
|
|
176
|
+
note:
|
|
177
|
+
"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." +
|
|
178
|
+
EXTERNAL_MODEL_NOTE_SUFFIX,
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const EXTERNAL_MODEL_DETAIL =
|
|
183
|
+
"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";
|
|
184
|
+
|
|
106
185
|
/**
|
|
107
186
|
* Models NaN serves that models.dev provider nan may not list. Mirrors the
|
|
108
187
|
* generator's MANUAL_ONLY_MODEL_IDS — kept in sync so the generator and the
|
|
@@ -112,6 +191,7 @@ const MANUAL_ONLY_NOTE =
|
|
|
112
191
|
*/
|
|
113
192
|
export const MANUAL_ONLY_MODEL_IDS: Record<string, string> = {
|
|
114
193
|
"mimo-v2.6-flash": MANUAL_ONLY_NOTE,
|
|
194
|
+
...Object.fromEntries(Object.keys(EXTERNAL_MODELS).map((id) => [id, EXTERNAL_MODEL_DETAIL])),
|
|
115
195
|
};
|
|
116
196
|
|
|
117
197
|
/**
|
|
@@ -128,6 +208,7 @@ export const MANUAL_ONLY_MODELS: Record<string, ManualModelOverride> = {
|
|
|
128
208
|
maxTokens: 131_072,
|
|
129
209
|
note: MANUAL_ONLY_NOTE,
|
|
130
210
|
},
|
|
211
|
+
...EXTERNAL_MODELS,
|
|
131
212
|
};
|
|
132
213
|
|
|
133
214
|
/**
|
|
@@ -149,6 +230,17 @@ export const MANUAL_ONLY_MODELS: Record<string, ManualModelOverride> = {
|
|
|
149
230
|
* docs are explicit about both the default and the `none` behavior.
|
|
150
231
|
*/
|
|
151
232
|
export const MANUAL_OVERRIDES: Record<string, ManualModelOverride> = {
|
|
233
|
+
...EXTERNAL_MODELS,
|
|
234
|
+
"glm5.3": {
|
|
235
|
+
name: "GLM 5.3",
|
|
236
|
+
input: ["text", "image"],
|
|
237
|
+
contextWindow: 1_048_576,
|
|
238
|
+
maxTokens: 131_072,
|
|
239
|
+
reasoningEffortValues: ["low", "medium", "high", "max"],
|
|
240
|
+
thinkingLevelMap: { off: "low" },
|
|
241
|
+
note:
|
|
242
|
+
"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.",
|
|
243
|
+
},
|
|
152
244
|
"qwen3.8-flash": {
|
|
153
245
|
contextWindow: 1_048_576,
|
|
154
246
|
note:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file is auto-generated by scripts/generate-models.ts
|
|
2
2
|
// Do not edit manually — run `bun run generate-models` to update.
|
|
3
3
|
//
|
|
4
|
-
// Source: https://models.dev/api.json (provider "nan"), fetched 2026-11-
|
|
4
|
+
// Source: https://models.dev/api.json (provider "nan"), fetched 2026-11-10T14:00:46.087Z
|
|
5
5
|
// Provenance: every contextWindow/maxTokens/input/cost value traces to
|
|
6
6
|
// models.dev or to the per-entry notes below. Nothing is invented; entries
|
|
7
7
|
// models.dev documents incompletely are omitted and flagged instead.
|
|
@@ -93,6 +93,36 @@ export const NAN_GENERATED_MODELS: readonly GeneratedModelEntry[] = [
|
|
|
93
93
|
"canonical_model_id": "deepseek/deepseek-v4.1-flash"
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
|
+
{
|
|
97
|
+
"id": "deepseek-v4-pro",
|
|
98
|
+
"name": "DeepSeek V4-Pro (0813 version)",
|
|
99
|
+
"reasoning": true,
|
|
100
|
+
"input": [
|
|
101
|
+
"text"
|
|
102
|
+
],
|
|
103
|
+
"cost": {
|
|
104
|
+
"input": 0,
|
|
105
|
+
"output": 0,
|
|
106
|
+
"cacheRead": 0,
|
|
107
|
+
"cacheWrite": 0
|
|
108
|
+
},
|
|
109
|
+
"contextWindow": 1048576,
|
|
110
|
+
"maxTokens": 32768,
|
|
111
|
+
"reasoningEffortValues": [],
|
|
112
|
+
"compat": {
|
|
113
|
+
"supportsDeveloperRole": false,
|
|
114
|
+
"supportsReasoningEffort": true,
|
|
115
|
+
"supportsUsageInStreaming": true,
|
|
116
|
+
"supportsFinishReason": true,
|
|
117
|
+
"maxTokensField": "max_tokens"
|
|
118
|
+
},
|
|
119
|
+
"notes": [
|
|
120
|
+
"compat matches the maintainer's working ~/.pi/agent/models.json LiteLLM config for api.nan.builders (2026-09-04): supportsDeveloperRole false, supportsReasoningEffort true, maxTokensField max_tokens. NaN's docs example sets only supportsDeveloperRole: true and is not battle-tested. supportsFinishReason true (2026-09-13, issue #2): the LiteLLM gateway intermittently closes SSE streams before emitting finish_reason; with true pi-ai raises 'Stream ended without finish_reason', which matches pi-ai's retryable-provider pattern ('ended without') and is retried automatically, whereas false silently synthesized stop/toolUse and stalled the turn mid-answer. supportsUsageInStreaming true (2026-09-16, issue #7): NaN's published schema is silent about stream_options, but the live gateway honors it — two identical streaming calls per model, differing only in stream_options: { include_usage: true }, returned 0 usage chunks without it and exactly 1 with it (prompt/completion/reasoning/cached token counts) on deepseek-v4-flash, glm5.3-flash, qwen3.6, mimo-v2.5 and gemma4, and a real pi session then recorded token counts where it recorded zeros. pi-ai only sends stream_options when this is not false, and the sanitizer forwards it when the model declares true, so chat models opt in by default and usage is reported (issue #4). A model that does not report streaming usage can still opt out per model with a models.json compat override (supportsUsageInStreaming: false); the sanitizer then strips stream_options and the payload stays strict.",
|
|
121
|
+
"manual-only: \"deepseek-v4-pro\" not yet on models.dev provider nan (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).",
|
|
122
|
+
"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. 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."
|
|
123
|
+
],
|
|
124
|
+
"extras": {}
|
|
125
|
+
},
|
|
96
126
|
{
|
|
97
127
|
"id": "gemma4",
|
|
98
128
|
"name": "Gemma 4 26B A4B IT",
|
|
@@ -176,6 +206,87 @@ export const NAN_GENERATED_MODELS: readonly GeneratedModelEntry[] = [
|
|
|
176
206
|
"canonical_model_id": "google/gemma-4-26b-a4b-it"
|
|
177
207
|
}
|
|
178
208
|
},
|
|
209
|
+
{
|
|
210
|
+
"id": "glm5.3",
|
|
211
|
+
"name": "GLM 5.3",
|
|
212
|
+
"reasoning": true,
|
|
213
|
+
"input": [
|
|
214
|
+
"text",
|
|
215
|
+
"image"
|
|
216
|
+
],
|
|
217
|
+
"cost": {
|
|
218
|
+
"input": 0,
|
|
219
|
+
"output": 0,
|
|
220
|
+
"cacheRead": 0,
|
|
221
|
+
"cacheWrite": 0
|
|
222
|
+
},
|
|
223
|
+
"contextWindow": 1048576,
|
|
224
|
+
"maxTokens": 131072,
|
|
225
|
+
"reasoningEffortValues": [
|
|
226
|
+
"low",
|
|
227
|
+
"medium",
|
|
228
|
+
"high",
|
|
229
|
+
"max"
|
|
230
|
+
],
|
|
231
|
+
"thinkingLevelMap": {
|
|
232
|
+
"off": "low"
|
|
233
|
+
},
|
|
234
|
+
"compat": {
|
|
235
|
+
"supportsDeveloperRole": false,
|
|
236
|
+
"supportsReasoningEffort": true,
|
|
237
|
+
"supportsUsageInStreaming": true,
|
|
238
|
+
"supportsFinishReason": true,
|
|
239
|
+
"maxTokensField": "max_tokens"
|
|
240
|
+
},
|
|
241
|
+
"notes": [
|
|
242
|
+
"compat matches the maintainer's working ~/.pi/agent/models.json LiteLLM config for api.nan.builders (2026-09-04): supportsDeveloperRole false, supportsReasoningEffort true, maxTokensField max_tokens. NaN's docs example sets only supportsDeveloperRole: true and is not battle-tested. supportsFinishReason true (2026-09-13, issue #2): the LiteLLM gateway intermittently closes SSE streams before emitting finish_reason; with true pi-ai raises 'Stream ended without finish_reason', which matches pi-ai's retryable-provider pattern ('ended without') and is retried automatically, whereas false silently synthesized stop/toolUse and stalled the turn mid-answer. supportsUsageInStreaming true (2026-09-16, issue #7): NaN's published schema is silent about stream_options, but the live gateway honors it — two identical streaming calls per model, differing only in stream_options: { include_usage: true }, returned 0 usage chunks without it and exactly 1 with it (prompt/completion/reasoning/cached token counts) on deepseek-v4-flash, glm5.3-flash, qwen3.6, mimo-v2.5 and gemma4, and a real pi session then recorded token counts where it recorded zeros. pi-ai only sends stream_options when this is not false, and the sanitizer forwards it when the model declares true, so chat models opt in by default and usage is reported (issue #4). A model that does not report streaming usage can still opt out per model with a models.json compat override (supportsUsageInStreaming: false); the sanitizer then strips stream_options and the payload stays strict.",
|
|
243
|
+
"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."
|
|
244
|
+
],
|
|
245
|
+
"extras": {
|
|
246
|
+
"id": "glm5.3",
|
|
247
|
+
"name": "GLM-5.3",
|
|
248
|
+
"description": "Flagship GLM model for long-horizon coding, agents, and complex project delivery",
|
|
249
|
+
"family": "glm",
|
|
250
|
+
"attachment": false,
|
|
251
|
+
"reasoning": true,
|
|
252
|
+
"reasoning_options": [
|
|
253
|
+
{
|
|
254
|
+
"type": "effort",
|
|
255
|
+
"values": [
|
|
256
|
+
"minimal",
|
|
257
|
+
"low",
|
|
258
|
+
"medium",
|
|
259
|
+
"high",
|
|
260
|
+
"xhigh",
|
|
261
|
+
"max"
|
|
262
|
+
]
|
|
263
|
+
}
|
|
264
|
+
],
|
|
265
|
+
"tool_call": true,
|
|
266
|
+
"structured_output": true,
|
|
267
|
+
"temperature": true,
|
|
268
|
+
"release_date": "2026-08-14",
|
|
269
|
+
"last_updated": "2026-08-14",
|
|
270
|
+
"modalities": {
|
|
271
|
+
"input": [
|
|
272
|
+
"text"
|
|
273
|
+
],
|
|
274
|
+
"output": [
|
|
275
|
+
"text"
|
|
276
|
+
]
|
|
277
|
+
},
|
|
278
|
+
"open_weights": true,
|
|
279
|
+
"limit": {
|
|
280
|
+
"context": 1000000,
|
|
281
|
+
"output": 131072
|
|
282
|
+
},
|
|
283
|
+
"cost": {
|
|
284
|
+
"input": 0,
|
|
285
|
+
"output": 0
|
|
286
|
+
},
|
|
287
|
+
"canonical_model_id": "zhipuai/glm-5.3"
|
|
288
|
+
}
|
|
289
|
+
},
|
|
179
290
|
{
|
|
180
291
|
"id": "glm5.3-flash",
|
|
181
292
|
"name": "GLM-5.3-Flash",
|
|
@@ -259,6 +370,68 @@ export const NAN_GENERATED_MODELS: readonly GeneratedModelEntry[] = [
|
|
|
259
370
|
"canonical_model_id": "zhipuai/glm-5.3-flash"
|
|
260
371
|
}
|
|
261
372
|
},
|
|
373
|
+
{
|
|
374
|
+
"id": "hy4",
|
|
375
|
+
"name": "Hy4",
|
|
376
|
+
"reasoning": true,
|
|
377
|
+
"input": [
|
|
378
|
+
"text",
|
|
379
|
+
"image"
|
|
380
|
+
],
|
|
381
|
+
"cost": {
|
|
382
|
+
"input": 0,
|
|
383
|
+
"output": 0,
|
|
384
|
+
"cacheRead": 0,
|
|
385
|
+
"cacheWrite": 0
|
|
386
|
+
},
|
|
387
|
+
"contextWindow": 1048576,
|
|
388
|
+
"maxTokens": 32768,
|
|
389
|
+
"reasoningEffortValues": [],
|
|
390
|
+
"compat": {
|
|
391
|
+
"supportsDeveloperRole": false,
|
|
392
|
+
"supportsReasoningEffort": true,
|
|
393
|
+
"supportsUsageInStreaming": true,
|
|
394
|
+
"supportsFinishReason": true,
|
|
395
|
+
"maxTokensField": "max_tokens"
|
|
396
|
+
},
|
|
397
|
+
"notes": [
|
|
398
|
+
"compat matches the maintainer's working ~/.pi/agent/models.json LiteLLM config for api.nan.builders (2026-09-04): supportsDeveloperRole false, supportsReasoningEffort true, maxTokensField max_tokens. NaN's docs example sets only supportsDeveloperRole: true and is not battle-tested. supportsFinishReason true (2026-09-13, issue #2): the LiteLLM gateway intermittently closes SSE streams before emitting finish_reason; with true pi-ai raises 'Stream ended without finish_reason', which matches pi-ai's retryable-provider pattern ('ended without') and is retried automatically, whereas false silently synthesized stop/toolUse and stalled the turn mid-answer. supportsUsageInStreaming true (2026-09-16, issue #7): NaN's published schema is silent about stream_options, but the live gateway honors it — two identical streaming calls per model, differing only in stream_options: { include_usage: true }, returned 0 usage chunks without it and exactly 1 with it (prompt/completion/reasoning/cached token counts) on deepseek-v4-flash, glm5.3-flash, qwen3.6, mimo-v2.5 and gemma4, and a real pi session then recorded token counts where it recorded zeros. pi-ai only sends stream_options when this is not false, and the sanitizer forwards it when the model declares true, so chat models opt in by default and usage is reported (issue #4). A model that does not report streaming usage can still opt out per model with a models.json compat override (supportsUsageInStreaming: false); the sanitizer then strips stream_options and the payload stays strict.",
|
|
399
|
+
"manual-only: \"hy4\" not yet on models.dev provider nan (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).",
|
|
400
|
+
"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. 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."
|
|
401
|
+
],
|
|
402
|
+
"extras": {}
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"id": "kimi-k3.1-pro",
|
|
406
|
+
"name": "Kimi K3.1 Pro",
|
|
407
|
+
"reasoning": true,
|
|
408
|
+
"input": [
|
|
409
|
+
"text",
|
|
410
|
+
"image"
|
|
411
|
+
],
|
|
412
|
+
"cost": {
|
|
413
|
+
"input": 0,
|
|
414
|
+
"output": 0,
|
|
415
|
+
"cacheRead": 0,
|
|
416
|
+
"cacheWrite": 0
|
|
417
|
+
},
|
|
418
|
+
"contextWindow": 1048576,
|
|
419
|
+
"maxTokens": 32768,
|
|
420
|
+
"reasoningEffortValues": [],
|
|
421
|
+
"compat": {
|
|
422
|
+
"supportsDeveloperRole": false,
|
|
423
|
+
"supportsReasoningEffort": true,
|
|
424
|
+
"supportsUsageInStreaming": true,
|
|
425
|
+
"supportsFinishReason": true,
|
|
426
|
+
"maxTokensField": "max_tokens"
|
|
427
|
+
},
|
|
428
|
+
"notes": [
|
|
429
|
+
"compat matches the maintainer's working ~/.pi/agent/models.json LiteLLM config for api.nan.builders (2026-09-04): supportsDeveloperRole false, supportsReasoningEffort true, maxTokensField max_tokens. NaN's docs example sets only supportsDeveloperRole: true and is not battle-tested. supportsFinishReason true (2026-09-13, issue #2): the LiteLLM gateway intermittently closes SSE streams before emitting finish_reason; with true pi-ai raises 'Stream ended without finish_reason', which matches pi-ai's retryable-provider pattern ('ended without') and is retried automatically, whereas false silently synthesized stop/toolUse and stalled the turn mid-answer. supportsUsageInStreaming true (2026-09-16, issue #7): NaN's published schema is silent about stream_options, but the live gateway honors it — two identical streaming calls per model, differing only in stream_options: { include_usage: true }, returned 0 usage chunks without it and exactly 1 with it (prompt/completion/reasoning/cached token counts) on deepseek-v4-flash, glm5.3-flash, qwen3.6, mimo-v2.5 and gemma4, and a real pi session then recorded token counts where it recorded zeros. pi-ai only sends stream_options when this is not false, and the sanitizer forwards it when the model declares true, so chat models opt in by default and usage is reported (issue #4). A model that does not report streaming usage can still opt out per model with a models.json compat override (supportsUsageInStreaming: false); the sanitizer then strips stream_options and the payload stays strict.",
|
|
430
|
+
"manual-only: \"kimi-k3.1-pro\" not yet on models.dev provider nan (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).",
|
|
431
|
+
"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. 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."
|
|
432
|
+
],
|
|
433
|
+
"extras": {}
|
|
434
|
+
},
|
|
262
435
|
{
|
|
263
436
|
"id": "mimo-v2.6-flash",
|
|
264
437
|
"name": "MiMo-V2.6-Flash",
|
|
@@ -493,17 +666,47 @@ export const NAN_GENERATED_MODELS: readonly GeneratedModelEntry[] = [
|
|
|
493
666
|
},
|
|
494
667
|
"canonical_model_id": "alibaba/qwen3.8-flash"
|
|
495
668
|
}
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
"id": "qwen3.8-max",
|
|
672
|
+
"name": "Qwen3.8 Max",
|
|
673
|
+
"reasoning": true,
|
|
674
|
+
"input": [
|
|
675
|
+
"text",
|
|
676
|
+
"image"
|
|
677
|
+
],
|
|
678
|
+
"cost": {
|
|
679
|
+
"input": 0,
|
|
680
|
+
"output": 0,
|
|
681
|
+
"cacheRead": 0,
|
|
682
|
+
"cacheWrite": 0
|
|
683
|
+
},
|
|
684
|
+
"contextWindow": 1000000,
|
|
685
|
+
"maxTokens": 32768,
|
|
686
|
+
"reasoningEffortValues": [],
|
|
687
|
+
"compat": {
|
|
688
|
+
"supportsDeveloperRole": false,
|
|
689
|
+
"supportsReasoningEffort": true,
|
|
690
|
+
"supportsUsageInStreaming": true,
|
|
691
|
+
"supportsFinishReason": true,
|
|
692
|
+
"maxTokensField": "max_tokens"
|
|
693
|
+
},
|
|
694
|
+
"notes": [
|
|
695
|
+
"compat matches the maintainer's working ~/.pi/agent/models.json LiteLLM config for api.nan.builders (2026-09-04): supportsDeveloperRole false, supportsReasoningEffort true, maxTokensField max_tokens. NaN's docs example sets only supportsDeveloperRole: true and is not battle-tested. supportsFinishReason true (2026-09-13, issue #2): the LiteLLM gateway intermittently closes SSE streams before emitting finish_reason; with true pi-ai raises 'Stream ended without finish_reason', which matches pi-ai's retryable-provider pattern ('ended without') and is retried automatically, whereas false silently synthesized stop/toolUse and stalled the turn mid-answer. supportsUsageInStreaming true (2026-09-16, issue #7): NaN's published schema is silent about stream_options, but the live gateway honors it — two identical streaming calls per model, differing only in stream_options: { include_usage: true }, returned 0 usage chunks without it and exactly 1 with it (prompt/completion/reasoning/cached token counts) on deepseek-v4-flash, glm5.3-flash, qwen3.6, mimo-v2.5 and gemma4, and a real pi session then recorded token counts where it recorded zeros. pi-ai only sends stream_options when this is not false, and the sanitizer forwards it when the model declares true, so chat models opt in by default and usage is reported (issue #4). A model that does not report streaming usage can still opt out per model with a models.json compat override (supportsUsageInStreaming: false); the sanitizer then strips stream_options and the payload stays strict.",
|
|
696
|
+
"manual-only: \"qwen3.8-max\" not yet on models.dev provider nan (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).",
|
|
697
|
+
"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. 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."
|
|
698
|
+
],
|
|
699
|
+
"extras": {}
|
|
496
700
|
}
|
|
497
701
|
];
|
|
498
702
|
|
|
499
703
|
export const GENERATED_CATALOG_META = {
|
|
500
704
|
source: "https://models.dev/api.json",
|
|
501
705
|
modelsDevProvider: "nan",
|
|
502
|
-
fetchedAt: "2026-11-
|
|
503
|
-
modelCount:
|
|
504
|
-
models: ["deepseek-v4-flash","gemma4","glm5.3-flash","mimo-v2.6-flash","qwen3.6","qwen3.8-flash"],
|
|
706
|
+
fetchedAt: "2026-11-10T14:00:46.087Z",
|
|
707
|
+
modelCount: 11,
|
|
708
|
+
models: ["deepseek-v4-flash","deepseek-v4-pro","gemma4","glm5.3","glm5.3-flash","hy4","kimi-k3.1-pro","mimo-v2.6-flash","qwen3.6","qwen3.8-flash","qwen3.8-max"],
|
|
505
709
|
notes: [
|
|
506
|
-
"live-only: \"glm5.3\" kept out of the static catalog (premium-tier model (models.dev now documents it with 1M context / 131,072 max output; NaN docs https://nan.builders/docs/models + https://nan.builders/openapi.json, checked 2026-09-13) kept live-only so a non-premium key never sees a model it cannot call when the live /models fetch is unavailable; premium keys still get it via the /models refresh with conservative placeholder limits)",
|
|
507
710
|
"non-chat: \"qwen-image-2.1\" excluded from the chat catalog (image-generation model (text→image; output modality image) documented in https://nan.builders/docs/models and https://nan.builders/openapi.json (checked 2026-09-29) — not a chat model, out of the static chat catalog (models.dev reports limit.output 0))",
|
|
508
711
|
"provider-removed: \"glm5.2\" excluded from the catalog (removed by NaN (2026-09-05); absent from the official chat model list in https://nan.builders/openapi.json and https://nan.builders/docs/models (checked 2026-09-07) while models.dev provider nan still listed it — excluded so regeneration does not resurrect it)",
|
|
509
712
|
"provider-removed: \"mimo-v2.5\" excluded from the catalog (removed by NaN (checked 2026-09-29): zero mentions in https://nan.builders/docs/models and in the model param description of https://nan.builders/openapi.json, and models.dev provider nan dropped it as well — superseded by mimo-v2.6-flash; excluded so regeneration does not resurrect it)",
|
|
@@ -512,13 +715,23 @@ export const GENERATED_CATALOG_META = {
|
|
|
512
715
|
"non-chat: \"kokoro\" excluded from the chat catalog (text-to-speech (TTS) endpoint (https://nan.builders/docs/models, checked 2026-10-01) — not a chat model)",
|
|
513
716
|
"non-chat: \"whisper\" excluded from the chat catalog (speech-to-text (STT) endpoint (https://nan.builders/docs/models, checked 2026-10-01) — not a chat model)",
|
|
514
717
|
"non-chat: \"flux-2-klein\" excluded from the chat catalog (image generation endpoint (https://nan.builders/docs/models, checked 2026-10-01) — not a chat model)",
|
|
718
|
+
"non-chat: \"minimax-h3\" excluded from the chat catalog (video-generation model (output modality video): listed by the live GET https://api.nan.builders/v1/models with owned_by \"nan\" (checked 2026-11-10) next to flux-2-klein and qwen-image-2.1, and models.dev (vercel/minimax/minimax-h3, \"MiniMax H3\", https://models.dev/api.json, checked 2026-11-10) reports output video — not a chat model)",
|
|
515
719
|
"compat matches the maintainer's working ~/.pi/agent/models.json LiteLLM config for api.nan.builders (2026-09-04): supportsDeveloperRole false, supportsReasoningEffort true, maxTokensField max_tokens. NaN's docs example sets only supportsDeveloperRole: true and is not battle-tested. supportsFinishReason true (2026-09-13, issue #2): the LiteLLM gateway intermittently closes SSE streams before emitting finish_reason; with true pi-ai raises 'Stream ended without finish_reason', which matches pi-ai's retryable-provider pattern ('ended without') and is retried automatically, whereas false silently synthesized stop/toolUse and stalled the turn mid-answer. supportsUsageInStreaming true (2026-09-16, issue #7): NaN's published schema is silent about stream_options, but the live gateway honors it — two identical streaming calls per model, differing only in stream_options: { include_usage: true }, returned 0 usage chunks without it and exactly 1 with it (prompt/completion/reasoning/cached token counts) on deepseek-v4-flash, glm5.3-flash, qwen3.6, mimo-v2.5 and gemma4, and a real pi session then recorded token counts where it recorded zeros. pi-ai only sends stream_options when this is not false, and the sanitizer forwards it when the model declares true, so chat models opt in by default and usage is reported (issue #4). A model that does not report streaming usage can still opt out per model with a models.json compat override (supportsUsageInStreaming: false); the sanitizer then strips stream_options and the payload stays strict.",
|
|
516
720
|
"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). 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. 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. 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. 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. 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.",
|
|
721
|
+
"manual-only: \"deepseek-v4-pro\" not yet on models.dev provider nan (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).",
|
|
722
|
+
"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. 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.",
|
|
517
723
|
"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.",
|
|
724
|
+
"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.",
|
|
518
725
|
"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). 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. 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).",
|
|
726
|
+
"manual-only: \"hy4\" not yet on models.dev provider nan (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).",
|
|
727
|
+
"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. 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.",
|
|
728
|
+
"manual-only: \"kimi-k3.1-pro\" not yet on models.dev provider nan (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).",
|
|
729
|
+
"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. 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.",
|
|
519
730
|
"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.",
|
|
520
731
|
"manual-only: \"mimo-v2.6-flash\" skipped: models.dev provider \"nan\" now lists it, so the manual-only entry is not emitted and the models.dev values are used (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.)",
|
|
521
732
|
"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.",
|
|
522
|
-
"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."
|
|
733
|
+
"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.",
|
|
734
|
+
"manual-only: \"qwen3.8-max\" not yet on models.dev provider nan (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).",
|
|
735
|
+
"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. 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."
|
|
523
736
|
],
|
|
524
737
|
} as const;
|
package/src/attribution.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* pi-ai merges `model.headers` over its own identity headers in
|
|
6
6
|
* `createClient` (`{ ...getIdentityHeaders(model, identity), ...model.headers }`,
|
|
7
7
|
* the same shape since pi-ai 0.99.1), so attaching the header to every model
|
|
8
|
-
* entry — generated catalog, live merge, unknown-id placeholders,
|
|
9
|
-
*
|
|
8
|
+
* entry — generated catalog, live merge, unknown-id placeholders, the
|
|
9
|
+
* stale-catalog overlay and image models — reaches
|
|
10
10
|
* the gateway on every supported host without touching the request payload
|
|
11
11
|
* or pi's own `User-Agent`.
|
|
12
12
|
*
|
package/src/fetch-models.ts
CHANGED
|
@@ -86,50 +86,17 @@ export const UNKNOWN_MODEL_LIMITS = { contextWindow: 128_000, maxTokens: 4_096 }
|
|
|
86
86
|
/** Timeout for the live /models fetch; matches the pi-synthetic-provider precedent (~3s). */
|
|
87
87
|
export const DEFAULT_MODELS_TIMEOUT_MS = 3_000;
|
|
88
88
|
|
|
89
|
-
/**
|
|
90
|
-
* Capability data for models the docs serve but the static baseline must NOT
|
|
91
|
-
* carry (tier-gated), so the live `/models` path registers them with real
|
|
92
|
-
* documented values instead of the blind `UNKNOWN_MODEL_LIMITS` placeholder.
|
|
93
|
-
*
|
|
94
|
-
* `glm5.3` is premium-tier: a non-premium key must never see it in the static
|
|
95
|
-
* baseline (it cannot call it), but a premium key that discovers it live must
|
|
96
|
-
* get its real capabilities. Every value traces to
|
|
97
|
-
* https://nan.builders/docs/models (checked 2026-10-14; docs are the source of
|
|
98
|
-
* truth — models.dev lags):
|
|
99
|
-
* - Context 1M tokens, multimodal input text·image·audio·video (pi-representable
|
|
100
|
-
* subset: text, image; pi's Model.input has no audio/video), output text,
|
|
101
|
-
* tool calling, reasoning_effort low·medium·high·max.
|
|
102
|
-
* - Max output 131,072: models.dev documents that value for glm5.3; the docs
|
|
103
|
-
* give the same 131K figure for the sibling glm5.3-flash, and do not state a
|
|
104
|
-
* lower bound for glm5.3. Kept as the confirmed maximum rather than invented.
|
|
105
|
-
* - thinkingLevelMap { off: "low" }: the docs list low as glm5.3's shallowest
|
|
106
|
-
* level, so `thinking: off` sends the shallowest supported effort. glm5.3 was
|
|
107
|
-
* never measured (issue #16 covered glm5.3-flash, whose shallowest effective
|
|
108
|
-
* value is "minimal"); "low" is the documented floor.
|
|
109
|
-
*/
|
|
110
|
-
export const LIVE_ONLY_MODEL_DATA: Readonly<Record<string, Omit<GeneratedModelEntry, "compat">>> = {
|
|
111
|
-
"glm5.3": {
|
|
112
|
-
id: "glm5.3",
|
|
113
|
-
name: "GLM 5.3",
|
|
114
|
-
reasoning: true,
|
|
115
|
-
input: ["text", "image"],
|
|
116
|
-
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
117
|
-
contextWindow: 1_048_576,
|
|
118
|
-
maxTokens: 131_072,
|
|
119
|
-
reasoningEffortValues: ["low", "medium", "high", "max"],
|
|
120
|
-
thinkingLevelMap: { off: "low" },
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
|
|
124
89
|
/**
|
|
125
90
|
* Live endpoint IDs classified as non-chat and excluded from the registered
|
|
126
91
|
* model set. Keys are model ids; values are provenance reasons citing the
|
|
127
92
|
* source that designated the endpoint as non-chat.
|
|
128
93
|
*
|
|
129
94
|
* Source: https://nan.builders/docs/models (checked 2026-10-01), plus
|
|
130
|
-
* qwen-image-2.1: https://models.dev API `limit.output: 0` (checked 2026-09-29)
|
|
131
|
-
*
|
|
132
|
-
*
|
|
95
|
+
* qwen-image-2.1: https://models.dev API `limit.output: 0` (checked 2026-09-29),
|
|
96
|
+
* and minimax-h3: live `GET /v1/models` + models.dev output modality video
|
|
97
|
+
* (checked 2026-11-10).
|
|
98
|
+
* These are MCP-bridge territory (embedding / rerank / TTS / STT / image or
|
|
99
|
+
* video generation), not chat catalog models — see AGENTS.md classification notes
|
|
133
100
|
* and issue #15.
|
|
134
101
|
*/
|
|
135
102
|
export const NON_CHAT_MODEL_IDS: Readonly<Record<string, string>> = {
|
|
@@ -145,6 +112,8 @@ export const NON_CHAT_MODEL_IDS: Readonly<Record<string, string>> = {
|
|
|
145
112
|
"image generation endpoint (https://nan.builders/docs/models, checked 2026-10-01) — not a chat model",
|
|
146
113
|
"qwen-image-2.1":
|
|
147
114
|
"image-generation model (text→image; output modality image) documented in https://nan.builders/docs/models and https://nan.builders/openapi.json (checked 2026-09-29) — not a chat model, out of the static chat catalog (models.dev reports limit.output 0)",
|
|
115
|
+
"minimax-h3":
|
|
116
|
+
"video-generation model (output modality video): listed by the live GET https://api.nan.builders/v1/models with owned_by \"nan\" (checked 2026-11-10) next to flux-2-klein and qwen-image-2.1, and models.dev (vercel/minimax/minimax-h3, \"MiniMax H3\", https://models.dev/api.json, checked 2026-11-10) reports output video — not a chat model",
|
|
148
117
|
} as const;
|
|
149
118
|
|
|
150
119
|
export interface CatalogSource {
|
|
@@ -255,10 +224,6 @@ export function mergeLiveWithGenerated(
|
|
|
255
224
|
generated: readonly GeneratedModelEntry[] = NAN_GENERATED_MODELS,
|
|
256
225
|
): MergedCatalog {
|
|
257
226
|
const byId = new Map(generated.map((entry) => [entry.id, entry]));
|
|
258
|
-
// Every generated entry shares the same NaN/LiteLLM compat block; borrow it
|
|
259
|
-
// for the live-only documented entries so the gateway-behavior flags never
|
|
260
|
-
// drift between the static catalog and the live overlay.
|
|
261
|
-
const catalogCompat = generated.find((entry) => entry.compat)?.compat;
|
|
262
227
|
const models: Model<"openai-completions">[] = [];
|
|
263
228
|
const matched: string[] = [];
|
|
264
229
|
const unknown: string[] = [];
|
|
@@ -276,16 +241,6 @@ export function mergeLiveWithGenerated(
|
|
|
276
241
|
models.push(toModel(entry, source));
|
|
277
242
|
matched.push(id);
|
|
278
243
|
} else {
|
|
279
|
-
// Documented data for tier-gated live-only ids (glm5.3): the static
|
|
280
|
-
// baseline excludes them so a non-premium key never sees a model it
|
|
281
|
-
// cannot call, but a key that discovers one live gets its real
|
|
282
|
-
// capabilities instead of the blind placeholder below.
|
|
283
|
-
const liveOnlyEntry = LIVE_ONLY_MODEL_DATA[id];
|
|
284
|
-
if (liveOnlyEntry) {
|
|
285
|
-
models.push(toModel({ ...liveOnlyEntry, compat: catalogCompat }, source));
|
|
286
|
-
matched.push(id);
|
|
287
|
-
continue;
|
|
288
|
-
}
|
|
289
244
|
// Placeholder for uncatalogued live ids (e.g. new or undocumented):
|
|
290
245
|
// limits are the documented safe envelope and capabilities stay
|
|
291
246
|
// "unknown". The compat keys are the same gateway-behavior flags
|
|
@@ -333,7 +288,7 @@ export interface ResolvedCatalog {
|
|
|
333
288
|
/**
|
|
334
289
|
* Live model IDs from the provider's /models endpoint when the fetch
|
|
335
290
|
* succeeded — the authoritative per-key list (what your NaN membership can
|
|
336
|
-
* actually use, e.g.
|
|
291
|
+
* actually use, e.g. a model the key's membership cannot call is absent). `undefined`
|
|
337
292
|
* when the live fetch failed and the generated fallback was used.
|
|
338
293
|
*/
|
|
339
294
|
liveIds: Set<string> | undefined;
|
|
@@ -495,15 +450,6 @@ export function buildOverlayMap(
|
|
|
495
450
|
for (const entry of generated) {
|
|
496
451
|
overlay.set(entry.id, { chat: toModel(entry, source) });
|
|
497
452
|
}
|
|
498
|
-
// Tier-gated live-only chat models with documented capabilities (glm5.3):
|
|
499
|
-
// absent from the static baseline so a non-premium key never sees them, but
|
|
500
|
-
// present here so a stored entry for one is corrected to the documented
|
|
501
|
-
// values instead of passing through stale. The store still decides which ids
|
|
502
|
-
// exist (issue #19); this map only decides their capabilities.
|
|
503
|
-
const catalogCompat = generated.find((entry) => entry.compat)?.compat;
|
|
504
|
-
for (const entry of Object.values(LIVE_ONLY_MODEL_DATA)) {
|
|
505
|
-
overlay.set(entry.id, { chat: toModel({ ...entry, compat: catalogCompat }, source) });
|
|
506
|
-
}
|
|
507
453
|
// Image models from the baseline (these live under a different api id
|
|
508
454
|
// so they cannot coexist as chat entries — ids are unique across types).
|
|
509
455
|
if (imageModels) {
|
package/src/provider-factory.ts
CHANGED
|
@@ -225,9 +225,11 @@ export async function createNanCompatibleProvider(
|
|
|
225
225
|
|
|
226
226
|
// Last successful live /models result, shared between fetchModels (writes)
|
|
227
227
|
// and filterModels (reads). When set it is authoritative for what your key
|
|
228
|
-
// can use
|
|
229
|
-
//
|
|
230
|
-
//
|
|
228
|
+
// can use: NaN lists exactly the models your key can call, so models
|
|
229
|
+
// absent from the live list are filtered out of `available` (e.g. a
|
|
230
|
+
// catalogued model NaN has retired or not yet enabled for your key).
|
|
231
|
+
// NaN removed tier-exclusive models on 2026-11-10 (credits system); the
|
|
232
|
+
// filter stays as the generic availability guard.
|
|
231
233
|
let liveIds: Set<string> | undefined;
|
|
232
234
|
|
|
233
235
|
const imageModels = baselineImageModels(source);
|
package/src/usage.ts
CHANGED
|
@@ -45,18 +45,16 @@ export interface ModelQuota {
|
|
|
45
45
|
rollingWindowCap: number;
|
|
46
46
|
/** Rolling window duration in hours. */
|
|
47
47
|
rollingWindowHours: number;
|
|
48
|
-
/** Whether this model is premium-tier (glm5.3). */
|
|
49
|
-
premium: boolean;
|
|
50
48
|
}
|
|
51
49
|
|
|
52
50
|
export const MODEL_QUOTAS: readonly ModelQuota[] = [
|
|
53
|
-
{ model: "deepseek-v4-flash", label: "DeepSeek V4 Flash", monthlyCap: 3_000_000_000, rollingWindowCap: 0, rollingWindowHours: 0
|
|
54
|
-
{ model: "mimo-v2.6-flash", label: "MiMo V2.6 Flash", monthlyCap: 1_000_000_000, rollingWindowCap: 0, rollingWindowHours: 0
|
|
55
|
-
{ model: "qwen3.6", label: "Qwen 3.6", monthlyCap: 0, rollingWindowCap: 0, rollingWindowHours: 0
|
|
56
|
-
{ model: "gemma4", label: "Gemma 4", monthlyCap: 0, rollingWindowCap: 0, rollingWindowHours: 0
|
|
57
|
-
{ model: "qwen3.8-flash", label: "Qwen 3.8 Flash", monthlyCap: 500_000_000, rollingWindowCap: 0, rollingWindowHours: 0
|
|
58
|
-
{ model: "glm5.3-flash", label: "GLM 5.3 Flash", monthlyCap: 2_000_000_000, rollingWindowCap: 0, rollingWindowHours: 0
|
|
59
|
-
{ model: "glm5.3", label: "GLM 5.3", monthlyCap: 3_000_000_000, rollingWindowCap: 400_000_000, rollingWindowHours: 4
|
|
51
|
+
{ model: "deepseek-v4-flash", label: "DeepSeek V4 Flash", monthlyCap: 3_000_000_000, rollingWindowCap: 0, rollingWindowHours: 0 },
|
|
52
|
+
{ model: "mimo-v2.6-flash", label: "MiMo V2.6 Flash", monthlyCap: 1_000_000_000, rollingWindowCap: 0, rollingWindowHours: 0 },
|
|
53
|
+
{ model: "qwen3.6", label: "Qwen 3.6", monthlyCap: 0, rollingWindowCap: 0, rollingWindowHours: 0 },
|
|
54
|
+
{ model: "gemma4", label: "Gemma 4", monthlyCap: 0, rollingWindowCap: 0, rollingWindowHours: 0 },
|
|
55
|
+
{ model: "qwen3.8-flash", label: "Qwen 3.8 Flash", monthlyCap: 500_000_000, rollingWindowCap: 0, rollingWindowHours: 0 },
|
|
56
|
+
{ model: "glm5.3-flash", label: "GLM 5.3 Flash", monthlyCap: 2_000_000_000, rollingWindowCap: 0, rollingWindowHours: 0 },
|
|
57
|
+
{ model: "glm5.3", label: "GLM 5.3", monthlyCap: 3_000_000_000, rollingWindowCap: 400_000_000, rollingWindowHours: 4 },
|
|
60
58
|
];
|
|
61
59
|
|
|
62
60
|
// ── GET /v1/usage types ───────────────────────────────────────────────────
|
|
@@ -254,12 +252,11 @@ export function buildStaticMessage(now = new Date()): string {
|
|
|
254
252
|
|
|
255
253
|
for (const quota of MODEL_QUOTAS) {
|
|
256
254
|
const capStr = quota.monthlyCap > 0 ? formatTokens(quota.monthlyCap) : "uncapped";
|
|
257
|
-
const premiumStr = quota.premium ? " 👑" : "";
|
|
258
255
|
const rollingStr = quota.rollingWindowCap > 0
|
|
259
256
|
? ` (rolling ${formatTokens(quota.rollingWindowCap)}/${quota.rollingWindowHours}h)`
|
|
260
257
|
: "";
|
|
261
258
|
|
|
262
|
-
lines.push(`${quota.label.padEnd(28)} ${capStr}${
|
|
259
|
+
lines.push(`${quota.label.padEnd(28)} ${capStr}${rollingStr}`);
|
|
263
260
|
}
|
|
264
261
|
|
|
265
262
|
lines.push("", `💡 Set ${NAN_API_KEY_ENV} or run \`/login nan\` to see real usage (GET /v1/usage).`);
|
|
@@ -303,7 +300,7 @@ export function buildUsageMessage(report: UsageReport, now = new Date()): string
|
|
|
303
300
|
const percentage = (used / quota.monthlyCap) * 100;
|
|
304
301
|
const remaining = Math.max(quota.monthlyCap - used, 0);
|
|
305
302
|
|
|
306
|
-
lines.push(`${quota.label}
|
|
303
|
+
lines.push(`${quota.label}:`);
|
|
307
304
|
lines.push(` ${progressBar(percentage)} ${percentage.toFixed(1)}% of monthly cap`);
|
|
308
305
|
lines.push(
|
|
309
306
|
` Used: ${formatTokens(used)} / ${formatTokens(quota.monthlyCap)} (${formatTokens(remaining)} remaining) · ${requestsSuffix(used, requests)}`,
|