pi-freeflow 1.3.8 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +93 -56
  2. package/package.json +1 -1
  3. package/src/models.ts +9 -10
package/README.md CHANGED
@@ -14,57 +14,66 @@ Thin by design: model list + dumb relay + log. Host `pi-ai` owns thinking, norma
14
14
 
15
15
  ---
16
16
 
17
- ### Why FreeFlow?
18
-
19
- You love Pi. You love free models. You hate:
20
-
21
- - **429 Rate Limit** killing your 10-parallel subagent fleet
22
- - Paid models leaking into your picker
23
- - `reasoning_effort: max` rejected and thinking silently disabled
24
- - Paying for 1M context you should get for free
25
-
26
- **FreeFlow fixes all three in 17 files, 102KB.**
27
-
28
- ### Features
29
-
30
- | What You Get | Value | Cost |
31
- | :--- | :--- | :--- |
32
- | **23 Curated Free Models** — 9 OpenCode Zen + 14 Kilo, 66K-1M context, vision-ready | Unlimited | **$0** |
33
- | **BYO Relay Pool** — Cloudflare Workers + Vercel Edge, round-robin, seamless `429 → next` | Auto-scale | **$0** (your free tiers) |
34
- | **Dumb Proxy That Never Breaks** — `127.0.0.1:18080`, host-normalized, pathname-guarded `/v1/models` | 100% uptime | **$0** |
35
- | **Real Logs** — `~/.pi/agent/pi-freeflow.log`, 5MB rotate, debug toggle | Observable | **$0** |
17
+ ### Features at a Glance
18
+
19
+ | Feature | Description | Value | Cost |
20
+ | :--- | :--- | :--- | :--- |
21
+ | **23 Curated Free Models** | 9 OpenCode Zen + 14 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:18080`, host-normalized, pathname-guarded `/v1/models` | 100% Uptime | **$0** |
29
+ | **Observable Real Logs** | `~/.pi/agent/pi-freeflow.log`, 5MB auto-rotation, real-time debug toggle | Observable | **$0** |
36
30
 
37
31
  Philosophy: **Thin by design.** We only ship model list + relay proxy + log. Host owns thinking & normalization.
38
32
 
39
33
  ---
40
34
 
41
- ### 23 Models — One Command
35
+ ### 23 Curated Models — One Command
42
36
 
43
37
  ```bash
44
38
  /model → freeflow → pick
