pi-free 2.0.11 → 2.0.13

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/CHANGELOG.md CHANGED
@@ -1,576 +1,628 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [2.0.11] - 2026-05-08
9
-
10
- ### Fixed
11
-
12
- - **Config wipe on JSON parse failure** — `saveConfig` used `loadConfigFile()` which returns `{}` on any parse error, causing `{ ...{}, ...updates }` to write a partial config that permanently destroyed all API keys. Now reads the raw file directly and refuses to save if corrupt. `ensureConfigFile` also refuses to overwrite corrupt files.
13
-
14
- - **Built-in provider keys removed from pi-free config** `mistral_api_key`, `groq_api_key`, `cerebras_api_key`, `xai_api_key`, and `hf_token` are no longer in `~/.pi/free.json`. These are pi's own built-in providers; their keys come from environment variables only.
15
-
16
- ## [2.0.9] - 2026-05-08
17
-
18
- ### Added
19
-
20
- - **Together AI provider** — Fast inference on 200+ open-source models (Llama, DeepSeek, Qwen, etc.) through an OpenAI-compatible API. $1 trial credit on signup, no credit card required. Set `TOGETHER_AI_API_KEY`.
21
-
22
- - **Per-model metadata for Ollama Cloud** — Fetches `/api/show` details for every Ollama Cloud model to detect real capabilities: thinking/vision support, actual context windows (up to 1M tokens), and thinking level maps (`reasoning_effort`). Models now show parameter size and quantization in display names.
23
-
24
- - **Thinking level maps** — Four curated maps (`DEFAULT`, `GPT_OSS`, `QWEN3`, `NO_OFF`) for Ollama Cloud models that map Pi's thinking levels to Ollama's `reasoning_effort` values, based on per-model API testing.
25
-
26
- - **`/ollama-cloud-refresh` command** — Re-fetch Ollama Cloud models from the API and update the provider live, no restart needed.
27
-
28
- - **Persistent Ollama Cloud cache** — Models cached via `provider-cache.ts` for fast startup. Stale cache auto-refreshes on `session_start`. Fallback models used when cache is unavailable.
29
-
30
- ### Fixed
31
-
32
- - **ZenMux pricing** — Fixed `pricings` key (was reading `pricing`, always returned $0). Now correctly extracts per-model pricing (per-million-tokens ÷ 1M). Also uses `display_name`, `input_modalities` (vision detection), and `capabilities.reasoning` from API.
33
-
34
- - **CrofAI model metadata** — Custom fetch now reads per-model `name`, `custom_reasoning`, `context_length`, `max_completion_tokens`, and per-million-token `pricing` from the API.
35
-
36
- - **DeepInfra model metadata** — Extracts real model data from the `metadata` sub-object (context_length, max_tokens, pricing, reasoning tags). Filters non-chat models (embedding, rerank, whisper).
37
-
38
- - **Ollama Cloud model names** — Enriched with parameter size and quantization (e.g., `deepseek-v4-pro (671B, Q4_0)`). Set `supportsDeveloperRole: false` (fixes GLM models silently ignoring prompts). Bumped `maxTokens` from 4096 to 32768.
39
-
40
- - **SambaNova model accuracy** `fetchOpenAICompatibleModels` now reads per-model `context_length`, `max_completion_tokens`, and `pricing` from SambaNova's extended API response. Also reads `reasoning`, `input_modalities`, and accepts plain array responses.
41
-
42
- ### Changed
43
-
44
- - **Package scope migration**Updated all peer dependency imports from `@mariozechner/*` to `@earendil-works/*` (`pi-ai`, `pi-coding-agent`, `pi-tui`) to match the upstream scope rename in `@earendil-works/pi` v0.74.0.
45
-
46
- ## [2.0.8] - 2026-05-07
47
-
48
- ### Added
49
-
50
- - **Codestral provider** — Mistral's code-focused model via codestral.mistral.ai.
51
- Free tier (Experiment plan): 2 req/min, 500K tokens/min, 1B tokens/month.
52
- Uses pi's built-in Mistral SDK (`mistral-conversations` API type).
53
-
54
- - **LLM7.io provider** — OpenAI-compatible API gateway routing across
55
- multiple providers (OpenAI, Mistral, Google, DeepSeek, etc.). Free tier:
56
- default/fast selectors, 100 req/hr, 20 req/min.
57
-
58
- - **DeepInfra provider** — AI inference cloud with 100+ open-source models.
59
- $5 one-time credit on signup (no credit card). Models fetched dynamically.
60
- Shown as trial credit provider in `/free-providers`.
61
-
62
- - **SambaNova provider** — Fast inference on custom RDU hardware with
63
- OpenAI-compatible API. All models accessible on free tier (no credit card):
64
- 20-480 RPM. Models include Llama 3.3 70B, DeepSeek-V3/R1, Llama 4 Maverick.
65
- Shown as freemium provider in `/free-providers`.
66
-
67
- ### Changed
68
-
69
- - **Codestral: fixed HTTP 422 error** — Switched API type from
70
- `openai-completions` to `mistral-conversations`. The OpenAI completions
71
- adapter was sending unrecognized fields (`stream_options`, `store`,
72
- `max_completion_tokens`) that Mistral's API rejects with 422.
73
-
74
- ### Fixed
75
-
76
- - **Toggle commands persist across sessions for all providers** Providers using
77
- `setupProvider` (zenmux, crofai, llm7, sambanova, deepinfra) were always
78
- registering `freeModels` on startup, ignoring the persisted `show_paid` config.
79
- Now each provider reads its config getter and registers the correct initial
80
- model set. Fixes #149.
81
-
82
- ### Security
83
-
84
- - **Log injection prevention** — `scripts/update-benchmarks.ts` sanitizes external
85
- API data (CRLF stripping) before logging. Fixes SonarCloud S1075.
86
-
87
- ### Reliability
88
-
89
- - **Prefer `String#replaceAll()` over `String#replace()`** — Replaced all 7 flagged
90
- instances. Where regex is unnecessary (2/7), switched to string literal form.
91
- Fixes SonarCloud S4144.
92
-
93
- ### Added
94
-
95
- - **`agents.md`** — Codebase guide for AI agents covering architecture, patterns,
96
- conventions, testing, and the Pi extension API.
97
-
98
- ### Added
99
-
100
- - **Passive quota monitoring** — Extracts rate-limit headers from every
101
- provider response via `after_provider_response` event (no extra API calls).
102
- Tries 6 header format variants (`x-ratelimit-remaining`,
103
- `ratelimit-remaining-requests-day`, etc.). Shows remaining quota in the
104
- status bar with warning icons when ≤25% or ≤10%. Fixes #147.
105
-
106
- ### Fixed
107
-
108
- - **Missing `g` flag on `replaceAll` regexps broke model filtering** —
109
- `String.prototype.replaceAll()` requires a global RegExp; 20+ patterns in
110
- `benchmark-lookup.ts` were missing it, causing a `TypeError` that prevented
111
- models from appearing for providers like cline and kilo. Added `/g` flag to
112
- all affected patterns. Fixes #151.
113
-
114
- ### Changed
115
-
116
- - **Resolved ~280 SonarCloud issues across 21 files** Bulk code-quality
117
- cleanup including: stripping trailing zeros from `toFixed()` (S7748),
118
- `global` → `globalThis` (S7764), `parseFloat` → `Number.parseFloat` (S7773),
119
- naming unnamed async exports (S7726), `String.raw` for path strings (S7780),
120
- top-level await over promise chains (S7785), re-export from source (S7763),
121
- `.at(-1)` over `[length-1]` (S7755), `node:fs` protocol imports (S7772),
122
- and logging user-controlled data sanitization (S5145). Fixes #148.
123
-
124
- ### Security
125
-
126
- - **Bump `basic-ftp` 5.3.0 → 5.3.1** — Patches GHSA-rpmf-866q-6p89 (high
127
- severity): malicious FTP server could cause client-side DoS via unbounded
128
- multiline control response buffering. Fixes `npm audit` finding.
129
-
130
- ### Refactored
131
-
132
- - **Extracted shared model-fetch helper** `fetchOpenAICompatibleModels()`
133
- in `lib/util.ts` eliminates ~120 lines of duplicated fetch→parse→map
134
- boilerplate across CrofAI, DeepInfra, and SambaNova providers.
135
-
136
- ## [2.0.6] - 2026-05-02
137
-
138
- ### Security
139
-
140
- - **5x S5852 regex super-linear runtime** — Replaced all flagged regex patterns
141
- (nested quantifiers in model size extraction) with manual char-by-char string
142
- parsing in `parseModelSize()`, `normalizeSizeTokenOrder()`, and test helpers.
143
- Eliminates catastrophic backtracking risk.
144
-
145
- - **4x S4036 PATH variable security** —
146
- - `open-browser.ts`: Added `resolveExe()` helper that prefers known absolute
147
- paths (`/usr/bin/open`, `C:\Windows\System32\...\powershell.exe`) before
148
- falling back to PATH lookup
149
- - `check-extensions.mjs`: Removed hardcoded PATH override; resolved `npm` via
150
- `execFileSync` with known absolute paths
151
-
152
- - **1x S4721 command injection** — Replaced `execSync` with `execFileSync` in
153
- `resolveExe()` helper. `execFileSync` takes separate arguments and never
154
- spawns a shell, eliminating the injection vector.
155
-
156
- ### Changed
157
-
158
- - **Banner image** — Converted `banner.svg` to `banner.png` for reliable
159
- rendering across all GitHub surfaces (mobile, email, dark mode readers).
160
-
161
- ## [2.0.5] - 2026-05-02
162
-
163
- ### Added
164
-
165
- - **NVIDIA model probe auto-discovery** — Lazy auto-probe for NVIDIA models on
166
- first `session_start` (once per session). Broken 404 models detected and
167
- auto-hidden without requiring manual `/probe-nvidia`.
168
-
169
- ### Changed
170
-
171
- - **Ollama provider updates** Improved cloud model detection and configuration.
172
-
173
- ## [2.0.4] - 2026-05-02
174
-
175
- ### Fixed
176
-
177
- - **OpenRouter key resolution no longer falls back to `free.json`** —
178
- `getOpenrouterApiKey()` now only checks the `OPENROUTER_API_KEY` environment variable.
179
- Previously it fell back to `~/.pi/free.json`, which could contain stale/revoked keys
180
- that conflict with pi's built-in OpenRouter provider (which reads from
181
- `~/.pi/agent/auth.json`).
182
-
183
- - **Removed `openrouter_api_key` from `PiFreeConfig` interface and config template** —
184
- Prevents future persistence of OpenRouter keys in `free.json`, eliminating the
185
- source of stale key conflicts for built-in providers.
186
-
187
- ## [2.0.3] - 2026-05-02
188
-
189
- ### Added
190
-
191
- - **Consistent `isFreeModel` helper with Route A/B logic** — Created a unified helper for free model detection that automatically detects whether a provider exposes pricing:
192
- - **Route A (pricing-exposed)**: Model is free if `cost === 0` OR `"free"` in name (OR logic)
193
- - **Route B (non-pricing-exposed)**: Model is free only if `"free"` in name
194
- - Dynamic detection: If ALL models have cost === 0, assumes pricing not exposed → uses Route B
195
- - If ANY model has cost > 0, assumes pricing exposed → uses Route A
196
- - All providers (Cline, Kilo, NVIDIA, Ollama, dynamic built-in) now use this consistent helper
197
-
198
- - **CrofAI provider (PAID)** — Added new **paid** provider for CrofAI (https://crof.ai), an OpenAI-compatible LLM inference API. **Note: CrofAI is a paid provider** — users must have a CrofAI API key with credits. The provider uses Route B detection (name-only) since CrofAI's API doesn't expose per-model pricing. Only models with `"free"` in their names are marked as free (none currently).
199
-
200
- - **ZenMux provider (PAID)** — Added new **paid** provider for ZenMux AI gateway (https://zenmux.ai), a unified API for 200+ models from OpenAI, Anthropic, Google, etc. **Note: ZenMux is a paid provider** — users must have a ZenMux API key with credits. The provider uses Route A detection (OR logic) since ZenMux exposes pricing. Models marked as free only if `cost === 0` OR `"free"` in name (2 free models identified: GLM 4.7 Flash Free, GLM 4.6v Flash Free).
201
-
202
- - **Comprehensive `isFreeModel` test suite** Added 30+ unit tests covering Route A, Route B, freemium behavior, and edge cases. Tests verify correct classification on actual OpenRouter API data (371 models, 30 free).
203
-
204
- - **Toggle commands for dynamic built-in providers** — Added `/toggle-mistral`, `/toggle-groq`,
205
- `/toggle-cerebras`, `/toggle-xai`, and `/toggle-huggingface` commands. These providers were
206
- registered with the global toggle system but lacked per-provider toggle commands, making
207
- free/paid switching inaccessible without editing config files.
208
-
209
- - **Lazy auto-probe for NVIDIA models** — Extracted `runNvidiaProbe()` into a shared function
210
- called automatically on first `session_start` (once per session). Previously, users had to
211
- manually run `/probe-nvidia` to discover 404 models. Now broken models are detected and
212
- auto-hidden on first use.
213
-
214
- ### Changed
215
-
216
- - **Cline provider now uses `isFreeModel`** — Fixed Cline to use the consistent `isFreeModel` helper instead of `m.cost.input === 0`. Previously used cost-only filtering, now uses proper OR logic for pricing-exposed providers.
217
-
218
- - **NVIDIA test expectations updated** — Updated tests to reflect strict Route B behavior (name-only detection for non-pricing-exposed providers). Added test for models with `"free"` in name being marked as free.
219
-
220
- ### Fixed
221
-
222
- - **`provider-factory.ts` — `beforeProviderRequest` hook now scoped to owning provider** —
223
- The hook was firing for **all** provider requests regardless of which provider the factory
224
- was configuring. Now checks `evt.provider !== def.providerId` and returns early if the
225
- event doesn't belong to the owning provider.
226
-
227
- - **`provider-factory.ts` — `reRegister` callback no longer corrupts stored model lists** —
228
- When toggling between free/paid modes, the callback was overwriting `stored.all` with only
229
- the filtered subset, losing the original full model list. Now preserves the original model
230
- lists for correct subsequent toggling.
231
-
232
- - **`lib/types.ts` Removed leftover `LspTestInterface`** Removed a test interface that
233
- was left in production code.
234
-
235
- - **`index.ts` Removed redundant `.catch()` on deprecated Qwen provider** — The `.catch()`
236
- was unnecessary since `Promise.allSettled` already handles rejections.
237
-
238
- ### Removed
239
-
240
- - **Qwen provider (deprecated)** — Removed Qwen OAuth provider as the 1,000 req/day free tier is no longer available. Provider remains functional for existing authenticated users but new free tier registrations are not supported.
241
-
242
- - **Modal provider** — Removed single-model Modal provider (only had GLM-5.1 FP8). Users should use other providers for GLM models.
243
-
244
- - **Cloudflare provider** Removed Cloudflare Workers AI provider as it's now built into pi core. Users can use pi's built-in Cloudflare provider instead.
245
-
246
- - **Qwen test file** Removed `tests/qwen.test.ts` along with the deprecated provider.
247
-
248
- ## [2.0.2] - 2026-04-26
249
-
250
- ### Added
251
-
252
- - **Model matching debug logging** — Added `~/.pi/modelmatch.log` to diagnose which models get Coding Index scores and which don't:
253
- - Logs every matching attempt with provider, model ID, normalization strategy, and result
254
- - CSV-like format: `timestamp|provider|modelId|modelName|action|strategy|normalizedId|matchKey|codingIndex|details`
255
- - Provider-specific normalizers for better matching:
256
- - **NVIDIA**: Strips vendor prefixes (`meta/`, `mistralai/`, `microsoft/`, `qwen/`, etc.)
257
- - **Cloudflare**: Strips `@cf/namespace/` prefixes
258
- - **Groq**: Removes `-versatile` and numeric context suffixes (`-32768`)
259
- - **Cerebras**: Normalizes `llama3.1` `llama-3.1`, auto-adds `instruct` suffix
260
- - **Mistral**: Strips `-latest` suffix
261
- - **Ollama**: Converts `model:tag` `model-tag`
262
- - Common suffix stripping: `:free`, date codes (`-20250514`), versions (`-v1.1`), `-it`, `-fp8`/`-bf16`
263
-
264
- - **Enhanced benchmark lookup** — `enhanceModelNameWithCodingIndex()` now accepts optional `provider` parameter for provider-aware normalization
265
-
266
- - **Static 404 model blocklist for NVIDIA** — Probed all 136 models from `integrate.api.nvidia.com/v1/models` and identified 57 that return 404 "Function not found" on `/v1/chat/completions`. These are now hard-filtered so they never appear in the model selector:
267
- - Covers discontinued models (`databricks/dbrx-instruct`, `meta/codellama-70b`, `meta/llama2-70b`, `ibm/granite-*`, etc.)
268
- - Covers embedding-only models listed as chat-capable (`nvidia/nv-embed-v1`, `nvidia/nv-embedqa-*`, `snowflake/arctic-embed-l`, etc.)
269
- - Covers stale API catalog entries (`mistralai/mistral-large`, `mistralai/mistral-large-2-instruct`, `writer/palmyra-*`, etc.)
270
- - Full list in `NVIDIA_KNOWN_404_MODELS` in `providers/nvidia/nvidia.ts`
271
-
272
- - **`/probe-nvidia` command** — On-demand model health check. Tests every registered NVIDIA model with a minimal `max_tokens: 1` request, auto-hides any new 404s in `~/.pi/free.json`, and re-registers the provider immediately.
273
-
274
- - **`scripts/probe-nvidia.mjs`**Standalone Node.js script to reproduce the probe. Reads `~/.pi/free.json` for the API key, batches 20 requests at a time with 10s timeout, and prints all broken model IDs for adding to the blocklist.
275
-
276
- - **Ollama Cloud 403 handling** Same pattern as NVIDIA 404s for Ollama Cloud:
277
- - `OLLAMA_KNOWN_403_MODELS` blocklist for models that return 403 "access denied"
278
- - `/probe-ollama` command to test all models on-demand, auto-hide broken ones, and re-register
279
- - `scripts/probe-ollama.mjs` standalone script for blocklist maintenance
280
-
281
- - **Provider-scoped hidden models** Hidden models are now provider-specific:
282
- - Format: `"provider/model-id"` (e.g., `"ollama/kimi-k2.6"`, `"nvidia/broken-model"`)
283
- - A model hidden from one provider doesn't hide it from other providers
284
- - Backward compatible with old global `"model-id"` format
285
- - All providers updated: NVIDIA, Ollama, Cloudflare, Cline, Kilo, Modal
286
-
287
- ### Fixed
288
-
289
- - **Probe commands timeout handling** — Added `fetchWithTimeout` with 10-second timeout to `/probe-nvidia` and `/probe-ollama` commands. Prevents the coding harness from freezing when individual model probe requests hang indefinitely.
290
-
291
- - **NVIDIA provider now sends `authHeader: true`** — Explicitly enables `Authorization: Bearer` header injection. Previously relied on pi's implicit behavior which could fail in some configurations.
292
-
293
- ### Removed
294
-
295
- - **NVIDIA 404 model warning log** — Removed the `console.warn("[nvidia] Skipping known 404 model: ...")` output when filtering out known broken models. The filter still works silently; use `/probe-nvidia` to identify new 404s if needed.
296
-
297
- ### Changed
298
-
299
- - **Cloudflare provider now fetches models dynamically** — Replaced static 19-model hardcoded list with live API fetch from `api.cloudflare.com/client/v4/accounts/{account_id}/ai/models`:
300
- - Automatically discovers all 30+ text generation models (was manually maintaining 19)
301
- - Smart filtering excludes embeddings, image generation, speech, translation, and vision-only models via regex patterns
302
- - Metadata inference from model IDs: detects vision (`vision`/`multimodal`), reasoning (`r1`/`thinking`/`qwq`), context windows, and estimated costs
303
- - Fixed Mistral Small ID: changed from incorrect `@cf/mistralai/...` to correct `@cf/mistral/...`
304
- - Added new fallback models: Kimi K2.6, OpenAI GPT-OSS 120B/20B, Qwen 2.5 Coder 32B, QwQ 32B, Llama 3.2 11B Vision
305
- - Graceful fallback to expanded 18-model hardcoded list if API fetch fails
306
-
307
- - **NVIDIA provider now queries NVIDIA's API directly** — Source of truth switched from `models.dev` curated JSON to `https://integrate.api.nvidia.com/v1/models`:
308
- - Eliminates 57 missing models and 25 stale entries from the old third-party source
309
- - Models not in `models.dev` get inferred metadata (128k context, 4k output, vision/reasoning heuristics)
310
- - Added regex-based non-chat model filtering for unknown models (embeddings, whisper, reward models, safety guards, parsers, detectors, etc.)
311
- - Graceful fallback to `models.dev` if NVIDIA API is unreachable
312
- - Removed paid/free toggle filtering — NVIDIA is freemium (all models use free credits)
313
-
314
- ## [2.0.1] - 2026-04-24
315
-
316
- ### Added
317
-
318
- - **Built-in provider toggle support** (`lib/built-in-toggle.ts`) Enables free/paid filtering for Pi's built-in providers that expose per-model pricing:
319
- - **OpenCode (`/toggle-opencode`)** — Captures built-in OpenCode models on session start and filters to free-only by default
320
- - **OpenRouter (`/toggle-openrouter`)** Now uses the built-in toggle system for consistency
321
- - Toggle works in the current session (no restart needed)
322
- - Persisted via `opencode_show_paid` and `openrouter_show_paid` in `~/.pi/free.json`
323
-
324
- ### Changed
325
-
326
- - **OpenRouter moved to built-in toggle system** OpenRouter is now handled by `lib/built-in-toggle.ts` alongside OpenCode for a unified approach:
327
- - Removed from `providers/dynamic-built-in/index.ts`
328
- - Eliminated duplicate toggle command registration logic
329
- - Consolidated toggle persistence with other built-in providers
330
-
331
- - **Standardized all toggle commands to `toggle-{provider}`** Renamed from `{provider}-toggle` for consistency:
332
- - `/kilo-toggle` → `/toggle-kilo`
333
- - `/cline-toggle` `/toggle-cline`
334
- - `/openrouter-toggle` `/toggle-openrouter`
335
- - `/nvidia-toggle` `/toggle-nvidia`
336
- - `/cloudflare-toggle` `/toggle-cloudflare`
337
- - `/ollama-toggle` `/toggle-ollama`
338
- - `/mistral-toggle` → `/toggle-mistral`
339
- - `/groq-toggle` → `/toggle-groq`
340
- - `/cerebras-toggle` → `/toggle-cerebras`
341
- - `/toggle-opencode` (new)
342
-
343
- ### Fixed
344
-
345
- - **Ollama Cloud model fetching endpoint** — Corrected the `/v1/models` → `/models` endpoint path in `providers/ollama/ollama.ts`:
346
- - The previous fix (2.0.0) incorrectly used `/v1/models`; Ollama Cloud's models endpoint is `/v1/models` for chat completions but `/models` for listing
347
- - This ensures model fetching works correctly with the OpenAI-compatible API
348
-
349
- ### Removed
350
-
351
- - **Global `/free` command** Removed the global free-only toggle. Per-provider toggles (`/toggle-{provider}`) are now the only way to switch between free and paid models. The `/free-providers` status command remains.
352
-
353
- ## [2.0.0] - 2026-04-23
354
-
355
- ### Breaking Changes
356
-
357
- - **Removed Fireworks provider** Fireworks is now a built-in Pi provider (added in pi 0.68.1), so the extension's Fireworks provider has been removed to avoid conflicts:
358
- - Deleted `providers/fireworks/fireworks.ts` and `tests/fireworks.test.ts`
359
- - Removed all Fireworks configuration options from `config.ts` (`fireworks_api_key`, `fireworks_show_paid`)
360
- - Users should now use Pi's built-in Fireworks support with `FIREWORKS_API_KEY`
361
-
362
- - **Renamed Ollama provider to `ollama-cloud`** Changed provider ID from `"ollama"` to `"ollama-cloud"` to avoid collision with Pi's built-in local Ollama provider:
363
- - This prevents provider ID conflicts when both are registered
364
- - All log messages and documentation now reference "Ollama Cloud"
365
-
366
- ### Removed
367
-
368
- - **Dropped `@sinclair/typebox` peer dependency** — Pi 0.69.0 migrated from `@sinclair/typebox` to `typebox` 1.x. The extension didn't directly import this package, so it was removed from `peerDependencies` to avoid potential conflicts.
369
-
370
- ### Fixed
371
-
372
- - **Ollama Cloud API endpoint** — Fixed broken Ollama Cloud integration:
373
- - Changed `BASE_URL_OLLAMA` from `https://ollama.com` to `https://ollama.com/v1` the OpenAI-compatible API endpoint
374
- - Fixed model fetching to use `/v1/models` instead of `/api/tags` — ensures model IDs work with chat completions endpoint
375
- - Previously calls went to HTML homepage instead of API endpoints, causing 404 errors
376
-
377
- ### Removed
378
-
379
- - **Removed paid model warning on selection** — Deleted the `model_select` event handler that showed:
380
- - `⚠️ Paid model selected (${model.id}). Use "/free off" to enable paid models.`
381
- - This warning was redundant since the global `/free` toggle and provider toggles already control model visibility
382
-
383
- - **Removed pointless `/modal-toggle` command** Modal provider only has 1 free model (GLM-5.1 FP8), so there was nothing meaningful to toggle:
384
- - Added `skipToggle` option to `ProviderDefinition` and `ProviderSetupConfig` interfaces
385
- - Modal provider now sets `skipToggle: true` to prevent toggle command creation
386
-
387
- ### Changed
388
-
389
- - **Marked Qwen provider as fully deprecated** — Updated messaging to clarify the provider is broken:
390
- - Changed model name from `"Qwen Coder — Free 1k/day"` to `"Qwen Coder — DEPRECATED (free tier discontinued)"`
391
- - Updated all JSDoc comments to clearly state auth is broken and free tier is no longer available
392
- - Provider remains for backward compatibility but should not be used
393
-
394
- ### Added
395
-
396
- - **Cloudflare Workers AI provider** — New provider for Cloudflare's serverless GPU platform:
397
- - 50+ open-source models: Llama 4, Mistral Small 3.1, Qwen 2.5/3, DeepSeek R1, Gemma 4, Kimi K2.5/2.6, and more
398
- - **10,000 Neurons/day FREE tier** (resets daily at 00:00 UTC)
399
- - **$0.011 per 1,000 Neurons** beyond free allocation
400
- - Only requires `CLOUDFLARE_API_TOKEN` — account ID auto-derived from token
401
- - Toggle with `/cloudflare-toggle`
402
- - Create token at https://dash.cloudflare.com/profile/api-tokens
403
-
404
- - **Unified dynamic built-in providers module** — New `providers/dynamic-built-in/` module that dynamically fetches models from Pi's built-in providers when users have API keys:
405
- - **Mistral** (`MISTRAL_API_KEY`) — Fetches from `api.mistral.ai/v1/models`
406
- - **Groq** (`GROQ_API_KEY`) — Fetches from `api.groq.com/openai/v1/models`
407
- - **Cerebras** (`CEREBRAS_API_KEY`) — Fetches from `api.cerebras.ai/v1/models`
408
- - **xAI** (`XAI_API_KEY`) — Fetches from `api.x.ai/v1/models`
409
- - **Hugging Face** (`HF_TOKEN` optional) Fetches public + authenticated models
410
- - **OpenRouter** Moved from `index.ts` to unified module with dynamic fetch
411
- - All integrate with global `/free` toggle and have per-provider toggle commands (`/mistral-toggle`, `/groq-toggle`, etc.)
412
-
413
- - **Global `/free` toggle system** — New centralized free/paid filtering across ALL providers:
414
- - `/free on/off/status` — Toggle free-only view globally
415
- - `/free-providers` Show free/paid model counts by provider
416
- - `FREE_ONLY` config option and `PI_FREE_ONLY` environment variable
417
- - Providers register via `registerWithGlobalToggle()` for unified filtering
418
-
419
- ### Fixed
420
-
421
- - **Toggle commands now actually filter models from UI** — Previously, toggle commands only showed notifications but didn't remove paid models from the model picker:
422
- - **OpenRouter (`/openrouter-toggle`)**: Now uses `registerProvider`/`unregisterProvider` to actually filter models from the picker UI
423
- - **NVIDIA (`/nvidia-toggle`)**: Added dynamic `showPaid` parameter to `fetchNvidiaModels()` so toggle properly switches between free and paid model sets
424
- - **Fireworks**: Removed broken toggle command all models are paid with no free tier, so there was nothing to toggle
425
-
426
- ### Added
427
-
428
- - **OpenRouter per-provider free model toggle** — Added `/openrouter-toggle` command for the built-in OpenRouter provider:
429
- - `/openrouter-toggle` — Switch between showing only free models vs all models (including paid)
430
- - New config flag `openrouter_show_paid` in `~/.pi/free.json` (default: `false`)
431
- - Environment variable: `OPENROUTER_SHOW_PAID=true` to show paid models by default
432
- - This brings OpenRouter (a built-in pi provider) in line with extension providers that have per-provider toggles
433
-
434
- ### Deprecated
435
-
436
- - **Qwen provider** The 1,000 requests/day free tier is no longer available from Qwen/DashScope. The provider code remains for backward compatibility but is now deprecated:
437
- - Added `@deprecated` JSDoc tags to all Qwen-related exports
438
- - Added deprecation warning when Qwen provider loads
439
- - Added warning when `QWEN_SHOW_PAID` config is used
440
- - Consider migrating to other free providers: Kilo, Cline, NVIDIA, or Modal
441
-
442
- ### Added
443
-
444
- - **Go provider** OpenCode Go subscription gateway (⚠️ paid only — $5 first month, then $10/month, no free tier) with models: GLM-5, Kimi K2.5, MiMo-V2-Pro, MiMo-V2-Omni, MiniMax M2.7, MiniMax M2.5
445
- - Set `OPENCODE_GO_API_KEY` or `opencode_go_api_key` in `~/.pi/free.json`
446
- - Toggle with `/go-toggle`
447
-
448
- ### Fixed
449
-
450
- - **All providers now show Coding Index scores in model selector** — Added `enhanceWithCI()` to factory-based providers (nvidia, fireworks, mistral, modal, ollama) and cline. Now all providers display CI scores in `/models` command (pi-models extension).
451
-
452
- - **All providers now show in `--list-models`** — Providers (zen, openrouter, go) that registered models only in `session_start` were missing from `pi --list-models` which runs before session starts. Added immediate registration for these providers:
453
- - **zen**: Added model caching to `~/.pi/provider-cache.json` for immediate registration + dynamic refresh
454
- - **openrouter**: Immediate model registration at extension load (like kilo/cline)
455
- - **go**: Immediate registration with static model list (no API to fetch from)
456
- - All 11 providers now visible in `--list-models`
457
-
458
- ### Changed
459
-
460
- - Updated README with clear free vs paid provider distinction (9 free + 2 paid-only: Go, Fireworks)
461
- - Added Go and Fireworks provider documentation under new "💳 Paid-Only Providers" section
462
- - Added `opencode_go_api_key` to config file template
463
- - Updated package.json description and keywords to include all 11 providers
464
-
465
- ### Added
466
-
467
- - **Provider model cache** (`lib/provider-cache.ts`)New utility for caching provider model lists to `~/.pi/provider-cache.json`. Used by zen provider for faster startup and offline access after first successful fetch.
468
-
469
- ## [1.0.9] - 2026-04-14
470
-
471
- ### Fixed
472
-
473
- - **Qwen OAuth breaks other OAuth providers** — `modifyModels` receives all models across every registered provider, not just Qwen's. The previous `map()` stamped the Qwen dashscope `baseUrl` onto every model, causing other OAuth providers (Kilo, OpenRouter, etc.) to return 404 after a `/login qwen` flow. Now only models with `provider === PROVIDER_QWEN` are patched; others pass through unchanged.
474
-
475
- ## [1.0.8] - 2026-04-13
476
-
477
- ### Added
478
-
479
- - **Modal provider** — Free access to GLM-5.1 FP8 (128k context, 16k max output) during promotional period (free until April 30, 2026)
480
- - Requires a free Modal API key (`MODAL_API_KEY` or `modal_api_key` in `~/.pi/free.json`)
481
- - Model: `zai-org/GLM-5.1-FP8` — 128k context window, 16k max output tokens
482
- - **Qwen provider** Free access to Qwen Coder (1,000 requests/day) via OAuth device flow
483
- - Run `/login qwen` to authenticate through Qwen Studio (chat.qwen.ai)
484
- - Uses `coder-model` alias (maps to Qwen3.6-Plus on the backend)
485
- - 131k context window, 16k max output tokens, zero cost
486
-
487
- ### Fixed
488
-
489
- - **Qwen OAuth browser launch on Windows** — URLs with `&` query params were truncated by `cmd.exe`'s `&` command separator; switched to `powershell.exe Start-Process` which passes the URL as a literal string
490
- - **Qwen API endpoint** Replicates qwen-code's `getCurrentEndpoint()` logic: uses `resource_url` from OAuth token response (`dashscope.aliyuncs.com` for Chinese accounts, `portal.qwen.ai` for international), with fallback to `dashscope.aliyuncs.com/compatible-mode/v1`
491
- - **Qwen DashScope headers** — Added all headers required by DashScope's OpenAI-compatible API: `X-DashScope-AuthType: qwen-oauth`, `X-DashScope-CacheControl: enable`, `X-DashScope-UserAgent`, `Client-Code: QwenCode`
492
- - **Qwen modifyModels crash** — `modifyModels` must be synchronous; making it async caused the pi framework to receive a `Promise` instead of a `Model[]`, breaking `ModelRegistry.find()`
493
-
494
- ## [1.0.5] - 2025-04-03
495
-
496
- ### Fixed
497
-
498
- - **NVIDIA provider non-chat model filtering** (comment/implementation mismatch)
499
- - Added modalities-based filtering to exclude embedding, speech-to-text, OCR, and image-gen models
500
- - Filters models where `output` is not `["text"]` (e.g., image generation like `black-forest-labs/flux.1-dev`)
501
- - Filters models where `input` lacks `"text"` (e.g., OCR like `nvidia/nemoretriever-ocr-v1`, speech-to-text like `openai/whisper-large-v3`)
502
- - Updated file comment to accurately describe the filtering behavior
503
- - Added 8 comprehensive unit tests for model filtering logic
504
-
505
- ## [1.0.4] - 2025-04-03
506
-
507
- ### Fixed
508
-
509
- - **All tests now passing** (127/127)
510
- - Fixed mock paths in kilo.test.ts, zen.test.ts, ollama.test.ts
511
- - Fixed createCtxReRegister mocks in zen.test.ts and openrouter.test.ts
512
- - Fixed cline.test.ts to test actual provider re-registration behavior
513
- - Added missing DEFAULT_MIN_SIZE_B constant to openrouter mock
514
-
515
- ### Changed
516
-
517
- - **Code quality improvements**
518
- - Refactored usage modules to break circular dependency (limits.ts ↔ formatters.ts)
519
- - Created usage/types.ts with shared interfaces (FreeTierLimit, FreeTierUsage)
520
- - Bumped version to 1.0.4
521
-
522
- ## [1.0.3] - 2025-04-03
523
-
524
- ### Changed
525
-
526
- - Updated package.json metadata (name, description, keywords, repository URL)
527
- - Updated .npmignore for cleaner publishes
528
-
529
- ## [1.0.0] - 2024-03-28
530
-
531
- ### Added
532
-
533
- - Initial release with 6 providers: Kilo, Zen, OpenRouter, NVIDIA, Cline, Fireworks
534
- - Free tier usage tracking across all sessions
535
- - Provider failover with model hopping
536
- - Autocompact integration for rate limit recovery
537
- - Usage widget with glimpseui
538
- - Command toggles for free/all model filtering
539
- - Hardcoded benchmark data from Artificial Analysis
540
-
541
- ### Changed
542
-
543
- - **Major refactoring**: Split free-tier-limits.ts into usage/\* modules
544
- - usage/tracking.ts - runtime session tracking
545
- - usage/cumulative.ts - persistent storage
546
- - usage/formatters.ts - display formatting
547
- - 77% line reduction (741 → 166 lines)
548
- - **Major refactoring**: Split usage-widget.ts into widget/\* modules
549
- - widget/data.ts - data collection
550
- - widget/format.ts - formatting utilities
551
- - widget/render.ts - HTML generation
552
- - 74% line reduction (~350 90 lines)
553
- - **Refactoring**: Extracted functions from cline-auth.ts
554
- - fetchAuthorizeUrl() - auth URL fetching
555
- - waitForAuthCode() - callback handling
556
- - exchangeCodeForTokens() - token exchange
557
- - parseManualInput() - manual input parsing
558
- - **Refactoring**: Simplified model-hop.ts complexity
559
- - Extracted handleDowngradeDecision()
560
- - Extracted tryAlternativeModel()
561
- - **Deduplication**: Created shared modules
562
- - lib/json-persistence.ts - file I/O with caching
563
- - lib/logger.ts - structured logging
564
- - providers/model-fetcher.ts - OpenRouter-compatible fetching
565
- - Replaced ~30 console.log statements with structured logging
566
- - Fixed all 9 pre-existing test failures
567
- - fetchWithRetry now throws after last retry
568
- - Fixed auth pattern matching (added key.*not.*valid)
569
- - Updated capability ranking tests
570
- - Added resetUsageStats() for test isolation
571
-
572
- ### Fixed
573
-
574
- - fetchWithRetry() now properly throws after exhausting retries
575
- - Auth error pattern matching now handles more message variants
576
- - Test isolation for free-tier-limits tests
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [2.0.13] - 2026-05-21
11
+
12
+ ### Added
13
+
14
+ - **OpenCode static headers injection** pi-free now injects required OpenCode headers (`x-opencode-client`, `x-opencode-session`, `x-opencode-request`, `x-opencode-project`, `User-Agent`) when capturing/re-registering pi's built-in OpenCode models **and** when dynamically fetching/registering OpenCode models from `opencode.ai/zen/v1`. Prevents requests from hanging indefinitely when pi's model generation omits these headers ([pi#4680](https://github.com/earendil-works/pi/issues/4680), [#171](https://github.com/apmantza/pi-free/issues/171), [#173](https://github.com/apmantza/pi-free/issues/173), [#174](https://github.com/apmantza/pi-free/issues/174)). Headers are now regenerated per-call with fresh session and request IDs. Uses native `ses_`/`msg_` prefixed ULID identifiers matching OpenCode's `Identifier.descending()` format to avoid daily rate-limit throttling ([#175](https://github.com/apmantza/pi-free/issues/175)).
15
+
16
+ - **OpenCode endpoint detection** — Replaced regex-based OpenCode endpoint check with a simple string comparison, reducing overhead on every streaming request.
17
+
18
+ ### Fixed
19
+
20
+ - **Lazy-load Pi AI stream providers** — Pi-ai's OpenAI completions and Anthropic stream modules are now imported lazily on first use rather than at extension load time. Eliminates start-up failures when pi-ai exports are not yet resolvable ([#177](https://github.com/apmantza/pi-free/issues/177)).
21
+
22
+ - **Subpath resolution for isolated extension context** — Pi loads pi-free from a directory tree that does not contain `@earendil-works/pi-ai` in its `node_modules`. `createRequire().resolve()` only understands CJS resolution, but pi-ai is ESM-only with strict exports. The new fallback resolves a pi-ai dependency from Pi's entry point, walks up to `node_modules`, reads `pi-ai/package.json`, and maps the `exports` field to the actual file path. Fixes module resolution for both `anthropic` and `openai-completions` subpaths. Includes integration test.
23
+
24
+ - **Security: shell injection in test** — Replaced `execSync` with `execFileSync` in the OpenCode session integration test to avoid shell injection risk.
25
+
26
+ ### Security
27
+
28
+ - **Bump `brace-expansion` 5.0.5 5.0.6** Patches minor dependency vulnerability. Fixes `npm audit`. ([#172](https://github.com/apmantza/pi-free/issues/172))
29
+
30
+ ## [2.0.12] - 2026-05-13
31
+
32
+ ### Added
33
+
34
+ - **Novita AI provider** — OpenAI-compatible API at `api.novita.ai/openai/v1` with 100+ open-source models. Non-standard but rich metadata: per-model pricing (`input_token_price_per_m`), context size, max output tokens, reasoning/vision features, and model descriptions. 3 free models, 99 paid.
35
+
36
+ - **FastRouter provider** — OpenRouter-compatible API at `api.fastrouter.ai/api/v1` with 170+ models. Always discovered (no auth needed for model listing). Full pricing, context lengths, and feature metadata. 129 text models (6 free, 123 paid) after filtering image/video. Set `FASTROUTER_API_KEY` for chat completions.
37
+
38
+ - **Dynamic model fetching for OpenCode and OpenRouter** — Pi's built-in providers now get their models fetched dynamically from the API (`opencode.ai/zen/v1/models` and `openrouter.ai/api/v1/models`), same as Mistral, Groq, Cerebras, and xAI. Overwrites Pi's defaults with the full model list. OpenCode uses name-based free detection (API returns no pricing); OpenRouter uses full cost-based detection.
39
+
40
+ - **API key reading from `~/.pi/agent/auth.json`** `getOpencodeApiKey()` and `getOpenrouterApiKey()` now fall back to Pi's auth.json when the env var isn't set, matching how Pi's built-in providers read their keys.
41
+
42
+ ### Changed
43
+
44
+ - **`_pricingKnown` guard in `isFreeModel`** Providers can now signal whether pricing data is authoritative. When `_pricingKnown` is explicitly `false` (API returned no pricing), `isFreeModel` falls back to name-only detection (checks for "free" in the model name). This eliminates false positives where missing pricing data was treated as $0 cost. All affected providers (ZenMux, Together, CrofAI, dynamic-built-in, fetchOpenAICompatibleModels, deepinfra, sambanova, novita) now set this flag correctly.
45
+
46
+ - **All providers now use `isFreeModel` consistently** — Together switched from hardcoded `cost===0` check to `isFreeModel`. DeepInfra and SambaNova switched from manual free lists to `isFreeModel` with proper `_pricingKnown` metadata. NVIDIA, Codestral, and Ollama explicitly documented as free-tier providers (`freeModels = allModels`).
47
+
48
+ - **Unified OpenRouter-based providers** — Kilo, OpenRouter, and Cline now share the same `fetchOpenRouterCompatibleModels` / OpenRouter API logic.
49
+
50
+ ### Removed
51
+
52
+ - **`DEFAULT_MIN_SIZE_B` (30B minimum model size filter)** — Removed from `model-fetcher.ts` and `cline-models.ts`. All models are now shown regardless of parameter count. NVIDIA still uses its own 70B threshold (`NVIDIA_MIN_SIZE_B`).
53
+
54
+ ### Fixed
55
+
56
+ - **ZenMux false free classifications** — Models without `pricings` data (DeepSeek Chat V3.1, Kimi K2 0711, Claude 3.7 Sonnet) were incorrectly classified as free because missing pricing defaulted to $0. Fixed to 3 genuinely free models (down from 6 false positives).
57
+
58
+ - **Together AI, CrofAI, dynamic-built-in missing-pricing false positives** — Same `?? 0` pattern across multiple providers could mark unpriced models as free. All now set `_pricingKnown: false` when pricing is absent from the API response.
59
+
60
+ ## [2.0.10] - 2026-05-08
61
+
62
+ ### Fixed
63
+
64
+ - **Config wipe on JSON parse failure** — `saveConfig` used `loadConfigFile()` which returns `{}` on any parse error, causing `{ ...{}, ...updates }` to write a partial config that permanently destroyed all API keys. Now reads the raw file directly and refuses to save if corrupt. `ensureConfigFile` also refuses to overwrite corrupt files.
65
+
66
+ - **Built-in provider keys removed from pi-free config** — `mistral_api_key`, `groq_api_key`, `cerebras_api_key`, `xai_api_key`, and `hf_token` are no longer in `~/.pi/free.json`. These are pi's own built-in providers; their keys come from environment variables only.
67
+
68
+ ## [2.0.9] - 2026-05-08
69
+
70
+ ### Added
71
+
72
+ - **Together AI provider** — Fast inference on 200+ open-source models (Llama, DeepSeek, Qwen, etc.) through an OpenAI-compatible API. $1 trial credit on signup, no credit card required. Set `TOGETHER_AI_API_KEY`.
73
+
74
+ - **Per-model metadata for Ollama Cloud** — Fetches `/api/show` details for every Ollama Cloud model to detect real capabilities: thinking/vision support, actual context windows (up to 1M tokens), and thinking level maps (`reasoning_effort`). Models now show parameter size and quantization in display names.
75
+
76
+ - **Thinking level maps** Four curated maps (`DEFAULT`, `GPT_OSS`, `QWEN3`, `NO_OFF`) for Ollama Cloud models that map Pi's thinking levels to Ollama's `reasoning_effort` values, based on per-model API testing.
77
+
78
+ - **`/ollama-cloud-refresh` command** Re-fetch Ollama Cloud models from the API and update the provider live, no restart needed.
79
+
80
+ - **Persistent Ollama Cloud cache** — Models cached via `provider-cache.ts` for fast startup. Stale cache auto-refreshes on `session_start`. Fallback models used when cache is unavailable.
81
+
82
+ ### Fixed
83
+
84
+ - **ZenMux pricing** — Fixed `pricings` key (was reading `pricing`, always returned $0). Now correctly extracts per-model pricing (per-million-tokens ÷ 1M). Also uses `display_name`, `input_modalities` (vision detection), and `capabilities.reasoning` from API.
85
+
86
+ - **CrofAI model metadata** — Custom fetch now reads per-model `name`, `custom_reasoning`, `context_length`, `max_completion_tokens`, and per-million-token `pricing` from the API.
87
+
88
+ - **DeepInfra model metadata** — Extracts real model data from the `metadata` sub-object (context_length, max_tokens, pricing, reasoning tags). Filters non-chat models (embedding, rerank, whisper).
89
+
90
+ - **Ollama Cloud model names** — Enriched with parameter size and quantization (e.g., `deepseek-v4-pro (671B, Q4_0)`). Set `supportsDeveloperRole: false` (fixes GLM models silently ignoring prompts). Bumped `maxTokens` from 4096 to 32768.
91
+
92
+ - **SambaNova model accuracy** — `fetchOpenAICompatibleModels` now reads per-model `context_length`, `max_completion_tokens`, and `pricing` from SambaNova's extended API response. Also reads `reasoning`, `input_modalities`, and accepts plain array responses.
93
+
94
+ ### Changed
95
+
96
+ - **Package scope migration** — Updated all peer dependency imports from `@mariozechner/*` to `@earendil-works/*` (`pi-ai`, `pi-coding-agent`, `pi-tui`) to match the upstream scope rename in `@earendil-works/pi` v0.74.0.
97
+
98
+ ## [2.0.8] - 2026-05-07
99
+
100
+ ### Added
101
+
102
+ - **Codestral provider** Mistral's code-focused model via codestral.mistral.ai.
103
+ Free tier (Experiment plan): 2 req/min, 500K tokens/min, 1B tokens/month.
104
+ Uses pi's built-in Mistral SDK (`mistral-conversations` API type).
105
+
106
+ - **LLM7.io provider** — OpenAI-compatible API gateway routing across
107
+ multiple providers (OpenAI, Mistral, Google, DeepSeek, etc.). Free tier:
108
+ default/fast selectors, 100 req/hr, 20 req/min.
109
+
110
+ - **DeepInfra provider** AI inference cloud with 100+ open-source models.
111
+ $5 one-time credit on signup (no credit card). Models fetched dynamically.
112
+ Shown as trial credit provider in `/free-providers`.
113
+
114
+ - **SambaNova provider** — Fast inference on custom RDU hardware with
115
+ OpenAI-compatible API. All models accessible on free tier (no credit card):
116
+ 20-480 RPM. Models include Llama 3.3 70B, DeepSeek-V3/R1, Llama 4 Maverick.
117
+ Shown as freemium provider in `/free-providers`.
118
+
119
+ ### Changed
120
+
121
+ - **Codestral: fixed HTTP 422 error** Switched API type from
122
+ `openai-completions` to `mistral-conversations`. The OpenAI completions
123
+ adapter was sending unrecognized fields (`stream_options`, `store`,
124
+ `max_completion_tokens`) that Mistral's API rejects with 422.
125
+
126
+ ### Fixed
127
+
128
+ - **Toggle commands persist across sessions for all providers** — Providers using
129
+ `setupProvider` (zenmux, crofai, llm7, sambanova, deepinfra) were always
130
+ registering `freeModels` on startup, ignoring the persisted `show_paid` config.
131
+ Now each provider reads its config getter and registers the correct initial
132
+ model set. Fixes #149.
133
+
134
+ ### Security
135
+
136
+ - **Log injection prevention** — `scripts/update-benchmarks.ts` sanitizes external
137
+ API data (CRLF stripping) before logging. Fixes SonarCloud S1075.
138
+
139
+ ### Reliability
140
+
141
+ - **Prefer `String#replaceAll()` over `String#replace()`** Replaced all 7 flagged
142
+ instances. Where regex is unnecessary (2/7), switched to string literal form.
143
+ Fixes SonarCloud S4144.
144
+
145
+ ### Added
146
+
147
+ - **`agents.md`** — Codebase guide for AI agents covering architecture, patterns,
148
+ conventions, testing, and the Pi extension API.
149
+
150
+ ### Added
151
+
152
+ - **Passive quota monitoring** — Extracts rate-limit headers from every
153
+ provider response via `after_provider_response` event (no extra API calls).
154
+ Tries 6 header format variants (`x-ratelimit-remaining`,
155
+ `ratelimit-remaining-requests-day`, etc.). Shows remaining quota in the
156
+ status bar with warning icons when ≤25% or ≤10%. Fixes #147.
157
+
158
+ ### Fixed
159
+
160
+ - **Missing `g` flag on `replaceAll` regexps broke model filtering** —
161
+ `String.prototype.replaceAll()` requires a global RegExp; 20+ patterns in
162
+ `benchmark-lookup.ts` were missing it, causing a `TypeError` that prevented
163
+ models from appearing for providers like cline and kilo. Added `/g` flag to
164
+ all affected patterns. Fixes #151.
165
+
166
+ ### Changed
167
+
168
+ - **Resolved ~280 SonarCloud issues across 21 files** — Bulk code-quality
169
+ cleanup including: stripping trailing zeros from `toFixed()` (S7748),
170
+ `global` → `globalThis` (S7764), `parseFloat` → `Number.parseFloat` (S7773),
171
+ naming unnamed async exports (S7726), `String.raw` for path strings (S7780),
172
+ top-level await over promise chains (S7785), re-export from source (S7763),
173
+ `.at(-1)` over `[length-1]` (S7755), `node:fs` protocol imports (S7772),
174
+ and logging user-controlled data sanitization (S5145). Fixes #148.
175
+
176
+ ### Security
177
+
178
+ - **Bump `basic-ftp` 5.3.0 5.3.1** Patches GHSA-rpmf-866q-6p89 (high
179
+ severity): malicious FTP server could cause client-side DoS via unbounded
180
+ multiline control response buffering. Fixes `npm audit` finding.
181
+
182
+ ### Refactored
183
+
184
+ - **Extracted shared model-fetch helper** `fetchOpenAICompatibleModels()`
185
+ in `lib/util.ts` eliminates ~120 lines of duplicated fetch→parse→map
186
+ boilerplate across CrofAI, DeepInfra, and SambaNova providers.
187
+
188
+ ## [2.0.6] - 2026-05-02
189
+
190
+ ### Security
191
+
192
+ - **5x S5852 regex super-linear runtime** Replaced all flagged regex patterns
193
+ (nested quantifiers in model size extraction) with manual char-by-char string
194
+ parsing in `parseModelSize()`, `normalizeSizeTokenOrder()`, and test helpers.
195
+ Eliminates catastrophic backtracking risk.
196
+
197
+ - **4x S4036 PATH variable security** —
198
+ - `open-browser.ts`: Added `resolveExe()` helper that prefers known absolute
199
+ paths (`/usr/bin/open`, `C:\Windows\System32\...\powershell.exe`) before
200
+ falling back to PATH lookup
201
+ - `check-extensions.mjs`: Removed hardcoded PATH override; resolved `npm` via
202
+ `execFileSync` with known absolute paths
203
+
204
+ - **1x S4721 command injection** — Replaced `execSync` with `execFileSync` in
205
+ `resolveExe()` helper. `execFileSync` takes separate arguments and never
206
+ spawns a shell, eliminating the injection vector.
207
+
208
+ ### Changed
209
+
210
+ - **Banner image** Converted `banner.svg` to `banner.png` for reliable
211
+ rendering across all GitHub surfaces (mobile, email, dark mode readers).
212
+
213
+ ## [2.0.5] - 2026-05-02
214
+
215
+ ### Added
216
+
217
+ - **NVIDIA model probe auto-discovery** — Lazy auto-probe for NVIDIA models on
218
+ first `session_start` (once per session). Broken 404 models detected and
219
+ auto-hidden without requiring manual `/probe-nvidia`.
220
+
221
+ ### Changed
222
+
223
+ - **Ollama provider updates** Improved cloud model detection and configuration.
224
+
225
+ ## [2.0.4] - 2026-05-02
226
+
227
+ ### Fixed
228
+
229
+ - **OpenRouter key resolution no longer falls back to `free.json`**
230
+ `getOpenrouterApiKey()` now only checks the `OPENROUTER_API_KEY` environment variable.
231
+ Previously it fell back to `~/.pi/free.json`, which could contain stale/revoked keys
232
+ that conflict with pi's built-in OpenRouter provider (which reads from
233
+ `~/.pi/agent/auth.json`).
234
+
235
+ - **Removed `openrouter_api_key` from `PiFreeConfig` interface and config template** —
236
+ Prevents future persistence of OpenRouter keys in `free.json`, eliminating the
237
+ source of stale key conflicts for built-in providers.
238
+
239
+ ## [2.0.3] - 2026-05-02
240
+
241
+ ### Added
242
+
243
+ - **Consistent `isFreeModel` helper with Route A/B logic** — Created a unified helper for free model detection that automatically detects whether a provider exposes pricing:
244
+ - **Route A (pricing-exposed)**: Model is free if `cost === 0` OR `"free"` in name (OR logic)
245
+ - **Route B (non-pricing-exposed)**: Model is free only if `"free"` in name
246
+ - Dynamic detection: If ALL models have cost === 0, assumes pricing not exposed → uses Route B
247
+ - If ANY model has cost > 0, assumes pricing exposed → uses Route A
248
+ - All providers (Cline, Kilo, NVIDIA, Ollama, dynamic built-in) now use this consistent helper
249
+
250
+ - **CrofAI provider (PAID)** — Added new **paid** provider for CrofAI (https://crof.ai), an OpenAI-compatible LLM inference API. **Note: CrofAI is a paid provider** — users must have a CrofAI API key with credits. The provider uses Route B detection (name-only) since CrofAI's API doesn't expose per-model pricing. Only models with `"free"` in their names are marked as free (none currently).
251
+
252
+ - **ZenMux provider (PAID)** — Added new **paid** provider for ZenMux AI gateway (https://zenmux.ai), a unified API for 200+ models from OpenAI, Anthropic, Google, etc. **Note: ZenMux is a paid provider** — users must have a ZenMux API key with credits. The provider uses Route A detection (OR logic) since ZenMux exposes pricing. Models marked as free only if `cost === 0` OR `"free"` in name (2 free models identified: GLM 4.7 Flash Free, GLM 4.6v Flash Free).
253
+
254
+ - **Comprehensive `isFreeModel` test suite** — Added 30+ unit tests covering Route A, Route B, freemium behavior, and edge cases. Tests verify correct classification on actual OpenRouter API data (371 models, 30 free).
255
+
256
+ - **Toggle commands for dynamic built-in providers** Added `/toggle-mistral`, `/toggle-groq`,
257
+ `/toggle-cerebras`, `/toggle-xai`, and `/toggle-huggingface` commands. These providers were
258
+ registered with the global toggle system but lacked per-provider toggle commands, making
259
+ free/paid switching inaccessible without editing config files.
260
+
261
+ - **Lazy auto-probe for NVIDIA models** — Extracted `runNvidiaProbe()` into a shared function
262
+ called automatically on first `session_start` (once per session). Previously, users had to
263
+ manually run `/probe-nvidia` to discover 404 models. Now broken models are detected and
264
+ auto-hidden on first use.
265
+
266
+ ### Changed
267
+
268
+ - **Cline provider now uses `isFreeModel`** Fixed Cline to use the consistent `isFreeModel` helper instead of `m.cost.input === 0`. Previously used cost-only filtering, now uses proper OR logic for pricing-exposed providers.
269
+
270
+ - **NVIDIA test expectations updated** — Updated tests to reflect strict Route B behavior (name-only detection for non-pricing-exposed providers). Added test for models with `"free"` in name being marked as free.
271
+
272
+ ### Fixed
273
+
274
+ - **`provider-factory.ts` — `beforeProviderRequest` hook now scoped to owning provider**
275
+ The hook was firing for **all** provider requests regardless of which provider the factory
276
+ was configuring. Now checks `evt.provider !== def.providerId` and returns early if the
277
+ event doesn't belong to the owning provider.
278
+
279
+ - **`provider-factory.ts` `reRegister` callback no longer corrupts stored model lists** —
280
+ When toggling between free/paid modes, the callback was overwriting `stored.all` with only
281
+ the filtered subset, losing the original full model list. Now preserves the original model
282
+ lists for correct subsequent toggling.
283
+
284
+ - **`lib/types.ts` Removed leftover `LspTestInterface`** — Removed a test interface that
285
+ was left in production code.
286
+
287
+ - **`index.ts` — Removed redundant `.catch()` on deprecated Qwen provider** — The `.catch()`
288
+ was unnecessary since `Promise.allSettled` already handles rejections.
289
+
290
+ ### Removed
291
+
292
+ - **Qwen provider (deprecated)** — Removed Qwen OAuth provider as the 1,000 req/day free tier is no longer available. Provider remains functional for existing authenticated users but new free tier registrations are not supported.
293
+
294
+ - **Modal provider** — Removed single-model Modal provider (only had GLM-5.1 FP8). Users should use other providers for GLM models.
295
+
296
+ - **Cloudflare provider** — Removed Cloudflare Workers AI provider as it's now built into pi core. Users can use pi's built-in Cloudflare provider instead.
297
+
298
+ - **Qwen test file** — Removed `tests/qwen.test.ts` along with the deprecated provider.
299
+
300
+ ## [2.0.2] - 2026-04-26
301
+
302
+ ### Added
303
+
304
+ - **Model matching debug logging** Added `~/.pi/modelmatch.log` to diagnose which models get Coding Index scores and which don't:
305
+ - Logs every matching attempt with provider, model ID, normalization strategy, and result
306
+ - CSV-like format: `timestamp|provider|modelId|modelName|action|strategy|normalizedId|matchKey|codingIndex|details`
307
+ - Provider-specific normalizers for better matching:
308
+ - **NVIDIA**: Strips vendor prefixes (`meta/`, `mistralai/`, `microsoft/`, `qwen/`, etc.)
309
+ - **Cloudflare**: Strips `@cf/namespace/` prefixes
310
+ - **Groq**: Removes `-versatile` and numeric context suffixes (`-32768`)
311
+ - **Cerebras**: Normalizes `llama3.1` `llama-3.1`, auto-adds `instruct` suffix
312
+ - **Mistral**: Strips `-latest` suffix
313
+ - **Ollama**: Converts `model:tag` → `model-tag`
314
+ - Common suffix stripping: `:free`, date codes (`-20250514`), versions (`-v1.1`), `-it`, `-fp8`/`-bf16`
315
+
316
+ - **Enhanced benchmark lookup** — `enhanceModelNameWithCodingIndex()` now accepts optional `provider` parameter for provider-aware normalization
317
+
318
+ - **Static 404 model blocklist for NVIDIA** — Probed all 136 models from `integrate.api.nvidia.com/v1/models` and identified 57 that return 404 "Function not found" on `/v1/chat/completions`. These are now hard-filtered so they never appear in the model selector:
319
+ - Covers discontinued models (`databricks/dbrx-instruct`, `meta/codellama-70b`, `meta/llama2-70b`, `ibm/granite-*`, etc.)
320
+ - Covers embedding-only models listed as chat-capable (`nvidia/nv-embed-v1`, `nvidia/nv-embedqa-*`, `snowflake/arctic-embed-l`, etc.)
321
+ - Covers stale API catalog entries (`mistralai/mistral-large`, `mistralai/mistral-large-2-instruct`, `writer/palmyra-*`, etc.)
322
+ - Full list in `NVIDIA_KNOWN_404_MODELS` in `providers/nvidia/nvidia.ts`
323
+
324
+ - **`/probe-nvidia` command** — On-demand model health check. Tests every registered NVIDIA model with a minimal `max_tokens: 1` request, auto-hides any new 404s in `~/.pi/free.json`, and re-registers the provider immediately.
325
+
326
+ - **`scripts/probe-nvidia.mjs`** Standalone Node.js script to reproduce the probe. Reads `~/.pi/free.json` for the API key, batches 20 requests at a time with 10s timeout, and prints all broken model IDs for adding to the blocklist.
327
+
328
+ - **Ollama Cloud 403 handling** Same pattern as NVIDIA 404s for Ollama Cloud:
329
+ - `OLLAMA_KNOWN_403_MODELS` blocklist for models that return 403 "access denied"
330
+ - `/probe-ollama` command to test all models on-demand, auto-hide broken ones, and re-register
331
+ - `scripts/probe-ollama.mjs` standalone script for blocklist maintenance
332
+
333
+ - **Provider-scoped hidden models** — Hidden models are now provider-specific:
334
+ - Format: `"provider/model-id"` (e.g., `"ollama/kimi-k2.6"`, `"nvidia/broken-model"`)
335
+ - A model hidden from one provider doesn't hide it from other providers
336
+ - Backward compatible with old global `"model-id"` format
337
+ - All providers updated: NVIDIA, Ollama, Cloudflare, Cline, Kilo, Modal
338
+
339
+ ### Fixed
340
+
341
+ - **Probe commands timeout handling** — Added `fetchWithTimeout` with 10-second timeout to `/probe-nvidia` and `/probe-ollama` commands. Prevents the coding harness from freezing when individual model probe requests hang indefinitely.
342
+
343
+ - **NVIDIA provider now sends `authHeader: true`** — Explicitly enables `Authorization: Bearer` header injection. Previously relied on pi's implicit behavior which could fail in some configurations.
344
+
345
+ ### Removed
346
+
347
+ - **NVIDIA 404 model warning log** Removed the `console.warn("[nvidia] Skipping known 404 model: ...")` output when filtering out known broken models. The filter still works silently; use `/probe-nvidia` to identify new 404s if needed.
348
+
349
+ ### Changed
350
+
351
+ - **Cloudflare provider now fetches models dynamically** Replaced static 19-model hardcoded list with live API fetch from `api.cloudflare.com/client/v4/accounts/{account_id}/ai/models`:
352
+ - Automatically discovers all 30+ text generation models (was manually maintaining 19)
353
+ - Smart filtering excludes embeddings, image generation, speech, translation, and vision-only models via regex patterns
354
+ - Metadata inference from model IDs: detects vision (`vision`/`multimodal`), reasoning (`r1`/`thinking`/`qwq`), context windows, and estimated costs
355
+ - Fixed Mistral Small ID: changed from incorrect `@cf/mistralai/...` to correct `@cf/mistral/...`
356
+ - Added new fallback models: Kimi K2.6, OpenAI GPT-OSS 120B/20B, Qwen 2.5 Coder 32B, QwQ 32B, Llama 3.2 11B Vision
357
+ - Graceful fallback to expanded 18-model hardcoded list if API fetch fails
358
+
359
+ - **NVIDIA provider now queries NVIDIA's API directly** — Source of truth switched from `models.dev` curated JSON to `https://integrate.api.nvidia.com/v1/models`:
360
+ - Eliminates 57 missing models and 25 stale entries from the old third-party source
361
+ - Models not in `models.dev` get inferred metadata (128k context, 4k output, vision/reasoning heuristics)
362
+ - Added regex-based non-chat model filtering for unknown models (embeddings, whisper, reward models, safety guards, parsers, detectors, etc.)
363
+ - Graceful fallback to `models.dev` if NVIDIA API is unreachable
364
+ - Removed paid/free toggle filtering NVIDIA is freemium (all models use free credits)
365
+
366
+ ## [2.0.1] - 2026-04-24
367
+
368
+ ### Added
369
+
370
+ - **Built-in provider toggle support** (`lib/built-in-toggle.ts`) — Enables free/paid filtering for Pi's built-in providers that expose per-model pricing:
371
+ - **OpenCode (`/toggle-opencode`)** — Captures built-in OpenCode models on session start and filters to free-only by default
372
+ - **OpenRouter (`/toggle-openrouter`)** — Now uses the built-in toggle system for consistency
373
+ - Toggle works in the current session (no restart needed)
374
+ - Persisted via `opencode_show_paid` and `openrouter_show_paid` in `~/.pi/free.json`
375
+
376
+ ### Changed
377
+
378
+ - **OpenRouter moved to built-in toggle system** — OpenRouter is now handled by `lib/built-in-toggle.ts` alongside OpenCode for a unified approach:
379
+ - Removed from `providers/dynamic-built-in/index.ts`
380
+ - Eliminated duplicate toggle command registration logic
381
+ - Consolidated toggle persistence with other built-in providers
382
+
383
+ - **Standardized all toggle commands to `toggle-{provider}`** Renamed from `{provider}-toggle` for consistency:
384
+ - `/kilo-toggle` `/toggle-kilo`
385
+ - `/cline-toggle` `/toggle-cline`
386
+ - `/openrouter-toggle` → `/toggle-openrouter`
387
+ - `/nvidia-toggle` → `/toggle-nvidia`
388
+ - `/cloudflare-toggle` → `/toggle-cloudflare`
389
+ - `/ollama-toggle` `/toggle-ollama`
390
+ - `/mistral-toggle` `/toggle-mistral`
391
+ - `/groq-toggle` `/toggle-groq`
392
+ - `/cerebras-toggle` `/toggle-cerebras`
393
+ - `/toggle-opencode` (new)
394
+
395
+ ### Fixed
396
+
397
+ - **Ollama Cloud model fetching endpoint** Corrected the `/v1/models` `/models` endpoint path in `providers/ollama/ollama.ts`:
398
+ - The previous fix (2.0.0) incorrectly used `/v1/models`; Ollama Cloud's models endpoint is `/v1/models` for chat completions but `/models` for listing
399
+ - This ensures model fetching works correctly with the OpenAI-compatible API
400
+
401
+ ### Removed
402
+
403
+ - **Global `/free` command** — Removed the global free-only toggle. Per-provider toggles (`/toggle-{provider}`) are now the only way to switch between free and paid models. The `/free-providers` status command remains.
404
+
405
+ ## [2.0.0] - 2026-04-23
406
+
407
+ ### Breaking Changes
408
+
409
+ - **Removed Fireworks provider** — Fireworks is now a built-in Pi provider (added in pi 0.68.1), so the extension's Fireworks provider has been removed to avoid conflicts:
410
+ - Deleted `providers/fireworks/fireworks.ts` and `tests/fireworks.test.ts`
411
+ - Removed all Fireworks configuration options from `config.ts` (`fireworks_api_key`, `fireworks_show_paid`)
412
+ - Users should now use Pi's built-in Fireworks support with `FIREWORKS_API_KEY`
413
+
414
+ - **Renamed Ollama provider to `ollama-cloud`**Changed provider ID from `"ollama"` to `"ollama-cloud"` to avoid collision with Pi's built-in local Ollama provider:
415
+ - This prevents provider ID conflicts when both are registered
416
+ - All log messages and documentation now reference "Ollama Cloud"
417
+
418
+ ### Removed
419
+
420
+ - **Dropped `@sinclair/typebox` peer dependency** — Pi 0.69.0 migrated from `@sinclair/typebox` to `typebox` 1.x. The extension didn't directly import this package, so it was removed from `peerDependencies` to avoid potential conflicts.
421
+
422
+ ### Fixed
423
+
424
+ - **Ollama Cloud API endpoint**Fixed broken Ollama Cloud integration:
425
+ - Changed `BASE_URL_OLLAMA` from `https://ollama.com` to `https://ollama.com/v1` — the OpenAI-compatible API endpoint
426
+ - Fixed model fetching to use `/v1/models` instead of `/api/tags` — ensures model IDs work with chat completions endpoint
427
+ - Previously calls went to HTML homepage instead of API endpoints, causing 404 errors
428
+
429
+ ### Removed
430
+
431
+ - **Removed paid model warning on selection** — Deleted the `model_select` event handler that showed:
432
+ - `⚠️ Paid model selected (${model.id}). Use "/free off" to enable paid models.`
433
+ - This warning was redundant since the global `/free` toggle and provider toggles already control model visibility
434
+
435
+ - **Removed pointless `/modal-toggle` command** — Modal provider only has 1 free model (GLM-5.1 FP8), so there was nothing meaningful to toggle:
436
+ - Added `skipToggle` option to `ProviderDefinition` and `ProviderSetupConfig` interfaces
437
+ - Modal provider now sets `skipToggle: true` to prevent toggle command creation
438
+
439
+ ### Changed
440
+
441
+ - **Marked Qwen provider as fully deprecated** — Updated messaging to clarify the provider is broken:
442
+ - Changed model name from `"Qwen Coder — Free 1k/day"` to `"Qwen Coder — DEPRECATED (free tier discontinued)"`
443
+ - Updated all JSDoc comments to clearly state auth is broken and free tier is no longer available
444
+ - Provider remains for backward compatibility but should not be used
445
+
446
+ ### Added
447
+
448
+ - **Cloudflare Workers AI provider** — New provider for Cloudflare's serverless GPU platform:
449
+ - 50+ open-source models: Llama 4, Mistral Small 3.1, Qwen 2.5/3, DeepSeek R1, Gemma 4, Kimi K2.5/2.6, and more
450
+ - **10,000 Neurons/day FREE tier** (resets daily at 00:00 UTC)
451
+ - **$0.011 per 1,000 Neurons** beyond free allocation
452
+ - Only requires `CLOUDFLARE_API_TOKEN` account ID auto-derived from token
453
+ - Toggle with `/cloudflare-toggle`
454
+ - Create token at https://dash.cloudflare.com/profile/api-tokens
455
+
456
+ - **Unified dynamic built-in providers module** New `providers/dynamic-built-in/` module that dynamically fetches models from Pi's built-in providers when users have API keys:
457
+ - **Mistral** (`MISTRAL_API_KEY`) — Fetches from `api.mistral.ai/v1/models`
458
+ - **Groq** (`GROQ_API_KEY`) — Fetches from `api.groq.com/openai/v1/models`
459
+ - **Cerebras** (`CEREBRAS_API_KEY`) — Fetches from `api.cerebras.ai/v1/models`
460
+ - **xAI** (`XAI_API_KEY`) Fetches from `api.x.ai/v1/models`
461
+ - **Hugging Face** (`HF_TOKEN` optional) Fetches public + authenticated models
462
+ - **OpenRouter** — Moved from `index.ts` to unified module with dynamic fetch
463
+ - All integrate with global `/free` toggle and have per-provider toggle commands (`/mistral-toggle`, `/groq-toggle`, etc.)
464
+
465
+ - **Global `/free` toggle system** — New centralized free/paid filtering across ALL providers:
466
+ - `/free on/off/status` — Toggle free-only view globally
467
+ - `/free-providers` — Show free/paid model counts by provider
468
+ - `FREE_ONLY` config option and `PI_FREE_ONLY` environment variable
469
+ - Providers register via `registerWithGlobalToggle()` for unified filtering
470
+
471
+ ### Fixed
472
+
473
+ - **Toggle commands now actually filter models from UI** — Previously, toggle commands only showed notifications but didn't remove paid models from the model picker:
474
+ - **OpenRouter (`/openrouter-toggle`)**: Now uses `registerProvider`/`unregisterProvider` to actually filter models from the picker UI
475
+ - **NVIDIA (`/nvidia-toggle`)**: Added dynamic `showPaid` parameter to `fetchNvidiaModels()` so toggle properly switches between free and paid model sets
476
+ - **Fireworks**: Removed broken toggle command — all models are paid with no free tier, so there was nothing to toggle
477
+
478
+ ### Added
479
+
480
+ - **OpenRouter per-provider free model toggle** Added `/openrouter-toggle` command for the built-in OpenRouter provider:
481
+ - `/openrouter-toggle` — Switch between showing only free models vs all models (including paid)
482
+ - New config flag `openrouter_show_paid` in `~/.pi/free.json` (default: `false`)
483
+ - Environment variable: `OPENROUTER_SHOW_PAID=true` to show paid models by default
484
+ - This brings OpenRouter (a built-in pi provider) in line with extension providers that have per-provider toggles
485
+
486
+ ### Deprecated
487
+
488
+ - **Qwen provider** — The 1,000 requests/day free tier is no longer available from Qwen/DashScope. The provider code remains for backward compatibility but is now deprecated:
489
+ - Added `@deprecated` JSDoc tags to all Qwen-related exports
490
+ - Added deprecation warning when Qwen provider loads
491
+ - Added warning when `QWEN_SHOW_PAID` config is used
492
+ - Consider migrating to other free providers: Kilo, Cline, NVIDIA, or Modal
493
+
494
+ ### Added
495
+
496
+ - **Go provider** — OpenCode Go subscription gateway (⚠️ paid only — $5 first month, then $10/month, no free tier) with models: GLM-5, Kimi K2.5, MiMo-V2-Pro, MiMo-V2-Omni, MiniMax M2.7, MiniMax M2.5
497
+ - Set `OPENCODE_GO_API_KEY` or `opencode_go_api_key` in `~/.pi/free.json`
498
+ - Toggle with `/go-toggle`
499
+
500
+ ### Fixed
501
+
502
+ - **All providers now show Coding Index scores in model selector** — Added `enhanceWithCI()` to factory-based providers (nvidia, fireworks, mistral, modal, ollama) and cline. Now all providers display CI scores in `/models` command (pi-models extension).
503
+
504
+ - **All providers now show in `--list-models`** — Providers (zen, openrouter, go) that registered models only in `session_start` were missing from `pi --list-models` which runs before session starts. Added immediate registration for these providers:
505
+ - **zen**: Added model caching to `~/.pi/provider-cache.json` for immediate registration + dynamic refresh
506
+ - **openrouter**: Immediate model registration at extension load (like kilo/cline)
507
+ - **go**: Immediate registration with static model list (no API to fetch from)
508
+ - All 11 providers now visible in `--list-models`
509
+
510
+ ### Changed
511
+
512
+ - Updated README with clear free vs paid provider distinction (9 free + 2 paid-only: Go, Fireworks)
513
+ - Added Go and Fireworks provider documentation under new "💳 Paid-Only Providers" section
514
+ - Added `opencode_go_api_key` to config file template
515
+ - Updated package.json description and keywords to include all 11 providers
516
+
517
+ ### Added
518
+
519
+ - **Provider model cache** (`lib/provider-cache.ts`) New utility for caching provider model lists to `~/.pi/provider-cache.json`. Used by zen provider for faster startup and offline access after first successful fetch.
520
+
521
+ ## [1.0.9] - 2026-04-14
522
+
523
+ ### Fixed
524
+
525
+ - **Qwen OAuth breaks other OAuth providers** — `modifyModels` receives all models across every registered provider, not just Qwen's. The previous `map()` stamped the Qwen dashscope `baseUrl` onto every model, causing other OAuth providers (Kilo, OpenRouter, etc.) to return 404 after a `/login qwen` flow. Now only models with `provider === PROVIDER_QWEN` are patched; others pass through unchanged.
526
+
527
+ ## [1.0.8] - 2026-04-13
528
+
529
+ ### Added
530
+
531
+ - **Modal provider** — Free access to GLM-5.1 FP8 (128k context, 16k max output) during promotional period (free until April 30, 2026)
532
+ - Requires a free Modal API key (`MODAL_API_KEY` or `modal_api_key` in `~/.pi/free.json`)
533
+ - Model: `zai-org/GLM-5.1-FP8` 128k context window, 16k max output tokens
534
+ - **Qwen provider** — Free access to Qwen Coder (1,000 requests/day) via OAuth device flow
535
+ - Run `/login qwen` to authenticate through Qwen Studio (chat.qwen.ai)
536
+ - Uses `coder-model` alias (maps to Qwen3.6-Plus on the backend)
537
+ - 131k context window, 16k max output tokens, zero cost
538
+
539
+ ### Fixed
540
+
541
+ - **Qwen OAuth browser launch on Windows** — URLs with `&` query params were truncated by `cmd.exe`'s `&` command separator; switched to `powershell.exe Start-Process` which passes the URL as a literal string
542
+ - **Qwen API endpoint** — Replicates qwen-code's `getCurrentEndpoint()` logic: uses `resource_url` from OAuth token response (`dashscope.aliyuncs.com` for Chinese accounts, `portal.qwen.ai` for international), with fallback to `dashscope.aliyuncs.com/compatible-mode/v1`
543
+ - **Qwen DashScope headers** — Added all headers required by DashScope's OpenAI-compatible API: `X-DashScope-AuthType: qwen-oauth`, `X-DashScope-CacheControl: enable`, `X-DashScope-UserAgent`, `Client-Code: QwenCode`
544
+ - **Qwen modifyModels crash** `modifyModels` must be synchronous; making it async caused the pi framework to receive a `Promise` instead of a `Model[]`, breaking `ModelRegistry.find()`
545
+
546
+ ## [1.0.5] - 2025-04-03
547
+
548
+ ### Fixed
549
+
550
+ - **NVIDIA provider non-chat model filtering** (comment/implementation mismatch)
551
+ - Added modalities-based filtering to exclude embedding, speech-to-text, OCR, and image-gen models
552
+ - Filters models where `output` is not `["text"]` (e.g., image generation like `black-forest-labs/flux.1-dev`)
553
+ - Filters models where `input` lacks `"text"` (e.g., OCR like `nvidia/nemoretriever-ocr-v1`, speech-to-text like `openai/whisper-large-v3`)
554
+ - Updated file comment to accurately describe the filtering behavior
555
+ - Added 8 comprehensive unit tests for model filtering logic
556
+
557
+ ## [1.0.4] - 2025-04-03
558
+
559
+ ### Fixed
560
+
561
+ - **All tests now passing** (127/127)
562
+ - Fixed mock paths in kilo.test.ts, zen.test.ts, ollama.test.ts
563
+ - Fixed createCtxReRegister mocks in zen.test.ts and openrouter.test.ts
564
+ - Fixed cline.test.ts to test actual provider re-registration behavior
565
+ - Added missing DEFAULT_MIN_SIZE_B constant to openrouter mock
566
+
567
+ ### Changed
568
+
569
+ - **Code quality improvements**
570
+ - Refactored usage modules to break circular dependency (limits.ts formatters.ts)
571
+ - Created usage/types.ts with shared interfaces (FreeTierLimit, FreeTierUsage)
572
+ - Bumped version to 1.0.4
573
+
574
+ ## [1.0.3] - 2025-04-03
575
+
576
+ ### Changed
577
+
578
+ - Updated package.json metadata (name, description, keywords, repository URL)
579
+ - Updated .npmignore for cleaner publishes
580
+
581
+ ## [1.0.0] - 2024-03-28
582
+
583
+ ### Added
584
+
585
+ - Initial release with 6 providers: Kilo, Zen, OpenRouter, NVIDIA, Cline, Fireworks
586
+ - Free tier usage tracking across all sessions
587
+ - Provider failover with model hopping
588
+ - Autocompact integration for rate limit recovery
589
+ - Usage widget with glimpseui
590
+ - Command toggles for free/all model filtering
591
+ - Hardcoded benchmark data from Artificial Analysis
592
+
593
+ ### Changed
594
+
595
+ - **Major refactoring**: Split free-tier-limits.ts into usage/\* modules
596
+ - usage/tracking.ts - runtime session tracking
597
+ - usage/cumulative.ts - persistent storage
598
+ - usage/formatters.ts - display formatting
599
+ - 77% line reduction (741 → 166 lines)
600
+ - **Major refactoring**: Split usage-widget.ts into widget/\* modules
601
+ - widget/data.ts - data collection
602
+ - widget/format.ts - formatting utilities
603
+ - widget/render.ts - HTML generation
604
+ - 74% line reduction (~350 → 90 lines)
605
+ - **Refactoring**: Extracted functions from cline-auth.ts
606
+ - fetchAuthorizeUrl() - auth URL fetching
607
+ - waitForAuthCode() - callback handling
608
+ - exchangeCodeForTokens() - token exchange
609
+ - parseManualInput() - manual input parsing
610
+ - **Refactoring**: Simplified model-hop.ts complexity
611
+ - Extracted handleDowngradeDecision()
612
+ - Extracted tryAlternativeModel()
613
+ - **Deduplication**: Created shared modules
614
+ - lib/json-persistence.ts - file I/O with caching
615
+ - lib/logger.ts - structured logging
616
+ - providers/model-fetcher.ts - OpenRouter-compatible fetching
617
+ - Replaced ~30 console.log statements with structured logging
618
+ - Fixed all 9 pre-existing test failures
619
+ - fetchWithRetry now throws after last retry
620
+ - Fixed auth pattern matching (added key.*not.*valid)
621
+ - Updated capability ranking tests
622
+ - Added resetUsageStats() for test isolation
623
+
624
+ ### Fixed
625
+
626
+ - fetchWithRetry() now properly throws after exhausting retries
627
+ - Auth error pattern matching now handles more message variants
628
+ - Test isolation for free-tier-limits tests