pi-freeflow 1.11.2 → 1.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +384 -379
- package/package.json +1 -1
- package/src/catalog.ts +3 -2
- package/src/index.ts +1 -1
- package/src/models.ts +30 -10
- package/src/proxy.ts +1084 -883
- package/src/relay-state.ts +18 -0
- package/src/relay.ts +347 -309
- package/src/responses.ts +245 -0
package/README.md
CHANGED
|
@@ -1,379 +1,384 @@
|
|
|
1
|
-
# pi-freeflow 🌊
|
|
2
|
-
|
|
3
|
-
> **
|
|
4
|
-
|
|
5
|
-
Thin by design: model list + dumb relay + log. Host `pi-ai` owns thinking, normalization & provider magic. We just make it free, fast, and unbreakable.
|
|
6
|
-
|
|
7
|
-
[](https://www.npmjs.com/package/pi-freeflow)
|
|
8
|
-
[](https://www.npmjs.com/package/pi-freeflow)
|
|
9
|
-
[](https://opensource.org/licenses/MIT)
|
|
10
|
-
[](https://github.com/badlogic/pi-ai)
|
|
11
|
-
[](https://github.com/coder/oh-my-pi)
|
|
12
|
-
|
|
13
|
-
Join devs bypassing rate limits with their own relay pools. BYO, add as many as you need.
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
### Features at a Glance
|
|
18
|
-
|
|
19
|
-
| Feature | Description | Value | Cost |
|
|
20
|
-
| :--- | :--- | :--- | :--- |
|
|
21
|
-
| **
|
|
22
|
-
| **BYO Relay Pool** | Round-robin load balancing across your Cloudflare Workers & Vercel Edges | Zero Rate Limits | **$0** (your free tiers) |
|
|
23
|
-
| **Adaptive Health & Error Detection** | Auto-cooldown on 429 rate limits, 504 timeouts, and socket drops | 0ms Wasted Latency | **$0** |
|
|
24
|
-
| **Stream Truncation Resilience** | Stateful SSE terminal tracking (`response.failed` / `response.incomplete` injection) | Zero Host Crashes | **$0** |
|
|
25
|
-
| **Smart Model Aliasing** | Clean slash-free & colon-free CLI model names compatible with thinking selectors | DX Optimized | **$0** |
|
|
26
|
-
| **Auto-Enabled on Session** | Relay stays enabled in `auto` mode on session start and model switch | Zero Friction | **$0** |
|
|
27
|
-
| **Interactive CLI Management** | 10+ `/freeflow` subcommands (`status`, `list`, `use`, `add`, `label`, `remove`, `deploy`, `logs`, `debug`) | Full Control | **$0** |
|
|
28
|
-
| **Dumb Proxy That Never Breaks** | `127.0.0.1:28180`, host-normalized, pathname-guarded `/v1/models` | 100% Uptime | **$0** |
|
|
29
|
-
| **Observable Real Logs** | `~/.pi/agent/pi-freeflow.log`, 10MB auto-rotation, real-time debug toggle | Observable | **$0** |
|
|
30
|
-
|
|
31
|
-
Philosophy: **Thin by design.** We only ship model list + relay proxy + log. Host owns thinking & normalization.
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
###
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
/model → freeflow → pick
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
#### OpenCode Zen (7 Models), Responses & Chat API
|
|
42
|
-
Optimized for deep reasoning, long-horizon coding & autonomous agentic workflows.
|
|
43
|
-
|
|
44
|
-
| Model ID | Creator / Lab | Context | Max Output | Thinking | Vision |
|
|
45
|
-
| :--- | :--- | :--- | :--- | :--- | :--- |
|
|
46
|
-
| `muse-spark-1.2-contributor-free` | Meta Superintelligence Labs | **1M** (1.048.576) | **131K** (131.072) | `minimal … xhigh` | ✅ |
|
|
47
|
-
| `muse-spark-1.3-contributor-free` | Meta Superintelligence Labs | **1M** (1.048.576) | **131K** (131.072) | `minimal … xhigh` | ✅ |
|
|
48
|
-
| `mimo-v2.5-free` | Xiaomi MiMo | **1M** (1.048.576) | **131K** (131.072) | `minimal … xhigh`\* | ✅ |
|
|
49
|
-
| `nemotron-3.5-lightning-free` | NVIDIA | **1M** (1.000.000) | **262K** (262.144) | `minimal … xhigh` | ❌ |
|
|
50
|
-
| `nemotron-3-ultra-free` | NVIDIA | **1M** (1.000.000) | **128K** (128.000) | `minimal … xhigh` | ❌ |
|
|
51
|
-
| `big-pickle` | Big Pickle | **200K** (200.000) | **32K** (32.000) | `high / max` | ❌ |
|
|
52
|
-
| `ling-3.0-flash-fin-free` | Inclusion AI | **262K** (262.144) | **131K** (131.072) | `minimal … xhigh` | ❌ |
|
|
53
|
-
|
|
54
|
-
#### KiloCode Gateway (
|
|
55
|
-
Keyless access with `Bearer kilo-free`. Clean slash-free and colon-free CLI aliases supported.
|
|
56
|
-
|
|
57
|
-
| Model ID | Creator / Lab | Context | Max Output | Thinking | Vision |
|
|
58
|
-
| :--- | :--- | :--- | :--- | :--- | :--- |
|
|
59
|
-
| `dots-3-note-preview` (`dots-studio/...:free`) | Dots Studio | **512K** (512.000) | **512K** (512.000) | `minimal…xhigh`\* | ✅ |
|
|
60
|
-
| `step-3.7-flash` (`stepfun/...:free`) | StepFun | **262K** (262.144) | **262K** (262.144) | `minimal…xhigh`\* | ✅ |
|
|
61
|
-
| `nemotron-3-nano-omni` (`nvidia/...:free`) | NVIDIA | **256K** (256.000) | **131K** (131.072) | `minimal…xhigh`\* | ✅ |
|
|
62
|
-
| `nemotron-3-ultra-550b` (`nvidia/...:free`) | NVIDIA | **1M** (1.000.000) | **128K** (128.000) | `minimal…xhigh`\* | ❌ |
|
|
63
|
-
| `nvidia/nemotron-3.5-lightning:free` | NVIDIA | **1M** (1.000.000) | **262K** (262.144) | `minimal…xhigh`\* | ❌ |
|
|
64
|
-
| `nemotron-3-super` (`nvidia/...:free`) | NVIDIA | **262K** (262.144) | **262K** (262.144) | `minimal…xhigh`\* | ❌ |
|
|
65
|
-
| `north-mini-code` (`cohere/...:free`) | Cohere | **256K** (256.000) | **64K** (64.000) | `minimal…xhigh`\* | ❌ |
|
|
66
|
-
| `laguna-s-2.1:free` (`poolside/...:free`) | Poolside | **262K** (262.144) | **32K** (32.768) | `minimal…xhigh`\* | ❌ |
|
|
67
|
-
| `laguna-xs-2.1:free` (`poolside/...:free`) | Poolside | **262K** (262.144) | **32K** (32.768) | `minimal…xhigh`\* | ❌ |
|
|
68
|
-
| `lfm-2.5` (`liquid/lfm-2.5-2.6b:free`) | Liquid AI | **65K** (65.536) | **32K** (32.768) | `minimal…xhigh`\* | ❌ |
|
|
69
|
-
| `kilo-auto` (`kilo-auto/free`) | Kilo Gateway Auto | **256K** (256.000) | **10K** (10.000) | `minimal…xhigh`\* | ❌ |
|
|
70
|
-
| `openrouter` (`openrouter/free`) | OpenRouter Free | **200K** (200.000) | **65K** (65.536) | `minimal…xhigh`\* | ✅ |
|
|
71
|
-
| `content-safety` (`nvidia/...:free`) | NVIDIA | **128K** (128.000) | **8K** (8.192) | ❌ *(non-thinking)* | ✅ |
|
|
72
|
-
| `ling-3.0-flash-fin` (`inclusionai/ling-3.0-flash-fin:free`) | Inclusion AI | **262K** (262.144) | **32K** (32.768) | `minimal…xhigh`\* | ❌ |
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
/freeflow
|
|
107
|
-
/freeflow
|
|
108
|
-
/freeflow
|
|
109
|
-
/freeflow
|
|
110
|
-
/freeflow
|
|
111
|
-
/freeflow
|
|
112
|
-
/freeflow
|
|
113
|
-
/freeflow
|
|
114
|
-
/freeflow
|
|
115
|
-
/freeflow
|
|
116
|
-
/freeflow
|
|
117
|
-
/freeflow
|
|
118
|
-
/freeflow
|
|
119
|
-
/freeflow
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
omp plugin
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
>
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
/freeflow
|
|
177
|
-
/freeflow
|
|
178
|
-
/freeflow
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
**
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
//
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
/freeflow
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
**
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
(
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
####
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
pnpm
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
├──
|
|
348
|
-
├──
|
|
349
|
-
├──
|
|
350
|
-
├──
|
|
351
|
-
├──
|
|
352
|
-
├──
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
1
|
+
# pi-freeflow 🌊
|
|
2
|
+
|
|
3
|
+
> **26 free models. Up to 1M context. Zero API keys. Infinite scale via your own relay pool.**
|
|
4
|
+
|
|
5
|
+
Thin by design: model list + dumb relay + log. Host `pi-ai` owns thinking, normalization & provider magic. We just make it free, fast, and unbreakable.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/pi-freeflow)
|
|
8
|
+
[](https://www.npmjs.com/package/pi-freeflow)
|
|
9
|
+
[](https://opensource.org/licenses/MIT)
|
|
10
|
+
[](https://github.com/badlogic/pi-ai)
|
|
11
|
+
[](https://github.com/coder/oh-my-pi)
|
|
12
|
+
|
|
13
|
+
Join devs bypassing rate limits with their own relay pools. BYO, add as many as you need.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
### Features at a Glance
|
|
18
|
+
|
|
19
|
+
| Feature | Description | Value | Cost |
|
|
20
|
+
| :--- | :--- | :--- | :--- |
|
|
21
|
+
| **26 Curated Free Models** | 7 OpenCode Zen + 19 KiloCode Gateway models, up to 1M context & 512K output | Ceiling Unlocked | **$0** |
|
|
22
|
+
| **BYO Relay Pool** | Round-robin load balancing across your Cloudflare Workers & Vercel Edges | Zero Rate Limits | **$0** (your free tiers) |
|
|
23
|
+
| **Adaptive Health & Error Detection** | Auto-cooldown on 429 rate limits, 504 timeouts, and socket drops | 0ms Wasted Latency | **$0** |
|
|
24
|
+
| **Stream Truncation Resilience** | Stateful SSE terminal tracking (`response.failed` / `response.incomplete` injection) | Zero Host Crashes | **$0** |
|
|
25
|
+
| **Smart Model Aliasing** | Clean slash-free & colon-free CLI model names compatible with thinking selectors | DX Optimized | **$0** |
|
|
26
|
+
| **Auto-Enabled on Session** | Relay stays enabled in `auto` mode on session start and model switch | Zero Friction | **$0** |
|
|
27
|
+
| **Interactive CLI Management** | 10+ `/freeflow` subcommands (`status`, `list`, `use`, `add`, `label`, `remove`, `deploy`, `logs`, `debug`) | Full Control | **$0** |
|
|
28
|
+
| **Dumb Proxy That Never Breaks** | `127.0.0.1:28180`, host-normalized, pathname-guarded `/v1/models` | 100% Uptime | **$0** |
|
|
29
|
+
| **Observable Real Logs** | `~/.pi/agent/pi-freeflow.log`, 10MB auto-rotation, real-time debug toggle | Observable | **$0** |
|
|
30
|
+
|
|
31
|
+
Philosophy: **Thin by design.** We only ship model list + relay proxy + log. Host owns thinking & normalization.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
### 26 Curated Models, One Command
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
/model → freeflow → pick
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
#### OpenCode Zen (7 Models), Responses & Chat API
|
|
42
|
+
Optimized for deep reasoning, long-horizon coding & autonomous agentic workflows.
|
|
43
|
+
|
|
44
|
+
| Model ID | Creator / Lab | Context | Max Output | Thinking | Vision |
|
|
45
|
+
| :--- | :--- | :--- | :--- | :--- | :--- |
|
|
46
|
+
| `muse-spark-1.2-contributor-free` | Meta Superintelligence Labs | **1M** (1.048.576) | **131K** (131.072) | `minimal … xhigh` | ✅ |
|
|
47
|
+
| `muse-spark-1.3-contributor-free` | Meta Superintelligence Labs | **1M** (1.048.576) | **131K** (131.072) | `minimal … xhigh` | ✅ |
|
|
48
|
+
| `mimo-v2.5-free` | Xiaomi MiMo | **1M** (1.048.576) | **131K** (131.072) | `minimal … xhigh`\* | ✅ |
|
|
49
|
+
| `nemotron-3.5-lightning-free` | NVIDIA | **1M** (1.000.000) | **262K** (262.144) | `minimal … xhigh` | ❌ |
|
|
50
|
+
| `nemotron-3-ultra-free` | NVIDIA | **1M** (1.000.000) | **128K** (128.000) | `minimal … xhigh` | ❌ |
|
|
51
|
+
| `big-pickle` | Big Pickle | **200K** (200.000) | **32K** (32.000) | `high / max` | ❌ |
|
|
52
|
+
| `ling-3.0-flash-fin-free` | Inclusion AI | **262K** (262.144) | **131K** (131.072) | `minimal … xhigh` | ❌ |
|
|
53
|
+
|
|
54
|
+
#### KiloCode Gateway (19 Models), OpenRouter Compatible
|
|
55
|
+
Keyless access with `Bearer kilo-free`. Clean slash-free and colon-free CLI aliases supported.
|
|
56
|
+
|
|
57
|
+
| Model ID | Creator / Lab | Context | Max Output | Thinking | Vision |
|
|
58
|
+
| :--- | :--- | :--- | :--- | :--- | :--- |
|
|
59
|
+
| `dots-3-note-preview` (`dots-studio/...:free`) | Dots Studio | **512K** (512.000) | **512K** (512.000) | `minimal…xhigh`\* | ✅ |
|
|
60
|
+
| `step-3.7-flash` (`stepfun/...:free`) | StepFun | **262K** (262.144) | **262K** (262.144) | `minimal…xhigh`\* | ✅ |
|
|
61
|
+
| `nemotron-3-nano-omni` (`nvidia/...:free`) | NVIDIA | **256K** (256.000) | **131K** (131.072) | `minimal…xhigh`\* | ✅ |
|
|
62
|
+
| `nemotron-3-ultra-550b` (`nvidia/...:free`) | NVIDIA | **1M** (1.000.000) | **128K** (128.000) | `minimal…xhigh`\* | ❌ |
|
|
63
|
+
| `nvidia/nemotron-3.5-lightning:free` | NVIDIA | **1M** (1.000.000) | **262K** (262.144) | `minimal…xhigh`\* | ❌ |
|
|
64
|
+
| `nemotron-3-super` (`nvidia/...:free`) | NVIDIA | **262K** (262.144) | **262K** (262.144) | `minimal…xhigh`\* | ❌ |
|
|
65
|
+
| `north-mini-code` (`cohere/...:free`) | Cohere | **256K** (256.000) | **64K** (64.000) | `minimal…xhigh`\* | ❌ |
|
|
66
|
+
| `laguna-s-2.1:free` (`poolside/...:free`) | Poolside | **262K** (262.144) | **32K** (32.768) | `minimal…xhigh`\* | ❌ |
|
|
67
|
+
| `laguna-xs-2.1:free` (`poolside/...:free`) | Poolside | **262K** (262.144) | **32K** (32.768) | `minimal…xhigh`\* | ❌ |
|
|
68
|
+
| `lfm-2.5` (`liquid/lfm-2.5-2.6b:free`) | Liquid AI | **65K** (65.536) | **32K** (32.768) | `minimal…xhigh`\* | ❌ |
|
|
69
|
+
| `kilo-auto` (`kilo-auto/free`) | Kilo Gateway Auto | **256K** (256.000) | **10K** (10.000) | `minimal…xhigh`\* | ❌ |
|
|
70
|
+
| `openrouter` (`openrouter/free`) | OpenRouter Free | **200K** (200.000) | **65K** (65.536) | `minimal…xhigh`\* | ✅ |
|
|
71
|
+
| `content-safety` (`nvidia/...:free`) | NVIDIA | **128K** (128.000) | **8K** (8.192) | ❌ *(non-thinking)* | ✅ |
|
|
72
|
+
| `ling-3.0-flash-fin` (`inclusionai/ling-3.0-flash-fin:free`) | Inclusion AI | **262K** (262.144) | **32K** (32.768) | `minimal…xhigh`\* | ❌ |
|
|
73
|
+
| `ling-3.0-flash-sante` (`inclusionai/ling-3.0-flash-sante:free`) | Inclusion AI | **262K** (262.144) | **32K** (32.768) | `minimal…xhigh`\* | ❌ |
|
|
74
|
+
| `nex-n2.5-pro` (`nex-agi/nex-n2.5-pro:free`) | Nex AGI | **262K** (262.144) | **235K** (235.929) | `minimal…xhigh`\* | ✅ |
|
|
75
|
+
| `nex-n2.5-mini` (`nex-agi/nex-n2.5-mini:free`) | Nex AGI | **262K** (262.144) | **235K** (235.929) | `minimal…xhigh`\* | ✅ |
|
|
76
|
+
| `ling-3.0-flash-vl` (`inclusionai/ling-3.0-flash-vl:free`) | Inclusion AI | **262K** (262.144) | **32K** (32.768) | `minimal…xhigh`\* | ✅ |
|
|
77
|
+
| `inkling-small` (`thinkingmachines/inkling-small:free`) | Thinking Machines | **1M** (1.048.576) | **262K** (262.144) | `minimal…xhigh`\* | ✅ |
|
|
78
|
+
|
|
79
|
+
\* Levels are forwarded as-is through the OpenRouter-style nested `reasoning` parameter; effort mapping is decided by each model. MiMo collapses `minimal→low` and `xhigh→high` upstream, so its selector shows 5 labels but only 3 distinct effort values.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
### How It Works: BYO Relays, Zero Rate Limits
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
You → 127.0.0.1:28180 (dumb proxy, host-normalized) → x-relay-target → N egress IPs (your pool) → opencode.ai / api.kilo.ai
|
|
87
|
+
↑ host already normalized thinking → proxy just forwards
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
1. **Per-Request Round-Robin**: 10 parallel subagents hit N different egress IPs (your pool size). No thundering herd.
|
|
91
|
+
2. **Adaptive Health & Error Cooldown**: Relays hitting 429, 504, or socket disconnects enter temporary cooldown (30-90s) and automatically move behind healthy candidates. Healthy relays handle traffic with 0ms wasted delay.
|
|
92
|
+
3. **Seamless 429 Roll**: `429 / 408 / 502 / 503 / 504 / 520-530` → instant roll to next relay, never 429 to agent.
|
|
93
|
+
4. **Stream Truncation Resilience**: Stateful SSE terminal tracking prevents fatal unhandled stream closed errors when connections drop.
|
|
94
|
+
5. **Direct Fallback Safety Net**: If all relays in the pool are exhausted, transparent direct fetch to upstream.
|
|
95
|
+
6. **Zero Subagent Connect Errors**: 24h `DISK_CACHE_ONLY` model catalog avoids subagents hammering remote catalogs.
|
|
96
|
+
|
|
97
|
+
You bring the relays (free tiers). We bring the rolling.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
### Interactive Commands Reference (`/freeflow`)
|
|
102
|
+
|
|
103
|
+
Manage your relay pool directly from the OMP / Pi terminal:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
/freeflow status # View active relay, pool status, and candidates
|
|
107
|
+
/freeflow list # List all relays with real-time health badges (✓ / ⚠️ [cooling])
|
|
108
|
+
/freeflow use <url|index|label> # Switch active relay
|
|
109
|
+
/freeflow url <url> # Set the active relay URL directly
|
|
110
|
+
/freeflow add <url> [label] # Add new relay to the pool
|
|
111
|
+
/freeflow label <index|url> <name># Assign a friendly label to a relay
|
|
112
|
+
/freeflow remove <index|url|label># Remove a relay from the pool
|
|
113
|
+
/freeflow test <index|url|label> # Probe a relay for reachability (HTTP 200 + latency)
|
|
114
|
+
/freeflow on | off | auto # Toggle relay mode (auto = enabled for freeflow)
|
|
115
|
+
/freeflow deploy <platform> # Guided relay deploy: vercel|cloudflare|deno — token in-memory, auto-adds (Vercel 1M/mo recommended)
|
|
116
|
+
/freeflow logs [lines] # Inspect recent proxy logs
|
|
117
|
+
/freeflow trace [req-id] # Tail logs filtered by request correlation ID
|
|
118
|
+
/freeflow refresh # Reload the model catalog from live upstreams
|
|
119
|
+
/freeflow update # Check for and install a package update
|
|
120
|
+
/freeflow debug on | off # Toggle full HTTP lifecycle debug logging
|
|
121
|
+
/freeflow kill # Stop the shared proxy daemon now (restarts on next use)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
### Quick Start in 30 Seconds
|
|
127
|
+
|
|
128
|
+
**On Oh My Pi (OMP):**
|
|
129
|
+
```bash
|
|
130
|
+
omp plugin install pi-freeflow
|
|
131
|
+
# or local dev (repo checkout)
|
|
132
|
+
omp plugin link /path/to/pi-freeflow
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**On Pi:**
|
|
136
|
+
```bash
|
|
137
|
+
pi install npm:pi-freeflow
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
> Both commands fetch the **same npm package** from the registry — pi-freeflow
|
|
141
|
+
> is an extension loaded by the host, not a standalone CLI. It works on **OMP
|
|
142
|
+
> and Pi only** (they share the extension API).
|
|
143
|
+
|
|
144
|
+
#### 2. Pick a Model
|
|
145
|
+
|
|
146
|
+
**OMP — interactive:**
|
|
147
|
+
```bash
|
|
148
|
+
omp
|
|
149
|
+
/model → freeflow → muse-spark-1.2-contributor-free (1M) → max
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**OMP — one-shot CLI:**
|
|
153
|
+
```bash
|
|
154
|
+
omp -p --model freeflow/muse-spark-1.2-contributor-free "build me a SaaS"
|
|
155
|
+
omp -p --model freeflow/step-3.7-flash:high "solve this bug" # alias + thinking level
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Pi — interactive:**
|
|
159
|
+
```bash
|
|
160
|
+
pi
|
|
161
|
+
/model → freeflow → pick
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Pi — one-shot CLI:**
|
|
165
|
+
```bash
|
|
166
|
+
pi -p --model freeflow/step-3.7-flash:high "solve this bug"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
> Model IDs accept a full canonical ID, a short alias (see the tables above),
|
|
170
|
+
> and an optional `:effort` suffix (`:minimal` … `:xhigh`, `:max` where
|
|
171
|
+
> supported). The host resolves the rest — you only type `freeflow/<name>`.
|
|
172
|
+
|
|
173
|
+
#### 3. Manage Your Relay Pool (OMP & Pi both)
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
/freeflow status # active relay, pool status, candidates
|
|
177
|
+
/freeflow list # relays with health badges
|
|
178
|
+
/freeflow add <url> [label]
|
|
179
|
+
/freeflow deploy # guided deploy: vercel|cloudflare|deno
|
|
180
|
+
/freeflow logs [n] # tail proxy logs
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
These slash commands work **identically in OMP and Pi** — the extension
|
|
184
|
+
registers the same `/freeflow` command set in both hosts.
|
|
185
|
+
#### 4. Add Your Free Relays (Scale Infinitely)
|
|
186
|
+
|
|
187
|
+
Default ships direct. Add relays via `/freeflow add <url> [label]`.
|
|
188
|
+
|
|
189
|
+
**Zero setup?** Run `/freeflow deploy cloudflare` (or `deno`, `vercel`), paste your platform token once, and the relay is created and activated for you. Manual snippets below.
|
|
190
|
+
|
|
191
|
+
**Option A: Cloudflare Workers (100k req/day, no 25s timeout) — Auto Deploy**
|
|
192
|
+
```bash
|
|
193
|
+
/freeflow deploy cloudflare # prompts token in-memory, auto-adds to pool
|
|
194
|
+
```
|
|
195
|
+
*Manual fallback:* `dash.cloudflare.com` → Workers → Create → Deploy → Edit code → paste the canonical worker source (see "Canonical worker source" below) → Deploy → `/freeflow add https://your.workers.dev cf-worker-1`
|
|
196
|
+
|
|
197
|
+
**Option B: Vercel Edge Relay (1M req/mo) — Auto Deploy**
|
|
198
|
+
```bash
|
|
199
|
+
/freeflow deploy vercel # prompts token in-memory, auto-adds to pool
|
|
200
|
+
# or shorthand: /freeflow deploy
|
|
201
|
+
```
|
|
202
|
+
*Manual fallback:* Push 2 files (`api/relay.js` + `vercel.json`) to GitHub $\to$ Import on `vercel.com` $\to$ `/freeflow add https://your.vercel.app vercel-relay-1`
|
|
203
|
+
|
|
204
|
+
For `api/relay.js`, use the canonical worker source (see below); `vercel.json` stays:
|
|
205
|
+
|
|
206
|
+
```json
|
|
207
|
+
{ "rewrites": [{ "source": "/(.*)", "destination": "/api/relay" }] }
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Option C: Deno Deploy (100k req/day) — Auto Deploy**
|
|
211
|
+
```bash
|
|
212
|
+
/freeflow deploy deno # prompts token in-memory, auto-adds to pool
|
|
213
|
+
```
|
|
214
|
+
*Manual fallback:* `dash.deno.com` → New Project → Playground → paste the canonical worker source (see below) → Deploy → `/freeflow add https://your-project.deno.dev deno-relay-1`
|
|
215
|
+
|
|
216
|
+
**Canonical worker source (all platforms)**
|
|
217
|
+
|
|
218
|
+
The relay worker template is generated per deployment by `/freeflow deploy` and lives in [`src/deploy.ts`](src/deploy.ts): one hardened core plus thin Vercel / Cloudflare / Deno wrappers. Deployed relays are public by default for seamless migration across proxy tools (such as 9router), while enforcing the target allowlist (`https://opencode.ai`, `https://api.kilo.ai`), SSRF/private-host guard, relay-path validation, and a header denylist.
|
|
219
|
+
|
|
220
|
+
```js
|
|
221
|
+
// Minimal Cloudflare illustration. Prefer /freeflow deploy: the generated
|
|
222
|
+
// worker (src/deploy.ts) is the signed/hardened source for all three
|
|
223
|
+
// platforms. This example omits the SSRF guard, path validation, and auth.
|
|
224
|
+
const ALLOWED_TARGETS = ["https://opencode.ai", "https://api.kilo.ai"];
|
|
225
|
+
export default {
|
|
226
|
+
async fetch(req) {
|
|
227
|
+
const target = req.headers.get("x-relay-target");
|
|
228
|
+
const relayPath = req.headers.get("x-relay-path") || "/";
|
|
229
|
+
if (!target || !ALLOWED_TARGETS.includes(target.replace(/\/$/, ""))) {
|
|
230
|
+
return new Response(JSON.stringify({ error: "Forbidden target" }), { status: 403 });
|
|
231
|
+
}
|
|
232
|
+
const headers = new Headers(req.headers);
|
|
233
|
+
headers.delete("x-relay-target"); headers.delete("x-relay-path"); headers.delete("host");
|
|
234
|
+
return fetch(target.replace(/\/$/, "") + relayPath, { method: req.method, headers, body: req.method !== "GET" && req.method !== "HEAD" ? req.body : undefined });
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
**Verify your pool:**
|
|
240
|
+
```bash
|
|
241
|
+
/freeflow status # relay-A 1/N (ON) → candidates:N
|
|
242
|
+
/freeflow list # lists all relays with health status
|
|
243
|
+
/freeflow logs # tail -25
|
|
244
|
+
cat ~/.pi/agent/pi-freeflow.log | tail -n 20
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
### Logs & Debugging
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
/freeflow logs
|
|
253
|
+
cat ~/.pi/agent/pi-freeflow.log | tail -n 50
|
|
254
|
+
|
|
255
|
+
# debug toggle (full debug is on by default for complete error reports; `off` restores info)
|
|
256
|
+
/freeflow debug on
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Log rotation at 10MB. Clean, parseable, real-time HTTP lifecycle tracking.
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
### Design
|
|
264
|
+
|
|
265
|
+
This package stays thin. It ships three things: a model catalog, a relay proxy, and a log. There is no build step. Zero runtime dependencies — uses native Node.js global fetch. Thinking and prompt normalization stay with the host (`pi-ai`).
|
|
266
|
+
|
|
267
|
+
Current size: about 11.3k lines including tests. The full suite (sandboxed, mocked network) and typecheck pass before every release — see CHANGELOG.md.
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
### FAQ
|
|
272
|
+
|
|
273
|
+
**Do I need API keys?**
|
|
274
|
+
No. Kilo uses `Bearer kilo-free`, OpenCode free models are anonymous (no header needed).
|
|
275
|
+
|
|
276
|
+
**What if all relays are 429?**
|
|
277
|
+
Proxy tries direct. If that is also 429, Pi shows the rate limit. That number is the global upstream cap; without relays you would hit the same wall.
|
|
278
|
+
|
|
279
|
+
**Can I use without relays?**
|
|
280
|
+
Yes. `/freeflow off` → direct. Add relays later to scale.
|
|
281
|
+
|
|
282
|
+
**What happens when I update to a new version?**
|
|
283
|
+
The local proxy daemon is shared across sessions on port 28180. On upgrade, the new extension
|
|
284
|
+
detects a stale daemon (mismatched internal version) and replaces it automatically — no manual
|
|
285
|
+
kill, no restart of other sessions required. Replacement only happens when the running daemon is
|
|
286
|
+
idle: sessions with in-flight requests are never interrupted (busy or newer daemons are reused
|
|
287
|
+
with a log note instead). If a daemon cannot be replaced (e.g. port held by an unrelated process),
|
|
288
|
+
it falls back to reusing it with a warning. To disable replacement entirely, set the no-kill env
|
|
289
|
+
to `1` before starting a session.
|
|
290
|
+
|
|
291
|
+
**What happens when I close a session?**
|
|
292
|
+
Nothing visible to your other sessions. The proxy daemon is a separate background
|
|
293
|
+
process shared by every OMP/Pi session on the machine. Closing one session just
|
|
294
|
+
unregisters it; the daemon keeps serving the rest and retires itself automatically
|
|
295
|
+
once the last client disconnects and no client re-attaches within a short grace window.
|
|
296
|
+
To stop it manually, run `/freeflow kill` — the next freeflow use starts it again.
|
|
297
|
+
|
|
298
|
+
**Why did my session stop with "reasoning `encrypted_content` was not issued to this caller"?**
|
|
299
|
+
Reasoning models on the Responses API sign each thinking block for the upstream backend that produced it, and only that backend can read it back. When a later turn reaches a different backend, the replayed thinking blocks are rejected, and the host keeps re-sending the same history, so the session cannot continue on its own. pi-freeflow now handles this two ways: it keeps each conversation on the relay that issued its reasoning while that relay is healthy, and when the relay must change anyway (rate limit, relay removed or redeployed, direct-mode switch) it sends that turn's history without the signed thinking blocks, so the new backend accepts it immediately instead of rejecting the request. As a last resort it retries once without the blocks, then remembers which blocks were rejected and drops only those on later turns, keeping everything the current backend can read. Messages, tool calls and tool results are always preserved.
|
|
300
|
+
|
|
301
|
+
**Where's the normalizer?**
|
|
302
|
+
Deleted in 1.3.0. If zai/qwen/deepseek thinking broke before, it's fixed now because host handles it.
|
|
303
|
+
|
|
304
|
+
**Why is context free?**
|
|
305
|
+
We use OpenCode Zen & Kilo free tiers. You pay only with your own Cloudflare/Vercel free tiers for egress.
|
|
306
|
+
**Why is it installed via npm?**
|
|
307
|
+
The npm package is the **distribution channel** only — both hosts resolve it internally:
|
|
308
|
+
`omp plugin install pi-freeflow` and `pi install npm:pi-freeflow` install the same
|
|
309
|
+
package from the npm registry. pi-freeflow is an **extension, not a standalone CLI** —
|
|
310
|
+
the host (OMP or Pi) loads and runs it. A plain `npm install` just downloads the
|
|
311
|
+
files; it is not a supported way to run the extension.
|
|
312
|
+
|
|
313
|
+
**Which hosts can use it?**
|
|
314
|
+
Oh My Pi (OMP) and Pi only. They share the same extension API
|
|
315
|
+
(`extensions/index.ts` declares both `omp` and `pi` extension entries), so one
|
|
316
|
+
package serves both. Other AI agents (OpenCode, KiloCode, Cursor, ...) have their
|
|
317
|
+
own plugin systems and do not load this extension.
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
### Contributing
|
|
322
|
+
|
|
323
|
+
Contributions welcome — bug fixes, new relay platforms, model additions, docs improvements.
|
|
324
|
+
|
|
325
|
+
#### Prerequisites
|
|
326
|
+
|
|
327
|
+
- **Node.js ≥ 22.19.0** (uses `--experimental-strip-types`, no build step)
|
|
328
|
+
- **pnpm** (package manager)
|
|
329
|
+
|
|
330
|
+
#### Setup & Verify
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
git clone https://github.com/trefeon/pi-freeflow
|
|
334
|
+
cd pi-freeflow
|
|
335
|
+
pnpm install
|
|
336
|
+
|
|
337
|
+
# run all three before opening a PR
|
|
338
|
+
pnpm test # full suite; sandboxed + network-mocked
|
|
339
|
+
pnpm typecheck # tsc --noEmit, must pass clean
|
|
340
|
+
pnpm smoke # verifies extensions/index.ts loads without crashing
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
#### Project Structure
|
|
344
|
+
|
|
345
|
+
```
|
|
346
|
+
src/
|
|
347
|
+
├── index.ts # extension entry, lifecycle hooks
|
|
348
|
+
├── models.ts # 26-model catalog definitions
|
|
349
|
+
├── catalog.ts # model catalog cache (24h disk)
|
|
350
|
+
├── proxy.ts # local proxy server (127.0.0.1:28180)
|
|
351
|
+
├── relay.ts # relay selection & round-robin
|
|
352
|
+
├── relay-state.ts # relay pool state, health tracking
|
|
353
|
+
├── stream-pipe.ts # SSE stream piping & truncation resilience
|
|
354
|
+
├── commands.ts # /freeflow CLI subcommands
|
|
355
|
+
├── deploy.ts # guided relay deploy (vercel/cloudflare/deno)
|
|
356
|
+
├── config.ts # constants, whitelists, paths, and runtime settings
|
|
357
|
+
├── logger.ts # file logger with 10MB rotation
|
|
358
|
+
└── types.ts # shared type definitions
|
|
359
|
+
extensions/
|
|
360
|
+
└── index.ts # OMP/Pi extension manifest
|
|
361
|
+
test/
|
|
362
|
+
└── *.test.ts # mirrors src/, node:test runner
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
#### Guidelines
|
|
366
|
+
|
|
367
|
+
- **Stay thin.** Zero runtime dependencies, no build step. If it belongs in the host (`pi-ai`), don't add it here.
|
|
368
|
+
- **Test what you touch.** Every `src/*.ts` has a matching `test/*.test.ts`. Add or update tests for your change.
|
|
369
|
+
- **Keep model IDs clean.** Slash-free, colon-free aliases for CLI compatibility. See existing patterns in `models.ts`.
|
|
370
|
+
- **One concern per PR.** Bug fix? One PR. New relay platform? Separate PR. Easier to review, faster to merge.
|
|
371
|
+
|
|
372
|
+
#### Reporting Issues
|
|
373
|
+
|
|
374
|
+
Found a bug or want a feature? [Open an issue](https://github.com/trefeon/pi-freeflow/issues) with:
|
|
375
|
+
- What happened vs what you expected
|
|
376
|
+
- Your relay setup (`/freeflow status` output helps)
|
|
377
|
+
- Relevant logs (`/freeflow logs` or `~/.pi/agent/pi-freeflow.log`)
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
### License
|
|
382
|
+
|
|
383
|
+
MIT © trefeon
|
|
384
|
+
|