45
39
  ```
46
40
 
47
- #### OpenCode Zen (9) — Responses & Chat API
48
- Best for long-context reasoning. All vision-ready models marked.
49
-
50
- | Model | Context | Max Output | Thinking | Vision |
51
- | :--- | :--- | :--- | :--- | :--- |
52
- | `claude-sonnet-4.5-free` / `muse-spark-1.2-contributor-free` | 1M | 131K | `minimal → max` | ✅ |
53
- | `deepseek-v4-flash-free` | 1M | 384K | `minimal max` | |
54
- | `grok-code-fast-1-preview-f-free` / `x-preview-f-free` | 1M | 131K | `low / high / max` | ✅ |
55
- | `mimo-v2.5-free` | 1M | 131K | `low / medium / high` | |
56
- | `minimax-m2.1-free` / `laguna-s-2.1-free` | 1M | 131K | `minimal → max` | ❌ |
57
- | `nemotron-3.5-lightning-free` | 1M | 262K | `minimal → max` | ❌ |
58
- | `nemotron-3-ultra-free` | 1M | 128K | `minimal → max` | ❌ |
59
- | `qwen3-coder-480b-free` / `hy3-free` | 262K | 128K | `minimal → max` | ❌ |
60
- | `big-pickle` | 200K | 32K | `high / max` | ❌ |
41
+ #### OpenCode Zen (9 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 → max` | ✅ |
47
+ | `x-preview-f-free` | Ox Alpha | **1M** (1.048.576) | **131K** (131.072) | `low / high / max` | |
48
+ | `mimo-v2.5-free` | Xiaomi MiMo | **1M** (1.048.576) | **131K** (131.072) | `low / medium / high` | ✅ |
49
+ | `deepseek-v4-flash-free` | DeepSeek | **1M** (1.000.000) | **384K** (384.000) | `minimal max` | |
50
+ | `laguna-s-2.1-free` | Poolside | **1M** (1.048.576) | **131K** (131.072) | `minimal → max` | ❌ |
51
+ | `nemotron-3.5-lightning-free` | NVIDIA | **1M** (1.000.000) | **262K** (262.144) | `minimal → max` | ❌ |
52
+ | `nemotron-3-ultra-free` | NVIDIA | **1M** (1.000.000) | **128K** (128.000) | `minimal → max` | ❌ |
53
+ | `hy3-free` | Tencent Hunyuan | **262K** (262.144) | **262K** (262.144) | `minimal → max` | ❌ |
54
+ | `big-pickle` | Big Pickle | **200K** (200.000) | **32K** (32.000) | `high / max` | ❌ |
55
+
56
+ #### KiloCode Gateway (14 Models) — OpenRouter Compatible
57
+ Keyless access with `Bearer kilo-free`. Clean slash-free and colon-free CLI aliases supported.
58
+
59
+ | Model ID | Creator / Lab | Context | Max Output | Thinking | Vision |
60
+ | :--- | :--- | :--- | :--- | :--- | :--- |
61
+ | `dots-3-note-preview` (`dots-studio/...:free`) | Dots Studio | **512K** (512.000) | **512K** (512.000) | `openrouter` (auto) | ✅ |
62
+ | `step-3.7-flash` (`stepfun/...:free`) | StepFun | **262K** (262.144) | **262K** (262.144) | `low / medium / high` | ✅ |
63
+ | `nemotron-3-nano-omni` (`nvidia/...:free`) | NVIDIA | **256K** (256.000) | **65K** (65.536) | `openrouter` (auto) | ✅ |
64
+ | `nemotron-3-ultra-550b` (`nvidia/...:free`) | NVIDIA | **1M** (1.000.000) | **65K** (65.536) | `openrouter` (auto) | ❌ |
65
+ | `nemotron-3.5-lightning` (`nvidia/...:free`) | NVIDIA | **1M** (1.000.000) | **131K** (131.072) | `openrouter` (auto) | ❌ |
66
+ | `nemotron-3-super` (`nvidia/...:free`) | NVIDIA | **262K** (262.144) | **262K** (262.144) | `openrouter` (auto) | ❌ |
67
+ | `hy3` (`tencent/hy3:free`) | Tencent Hunyuan | **262K** (262.144) | **262K** (262.144) | `openrouter` (auto) | ❌ |
68
+ | `north-mini-code` (`cohere/...:free`) | Cohere | **256K** (256.000) | **64K** (64.000) | `openrouter` (auto) | ❌ |
69
+ | `laguna-s-2.1` (`poolside/...:free`) | Poolside | **1M** (1.048.576) | **131K** (131.072) | `openrouter` (auto) | ❌ |
70
+ | `laguna-xs-2.1` (`poolside/...:free`) | Poolside | **262K** (262.144) | **32K** (32.768) | `openrouter` (auto) | ❌ |
71
+ | `lfm-2.5` (`liquid/lfm-2.5-2.6b:free`) | Liquid AI | **128K** (128.000) | **32K** (32.768) | `openrouter` (auto) | ❌ |
72
+ | `kilo-auto` (`kilo-auto/free`) | Kilo Gateway Auto | **256K** (256.000) | **10K** (10.000) | ❌ *(non-thinking)* | ❌ |
73
+ | `openrouter` (`openrouter/free`) | OpenRouter Free | **200K** (200.000) | **65K** (65.536) | ❌ *(non-thinking)* | ✅ |
74
+ | `content-safety` (`nvidia/...:free`) | NVIDIA | **128K** (128.000) | **8K** (8.192) | ❌ *(non-thinking)* | ✅ |
61
75
 
