@gtrabanco/pi-nan-provider 0.6.11 → 0.8.0

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.es.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @gtrabanco/pi-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-0.6.5-blue)](https://github.com/gtrabanco/pi-nan-provider/releases)
4
+ [![Version](https://img.shields.io/badge/version-0.8.0-blue)](https://github.com/gtrabanco/pi-nan-provider/releases)
5
5
 
6
6
  [NaN Builders](https://nan.builders) model provider + MCP bridges para [pi](https://github.com/earendil-works/pi).
7
7
 
@@ -156,74 +156,99 @@ bun run check-nan-mcp-server --issue # crea/refresca el issue
156
156
 
157
157
  ## 📊 Uso de Cuotas: `/nan-usage`
158
158
 
159
- Muestra tu uso de tokens de NaN por modelo, los límites mensuales y el tiempo hasta el reinicio del ciclo de facturación.
159
+ Muestra tu uso de tokens de NaN por modelo combinado con los límites mensuales documentados, los totales de la ventana, tus totales acumulados y el tiempo hasta el reinicio del ciclo de facturación.
160
160
 
161
161
  ### Cómo funciona
162
162
 
163
- `/nan-usage` lee el token de sesión desde `~/.config/nan/session.json` — el mismo archivo que usa la [CLI de NaN](https://github.com/helmcode/nan-cli). Si el archivo existe y contiene una sesión válida, el comando obtiene datos de uso reales del dashboard de NaN. Si no, muestra los límites de cuota estáticos de la documentación.
163
+ `/nan-usage` llama al endpoint [`GET /v1/usage`](https://nan.builders/docs/api#tag/usage) de NaN con **la misma API key que ya usas para chat** — la credencial guardada en pi (`/login nan`) o `NAN_API_KEY`. Sin login de la CLI, sin cookie de sesión, sin configuración extra.
164
+
165
+ El endpoint devuelve tu uso (filas por fecha y modelo) y los totales de la ventana solicitada — máximo 90 días inclusivos. El comando lee esos totales y los combina con los límites publicados en la [documentación de NaN](https://nan.builders/docs/models) para mostrarte qué porcentaje de cada cuota mensual has consumido. `/usage` solo reporta consumo, así que los límites siempre vienen de la tabla documentada (comprobado 2026-09-27).
166
+
167
+ Límite de tasa: 30 peticiones por minuto para `/usage`, separado del de los endpoints de modelos.
168
+
169
+ ### Uso
170
+
171
+ ```
172
+ /nan-usage # mes en curso en UTC (coincide con las cuotas mensuales)
173
+ /nan-usage 7 # ventana móvil de 7 días (1-90)
174
+ /nan-usage 30 # ventana móvil de 30 días
175
+ /nan-usage help # muestra la línea de uso
176
+ ```
164
177
 
165
178
  ### Configuración
166
179
 
167
- 1. **Instala la CLI de NaN**:
168
- ```bash
169
- curl -fsSL https://nan.builders/install | sh
180
+ 1. **Autentica el proveedor `nan` en pi** con tu clave `sk-...`:
181
+ ```
182
+ /login nan
170
183
  ```
171
- 2. **Inicia sesión**:
184
+ o expórtala en su lugar:
172
185
  ```bash
173
- nan auth login
186
+ export NAN_API_KEY=sk-...
174
187
  ```
175
- Te envía un enlace de inicio de sesión por email. Pega el enlace en la terminal.
176
- 3. **Usa en pi**:
188
+ 2. **Úsalo en pi**:
177
189
  ```
178
190
  /nan-usage
179
191
  ```
180
192
 
181
193
  > [!TIP]
182
- > El token de sesión se comparte automáticamente — no necesitas variables de entorno ni configuración extra. Si la sesión expira, ejecuta `nan auth login` de nuevo.
194
+ > ¿No se resuelve ninguna API key? El comando muestra la tabla estática de cuotas de la documentación y te indica cómo autenticarte.
183
195
 
184
196
  ### Lo que ves
185
197
 
186
- **Con sesión válida** (uso real):
198
+ **Con API key** (uso real):
187
199
  ```
188
- 📊 NaN Quota Status
200
+ 📊 NaN Usage
201
+
202
+ 🗓️ Window: 2026-09-01 → 2026-09-27 UTC (27 days)
189
203
 
190
- ⏱️ Next billing reset: 2026-10-01 UTC (8d 14h 32m 15s)
204
+ ⏱️ Next billing reset: 2026-09-30 UTC (2d 14h 30m 0s)
191
205
 
192
206
  Models with monthly caps:
193
207
 
194
208
  DeepSeek V4 Flash:
195
- [████████░░░░░░░░░░░░] 40.2%
196
- Used: 1.2B / 3.0B (1.8B remaining)
209
+ [████████░░░░░░░░░░░░] 40.0% of monthly cap
210
+ Used: 1.2B / 3.0B (1.8B remaining) · 5,120 requests
197
211
 
198
212
  MiMo V2.5:
199
- [██░░░░░░░░░░░░░░░░░░] 12.5%
200
- Used: 125.0M / 1.0B (875.0M remaining)
213
+ [███░░░░░░░░░░░░░░░░░] 12.5% of monthly cap
214
+ Used: 125.0M / 1.0B (875.0M remaining) · 840 requests
215
+
216
+ GLM 5.3 👑:
217
+ [████████░░░░░░░░░░░░] 40.0% of monthly cap
218
+ Used: 1.2B / 3.0B (1.8B remaining) · 2,400 requests
219
+ ↳ rolling window: 400.0M / 4h (daily granularity — /usage cannot break it down)
201
220
 
202
221
  Uncapped models:
203
222
 
204
- Qwen 3.6: 890.5K used
205
- Gemma 4: 234.1K used
223
+ Qwen 3.6: 890.5K used · 123 requests
224
+
225
+ Window totals: 2.6B tokens (2.0B prompt / 640.0M completion) · 18,432 requests
226
+ All time: 13.2B tokens · 41,250 requests (cached 2026-02-01)
227
+ 💡 Source: GET /v1/usage · caps from https://nan.builders/docs/models
206
228
  ```
207
229
 
208
- **Sin sesión** (solo límites estáticos):
230
+ **Sin API key** (solo límites estáticos):
209
231
  ```
210
232
  📊 NaN Quota Status (static limits)
211
233
 
212
- ⏱️ Next billing reset: 2026-10-01 UTC (8d 14h 32m 15s)
234
+ ⏱️ Next billing reset: 2026-09-30 UTC (2d 14h 30m 0s)
213
235
 
214
236
  Model Monthly Cap
215
237
  ─────────────────────────────────────────────────
216
238
  DeepSeek V4 Flash 3.0B
217
239
  MiMo V2.5 1.0B
240
+ MiMo V2.6 Flash 1.0B
218
241
  Qwen 3.6 uncapped
219
242
  Gemma 4 uncapped
220
243
  Qwen 3.8 Flash 500.0M
221
244
  GLM 5.3 Flash 2.0B
222
- GLM 5.3 👑 3.0B (rolling 400.0M/4h)
245
+ GLM 5.3 3.0B 👑 (rolling 400.0M/4h)
223
246
 
224
- 💡 Run `nan auth login` to see real usage data.
247
+ 💡 Set NAN_API_KEY or run `/login nan` to see real usage (GET /v1/usage).
225
248
  ```
226
249
 
250
+ Los errores siguen siendo accionables: `401` → ejecuta `/login nan` o corrige `NAN_API_KEY`, `404` → la cuenta no tiene identidad de uso que reportar, `429` → reintenta tras los segundos de `Retry-After`.
251
+
227
252
  ---
228
253
 
229
254
  ## 📊 Modelos
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @gtrabanco/pi-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-0.6.5-blue)](https://github.com/gtrabanco/pi-nan-provider/releases)
4
+ [![Version](https://img.shields.io/badge/version-0.8.0-blue)](https://github.com/gtrabanco/pi-nan-provider/releases)
5
5
 
6
6
  [NaN Builders](https://nan.builders) model provider + MCP bridges for [pi](https://github.com/earendil-works/pi).
7
7
 
@@ -156,74 +156,99 @@ bun run check-nan-mcp-server --issue # create/refresh the issue
156
156
 
157
157
  ## 📊 Quota Usage: `/nan-usage`
158
158
 
159
- Shows your NaN token usage per model, monthly limits, and time until the billing cycle resets.
159
+ 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.
160
160
 
161
161
  ### How it works
162
162
 
163
- `/nan-usage` reads the session token from `~/.config/nan/session.json` — the same file the [NaN CLI](https://github.com/helmcode/nan-cli) uses. If the file exists and contains a valid session, the command fetches real usage data from NaN's dashboard. Otherwise, it shows static quota limits from the docs.
163
+ `/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.
164
+
165
+ 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).
166
+
167
+ Rate limit: 30 requests per minute for `/usage`, separate from the model endpoints.
168
+
169
+ ### Usage
170
+
171
+ ```
172
+ /nan-usage # current UTC month (matches the monthly caps)
173
+ /nan-usage 7 # rolling 7-day window (1-90)
174
+ /nan-usage 30 # rolling 30-day window
175
+ /nan-usage help # show the usage line
176
+ ```
164
177
 
165
178
  ### Setup
166
179
 
167
- 1. **Install the NaN CLI**:
168
- ```bash
169
- curl -fsSL https://nan.builders/install | sh
180
+ 1. **Authenticate the `nan` provider in pi** with your `sk-...` key:
181
+ ```
182
+ /login nan
170
183
  ```
171
- 2. **Log in**:
184
+ or export it instead:
172
185
  ```bash
173
- nan auth login
186
+ export NAN_API_KEY=sk-...
174
187
  ```
175
- This sends a sign-in link to your email. Paste the link back into the terminal.
176
- 3. **Use in pi**:
188
+ 2. **Use in pi**:
177
189
  ```
178
190
  /nan-usage
179
191
  ```
180
192
 
181
193
  > [!TIP]
182
- > The session token is shared automatically — no env vars or extra config needed. If the session expires, run `nan auth login` again.
194
+ > No API key resolves? The command falls back to the static quota table from the docs and tells you how to authenticate.
183
195
 
184
196
  ### What you see
185
197
 
186
- **With a valid session** (real usage):
198
+ **With an API key** (real usage):
187
199
  ```
188
- 📊 NaN Quota Status
200
+ 📊 NaN Usage
189
201
 
190
- ⏱️ Next billing reset: 2026-10-01 UTC (8d 14h 32m 15s)
202
+ 🗓️ Window: 2026-09-01 → 2026-09-27 UTC (27 days)
203
+
204
+ ⏱️ Next billing reset: 2026-09-30 UTC (2d 14h 30m 0s)
191
205
 
192
206
  Models with monthly caps:
193
207
 
194
208
  DeepSeek V4 Flash:
195
- [████████░░░░░░░░░░░░] 40.2%
196
- Used: 1.2B / 3.0B (1.8B remaining)
209
+ [████████░░░░░░░░░░░░] 40.0% of monthly cap
210
+ Used: 1.2B / 3.0B (1.8B remaining) · 5,120 requests
197
211
 
198
212
  MiMo V2.5:
199
- [██░░░░░░░░░░░░░░░░░░] 12.5%
200
- Used: 125.0M / 1.0B (875.0M remaining)
213
+ [███░░░░░░░░░░░░░░░░░] 12.5% of monthly cap
214
+ Used: 125.0M / 1.0B (875.0M remaining) · 840 requests
215
+
216
+ GLM 5.3 👑:
217
+ [████████░░░░░░░░░░░░] 40.0% of monthly cap
218
+ Used: 1.2B / 3.0B (1.8B remaining) · 2,400 requests
219
+ ↳ rolling window: 400.0M / 4h (daily granularity — /usage cannot break it down)
201
220
 
202
221
  Uncapped models:
203
222
 
204
- Qwen 3.6: 890.5K used
205
- Gemma 4: 234.1K used
223
+ Qwen 3.6: 890.5K used · 123 requests
224
+
225
+ Window totals: 2.6B tokens (2.0B prompt / 640.0M completion) · 18,432 requests
226
+ All time: 13.2B tokens · 41,250 requests (cached 2026-02-01)
227
+ 💡 Source: GET /v1/usage · caps from https://nan.builders/docs/models
206
228
  ```
207
229
 
208
- **Without a session** (static limits only):
230
+ **Without an API key** (static limits only):
209
231
  ```
210
232
  📊 NaN Quota Status (static limits)
211
233
 
212
- ⏱️ Next billing reset: 2026-10-01 UTC (8d 14h 32m 15s)
234
+ ⏱️ Next billing reset: 2026-09-30 UTC (2d 14h 30m 0s)
213
235
 
214
236
  Model Monthly Cap
215
237
  ─────────────────────────────────────────────────
216
238
  DeepSeek V4 Flash 3.0B
217
239
  MiMo V2.5 1.0B
240
+ MiMo V2.6 Flash 1.0B
218
241
  Qwen 3.6 uncapped
219
242
  Gemma 4 uncapped
220
243
  Qwen 3.8 Flash 500.0M
221
244
  GLM 5.3 Flash 2.0B
222
- GLM 5.3 👑 3.0B (rolling 400.0M/4h)
245
+ GLM 5.3 3.0B 👑 (rolling 400.0M/4h)
223
246
 
224
- 💡 Run `nan auth login` to see real usage data.
247
+ 💡 Set NAN_API_KEY or run `/login nan` to see real usage (GET /v1/usage).
225
248
  ```
226
249
 
250
+ Failures stay actionable: `401` → run `/login nan` or fix `NAN_API_KEY`, `404` → the account has no usage identity to report, `429` → retry after the `Retry-After` seconds.
251
+
227
252
  ---
228
253
 
229
254
  ## 📊 Models
@@ -236,9 +261,25 @@ Baseline catalog (verified against [NaN docs](https://nan.builders/docs/models)
236
261
  | `gemma4` | 262,144 | 32,768 | text, image | ✅ |
237
262
  | `deepseek-v4-flash` | 1,000,000 | 384,000 | text, image | ✅ |
238
263
  | `mimo-v2.5` | 1,048,576 | 131,072 | text, image | ✅ |
264
+ | `mimo-v2.6-flash` | 1,048,576 | 131,072 | text, image | ✅ |
239
265
  | `glm5.3-flash` | 1,000,000 | 131,072 | text, image | ✅ |
240
266
  | `qwen3.8-flash` | 262,144 | 131,072 | text, image | ✅ |
241
267
 
268
+ > [!NOTE]
269
+ > `mimo-v2.6-flash` is served by NaN but not yet listed on models.dev provider `nan`; it enters the catalog through a manual-only entry with the same limits as `mimo-v2.5`. The model will be auto-detected from models.dev once added there.
270
+
271
+ ---
272
+
273
+ ## 🧠 Reasoning controls
274
+
275
+ NaN's `reasoning_effort` parameter controls how much the model thinks before answering — but the degree of control varies by model:
276
+
277
+ | Model | Reasoning effort | How it works |
278
+ | :--- | :--- | :--- |
279
+ | `glm5.3`, `glm5.3-flash` | `low` · `medium` · `high` · `max` | Fully controllable — higher values let the model reason longer |
280
+ | `qwen3.6`, `gemma4` | `none` · `minimal` · `low` · `medium` · `high` · `max` | `none`/`minimal` skip reasoning entirely; others cap at 2K / 8K / 16K / 32K tokens |
281
+ | `deepseek-v4-flash`, `qwen3.8-flash`, `mimo-v2.5`, `mimo-v2.6-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 these models don't adjust |
282
+
242
283
  ---
243
284
 
244
285
  ## 🚀 Development
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtrabanco/pi-nan-provider",
3
- "version": "0.6.11",
3
+ "version": "0.8.0",
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 MCP bridges (official web search + optional community media server)",
5
5
  "keywords": [
6
6
  "pi",
@@ -38,7 +38,8 @@
38
38
  "check-nan-mcp-server": "bun run scripts/check-nan-mcp-server.ts",
39
39
  "prepublishOnly": "bun run generate-models && bun test && bun run typecheck",
40
40
  "test": "bun test",
41
- "typecheck": "bunx tsc --noEmit"
41
+ "typecheck": "bunx tsc --noEmit",
42
+ "check-pi-sdk-versions": "node scripts/check-pi-sdk-versions.mjs --report"
42
43
  },
43
44
  "peerDependencies": {
44
45
  "@earendil-works/pi-ai": ">=0.83.0 <1",