@gtrabanco/pi-nan-provider 1.5.3 โ†’ 1.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,13 +1,43 @@
1
1
  # @gtrabanco/๐œ‹-nan-provider
2
2
 
3
3
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
- [![Version](https://img.shields.io/badge/version-1.5.1-blue)](https://github.com/gtrabanco/pi-nan-provider/releases)
4
+ [![Version](https://img.shields.io/badge/version-1.5.5-blue)](https://github.com/gtrabanco/pi-nan-provider/releases)
5
5
  [![Built with NaN](https://nan.builders/badge/built-with-nan-compact.svg)](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).
8
8
 
9
9
  Registers the `nan` provider via `pi.registerProvider()` using NaN's OpenAI-compatible API (`https://api.nan.builders/v1`), and registers the community media MCP server via pi's native `pi.registerMcpServer()`.
10
10
 
11
+ > [!NOTE]
12
+ > **Requirements:** pi **โ‰ฅ 1.4.0** (peer range `^1.4.0`). The package is verified against **pi 1.5.1 / pi-ai 1.5.1**; the peer floor only rises on pi minor realigns.
13
+
14
+ ## โœจ Features
15
+
16
+ | Area | What you get |
17
+ | :--- | :--- |
18
+ | **Two-layer model catalog** | Build-time generated fallback (pi always starts, even offline) merged with the live `GET /v1/models` list; `filterModels` then hides whatever your key cannot call. |
19
+ | **Read-time catalog overlay** | Capability data is re-applied from the generated catalog on every `getModels()` / `getAllModels()` read, so a `models-store.json` written by an older package version can neither shadow it ([#19](https://github.com/gtrabanco/pi-nan-provider/issues/19)) nor re-register non-chat ids as chat models ([#32](https://github.com/gtrabanco/pi-nan-provider/issues/32)). The store decides *which* ids exist; the generated catalog decides *what they can do*. |
20
+ | **Non-chat endpoint guard** | `NON_CHAT_MODEL_IDS` keeps embedding / rerank / TTS / STT / image / video ids out of pi's chat picker. |
21
+ | **Strict payload sanitizer** | Every `/chat/completions` body is rewritten to match [NaN's published schema](https://nan.builders/openapi.json) before it leaves pi, whatever pi-ai version is bundled. |
22
+ | **Context-overflow rescue** | NaN's generic `400 Invalid request` is reclassified as an overflow when the request is estimated over the model's window ([#3](https://github.com/gtrabanco/pi-nan-provider/issues/3)), and a cold-cache `524` over `NAN_COLD_CACHE_CEILING_TOKENS` too ([#18](https://github.com/gtrabanco/pi-nan-provider/issues/18)) โ€” pi compacts and retries instead of wedging. |
23
+ | **Truncated-stream retry** | `supportsFinishReason: true` turns an SSE stream closed before `finish_reason` into a retryable error instead of a silent stall ([#2](https://github.com/gtrabanco/pi-nan-provider/issues/2)). |
24
+ | **Streaming token usage** | `stream_options.include_usage` is on by default, so pi reports real input/output/reasoning/cache counts ([#4](https://github.com/gtrabanco/pi-nan-provider/issues/4), [#7](https://github.com/gtrabanco/pi-nan-provider/issues/7)). |
25
+ | **Reasoning controls** | Per-model `reasoningEffortValues` + `thinkingLevelMap` ([#16](https://github.com/gtrabanco/pi-nan-provider/issues/16)), the reasoning-only stream guard ([#21](https://github.com/gtrabanco/pi-nan-provider/issues/21)) and the `max_completion_tokens` interim bound for `qwen3.8-flash` ([#34](https://github.com/gtrabanco/pi-nan-provider/issues/34)). |
26
+ | **Attribution header** | `X-Pi-Provider: gtrabanco/pi-nan-provider@<version>` on every request, stripped when pi's install telemetry is disabled. |
27
+ | **Native image models** | `flux-2-klein` and `qwen-image-2.1` registered as pi `type: "image"` models, reachable from codemode and extensions. |
28
+ | **Native MCP media bridge** | The `nan-media` server (10 tools) registered through `pi.registerMcpServer()`, managed with `/nan-mcp`. |
29
+ | **Credits reporting** | `/nan-usage` shows credits balance with a progress bar, per-model breakdown (input / cached / output in M, credits consumed), and billing period โ€” all from `GET /v1/usage` ([#37](https://github.com/gtrabanco/pi-nan-provider/issues/37)). |
30
+ | **Cache-anomaly evidence** | `cf-ray` capture on the repeated `id` + `created` gateway signature ([#17](https://github.com/gtrabanco/pi-nan-provider/issues/17)) plus the deterministic `/nan-debug` collector ([#35](https://github.com/gtrabanco/pi-nan-provider/issues/35)). |
31
+ | **pi integration** | Model refresh driven by pi's Models runtime, per-model `models.json` overrides, and the extension changelog (`pi.changelogPath`) that pi shows after an update. |
32
+
33
+ Commands:
34
+
35
+ | Command | Purpose |
36
+ | :--- | :--- |
37
+ | `/nan-mcp` | Manage the media MCP bridge (`status` / `enable` / `disable`) |
38
+ | `/nan-usage [1-90]` | Credits balance with usage bar, per-model breakdown (in / cached / out in M ยท credits cr), and all-time totals |
39
+ | `/nan-debug [topic] [--window N] [--out path] [--emit]` | Redacted, reproducible evidence package for NaN |
40
+
11
41
  ---
12
42
 
13
43
  ### โšก Quick Start
@@ -32,20 +62,32 @@ Registers the `nan` provider via `pi.registerProvider()` using NaN's OpenAI-comp
32
62
 
33
63
  ## โš™๏ธ How it works
34
64
 
35
- The provider uses a **two-layer model catalog** to ensure reliability:
65
+ The provider uses a **two-layer model catalog plus a read-time overlay** to ensure reliability:
36
66
 
37
67
  | Layer | Source | Purpose |
38
68
  | :--- | :--- | :--- |
39
- | **1. Generated Fallback** | `scripts/models.generated.ts` | Build-time snapshot from [models.dev](https://models.dev). Ensures pi can always start, even if the network fails. |
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. |
69
+ | **1. Generated Fallback** | `scripts/models.generated.ts` | Build-time snapshot from [models.dev](https://models.dev) plus manual overrides with provenance. Ensures pi can always start, even if the network fails. |
70
+ | **2. Live `/models` Fetch** | NaN Runtime API | Fetches the models your key can actually call and merges them with the fallback; `filterModels` hides anything the live list does not return. |
71
+ | **3. Read-time Overlay** | `withStaleCatalogOverlay` (`src/provider-factory.ts`) | Re-applies generated capability data on every `getModels()` / `getAllModels()` read, so a `models-store.json` written by an older package version cannot shadow it ([#19](https://github.com/gtrabanco/pi-nan-provider/issues/19)) nor re-register non-chat ids as chat models ([#32](https://github.com/gtrabanco/pi-nan-provider/issues/32)). |
41
72
 
42
73
  > [!IMPORTANT]
43
74
  > **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
75
 
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).
76
+ 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, and the read-time overlay drops chat-type entries whose id is in that list โ€” a stale store written before #15 (issue #32) cannot resurrect them. This prevents pi's chat picker from offering endpoints that cannot serve chat (requests would 404).
46
77
 
47
78
  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
79
 
80
+ ### ๐Ÿงพ Strict request sanitizer
81
+
82
+ NaN answers HTTP 400 `Invalid request. Check your request parameters.` for any body that does not match the schema it publishes at [nan.builders/openapi.json](https://nan.builders/openapi.json) โ€” a schema stricter than what pi-ai emits in several places. `src/openai-compat-sanitizer.ts` rewrites every outgoing `/chat/completions` payload on the way out, so no pi-ai version or conversation shape can produce an invalid request:
83
+
84
+ - an assistant `content` array carrying a tool call is moved into the top-level `tool_calls` field (NaN's `ContentPart` accepts only `text` and `image_url`);
85
+ - `reasoning_details` is stripped, and unknown content parts (e.g. `thinking`) are folded into a `text` part so reasoning is not silently lost;
86
+ - fields NaN's schema does not list are removed: `store` always, an empty `tools` array always, and `stream_options` unless the model's `compat.supportsUsageInStreaming` says the gateway reports it;
87
+ - `max_completion_tokens` is renamed to `max_tokens` (the documented field) unless the model's `compat.maxTokensField` opts out ([#34](https://github.com/gtrabanco/pi-nan-provider/issues/34), `qwen3.8-flash`).
88
+
89
+ A caller-supplied `onPayload` hook is preserved and chained after sanitization.
90
+
49
91
  ### ๐Ÿท๏ธ Attribution header
50
92
 
51
93
  Every model this package registers carries an `X-Pi-Provider: gtrabanco/pi-nan-provider@<version>` HTTP header, added on top of whatever identity headers pi-ai sends (pi's own `User-Agent` is never modified). It identifies the requests coming from this provider extension โ€” including the `/nan-usage` quota fetch โ€” and it is omitted silently when the package version cannot be resolved. User `models.json` overrides that replace a model entry replace its headers too.
@@ -54,7 +96,7 @@ The header **follows pi's telemetry setting**: with `enableInstallTelemetry: fal
54
96
 
55
97
  ### ๐Ÿง  Model-switch safety
56
98
 
57
- When you switch models, older pi-ai versions replayed the previous model's reasoning as plain assistant text with **no size bound**, which could overflow a 262K-context model's window; NaN answered with a generic `400 Invalid request. Check your request parameters.` that looked like a provider bug (upstream tracking: [pi-nan-provider#3](https://github.com/gtrabanco/pi-nan-provider/issues/3)). pi-ai 1.3.0 fixed this upstream (`transformMessages` now drops thinking blocks from a different model) and this package requires **pi โ‰ฅ 1.3.0** (peer range `^1.3.0`), so the extension-side guard that used to mitigate it was **removed in package 1.4.0** โ€” no action is needed, upstream handles it.
99
+ When you switch models, older pi-ai versions replayed the previous model's reasoning as plain assistant text with **no size bound**, which could overflow a 262K-context model's window; NaN answered with a generic `400 Invalid request. Check your request parameters.` that looked like a provider bug (upstream tracking: [pi-nan-provider#3](https://github.com/gtrabanco/pi-nan-provider/issues/3)). pi-ai 1.3.0 fixed this upstream (`transformMessages` now drops thinking blocks from a different model) and this package requires **pi โ‰ฅ 1.4.0** (peer range `^1.4.0`), so the extension-side guard that used to mitigate it was **removed in package 1.4.0** โ€” no action is needed, upstream handles it.
58
100
 
59
101
  A request can still overflow on its own merits โ€” oversized tool outputs, images, or a destination window simply smaller than the content โ€” and NaN answers the same generic 400 instead of naming the overflow, while pi's auto-compaction does not recognize it, so the session would wedge at the ceiling. The provider therefore **re-checks the request size on the way out**: when that generic 400 arrives for a request estimated over the model's window, the error is rewritten into a context-overflow message pi recognizes, so it compacts and retries instead of stalling. A generic 400 on a within-window request is left untouched, so unrelated errors are never mislabelled.
60
102
 
@@ -80,7 +122,7 @@ You can override any model's `compat` per-model in `~/.pi/agent/models.json` (pi
80
122
 
81
123
  **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
124
 
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:
125
+ **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`, `gemma4` and `mimo-v2.5` (since removed). 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:
84
126
 
85
127
  ```json
86
128
  {
@@ -108,7 +150,7 @@ Get a key from the [NaN platform](https://cloud.nan.builders/r/7GK06FX8) (user s
108
150
 
109
151
  ## ๐Ÿ”Œ Native MCP Server
110
152
 
111
- Since [pi 0.99.0 ships a built-in MCP client](https://github.com/earendil-works/pi/blob/main/docs/usage.md), this package bridges to native MCP (requires **pi >= 1.3.0**, the peer range floor since package 1.4.0).
153
+ Since [pi 0.99.0 ships a built-in MCP client](https://github.com/earendil-works/pi/blob/main/docs/usage.md), this package bridges to native MCP (requires **pi >= 1.4.0**, the peer range floor since package 1.5.0).
112
154
 
113
155
  The media bridge is **enabled by default** (session-scoped, visible in `/mcp`). Use `/nan-mcp` to manage it.
114
156
 
@@ -167,7 +209,7 @@ per session, keeps the registrations idle, and lets `/nan-mcp enable` persist th
167
209
  registering a server that can never connect. To get MCP in the CLI, enable the connector with
168
210
  `pi config` โ†’ Built-in extensions โ†’ `mcp`.
169
211
 
170
- ### pi 0.99-1.0 features and NaN models
212
+ ### pi features and NaN models
171
213
 
172
214
  - **Virtual models** โ€” register a router under `nan` (`pi.registerVirtualModel({ provider: "nan", ... })`);
173
215
  it routes to the physical NaN models with no provider-side configuration.
@@ -217,17 +259,18 @@ registering a server that can never connect. To get MCP in the CLI, enable the c
217
259
  | `mcp__nan_media__embed_text` | Text embeddings (qwen3-embedding) |
218
260
  | `mcp__nan_media__rerank_documents` | Document reranking (Qwen3-Reranker) |
219
261
  | `mcp__nan_media__get_quota` | Per-model token quota (used / cap / remaining / reset) |
262
+ | `mcp__nan_media__get_usage` | Real consumption and credit pool (`GET /v1/usage`; preferred over stale `get_quota` counters) |
220
263
 
221
264
  > pi 0.99.0โ€“0.99.1 used the hyphenated form (`mcp__nan-media__*`); pi 0.99.2+ sanitizes tool
222
265
  > names to `[A-Za-z0-9_]` only, so hyphens became underscores. The underscore form applies
223
- > on every supported version (pi >= 1.3.0).
266
+ > on every supported version (pi >= 1.4.0).
224
267
 
225
268
  #### ๐Ÿ”ง Media Bridge Configuration
226
269
 
227
270
  | Variable | Default | Description |
228
271
  | :--- | :--- | :--- |
229
272
  | `NAN_MEDIA_MCP` | โ€” | Per-session override (`0` or `false` to disable). |
230
- | `NAN_MEDIA_MCP_VERSION` | `1.3.0` | Pinned server version (recommended). |
273
+ | `NAN_MEDIA_MCP_VERSION` | `1.5.0` | Pinned server version (recommended). |
231
274
  | `NAN_MEDIA_MCP_COMMAND` | โ€” | Custom command override. |
232
275
  | `NAN_MEDIA_MCP_TIMEOUT_MS` | `120000` | Per-call timeout. |
233
276
 
@@ -244,26 +287,26 @@ bun run check-nan-mcp-server --issue # create/refresh the issue
244
287
  PI SDK updates (`@earendil-works/pi-ai` / `@earendil-works/pi-coding-agent`) are automated
245
288
  too: the weekly `check-pi-sdk-versions` workflow files the `sdk-monitor` issue **and**
246
289
  prepares a devDependencies-bump PR (`bun test` + `bun run typecheck` + type-surface diff
247
- included) for human review โ€” see `docs/sdk-version-monitoring.md`.
290
+ included) for human review โ€” see `.github/workflows/check-pi-sdk-versions.yml` and `scripts/check-pi-sdk-versions.mjs`.
248
291
 
249
292
  ---
250
293
 
251
- ## ๐Ÿ“Š Quota Usage: `/nan-usage`
294
+ ## ๐Ÿ“Š Credits: `/nan-usage`
252
295
 
253
- Shows your NaN token usage per model merged with the documented monthly caps, the window totals, your all-time totals, and the time until the billing cycle resets.
296
+ Shows your NaN credits balance with a progress bar, per-model breakdown (input / cached / output in millions, credits consumed), billing period, and all-time totals.
254
297
 
255
298
  ### How it works
256
299
 
257
300
  `/nan-usage` calls NaN's [`GET /v1/usage`](https://nan.builders/docs/api#tag/usage) endpoint with the **same API key you already use for chat** โ€” pi's stored credential (`/login nan`) or `NAN_API_KEY`. No CLI login, no session cookie, no extra setup.
258
301
 
259
- The endpoint returns your usage (rows per date and model) plus totals covering the requested window โ€” at most 90 inclusive days. The command reads those totals and merges them with the caps published in the [NaN docs](https://nan.builders/docs/models) to show how much of each monthly cap you have consumed. `/usage` reports consumption only, so the caps themselves always come from the documented table (checked 2026-09-27).
302
+ The endpoint returns your usage (rows per date and model) plus totals covering the requested window โ€” at most 90 inclusive days. The command reads those totals and displays them in a credits-first layout: the main progress bar reflects credits consumed vs. your plan's allowance, and each model row shows tokens (in / cached / out) and the credits it cost.
260
303
 
261
304
  Rate limit: 30 requests per minute for `/usage`, separate from the model endpoints.
262
305
 
263
306
  ### Usage
264
307
 
265
308
  ```
266
- /nan-usage # current UTC month (matches the monthly caps)
309
+ /nan-usage # current UTC month (matches the billing period)
267
310
  /nan-usage 7 # rolling 7-day window (1-90)
268
311
  /nan-usage 30 # rolling 30-day window
269
312
  /nan-usage help # show the usage line
@@ -291,36 +334,31 @@ Rate limit: 30 requests per minute for `/usage`, separate from the model endpoin
291
334
 
292
335
  **With an API key** (real usage):
293
336
  ```
294
- ๐Ÿ“Š NaN Usage
295
-
296
- ๐Ÿ—“๏ธ Window: 2026-09-01 โ†’ 2026-09-27 UTC (27 days)
297
-
298
- โฑ๏ธ Next billing reset: 2026-09-30 UTC (2d 14h 30m 0s)
299
-
300
- Models with monthly caps:
337
+ ๐Ÿ’ณ Credits
338
+ [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 13.4% used ยท 936.7 / 7000 (6063.3 remaining)
339
+ Period: 2026-11-02 โ†’ 2026-12-02 UTC
301
340
 
302
- DeepSeek V4 Flash:
303
- [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 40.0% of monthly cap
304
- Used: 1.2B / 3.0B (1.8B remaining) ยท 5,120 requests
341
+ โฑ๏ธ Next billing reset: 2026-12-02 UTC (20d 16h 0m 0s)
305
342
 
306
- MiMo V2.5:
307
- [โ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 12.5% of monthly cap
308
- Used: 125.0M / 1.0B (875.0M remaining) ยท 840 requests
343
+ โšก Usage
344
+ deepseek-v4-flash ยท 2701.1M in / 450.9M cached / 8.8M out ยท 189.7 (cr)
345
+ glm5.3-flash ยท 1619.6M in / 20.9M cached / 7.2M out ยท 621.4 (cr)
346
+ qwen3.6 ยท 1123.9M in / 37.1M cached / 3.3M out ยท 0 (cr)
347
+ mimo-v2.6-flash ยท 368.4M in / 67.4M cached / 3.3M out ยท 104.3 (cr)
348
+ qwen3.8-flash ยท 286.4M in / 0.0M cached / 1.3M out ยท 21.3 (cr)
349
+ qwen3-embedding ยท 4.6M in / 0.0M cached / 0.0M out ยท 0 (cr)
350
+ gemma4 ยท 1.0M in / 0.0M cached / 0.0M out ยท 0 (cr)
309
351
 
310
- GLM 5.3:
311
- [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 40.0% of monthly cap
312
- Used: 1.2B / 3.0B (1.8B remaining) ยท 2,400 requests
313
- โ†ณ rolling window: 400.0M / 4h (daily granularity โ€” /usage cannot break it down)
352
+ Total credits consumed: 936.7 (cr)
314
353
 
315
- Uncapped models:
316
-
317
- Qwen 3.6: 890.5K used ยท 123 requests
318
-
319
- Window totals: 2.6B tokens (2.0B prompt / 640.0M completion) ยท 18,432 requests
320
- All time: 13.2B tokens ยท 41,250 requests (cached 2026-02-01)
321
- ๐Ÿ’ก Source: GET /v1/usage ยท caps from https://nan.builders/docs/models
354
+ All time: 30.9B tokens ยท 125,915 requests (as of 2026-11-12)
355
+ ๐Ÿ’ก Source: GET /v1/usage
322
356
  ```
323
357
 
358
+ - **๐Ÿ’ณ Credits**: progress bar showing `% used ยท used / allowance (remaining)`, billing period dates, pack credits with expiration if applicable, frozen-account warning.
359
+ - **โšก Usage**: models sorted by credits consumed (primary billing metric), each row: `model ยท X.XM in / YM cached / Z.ZM out ยท W (cr)`.
360
+ - **All time**: lifetime totals with the last cache timestamp.
361
+
324
362
  **Without an API key** (static limits only):
325
363
  ```
326
364
  ๐Ÿ“Š NaN Quota Status (static limits)
@@ -438,7 +476,8 @@ NaN's `reasoning_effort` parameter controls how much the model thinks before ans
438
476
 
439
477
  | Model | Reasoning effort | How it works |
440
478
  | :--- | :--- | :--- |
441
- | `glm5.3`, `glm5.3-flash` | `minimal` ยท `low` ยท `medium` ยท `high` ยท `max` | Fully controllable โ€” higher values let the model reason longer; `minimal` yields ~38 reasoning tokens (issue #16, measured 2026-09-27); `none` does NOT suppress reasoning on glm5.3-flash (13,382 tokens) |
479
+ | `glm5.3` | `low` ยท `medium` ยท `high` ยท `max` | Fully controllable โ€” higher values let the model reason longer. `thinking: "off"` sends `low`, the shallowest level the NaN docs list, via the catalog's `thinkingLevelMap`. `minimal` is **not** in this model's declared values: issue #16 measured it on `glm5.3-flash` only, and `glm5.3` itself was never measured |
480
+ | `glm5.3-flash` | `minimal` ยท `low` ยท `medium` ยท `high` ยท `max` | Fully controllable โ€” higher values let the model reason longer; `minimal` yields ~38 reasoning tokens (issue #16, measured 2026-09-27). `none` does NOT suppress reasoning (13,382 tokens), so `thinking: "off"` sends `minimal`, the shallowest effective value, via the catalog's `thinkingLevelMap` |
442
481
  | `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 |
443
482
  | `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) |
444
483
  | `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 |
@@ -457,6 +496,13 @@ bun install
457
496
  bun run generate-models # Regenerate fallback catalog
458
497
  bun test # Run all tests
459
498
  bun run typecheck # Run typechecking
499
+ bun run check-nan-mcp-server # Newer nan-mcp-server release?
500
+ bun run check-pi-sdk-versions # Newer pi / pi-ai release?
460
501
  ```
461
502
 
462
- *Releases follow strict semver. CI publishes automatically on merge to `main`.*
503
+ Every code change must bump `package.json` in the same PR; capability values that diverge from
504
+ models.dev belong in `scripts/manual-overrides.ts` with a provenance note, never hand-edited into
505
+ the generated catalog.
506
+
507
+ *Releases follow strict semver. CI publishes automatically on merge to `main`. After an update, pi
508
+ shows this package's `CHANGELOG.md` (`pi.changelogPath`, pi 1.5.0+).*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtrabanco/pi-nan-provider",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
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",