62
- #### Kilo Gateway (14) — OpenRouter Compatible
63
- Zero-config, `Bearer kilo-free`.
64
-
65
- `dots-3-note-preview:free` (512K), `step-3.7-flash:free` (262K), `nemotron-3-nano-omni:free` (256K), `nemotron-3-ultra-550b:free` (1M), `nemotron-3-super:free` (262K), `hy3:free` (262K), `north-mini-code:free` (256K), `minimax-m2.1/xs:free` (262K), `lfm-2.5:free` (66K), `kilo-auto/free`, `openrouter/free`, `content-safety:free` + 2 more.
66
-
67
- > All `off → null` (hidden). Host decides token budgets, not us.
76
+ ---
68
77
 
69
78
  ### How It Works — The Magic: BYO Relays, Zero Rate Limits
70
79
 
@@ -73,16 +82,36 @@ You → 127.0.0.1:18080 (dumb proxy, host-normalized) → x-relay-target → N e
73
82
  ↑ host already normalized thinking → proxy just forwards
74
83
  ```
75
84
 
76
- - **Round-robin per request** — 10 parallel subagents hit N different egress IPs (your pool size). No thundering herd.
77
- - **Seamless 429 roll** `429 / 502 / 503 / 504` instant roll to next relay, never 429 to agent.
78
- - **Exhausted? Direct fallback** If all relays are 429 (global limit), transparent direct fetch. Host shows rate limit only when truly global.
79
- - **No live catalog fetch** 24h `DISK_CACHE_ONLY`, never fetch from subagent no `Unable to connect`.
80
- - **Real log (v1.3.1 thin):** `candidates:N relay-A 429 rolling relay-B 200 in 1.2s 98 chunks 663KB done`
85
+ 1. **Per-Request Round-Robin**: 10 parallel subagents hit N different egress IPs (your pool size). No thundering herd.
86
+ 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.
87
+ 3. **Seamless 429 Roll**: `429 / 502 / 503 / 504` instant roll to next relay, never 429 to agent.
88
+ 4. **Stream Truncation Resilience**: Stateful SSE terminal tracking prevents fatal unhandled stream closed errors when connections drop.
89
+ 5. **Direct Fallback Safety Net**: If all relays in the pool are exhausted, transparent direct fetch to upstream.
90
+ 6. **Zero Subagent Connect Errors**: 24h `DISK_CACHE_ONLY` model catalog avoids subagents hammering remote catalogs.
81
91
 
82
92
  You bring the relays (free tiers). We bring the rolling.
83
93
 
84
94
  ---
85
95
 
96
+ ### Interactive Commands Reference (`/freeflow`)
97
+
98
+ Manage your relay pool directly from the OMP / Pi terminal:
99
+
100
+ ```bash
101
+ /freeflow status # View active relay, pool status, and candidates
102
+ /freeflow list # List all relays with real-time health badges (✓ / ⚠️ [cooling])
103
+ /freeflow use <url|index|label> # Switch active relay
104
+ /freeflow add <url> [label] # Add new relay to the pool
105
+ /freeflow label <index|url> <name># Assign a friendly label to a relay
106
+ /freeflow remove <index|url|label># Remove a relay from the pool
107
+ /freeflow on | off | auto # Toggle relay mode (auto = enabled for freeflow)
108
+ /freeflow deploy # Guided auto-deploy 6 Vercel Edge relays (in-memory token)
109
+ /freeflow logs [lines] # Inspect recent proxy logs
110
+ /freeflow debug on | off # Toggle full HTTP lifecycle debug logging
111
+ ```
112
+
113
+ ---
114
+
86
115
  ### Quick Start — 30 Seconds
87
116
 
88
117
  #### 1. Install
@@ -103,39 +132,41 @@ pi install npm:pi-freeflow
103
132
 
104
133
  ```bash
