pi-free 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,393 +1,548 @@
1
- # pi-free-providers
2
-
3
- Free AI model providers for [Pi](https://pi.dev). Access **free models** from multiple providers in one install.
4
-
5
- ---
6
-
7
- ## What does pi-free do
8
-
9
- **pi-free is a Pi extension that unlocks free AI models from multiple providers.**
10
-
11
- When you install pi-free, it:
12
-
13
- 1. **Registers free-tier providers** with Pi's model picker — Kilo, Cline, NVIDIA, Cloudflare, Modal, Ollama Cloud, and more
14
-
15
- 2. **Fetches models dynamically** for Pi's built-in providers when API keys are configured — Mistral, Groq, Cerebras, xAI, Hugging Face, OpenRouter
16
-
17
- 3. **Filters to show only free models by default** for providers that expose pricing — You see only the models that cost $0 to use. Paid models are hidden until you explicitly toggle them on.
18
-
19
- 4. **Provides per-provider toggle commands** — Run `/toggle-{provider}` (e.g., `/toggle-kilo`, `/toggle-opencode`) to switch between free-only mode and showing all models including paid ones
20
-
21
- 5. **Handles authentication for you** — OAuth flows (Kilo, Cline) open your browser automatically; API keys are read from `~/.pi/free.json` or environment variables
22
-
23
- 6. **Adds Coding Index scores** — Model names include a coding benchmark score (CI: 45.2) to help you pick capable coding models at a glance
24
-
25
- 7. **Persists your preferences** — Your toggle choices (free vs all models) are saved to `~/.pi/free.json` and remembered across Pi restarts
26
-
27
- ---
28
-
29
- ## How to use
30
-
31
- ### 1. Install the extension
32
-
33
- ```bash
34
- pi install git:github.com/apmantza/pi-free
35
- ```
36
-
37
- ### 2. Open the model picker
38
-
39
- Start Pi and press `Ctrl+L` to open the model picker.
40
-
41
- Free models are shown by default — look for the provider prefixes:
42
-
43
- **✅ Offers Free Models (no usage limits, no payment required):**
44
- - `opencode/` — OpenCode models (no setup required; toggle with `/toggle-opencode`)
45
- - `kilo/` — Kilo models (free models available immediately, more after `/login kilo`)
46
- - `openrouter/` — OpenRouter models (free account required)
47
- - `cline/` — Cline models (run `/login cline` to use)
48
-
49
- **🔄 Freemium (free tier with limits, then paid):**
50
- - `nvidia/` NVIDIA NIM models (1,000 free requests/month, then credits)
51
- - `cloudflare/` — Cloudflare Workers AI (10K Neurons/day free tier, then $0.011/1K Neurons)
52
- - `modal/` — GLM-5.1 FP8 via Modal (free promotional period until April 30, 2026)
53
- - `ollama-cloud/` — Ollama Cloud models (usage-based free tier, resets every 5 hours + 7 days)
54
-
55
- **🔧 Dynamic API Providers (fetched when API key configured):**
56
- - `mistral/` — Mistral models (when `MISTRAL_API_KEY` set)
57
- - `groq/` Groq models (when `GROQ_API_KEY` set)
58
- - `cerebras/` — Cerebras models (when `CEREBRAS_API_KEY` set)
59
- - `xai/` — xAI models (when `XAI_API_KEY` set)
60
- - `huggingface/` — Hugging Face models (when `HF_TOKEN` set)
61
-
62
- **Note:** Fireworks is now a [built-in Pi provider](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/CHANGELOG.md#0681---2026-04-22) no extension needed. Set `FIREWORKS_API_KEY` to use it directly.
63
-
64
- ### 3. Toggle between free and paid models
65
-
66
- Want to see paid models too? Run the toggle command for your provider:
67
-
68
- ```
69
- /toggle-opencode # Toggle OpenCode (✅ offers free models)
70
- /toggle-kilo # Toggle Kilo (✅ offers free models)
71
- /toggle-openrouter # Toggle OpenRouter (✅ offers free models)
72
- /toggle-cline # Toggle Cline (✅ offers free models)
73
- /toggle-nvidia # Toggle NVIDIA (🔄 freemium)
74
- /toggle-cloudflare # Toggle Cloudflare (🔄 freemium)
75
- /toggle-ollama # Toggle Ollama Cloud (🔄 freemium)
76
- /toggle-mistral # Toggle Mistral (🔧 dynamic - needs API key)
77
- /toggle-groq # Toggle Groq (🔧 dynamic - needs API key)
78
- /toggle-cerebras # Toggle Cerebras (🔧 dynamic - needs API key)
79
- ```
80
-
81
- **Notes:**
82
- - **Toggle commands are mainly for ✅ and 🔄 providers** — to switch between "free models only" vs "show paid models too"
83
- - **🔧 Dynamic providers** show all fetched models by default — the toggle filters the list when you have an API key configured
84
- - **Freemium providers** show all models by default; you manage your usage limits via their dashboards
85
-
86
- You'll see a notification like: `opencode: showing free models` or `opencode: showing all models`
87
-
88
- ### 4. Add API keys for more providers (optional)
89
-
90
- Some providers require a free account or API key.
91
-
92
- **The first time you run Pi after installing this extension, a config file is automatically created:**
93
- - **Linux/Mac:** `~/.pi/free.json`
94
- - **Windows:** `%USERPROFILE%\.pi\free.json`
95
-
96
- Add your API keys to this file:
97
-
98
- ```json
99
- {
100
- "openrouter_api_key": "sk-or-v1-...",
101
- "nvidia_api_key": "nvapi-...",
102
- "cloudflare_api_token": "...",
103
- "ollama_api_key": "...",
104
- "mistral_api_key": "...",
105
- "modal_api_key": "sk-modal-..."
106
- }
107
- ```
108
-
109
- Or set environment variables instead (same names, uppercase: `OPENROUTER_API_KEY`, `NVIDIA_API_KEY`, etc.)
110
-
111
- See the [Providers That Need Authentication](#providers-that-need-authentication) section below for detailed setup instructions per provider.
112
-
113
- ### 5. Quick commands reference
114
-
115
- | Command | What it does |
116
- |---------|-------------|
117
- | `/toggle-{provider}` | Switch between free-only and all models for that provider |
118
- | `/free-providers` | Show free/paid model counts for all providers |
119
- | `/login kilo` | Start OAuth flow for Kilo |
120
- | `/login cline` | Start OAuth flow for Cline |
121
- | `/logout kilo` | Clear Kilo OAuth credentials |
122
- | `/logout cline` | Clear Cline OAuth credentials |
123
-
124
- ---
125
-
126
- ## Using Free Models (No Setup Required)
127
-
128
- ### OpenCode
129
-
130
- Works immediately with zero setup:
131
-
132
- 1. Press `Ctrl+L`
133
- 2. Search for `opencode/`
134
- 3. Pick any model (e.g., `opencode/big-pickle`)
135
- 4. Start chatting
136
-
137
- No account, no API key, no OAuth. Run `/toggle-opencode` to switch between free and paid OpenCode models.
138
-
139
- ### Kilo (free models, more after login)
140
-
141
- Kilo shows free models immediately. To unlock all models, authenticate with Kilo's free OAuth:
142
-
143
- ```
144
- /login kilo
145
- ```
146
-
147
- This command will:
148
- 1. Open your browser to Kilo's authorization page
149
- 2. Show a device code in Pi's UI
150
- 3. Wait for you to authorize in the browser
151
- 4. Automatically complete login once approved
152
-
153
- - No credit card required
154
- - Free tier: 200 requests/hour
155
- - After login, run `/toggle-kilo` to switch between free-only and all models
156
-
157
- ### Cline (free account)
158
-
159
- Cline models appear immediately in the model picker. To use them, authenticate with Cline's free account:
160
-
161
- ```
162
- /login cline
163
- ```
164
-
165
- This command will:
166
- 1. Open your browser to Cline's sign-in page
167
- 2. Wait for you to complete sign-in
168
- 3. Automatically complete login once approved
169
-
170
- - Free account required (no credit card)
171
- - Uses local ports 48801-48811 for OAuth callback
172
-
173
- ---
174
-
175
- ## Providers That Need Authentication
176
-
177
- Some providers require a free account or API key to access their free tiers.
178
-
179
- ---
180
-
181
- ### 🆓 Free Providers
182
-
183
- ### OpenRouter (free models available)
184
-
185
- Get a free API key at [openrouter.ai/keys](https://openrouter.ai/keys), then either:
186
-
187
- **Option A: Environment variable**
188
- ```bash
189
- export OPENROUTER_API_KEY="sk-or-v1-..."
190
- ```
191
-
192
- **Option B: Config file** (`~/.pi/free.json`)
193
- ```json
194
- {
195
- "openrouter_api_key": "sk-or-v1-..."
196
- }
197
- ```
198
-
199
- Then use `/toggle-openrouter` to switch between free-only and all models.
200
-
201
- ### NVIDIA NIM (Free Credits System)
202
-
203
- NVIDIA provides **free monthly credits** (1000 requests/month) at [build.nvidia.com](https://build.nvidia.com).
204
-
205
- **Important:** Models have different "costs" per token:
206
- - **Zero-cost models**: Don't consume your credit balance (shown by default)
207
- - **Credit-costing models**: Consume credits faster (hidden by default)
208
-
209
- Get your API key and optionally enable all models:
210
-
211
- **Option A: Show only free models (default)**
212
- ```bash
213
- export NVIDIA_API_KEY="nvapi-..."
214
- ```
215
- Uses only zero-cost models → your 1000 credits last the full month
216
-
217
- **Option B: Show all models (uses credits faster)**
218
- ```bash
219
- export NVIDIA_API_KEY="nvapi-..."
220
- export NVIDIA_SHOW_PAID=true
221
- ```
222
-
223
- Or in `~/.pi/free.json`:
224
- ```json
225
- {
226
- "nvidia_api_key": "nvapi-...",
227
- "nvidia_show_paid": true
228
- }
229
- ```
230
-
231
- Toggle anytime with `/toggle-nvidia`
232
-
233
- ### Cloudflare Workers AI (10K Neurons/day Free Tier)
234
-
235
- Cloudflare provides **50+ open-source AI models** with a generous free tier:
236
- - **10,000 Neurons per day FREE** (resets daily at 00:00 UTC)
237
- - **$0.011 per 1,000 Neurons** beyond the free allocation
238
-
239
- Get your API token at [dash.cloudflare.com/profile/api-tokens](https://dash.cloudflare.com/profile/api-tokens):
240
- 1. Create a token with "Cloudflare AI" → "Read" permission
241
- 2. Or use "My Account" → "Read" for broader access
242
-
243
- **Setup:**
244
- ```bash
245
- export CLOUDFLARE_API_TOKEN="your_token_here"
246
- ```
247
-
248
- The account ID is automatically derived from your token. Optionally, you can also set:
249
- ```bash
250
- export CLOUDFLARE_ACCOUNT_ID="your_account_id" # Optional
251
- ```
252
-
253
- **Models available:** Llama 4, Mistral Small 3.1, DeepSeek R1, Gemma 4, Kimi K2.5/2.6, and more.
254
-
255
- Toggle with `/toggle-cloudflare`
256
-
257
- ### Modal (GLM-5.1 FP8 — free promotional period until April 30, 2026)
258
-
259
- Modal hosts GLM-5.1 FP8 with a free promotional period. Get an API key at [modal.com](https://modal.com), then:
260
-
261
- **Option A: Environment variable**
262
- ```bash
263
- export MODAL_API_KEY="sk-modal-..."
264
- ```
265
-
266
- **Option B: Config file** (`~/.pi/free.json`)
267
- ```json
268
- {
269
- "modal_api_key": "sk-modal-..."
270
- }
271
- ```
272
-
273
- Then select a `modal/` model in the model picker.
274
-
275
- **Details:**
276
- - Free promotional period until April 30, 2026
277
- - Model: GLM-5.1 FP8 (128k context, 16k max output)
278
- - No credit card required during the promotional period
279
-
280
- ### Ollama Cloud
281
-
282
- Get an API key from [ollama.com/settings/keys](https://ollama.com/settings/keys), then:
283
-
284
- **Option A: Environment variable**
285
- ```bash
286
- export OLLAMA_API_KEY="..."
287
- export OLLAMA_SHOW_PAID=true
288
- ```
289
-
290
- **Option B: Config file** (`~/.pi/free.json`)
291
- ```json
292
- {
293
- "ollama_api_key": "YOUR_KEY",
294
- "ollama_show_paid": true
295
- }
296
- ```
297
-
298
- **Note:** Ollama requires `OLLAMA_SHOW_PAID=true` because they have usage limits on their cloud API.
299
-
300
- Free tier resets every 5 hours + 7 days.
301
-
302
- ### Mistral (free API key)
303
-
304
- Add API key to `~/.pi/free.json` or environment variables:
305
-
306
- ```bash
307
- export MISTRAL_API_KEY="..."
308
- ```
309
-
310
- ---
311
-
312
- ## Slash Commands
313
-
314
- Each provider has toggle commands to switch between free and all models:
315
-
316
- | Command | Action |
317
- |---------|--------|
318
- | `/toggle-opencode` | Toggle between free/all OpenCode models |
319
- | `/toggle-kilo` | Toggle between free/all Kilo models |
320
- | `/toggle-openrouter` | Toggle between free/all OpenRouter models |
321
- | `/toggle-cline` | Toggle between free/all Cline models |
322
- | `/toggle-nvidia` | Toggle between free/all NVIDIA models |
323
- | `/toggle-cloudflare` | Toggle between free/all Cloudflare models |
324
- | `/toggle-ollama` | Toggle between free/all Ollama Cloud models |
325
- | `/toggle-mistral` | Toggle between free/all Mistral models (🔧 dynamic) |
326
- | `/toggle-groq` | Toggle between free/all Groq models (🔧 dynamic) |
327
- | `/toggle-cerebras` | Toggle between free/all Cerebras models (🔧 dynamic) |
328
-
329
- **The toggle command:**
330
- - **For ✅ free providers**: Switches between showing only free models vs. all available models (including paid)
331
- - **For 🔄 freemium providers**: Shows all models by default; toggle switches between filtered and full list
332
- - **For 🔧 dynamic API providers**: Filters the model list when you have an API key configured
333
- - **Persists your preference** to `~/.pi/free.json` for next startup
334
- - Shows a notification: "opencode: showing free models" or "opencode: showing all models"
335
-
336
- ---
337
-
338
- ## Configuration
339
-
340
- Create `~/.pi/free.json` in your home directory:
341
-
342
- ```json
343
- {
344
- "openrouter_api_key": "YOUR_OPENROUTER_KEY",
345
- "nvidia_api_key": "YOUR_NVIDIA_KEY",
346
- "mistral_api_key": "YOUR_MISTRAL_KEY",
347
- "opencode_api_key": "YOUR_OPENCODE_KEY",
348
- "ollama_api_key": "YOUR_OLLAMA_KEY",
349
- "ollama_show_paid": true,
350
- "modal_api_key": "YOUR_MODAL_KEY",
351
- "hidden_models": ["model-id-to-hide"]
352
- }
353
- ```
354
-
355
- Or use environment variables (same names, uppercase):
356
-
357
- ```bash
358
- export OPENROUTER_API_KEY="..."
359
- export NVIDIA_API_KEY="..."
360
- ```
361
-
362
- ---
363
-
364
- ## Logging & Debugging
365
-
366
- pi-free now writes extension logs to:
367
-
368
- - **Windows:** `%USERPROFILE%\.pi\free.log`
369
- - **Linux/macOS:** `~/.pi/free.log`
370
-
371
- Useful env vars:
372
-
373
- ```bash
374
- # Console log verbosity (default: error)
375
- LOG_LEVEL=debug
376
-
377
- # File log verbosity (default: debug)
378
- PI_FREE_LOG_LEVEL=debug
379
-
380
- # Custom log path (optional)
381
- PI_FREE_LOG_PATH=/tmp/pi-free.log
382
-
383
- # Disable file logging
384
- PI_FREE_FILE_LOG=false
385
- ```
386
-
387
- ---
388
-
389
- ## License
390
-
391
- MIT — See [LICENSE](LICENSE)
392
-
393
- **Questions?** [Open an issue](https://github.com/apmantza/pi-free/issues)
1
+ # pi-free-providers
2
+
3
+ Free AI model providers for [Pi](https://pi.dev). Access **free models** from multiple providers in one install.
4
+
5
+ ---
6
+
7
+ ## What does pi-free do
8
+
9
+ **pi-free is a Pi extension that unlocks free AI models from multiple providers.**
10
+
11
+ When you install pi-free, it:
12
+
13
+ 1. **Registers free-tier providers** with Pi's model picker — Kilo, Cline, NVIDIA, Cloudflare, Modal, Ollama Cloud, and more
14
+
15
+ 2. **Fetches models dynamically** from provider APIs — Cloudflare Workers AI (30+ models), NVIDIA NIM, and Pi's built-in providers (Mistral, Groq, Cerebras, xAI, Hugging Face, OpenRouter) when API keys are configured
16
+
17
+ 3. **Filters to show only free models by default** for providers that expose pricing — You see only the models that cost $0 to use. Paid models are hidden until you explicitly toggle them on.
18
+
19
+ 4. **Provides per-provider toggle commands** — Run `/toggle-{provider}` (e.g., `/toggle-kilo`, `/toggle-opencode`) to switch between free-only mode and showing all models including paid ones. Changes apply immediately and your preference is saved for the next Pi restart.
20
+
21
+ 5. **Handles authentication for you** — OAuth flows (Kilo, Cline) open your browser automatically; API keys are read from `~/.pi/free.json` or environment variables
22
+
23
+ 6. **Adds Coding Index scores** — Model names include a coding benchmark score (CI: 45.2) to help you pick capable coding models at a glance
24
+
25
+ 7. **Persists your preferences** — Your toggle choices (free vs all models) are saved to `~/.pi/free.json` and remembered across Pi restarts
26
+
27
+ ---
28
+
29
+ ## How to use
30
+
31
+ ### 1. Install the extension
32
+
33
+ ```bash
34
+ pi install git:github.com/apmantza/pi-free
35
+ ```
36
+
37
+ ### 2. Open the model picker
38
+
39
+ Start Pi and press `Ctrl+L` to open the model picker.
40
+
41
+ Free models are shown by default — look for the provider prefixes:
42
+
43
+ **✅ Offers Free Models (no usage limits, no payment required):**
44
+
45
+ - `opencode/` — OpenCode models (no setup required; toggle with `/toggle-opencode`)
46
+ - `kilo/` — Kilo models (free models available immediately, more after `/login kilo`)
47
+ - `openrouter/` — OpenRouter models (free account required)
48
+ - `cline/` — Cline models (run `/login cline` to use)
49
+
50
+ **🔄 Freemium (free tier with limits, then paid):**
51
+
52
+ - `nvidia/` — NVIDIA NIM models (1,000 free requests/month, then credits)
53
+ - `cloudflare/` — Cloudflare Workers AI (10K Neurons/day free tier, then $0.011/1K Neurons)
54
+ - `modal/` — GLM-5.1 FP8 via Modal (free promotional period until April 30, 2026)
55
+ - `ollama-cloud/` Ollama Cloud models (usage-based free tier, resets every 5 hours + 7 days)
56
+
57
+ **🔧 Dynamic API Providers (fetched when API key configured):**
58
+
59
+ - `mistral/` — Mistral models (when `MISTRAL_API_KEY` set)
60
+ - `groq/` — Groq models (when `GROQ_API_KEY` set)
61
+ - `cerebras/` — Cerebras models (when `CEREBRAS_API_KEY` set)
62
+ - `xai/`xAI models (when `XAI_API_KEY` set)
63
+ - `huggingface/` — Hugging Face models (when `HF_TOKEN` set)
64
+
65
+ **Note:** Fireworks is now a [built-in Pi provider](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/CHANGELOG.md#0681---2026-04-22) — no extension needed. Set `FIREWORKS_API_KEY` to use it directly.
66
+
67
+ ### 3. Toggle between free and paid models
68
+
69
+ Want to see paid models too? Run the toggle command for your provider:
70
+
71
+ ```
72
+ /toggle-opencode # Toggle OpenCode (✅ offers free models)
73
+ /toggle-kilo # Toggle Kilo ( offers free models)
74
+ /toggle-openrouter # Toggle OpenRouter ( offers free models)
75
+ /toggle-cline # Toggle Cline ( offers free models)
76
+ /toggle-nvidia # Toggle NVIDIA (🔄 freemium)
77
+ /toggle-cloudflare # Toggle Cloudflare (🔄 freemium)
78
+ /toggle-ollama # Toggle Ollama Cloud (🔄 freemium)
79
+ /toggle-mistral # Toggle Mistral (🔧 dynamic - needs API key)
80
+ /toggle-groq # Toggle Groq (🔧 dynamic - needs API key)
81
+ /toggle-cerebras # Toggle Cerebras (🔧 dynamic - needs API key)
82
+ ```
83
+
84
+ **Notes:**
85
+
86
+ - **Toggle commands are mainly for and 🔄 providers** — to switch between "free models only" vs "show paid models too"
87
+ - **🔧 Dynamic providers** show all fetched models by default — the toggle filters the list when you have an API key configured
88
+ - **Freemium providers** show all models by default; you manage your usage limits via their dashboards
89
+
90
+ You'll see a notification like: `opencode: showing free models` or `opencode: showing all models`
91
+
92
+ **Note:** Built-in provider toggles such as OpenCode and OpenRouter update in the current session no restart needed.
93
+
94
+ ### 4. Add API keys for more providers (optional)
95
+
96
+ Some providers require a free account or API key.
97
+
98
+ **The first time you run Pi after installing this extension, a config file is automatically created:**
99
+
100
+ - **Linux/Mac:** `~/.pi/free.json`
101
+ - **Windows:** `%USERPROFILE%\.pi\free.json`
102
+
103
+ Add your API keys to this file:
104
+
105
+ ```json
106
+ {
107
+ "openrouter_api_key": "sk-or-v1-...",
108
+ "nvidia_api_key": "nvapi-...",
109
+ "cloudflare_api_token": "...",
110
+ "cloudflare_account_id": "...",
111
+ "ollama_api_key": "...",
112
+ "mistral_api_key": "...",
113
+ "modal_api_key": "sk-modal-..."
114
+ }
115
+ ```
116
+
117
+ Or set environment variables instead (same names, uppercase: `OPENROUTER_API_KEY`, `NVIDIA_API_KEY`, etc.)
118
+
119
+ If `~/.pi/free.json` contains invalid JSON, pi-free now logs the parse error to `~/.pi/free.log` so you can fix the file quickly.
120
+
121
+ See the [Providers That Need Authentication](#providers-that-need-authentication) section below for detailed setup instructions per provider.
122
+
123
+ ### 5. Quick commands reference
124
+
125
+ | Command | What it does |
126
+ | -------------------- | --------------------------------------------------------- |
127
+ | `/toggle-{provider}` | Switch between free-only and all models for that provider |
128
+ | `/free-providers` | Show free/paid model counts for all providers |
129
+ | `/login kilo` | Start OAuth flow for Kilo |
130
+ | `/login cline` | Start OAuth flow for Cline |
131
+ | `/logout kilo` | Clear Kilo OAuth credentials |
132
+ | `/logout cline` | Clear Cline OAuth credentials |
133
+
134
+ ---
135
+
136
+ ## Features
137
+
138
+ ### 🔍 NVIDIA: Pre-Filtering + 404 Detection
139
+
140
+ NVIDIA's API lists 130+ models, but 57+ return 404 "Function not found" when you try to use them. pi-free solves this:
141
+
142
+ - **57 known 404s hard-filtered** — Discontinued models (`dbrx-instruct`, `codellama-70b`), embedding models mislabeled as chat-capable (`nv-embed-*`), and stale catalog entries are silently excluded
143
+ - **Auto-discovery from NVIDIA's API** — Queries `integrate.api.nvidia.com/v1/models` directly for the ground-truth list
144
+ - **`/probe-nvidia` command** — On-demand health check: tests every model with a minimal request, auto-hides new 404s, and re-registers immediately
145
+
146
+ ### 🌩️ Cloudflare: Dynamic Model Discovery
147
+
148
+ Cloudflare Workers AI offers 80+ models including embeddings, image generation, and speech. pi-free automatically finds the chat models:
149
+
150
+ - **Live API fetching** — Calls Cloudflare's `/ai/models` endpoint on startup to get the current catalog
151
+ - **Smart filtering** — Automatically excludes embeddings (`bge-*`, `embed-*`), image generation (`flux`, `stable-diffusion`), speech (`whisper`, `aura-*`), translation, and vision-only models via regex patterns
152
+ - **Metadata inference** — Detects vision support (`llava`, `vision` in name), reasoning (`r1`, `thinking`, `qwq`), context windows, and estimated costs from model IDs
153
+ - **Expanding fallback** 18 hand-curated models (Kimi K2.6, GPT-OSS, Qwen 2.5 Coder, QwQ, Llama 3.2 Vision, etc.) if API is unreachable
154
+
155
+ ### 🎯 Coding Index (CI) Scores
156
+
157
+ Every model shows a **Coding Index score** (e.g., `CI: 52.3`) in the model picker:
158
+
159
+ - **Benchmark-based** Scores derived from Artificial Analysis coding benchmarks (HumanEval, MBPP, etc.)
160
+ - **Quality indicator** — Higher scores = better coding performance
161
+ - **All providers** — Applied to every model from every provider (NVIDIA, Cloudflare, Mistral, Groq, etc.)
162
+
163
+ **Missing CI scores?** Provider model IDs often don't match benchmark database keys exactly. pi-free applies provider-specific normalization to improve matching:
164
+
165
+ | Provider | Normalization Applied |
166
+ | -------------- | ------------------------------------------------------------------ |
167
+ | **NVIDIA** | Strips vendor prefixes (`meta/`, `mistralai/`, `microsoft/`, etc.) |
168
+ | **Cloudflare** | Strips `@cf/namespace/` prefixes |
169
+ | **Groq** | Removes `-versatile` and numeric suffixes (`-32768`) |
170
+ | **Cerebras** | Normalizes `llama3.1` `llama-3.1`, adds `instruct` suffix |
171
+ | **Mistral** | Strips `-latest` suffix |
172
+ | **Ollama** | Converts `model:tag` → `model-tag` |
173
+
174
+ **Debug missing scores:** Check `~/.pi/modelmatch.log` to see which models matched/didn't match and what normalization was applied.
175
+
176
+ ### 🔄 Free/Paid Model Toggling
177
+
178
+ Providers have different pricing models. pi-free handles them all:
179
+
180
+ - **Free-only by default** — Shows only zero-cost models initially
181
+ - **Per-provider toggles** — Run `/toggle-{provider}` to switch between "free only" vs "all models"
182
+ - **Persists across sessions** — Your preference is saved to `~/.pi/free.json`
183
+ - **Instant updates** Changes apply immediately; no Pi restart needed
184
+
185
+ **Provider types:**
186
+
187
+ - ✅ **Free providers** (OpenCode, Kilo, Cline) — Toggle between free-only vs paid models
188
+ - 🔄 **Freemium** (NVIDIA, Cloudflare, Modal, Ollama) — Free tier with limits, toggle shows all
189
+ - 🔧 **Dynamic API** (Mistral, Groq, Cerebras, xAI) — Fetched when API key configured, toggle filters the list
190
+
191
+ ### 🔐 OAuth + API Key Handling
192
+
193
+ Authentication is handled automatically:
194
+
195
+ - **OAuth flows** — `/login kilo` and `/login cline` open your browser, wait for authorization, and complete automatically
196
+ - **Multiple auth sources** — API keys read from `~/.pi/free.json`, environment variables, or standard Pi auth files (`~/.pi/agent/auth.json`)
197
+ - **Smart fallbacks** — New env var names (e.g., `CF_API_TOKEN`) with legacy support (`CLOUDFLARE_API_TOKEN`)
198
+
199
+ ---
200
+
201
+ ## Using Free Models (No Setup Required)
202
+
203
+ ### OpenCode
204
+
205
+ Works immediately with zero setup:
206
+
207
+ 1. Press `Ctrl+L`
208
+ 2. Search for `opencode/`
209
+ 3. Pick any model (e.g., `opencode/big-pickle`)
210
+ 4. Start chatting
211
+
212
+ No account, no API key, no OAuth. Run `/toggle-opencode` to switch between free and paid OpenCode models.
213
+
214
+ ### Kilo (free models, more after login)
215
+
216
+ Kilo shows free models immediately. To unlock all models, authenticate with Kilo's free OAuth:
217
+
218
+ ```
219
+ /login kilo
220
+ ```
221
+
222
+ This command will:
223
+
224
+ 1. Open your browser to Kilo's authorization page
225
+ 2. Show a device code in Pi's UI
226
+ 3. Wait for you to authorize in the browser
227
+ 4. Automatically complete login once approved
228
+
229
+ - No credit card required
230
+ - Free tier: 200 requests/hour
231
+ - After login, run `/toggle-kilo` to switch between free-only and all models
232
+
233
+ ### Cline (free account)
234
+
235
+ Cline models appear immediately in the model picker. To use them, authenticate with Cline's free account:
236
+
237
+ ```
238
+ /login cline
239
+ ```
240
+
241
+ This command will:
242
+
243
+ 1. Open your browser to Cline's sign-in page
244
+ 2. Wait for you to complete sign-in
245
+ 3. Automatically complete login once approved
246
+
247
+ - Free account required (no credit card)
248
+ - Uses local ports 48801-48811 for OAuth callback
249
+
250
+ ---
251
+
252
+ ## Providers That Need Authentication
253
+
254
+ Some providers require a free account or API key to access their free tiers.
255
+
256
+ ---
257
+
258
+ ### 🆓 Free Providers
259
+
260
+ ### OpenRouter (free models available)
261
+
262
+ Get a free API key at [openrouter.ai/keys](https://openrouter.ai/keys), then either:
263
+
264
+ **Option A: Environment variable**
265
+
266
+ ```bash
267
+ export OPENROUTER_API_KEY="sk-or-v1-..."
268
+ ```
269
+
270
+ **Option B: Config file** (`~/.pi/free.json`)
271
+
272
+ ```json
273
+ {
274
+ "openrouter_api_key": "sk-or-v1-..."
275
+ }
276
+ ```
277
+
278
+ Then use `/toggle-openrouter` to switch between free-only and all models.
279
+
280
+ ### NVIDIA NIM (Free Credits System)
281
+
282
+ NVIDIA provides **free monthly credits** (1000 requests/month) at [build.nvidia.com](https://build.nvidia.com).
283
+
284
+ **Important:** Models have different "costs" per token:
285
+
286
+ - **Zero-cost models**: Don't consume your credit balance (shown by default)
287
+ - **Credit-costing models**: Consume credits faster (hidden by default)
288
+
289
+ Get your API key and optionally enable all models:
290
+
291
+ **Option A: Show only free models (default)**
292
+
293
+ ```bash
294
+ export NVIDIA_API_KEY="nvapi-..."
295
+ ```
296
+
297
+ Uses only zero-cost models → your 1000 credits last the full month
298
+
299
+ **Option B: Show all models (uses credits faster)**
300
+
301
+ ```bash
302
+ export NVIDIA_API_KEY="nvapi-..."
303
+ export NVIDIA_SHOW_PAID=true
304
+ ```
305
+
306
+ Or in `~/.pi/free.json`:
307
+
308
+ ```json
309
+ {
310
+ "nvidia_api_key": "nvapi-...",
311
+ "nvidia_show_paid": true
312
+ }
313
+ ```
314
+
315
+ Toggle anytime with `/toggle-nvidia`
316
+
317
+ ### Cloudflare Workers AI (10K Neurons/day Free Tier)
318
+
319
+ Cloudflare provides **30+ text generation models** (auto-discovered from their API) with a generous free tier:
320
+
321
+ - **10,000 Neurons per day FREE** (resets daily at 00:00 UTC)
322
+ - **$0.011 per 1,000 Neurons** beyond the free allocation
323
+ - **Models auto-fetched** All available chat models are discovered dynamically from Cloudflare's API
324
+
325
+ Get your API token at [dash.cloudflare.com/profile/api-tokens](https://dash.cloudflare.com/profile/api-tokens):
326
+
327
+ 1. Create a token with "Cloudflare AI" "Read" permission
328
+ 2. Or use "My Account" → "Read" for broader access
329
+
330
+ **Setup:**
331
+
332
+ ```bash
333
+ # New short env vars (recommended)
334
+ export CF_API_TOKEN="your_token_here"
335
+ export CF_ACCOUNT_ID="your_account_id"
336
+
337
+ # Legacy env vars also work
338
+ export CLOUDFLARE_API_TOKEN="your_token_here"
339
+ export CLOUDFLARE_ACCOUNT_ID="your_account_id"
340
+ ```
341
+
342
+ **Models available:** Llama 4/3.x, Mistral Small 3.1, DeepSeek R1, Gemma 4, Kimi K2.5/2.6, Qwen 3/2.5, OpenAI GPT-OSS, and more.
343
+
344
+ Toggle with `/toggle-cloudflare`
345
+
346
+ ### Modal (GLM-5.1 FP8 — free promotional period until April 30, 2026)
347
+
348
+ Modal hosts GLM-5.1 FP8 with a free promotional period. Get an API key at [modal.com](https://modal.com), then:
349
+
350
+ **Option A: Environment variable**
351
+
352
+ ```bash
353
+ export MODAL_API_KEY="sk-modal-..."
354
+ ```
355
+
356
+ **Option B: Config file** (`~/.pi/free.json`)
357
+
358
+ ```json
359
+ {
360
+ "modal_api_key": "sk-modal-..."
361
+ }
362
+ ```
363
+
364
+ Then select a `modal/` model in the model picker.
365
+
366
+ **Details:**
367
+
368
+ - Free promotional period until April 30, 2026
369
+ - Model: GLM-5.1 FP8 (128k context, 16k max output)
370
+ - No credit card required during the promotional period
371
+
372
+ ### Ollama Cloud
373
+
374
+ Get an API key from [ollama.com/settings/keys](https://ollama.com/settings/keys), then:
375
+
376
+ **Option A: Environment variable**
377
+
378
+ ```bash
379
+ export OLLAMA_API_KEY="..."
380
+ export OLLAMA_SHOW_PAID=true
381
+ ```
382
+
383
+ **Option B: Config file** (`~/.pi/free.json`)
384
+
385
+ ```json
386
+ {
387
+ "ollama_api_key": "YOUR_KEY",
388
+ "ollama_show_paid": true
389
+ }
390
+ ```
391
+
392
+ **Note:** Ollama requires `OLLAMA_SHOW_PAID=true` because they have usage limits on their cloud API.
393
+
394
+ Free tier resets every 5 hours + 7 days.
395
+
396
+ ### Mistral (free API key)
397
+
398
+ Add API key to `~/.pi/free.json` or environment variables:
399
+
400
+ ```bash
401
+ export MISTRAL_API_KEY="..."
402
+ ```
403
+
404
+ ---
405
+
406
+ ## Slash Commands
407
+
408
+ Each provider has toggle commands to switch between free and all models:
409
+
410
+ | Command | Action |
411
+ | -------------------- | ---------------------------------------------------- |
412
+ | `/toggle-opencode` | Toggle between free/all OpenCode models |
413
+ | `/toggle-kilo` | Toggle between free/all Kilo models |
414
+ | `/toggle-openrouter` | Toggle between free/all OpenRouter models |
415
+ | `/toggle-cline` | Toggle between free/all Cline models |
416
+ | `/toggle-nvidia` | Toggle between free/all NVIDIA models |
417
+ | `/toggle-cloudflare` | Toggle between free/all Cloudflare models |
418
+ | `/toggle-ollama` | Toggle between free/all Ollama Cloud models |
419
+ | `/toggle-mistral` | Toggle between free/all Mistral models (🔧 dynamic) |
420
+ | `/toggle-groq` | Toggle between free/all Groq models (🔧 dynamic) |
421
+ | `/toggle-cerebras` | Toggle between free/all Cerebras models (🔧 dynamic) |
422
+
423
+ **The toggle command:**
424
+
425
+ - **For ✅ free providers**: Switches between showing only free models vs. all available models (including paid)
426
+ - **For 🔄 freemium providers**: Shows all models by default; toggle switches between filtered and full list
427
+ - **For 🔧 dynamic API providers**: Filters the model list when you have an API key configured
428
+ - **Persists your preference** to `~/.pi/free.json` for next startup
429
+ - Shows a notification: "opencode: showing free models" or "opencode: showing all models"
430
+
431
+ ### Probe Commands (Health Check)
432
+
433
+ Test models for 404/403 errors and auto-hide broken ones:
434
+
435
+ | Command | What it does |
436
+ | --------------- | ----------------------------------------------------------- |
437
+ | `/probe-nvidia` | Test all NVIDIA models, auto-hide 404s in `~/.pi/free.json` |
438
+ | `/probe-ollama` | Test all Ollama models, auto-hide 403s in `~/.pi/free.json` |
439
+
440
+ **How it works:**
441
+
442
+ 1. Sends a minimal test request to every model
443
+ 2. Identifies broken models (404/403 responses)
444
+ 3. **Auto-hides** broken models in your config (provider-scoped: `"ollama/kimi-k2.6"`)
445
+ 4. Re-registers the provider so broken models disappear immediately
446
+ 5. Hidden models persist across Pi restarts
447
+
448
+ Use these when you see models that appear in the picker but fail when you try to use them.
449
+
450
+ ---
451
+
452
+ ## Configuration
453
+
454
+ Create `~/.pi/free.json` in your home directory:
455
+
456
+ ```json
457
+ {
458
+ "openrouter_api_key": "YOUR_OPENROUTER_KEY",
459
+ "nvidia_api_key": "YOUR_NVIDIA_KEY",
460
+ "cloudflare_api_token": "YOUR_CLOUDFLARE_TOKEN",
461
+ "cloudflare_account_id": "YOUR_ACCOUNT_ID",
462
+ "mistral_api_key": "YOUR_MISTRAL_KEY",
463
+ "opencode_api_key": "YOUR_OPENCODE_KEY",
464
+ "ollama_api_key": "YOUR_OLLAMA_KEY",
465
+ "ollama_show_paid": true,
466
+ "modal_api_key": "YOUR_MODAL_KEY",
467
+ "hidden_models": ["model-id-to-hide"]
468
+ }
469
+ ```
470
+
471
+ Or use environment variables (same names, uppercase):
472
+
473
+ ```bash
474
+ export OPENROUTER_API_KEY="..."
475
+ export NVIDIA_API_KEY="..."
476
+ ```
477
+
478
+ ---
479
+
480
+ ## Logging & Debugging
481
+
482
+ pi-free writes extension logs to:
483
+
484
+ - **Windows:** `%USERPROFILE%\.pi\free.log`
485
+ - **Linux/macOS:** `~/.pi/free.log`
486
+
487
+ If the extension fails to read `~/.pi/free.json`, check this log first — config parse errors are written here.
488
+
489
+ ```bash
490
+ # Console log verbosity (default: error)
491
+ LOG_LEVEL=debug
492
+
493
+ # File log verbosity (default: debug)
494
+ PI_FREE_LOG_LEVEL=debug
495
+
496
+ # Custom log path (optional)
497
+ PI_FREE_LOG_PATH=/tmp/pi-free.log
498
+
499
+ # Disable file logging
500
+ PI_FREE_FILE_LOG=false
501
+ ```
502
+
503
+ ### Model Matching Debug Log
504
+
505
+ To diagnose why some models don't show Coding Index scores, pi-free writes detailed matching diagnostics to:
506
+
507
+ - **Windows:** `%USERPROFILE%\.pi\modelmatch.log`
508
+ - **Linux/macOS:** `~/.pi/modelmatch.log`
509
+
510
+ **Log format:**
511
+
512
+ ```
513
+ timestamp|provider|modelId|modelName|action|strategy|normalizedId|matchKey|codingIndex|details
514
+ ```
515
+
516
+ **Example entries:**
517
+
518
+ ```
519
+ 2026-04-26T10:30:00Z|nvidia|meta/llama-3.1-405b-instruct|Llama 3.1 405B|match|provider-normalized:strip-nvidia-prefix|llama-3.1-405b-instruct|llama-3.1-instruct-405b|52.3|
520
+ 2026-04-26T10:30:01Z|groq|llama-3.1-70b-versatile|Llama 3.1 70B Versatile|match|strip-groq-versatile|llama-3.1-70b|llama-3.1-instruct-70b|48.5|
521
+ 2026-04-26T10:30:02Z|cloudflare|@cf/meta/llama-3.1-70b|Llama 3.1 70B|miss|all-strategies-failed|llama-3.1-70b|||
522
+ ```
523
+
524
+ **Common mismatch patterns:**
525
+
526
+ - `miss` + `all-strategies-failed` = Model not in benchmark database or ID format not recognized
527
+ - Check `normalizedId` column to see what the lookup tried against
528
+
529
+ **View the log:**
530
+
531
+ ```bash
532
+ # Pretty-print with column alignment
533
+ cat ~/.pi/modelmatch.log | column -t -s '|'
534
+
535
+ # See only misses (models without CI scores)
536
+ grep '|miss|' ~/.pi/modelmatch.log
537
+
538
+ # See stats for specific provider
539
+ grep '|nvidia|' ~/.pi/modelmatch.log | grep -c '|match|'
540
+ ```
541
+
542
+ ---
543
+
544
+ ## License
545
+
546
+ MIT — See [LICENSE](LICENSE)
547
+
548
+ **Questions?** [Open an issue](https://github.com/apmantza/pi-free/issues)