105
134
  omp
106
- /model → freeflow → claude-sonnet-4.5 (1M) → max
135
+ /model → freeflow → muse-spark-1.2-contributor-free (1M) → max
107
136
 
108
137
  # or CLI
109
- omp -p --model freeflow/claude-sonnet-4.5-contributor-free "build me a SaaS"
138
+ omp -p --model freeflow/muse-spark-1.2-contributor-free "build me a SaaS"
139
+ # or with short alias & thinking level
140
+ omp -p --model freeflow/step-3.7-flash:high "solve this bug"
110
141
  ```
111
142
 
112
- #### 3. (Optional but 🔥) Add Your Free Relays
143
+ #### 3. Add Your Free Relays (Scale Infinitely)
113
144
 
114
- Scale infinitely. Default ships direct, add relays via `/freeflow use <url>`.
145
+ Default ships direct. Add relays via `/freeflow add <url> [label]`.
115
146
 
116
- **Option A: One Cloudflare Worker (100k req/day, no 25s timeout)**
147
+ **Option A: Cloudflare Workers (100k req/day, no 25s timeout)**
117
148
  1. Go to `dash.cloudflare.com` → Workers → Create → Deploy → Edit code
118
149
  2. Paste the Worker relay snippet from `/reference/worker-relay.js`
119
150
  3. Deploy and add it:
120
151
 
121
152
  ```bash
122
- omp → /freeflow use https://your.workers.dev
153
+ omp → /freeflow add https://your.workers.dev cf-worker-1
123
154
  ```
124
155
 
125
156
  **Option B: Six Vercel Edges (1M req/mo) — Auto Deploy**
126
157
  ```bash
127
158
  /freeflow deploy # prompts token in-memory, auto-adds to pool
128
- # or manual: vercel.json → api/relay.js
129
159
  ```
130
160
 
131
161
  **Verify your pool:**
132
162
  ```bash
133
163
  /freeflow status # relay-A 1/N (ON) → candidates:N
164
+ /freeflow list # lists all relays with health status
134
165
  /freeflow logs # tail -25
135
166
  cat ~/.pi/agent/pi-freeflow.log | tail -n 20
136
167
  ```
137
168
 
138
- Done. Subagents now follow parent proxy — `Unable to connect` is history.
169
+ ---
139
170
 
140
171
  ### Logs & Debugging
141
172
 
@@ -147,7 +178,9 @@ cat ~/.pi/agent/pi-freeflow.log | tail -n 50
147
178
  /freeflow debug on
148
179
  ```
149
180
 
150
- Log rotation at 5MB. Clean, parseable, real-time.
181
+ Log rotation at 5MB. Clean, parseable, real-time HTTP lifecycle tracking.
182
+
183
+ ---
151
184
 
152
185
  ### Philosophy: Thin vs Fat
153
186
 
@@ -158,7 +191,9 @@ Log rotation at 5MB. Clean, parseable, real-time.
158
191
  | 400 loops N× relays | Narrow 429/5xx only, 400 surfaces instantly |
159
192
  | `GET /v1/models?foo` leaks paid | Pathname-guarded |
160
193
 
161
- **Result: <500 LOC core, 29 tests PASS, typecheck PASS.**
194
+ **Result: <500 LOC core, 39 tests PASS, typecheck PASS.**
195
+
196
+ ---
162
197
 
163
198
  ### FAQ
164
199
 
@@ -177,6 +212,8 @@ Deleted in 1.3.0. If zai/qwen/deepseek thinking broke before, it's fixed now bec
177
212
  **Why is context free?**
178
213
  We use OpenCode Zen & Kilo free tiers. You pay only with your own Cloudflare/Vercel free tiers for egress.
179
214
 
215
+ ---
216
+
180
217
  ### Contributing
181
218
 
182
219
  > "I shipped 10 parallel subagents on 1M context, zero keys, zero 429s. FreeFlow did the rolling, Pi did the thinking."
@@ -195,5 +232,5 @@ MIT © trefeon
195
232
 
196
233
  Start now:
197
234
  ```bash
198
- omp plugin install pi-freeflow && omp --model freeflow/claude-sonnet-4.5-contributor-free --thinking max "make it sell"
235
+ omp plugin install pi-freeflow && omp --model freeflow/muse-spark-1.2-contributor-free --thinking max "make it sell"
199
236
  ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-freeflow",
3
3
  "type": "module",
4
- "version": "1.3.8",
4
+ "version": "1.4.0",
5
5
  "description": "Thin provider for OMP/Pi — model list + dumb relay proxy + log; host pi-ai owns thinking/normalization",
6
6
  "main": "extensions/index.ts",
7
7
  "types": "src/index.ts",
package/src/models.ts CHANGED
@@ -87,7 +87,7 @@ export const OPENCODE_MODELS: ModelDef[] = [
87
87
  name: "Hy3 (262K)",
88
88
  reasoning: true,
89
89
  contextWindow: 262_144,
90
- maxTokens: 128_000,
90
+ maxTokens: 262_144,
91
91
  input: ["text"],
92
92
  thinkingLevelMap: {
93
93
  off: null,
@@ -220,7 +220,7 @@ export const KILO_MODELS: ModelDef[] = [
220
220
  name: "Nemotron 3.5 Lightning (Kilo)",
221
221
  reasoning: true,
222
222
  contextWindow: 1_000_000,
223
- maxTokens: 65_536,
223
+ maxTokens: 131_072,
224
224
  input: ["text"],
225
225
  thinkingFormat: "openrouter",
226
226
  },
@@ -238,9 +238,8 @@ export const KILO_MODELS: ModelDef[] = [
238
238
  name: "Tencent Hy3 (Kilo)",
239
239
  reasoning: true,
240
240
  contextWindow: 262_144,
241
- maxTokens: 128_000,
241
+ maxTokens: 262_144,
242
242
  input: ["text"],
243
- thinkingFormat: "openrouter",
244
243
  },
245
244
  {
246
245
  id: "cohere/north-mini-code:free",
@@ -255,8 +254,8 @@ export const KILO_MODELS: ModelDef[] = [
255
254
  id: "poolside/laguna-s-2.1:free",
256
255
  name: "Laguna S 2.1 (Kilo)",
257
256
  reasoning: true,
258
- contextWindow: 262_144,
259
- maxTokens: 32_768,
257
+ contextWindow: 1_048_576,
258
+ maxTokens: 131_072,
260
259
  input: ["text"],
261
260
  thinkingFormat: "openrouter",
262
261
  },
@@ -273,8 +272,8 @@ export const KILO_MODELS: ModelDef[] = [
273
272
  id: "liquid/lfm-2.5-2.6b:free",
274
273
  name: "Liquid LFM 2.5",
275
274
  reasoning: true,
276
- contextWindow: 65_536,
277
- maxTokens: 8_192,
275
+ contextWindow: 128_000,
276
+ maxTokens: 32_768,
278
277
  input: ["text"],
279
278
  thinkingFormat: "openrouter",
280
279
  },
@@ -292,7 +291,7 @@ export const KILO_MODELS: ModelDef[] = [
292
291
  reasoning: false,
293
292
  contextWindow: 200_000,
294
293
  maxTokens: 65_536,
295
- input: ["text"],
294
+ input: ["text", "image"],
296
295
  },
297
296
  {
298
297
  id: "nvidia/nemotron-3.5-content-safety:free",
@@ -300,7 +299,7 @@ export const KILO_MODELS: ModelDef[] = [
300
299
  reasoning: false,
301
300
  contextWindow: 128_000,
302
301
  maxTokens: 8_192,
303
- input: ["text"],
302
+ input: ["text", "image"],
304
303
  },
305
304
  ];
306
305