pi-io-provider 1.1.0 → 1.1.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/AGENTS.md CHANGED
@@ -7,6 +7,7 @@ The following files are **idempotent** and regenerated by `scripts/update-models
7
7
  | File | Why it's auto-generated |
8
8
  |------|------------------------|
9
9
  | `models.json` | Built from the provider API. `update-models.js` fetches models, preserves curated data for known IDs, and writes this file. |
10
+ | `deprecated-models.json` | Graveyard for models the API delisted. update-models.js stamps them with deprecatedAt and pi keeps serving them for a 2-week grace period, then evicts them. Never edit by hand. |
10
11
  | `README.md` (model table) | The table under `## Available Models` is replaced in-place by `update-models.js` after merging base models → patch → custom models. |
11
12
 
12
13
  ## Correct Files to Edit
package/README.md CHANGED
@@ -19,32 +19,34 @@ A [pi](https://github.com/badlogic/pi-mono) extension that adds [IO Intelligence
19
19
  | DeepSeek R1 0528 | `deepseek-ai/DeepSeek-R1-0528` | 128K | 128K | ❌ | ✅ | ✅ | $0.57 | $2.28 |
20
20
  | Kimi K2 Thinking | `moonshotai/Kimi-K2-Thinking` | 262K | 262K | ❌ | ✅ | ✅ | $0.60 | $2.50 |
21
21
  | Llama 3.2 90B Vision Instruct | `meta-llama/Llama-3.2-90B-Vision-Instruct` | 16K | 16K | ✅ | ❌ | ✅ | $0.34 | $0.34 |
22
- | Llama 4 Maverick 17B 128E Instruct FP8 | `meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8` | 430K | 430K | ✅ | ❌ | ✅ | $0.27 | $0.89 |
23
- | Kimi K2.5 | `moonshotai/Kimi-K2.5` | 262K | 262K | ✅ | ❌ | ✅ | $0.51 | $2.67 |
24
- | Kimi K2.6 | `moonshotai/Kimi-K2.6` | 262K | 262K | ✅ | ❌ | ✅ | $0.95 | $3.98 |
25
- | DeepSeek V3.2 | `deepseek-ai/DeepSeek-V3.2` | 164K | 164K | ❌ | ❌ | ✅ | $0.91 | $1.77 |
26
- | DeepSeek V4 Flash | `deepseek-ai/DeepSeek-V4-Flash` | 1.0M | 1.0M | ❌ | ❌ | ✅ | $0.13 | $0.26 |
27
- | DeepSeek V4 Pro | `deepseek-ai/DeepSeek-V4-Pro` | 1.0M | 600K | ❌ | ❌ | ✅ | $1.28 | $2.56 |
28
- | Gemma 4 26B A4B | `google/gemma-4-26b-a4b-it` | 262K | 262K | ❌ | ❌ | ✅ | $0.12 | $0.43 |
29
- | Qwen3 Coder 480B A35B Instruct INT4 Mixed AR | `Intel/Qwen3-Coder-480B-A35B-Instruct-int4-mixed-ar` | 106K | 106K | ❌ | ❌ | ✅ | $0.60 | $2.08 |
30
- | Llama 3.3 70B Instruct | `meta-llama/Llama-3.3-70B-Instruct` | 128K | 128K | ❌ | ❌ | ✅ | $0.55 | $1.07 |
31
- | MiniMax M2.5 | `MiniMaxAI/MiniMax-M2.5` | 197K | 197K | ❌ | ❌ | ✅ | $0.28 | $1.31 |
32
- | MiniMax M2.7 | `MiniMaxAI/MiniMax-M2.7` | 205K | 205K | ❌ | ❌ | ✅ | $0.86 | $2.72 |
33
- | Mistral Nemo Instruct 2407 | `mistralai/Mistral-Nemo-Instruct-2407` | 128K | 128K | ❌ | ❌ | ✅ | $0.06 | $0.10 |
22
+ | Llama 4 Maverick 17B 128E Instruct FP8 | `meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8` | 430K | 430K | ✅ | ❌ | ✅ | $0.28 | $0.93 |
23
+ | Kimi K2.5 | `moonshotai/Kimi-K2.5` | 262K | 262K | ✅ | ❌ | ✅ | $0.53 | $2.79 |
24
+ | Kimi K2.6 | `moonshotai/Kimi-K2.6` | 262K | 262K | ✅ | ❌ | ✅ | $0.84 | $3.76 |
25
+ | DeepSeek V3.2 | `deepseek-ai/DeepSeek-V3.2` | 164K | 164K | ❌ | ❌ | ✅ | $0.90 | $1.76 |
26
+ | DeepSeek V4 Flash | `deepseek-ai/DeepSeek-V4-Flash` | 33K | 33K | ❌ | ❌ | ✅ | $0.20 | $0.37 |
27
+ | DeepSeek V4 Pro | `deepseek-ai/DeepSeek-V4-Pro` | 1.0M | 600K | ❌ | ❌ | ✅ | $1.62 | $3.25 |
28
+ | Gemma 4 26B A4B | `google/gemma-4-26b-a4b-it` | 262K | 262K | ❌ | ❌ | ✅ | $0.12 | $0.39 |
29
+ | Qwen3 Coder 480B A35B Instruct INT4 Mixed AR | `Intel/Qwen3-Coder-480B-A35B-Instruct-int4-mixed-ar` | 106K | 106K | ❌ | ❌ | ✅ | $0.58 | $2.25 |
30
+ | Llama 3.3 70B Instruct | `meta-llama/Llama-3.3-70B-Instruct` | 128K | 128K | ❌ | ❌ | ✅ | $0.51 | $1.04 |
31
+ | MiniMax M2.5 | `MiniMaxAI/MiniMax-M2.5` | 197K | 197K | ❌ | ❌ | ✅ | $0.28 | $1.13 |
32
+ | MiniMax M2.7 | `MiniMaxAI/MiniMax-M2.7` | 205K | 205K | ❌ | ❌ | ✅ | $0.42 | $1.62 |
33
+ | Mistral Nemo Instruct 2407 | `mistralai/Mistral-Nemo-Instruct-2407` | 128K | 128K | ❌ | ❌ | ✅ | $0.07 | $0.12 |
34
34
  | Kimi K2 Instruct 0905 | `moonshotai/Kimi-K2-Instruct-0905` | 262K | 262K | ❌ | ❌ | ✅ | $0.57 | $2.30 |
35
- | Kimi K2.7 Code | `moonshotai/Kimi-K2.7-Code` | 262K | 262K | ❌ | ❌ | ✅ | $1.08 | $4.60 |
36
- | gpt-oss-120b | `openai/gpt-oss-120b` | 131K | 131K | ❌ | ❌ | ✅ | $0.18 | $0.68 |
37
- | gpt-oss-20b | `openai/gpt-oss-20b` | 64K | 64K | ❌ | ❌ | ✅ | $0.05 | $0.20 |
35
+ | Kimi K2.7 Code | `moonshotai/Kimi-K2.7-Code` | 262K | 262K | ❌ | ❌ | ✅ | $1.10 | $4.70 |
36
+ | Kimi K3 | `moonshotai/Kimi-K3` | 1.0M | 1.0M | ❌ | ❌ | ✅ | $3.28 | $16.30 |
37
+ | gpt-oss-120b | `openai/gpt-oss-120b` | 131K | 131K | ❌ | ❌ | ✅ | $0.19 | $0.70 |
38
+ | gpt-oss-20b | `openai/gpt-oss-20b` | 64K | 64K | ❌ | ❌ | ✅ | $0.06 | $0.22 |
38
39
  | Qwen3 Next 80B A3B Instruct | `Qwen/Qwen3-Next-80B-A3B-Instruct` | 262K | 262K | ❌ | ❌ | ✅ | $0.12 | $1.14 |
39
- | Qwen3.6 27B | `Qwen/Qwen3.6-27B` | 262K | 262K | ❌ | ❌ | ✅ | $0.37 | $3.03 |
40
- | Qwen3.6 35B A3B | `Qwen/Qwen3.6-35B-A3B` | 262K | 262K | ❌ | ❌ | ✅ | $0.16 | $1.14 |
40
+ | Qwen3.6 27B | `Qwen/Qwen3.6-27B` | 33K | 33K | ❌ | ❌ | ✅ | $0.40 | $3.09 |
41
+ | Qwen3.6 35B A3B | `Qwen/Qwen3.6-35B-A3B` | 262K | 262K | ❌ | ❌ | ✅ | $0.18 | $1.19 |
42
+ | MiMo-V2.5 | `XiaomiMiMo/MiMo-V2.5` | 262K | 262K | ❌ | ❌ | ✅ | $0.20 | $0.64 |
41
43
  | GLM-4.5-Air | `zai-org/GLM-4.5-Air` | 131K | 131K | ❌ | ❌ | ✅ | $0.16 | $0.94 |
42
- | GLM 4.6 | `zai-org/GLM-4.6` | 131K | 131K | ❌ | ❌ | ✅ | $0.85 | $2.75 |
43
- | GLM 4.7 | `zai-org/GLM-4.7` | 203K | 203K | ❌ | ❌ | ✅ | $0.86 | $2.22 |
44
+ | GLM 4.6 | `zai-org/GLM-4.6` | 131K | 131K | ❌ | ❌ | ✅ | $0.54 | $2.07 |
45
+ | GLM 4.7 | `zai-org/GLM-4.7` | 203K | 203K | ❌ | ❌ | ✅ | $0.86 | $2.24 |
44
46
  | GLM 4.7 Flash | `zai-org/GLM-4.7-Flash` | 200K | 200K | ❌ | ❌ | ✅ | $0.08 | $0.42 |
45
- | GLM 5 | `zai-org/GLM-5` | 203K | 203K | ❌ | ❌ | ✅ | $0.83 | $2.58 |
46
- | GLM 5.1 | `zai-org/GLM-5.1` | 203K | 33K | ❌ | ❌ | ✅ | $1.38 | $4.38 |
47
- | GLM 5.2 | `zai-org/GLM-5.2` | 262K | 131K | ❌ | ❌ | ✅ | $1.46 | $4.74 |
47
+ | GLM 5 | `zai-org/GLM-5` | 203K | 203K | ❌ | ❌ | ✅ | $0.86 | $2.78 |
48
+ | GLM 5.1 | `zai-org/GLM-5.1` | 203K | 33K | ❌ | ❌ | ✅ | $1.29 | $4.22 |
49
+ | GLM 5.2 | `zai-org/GLM-5.2` | 262K | 66K | ❌ | ❌ | ✅ | $1.96 | $6.16 |
48
50
 
49
51
  *Costs are per million tokens. Cache read/write pricing available on most models.*
50
52
 
@@ -0,0 +1 @@
1
+ {}
package/index.ts CHANGED
@@ -40,6 +40,7 @@ import { getAgentDir, type ExtensionAPI, type ModelRegistry } from "@earendil-wo
40
40
  import modelsData from "./models.json" with { type: "json" };
41
41
  import customModelsData from "./custom-models.json" with { type: "json" };
42
42
  import patchData from "./patch.json" with { type: "json" };
43
+ import deprecatedData from "./deprecated-models.json" with { type: "json" };
43
44
  import fs from "fs";
44
45
  import path from "path";
45
46
 
@@ -49,7 +50,7 @@ interface JsonModel {
49
50
  id: string;
50
51
  name: string;
51
52
  reasoning: boolean;
52
- input: string[];
53
+ input: ("text" | "image")[];
53
54
  cost: {
54
55
  input: number;
55
56
  output: number;
@@ -70,7 +71,7 @@ interface JsonModel {
70
71
  interface PatchEntry {
71
72
  name?: string;
72
73
  reasoning?: boolean;
73
- input?: string[];
74
+ input?: ("text" | "image")[];
74
75
  cost?: {
75
76
  input?: number;
76
77
  output?: number;
@@ -121,7 +122,10 @@ function applyPatch(model: JsonModel, patch: PatchEntry): JsonModel {
121
122
  function buildModels(base: JsonModel[], custom: JsonModel[], patch: PatchData): JsonModel[] {
122
123
  const modelMap = new Map<string, JsonModel>();
123
124
 
124
- for (const model of base) {
125
+ // Seed with the base list plus grace-period deprecated models so patch.json
126
+ // entries apply to deprecated models exactly as while the model was live
127
+ // (withDeprecated keeps live data on id conflicts).
128
+ for (const model of withDeprecated(base)) {
125
129
  modelMap.set(model.id, model);
126
130
  }
127
131
 
@@ -258,6 +262,35 @@ function mergeWithEmbedded(liveModels: JsonModel[], embeddedModels: JsonModel[])
258
262
  return result;
259
263
  }
260
264
 
265
+ // Grace period for delisted models. When the provider API stops listing a
266
+ // model, update-models.js moves its last-known definition into
267
+ // deprecated-models.json (stamped with deprecatedAt) instead of dropping it.
268
+ // For 14 days the model keeps working here so in-flight sessions and saved
269
+ // model settings do not break; afterwards it is evicted permanently.
270
+ const DEPRECATED_MODEL_TTL_MS = 14 * 24 * 60 * 60 * 1000;
271
+
272
+ // Grace-period deprecated models with deprecation metadata stripped.
273
+ function activeDeprecatedModels(): JsonModel[] {
274
+ const now = Date.now();
275
+ const result: JsonModel[] = [];
276
+ for (const entry of Object.values(deprecatedData as Record<string, JsonModel & { deprecatedAt?: string }>)) {
277
+ if (!entry?.id) continue;
278
+ const removedAt = Date.parse(entry.deprecatedAt ?? "");
279
+ if (Number.isNaN(removedAt) || now - removedAt > DEPRECATED_MODEL_TTL_MS) continue;
280
+ const model = { ...entry } as JsonModel & { deprecatedAt?: string };
281
+ delete model.deprecatedAt;
282
+ result.push(model);
283
+ }
284
+ return result;
285
+ }
286
+
287
+ // Append grace-period deprecated models the list does not already have (live data wins).
288
+ function withDeprecated(models: JsonModel[]): JsonModel[] {
289
+ const seen = new Set(models.map((m) => m.id));
290
+ const extras = activeDeprecatedModels().filter((m) => !seen.has(m.id));
291
+ return extras.length > 0 ? [...models, ...extras] : models;
292
+ }
293
+
261
294
  function loadStaleModels(embeddedModels: JsonModel[]): JsonModel[] {
262
295
  const cached = loadCachedModels();
263
296
  if (!cached || cached.length === 0) return embeddedModels;
package/models.json CHANGED
@@ -1,4 +1,36 @@
1
1
  [
2
+ {
3
+ "id": "moonshotai/Kimi-K3",
4
+ "name": "Kimi K3",
5
+ "reasoning": false,
6
+ "input": [
7
+ "text"
8
+ ],
9
+ "cost": {
10
+ "input": 3.28,
11
+ "output": 16.3,
12
+ "cacheRead": 1.64,
13
+ "cacheWrite": 0
14
+ },
15
+ "contextWindow": 1048576,
16
+ "maxTokens": 1048576
17
+ },
18
+ {
19
+ "id": "XiaomiMiMo/MiMo-V2.5",
20
+ "name": "MiMo-V2.5",
21
+ "reasoning": false,
22
+ "input": [
23
+ "text"
24
+ ],
25
+ "cost": {
26
+ "input": 0.1976,
27
+ "output": 0.6352,
28
+ "cacheRead": 0.0988,
29
+ "cacheWrite": 0
30
+ },
31
+ "contextWindow": 262144,
32
+ "maxTokens": 262144
33
+ },
2
34
  {
3
35
  "id": "zai-org/GLM-5.2",
4
36
  "name": "GLM 5.2",
@@ -7,13 +39,13 @@
7
39
  "text"
8
40
  ],
9
41
  "cost": {
10
- "input": 1.458,
11
- "output": 4.74,
12
- "cacheRead": 0.729,
42
+ "input": 1.96,
43
+ "output": 6.16,
44
+ "cacheRead": 0.98,
13
45
  "cacheWrite": 0
14
46
  },
15
47
  "contextWindow": 262144,
16
- "maxTokens": 131072
48
+ "maxTokens": 65536
17
49
  },
18
50
  {
19
51
  "id": "moonshotai/Kimi-K2.7-Code",
@@ -23,9 +55,9 @@
23
55
  "text"
24
56
  ],
25
57
  "cost": {
26
- "input": 1.078,
27
- "output": 4.6,
28
- "cacheRead": 0.539,
58
+ "input": 1.098,
59
+ "output": 4.7,
60
+ "cacheRead": 0.549,
29
61
  "cacheWrite": 0
30
62
  },
31
63
  "contextWindow": 262144,
@@ -39,9 +71,9 @@
39
71
  "text"
40
72
  ],
41
73
  "cost": {
42
- "input": 0.1628,
43
- "output": 1.141313,
44
- "cacheRead": 0.0814,
74
+ "input": 0.1752,
75
+ "output": 1.19275,
76
+ "cacheRead": 0.0876,
45
77
  "cacheWrite": 0
46
78
  },
47
79
  "contextWindow": 262140,
@@ -55,13 +87,13 @@
55
87
  "text"
56
88
  ],
57
89
  "cost": {
58
- "input": 0.3708,
59
- "output": 3.03,
60
- "cacheRead": 0.1854,
90
+ "input": 0.403,
91
+ "output": 3.09,
92
+ "cacheRead": 0.2015,
61
93
  "cacheWrite": 0
62
94
  },
63
- "contextWindow": 262140,
64
- "maxTokens": 262140
95
+ "contextWindow": 32768,
96
+ "maxTokens": 32768
65
97
  },
66
98
  {
67
99
  "id": "MiniMaxAI/MiniMax-M2.7",
@@ -71,9 +103,9 @@
71
103
  "text"
72
104
  ],
73
105
  "cost": {
74
- "input": 0.86,
75
- "output": 2.72,
76
- "cacheRead": 0.43,
106
+ "input": 0.42,
107
+ "output": 1.62,
108
+ "cacheRead": 0.21,
77
109
  "cacheWrite": 0
78
110
  },
79
111
  "contextWindow": 204800,
@@ -87,13 +119,13 @@
87
119
  "text"
88
120
  ],
89
121
  "cost": {
90
- "input": 0.13146,
91
- "output": 0.26292,
92
- "cacheRead": 0.06573,
122
+ "input": 0.20346,
123
+ "output": 0.36692,
124
+ "cacheRead": 0.10173,
93
125
  "cacheWrite": 0
94
126
  },
95
- "contextWindow": 1048576,
96
- "maxTokens": 1048576
127
+ "contextWindow": 32768,
128
+ "maxTokens": 32768
97
129
  },
98
130
  {
99
131
  "id": "deepseek-ai/DeepSeek-V4-Pro",
@@ -103,9 +135,9 @@
103
135
  "text"
104
136
  ],
105
137
  "cost": {
106
- "input": 1.2821,
107
- "output": 2.5642,
108
- "cacheRead": 0.64105,
138
+ "input": 1.624,
139
+ "output": 3.2482,
140
+ "cacheRead": 0.812,
109
141
  "cacheWrite": 0
110
142
  },
111
143
  "contextWindow": 1048576,
@@ -120,9 +152,9 @@
120
152
  "image"
121
153
  ],
122
154
  "cost": {
123
- "input": 0.95,
124
- "output": 3.98,
125
- "cacheRead": 0.475,
155
+ "input": 0.84,
156
+ "output": 3.762,
157
+ "cacheRead": 0.42,
126
158
  "cacheWrite": 0
127
159
  },
128
160
  "contextWindow": 262142,
@@ -136,9 +168,9 @@
136
168
  "text"
137
169
  ],
138
170
  "cost": {
139
- "input": 1.38,
140
- "output": 4.38,
141
- "cacheRead": 0.69,
171
+ "input": 1.29,
172
+ "output": 4.22,
173
+ "cacheRead": 0.645,
142
174
  "cacheWrite": 0
143
175
  },
144
176
  "contextWindow": 202750,
@@ -152,9 +184,9 @@
152
184
  "text"
153
185
  ],
154
186
  "cost": {
155
- "input": 0.285,
156
- "output": 1.31,
157
- "cacheRead": 0.1425,
187
+ "input": 0.282,
188
+ "output": 1.128,
189
+ "cacheRead": 0.141,
158
190
  "cacheWrite": 0
159
191
  },
160
192
  "contextWindow": 196600,
@@ -169,9 +201,9 @@
169
201
  "image"
170
202
  ],
171
203
  "cost": {
172
- "input": 0.51,
173
- "output": 2.67,
174
- "cacheRead": 0.255,
204
+ "input": 0.528,
205
+ "output": 2.79,
206
+ "cacheRead": 0.264,
175
207
  "cacheWrite": 1.1
176
208
  },
177
209
  "contextWindow": 262144,
@@ -185,9 +217,9 @@
185
217
  "text"
186
218
  ],
187
219
  "cost": {
188
- "input": 0.83,
189
- "output": 2.58,
190
- "cacheRead": 0.415,
220
+ "input": 0.86,
221
+ "output": 2.784,
222
+ "cacheRead": 0.43,
191
223
  "cacheWrite": 0
192
224
  },
193
225
  "contextWindow": 202752,
@@ -201,9 +233,9 @@
201
233
  "text"
202
234
  ],
203
235
  "cost": {
204
- "input": 0.9111,
205
- "output": 1.7703,
206
- "cacheRead": 0.45555,
236
+ "input": 0.90054,
237
+ "output": 1.75646,
238
+ "cacheRead": 0.45027,
207
239
  "cacheWrite": 0.5
208
240
  },
209
241
  "contextWindow": 163840,
@@ -250,7 +282,7 @@
250
282
  ],
251
283
  "cost": {
252
284
  "input": 0.122,
253
- "output": 0.428,
285
+ "output": 0.388,
254
286
  "cacheRead": 0.061,
255
287
  "cacheWrite": 0
256
288
  },
@@ -281,9 +313,9 @@
281
313
  "text"
282
314
  ],
283
315
  "cost": {
284
- "input": 0.856,
285
- "output": 2.222,
286
- "cacheRead": 0.428,
316
+ "input": 0.864,
317
+ "output": 2.24,
318
+ "cacheRead": 0.432,
287
319
  "cacheWrite": 0.6
288
320
  },
289
321
  "contextWindow": 202752,
@@ -330,9 +362,9 @@
330
362
  "text"
331
363
  ],
332
364
  "cost": {
333
- "input": 0.178,
334
- "output": 0.68,
335
- "cacheRead": 0.089,
365
+ "input": 0.188,
366
+ "output": 0.7,
367
+ "cacheRead": 0.094,
336
368
  "cacheWrite": 0.04
337
369
  },
338
370
  "contextWindow": 131072,
@@ -362,9 +394,9 @@
362
394
  "text"
363
395
  ],
364
396
  "cost": {
365
- "input": 0.85,
366
- "output": 2.75,
367
- "cacheRead": 0.3,
397
+ "input": 0.536,
398
+ "output": 2.07,
399
+ "cacheRead": 0.268,
368
400
  "cacheWrite": 0.7
369
401
  },
370
402
  "contextWindow": 131072,
@@ -394,9 +426,9 @@
394
426
  "text"
395
427
  ],
396
428
  "cost": {
397
- "input": 0.601,
398
- "output": 2.085,
399
- "cacheRead": 0.3005,
429
+ "input": 0.585,
430
+ "output": 2.245,
431
+ "cacheRead": 0.2925,
400
432
  "cacheWrite": 0.44
401
433
  },
402
434
  "contextWindow": 106000,
@@ -411,9 +443,9 @@
411
443
  "image"
412
444
  ],
413
445
  "cost": {
414
- "input": 0.274,
415
- "output": 0.894,
416
- "cacheRead": 0.137,
446
+ "input": 0.284,
447
+ "output": 0.934,
448
+ "cacheRead": 0.142,
417
449
  "cacheWrite": 0.3
418
450
  },
419
451
  "contextWindow": 430000,
@@ -427,9 +459,9 @@
427
459
  "text"
428
460
  ],
429
461
  "cost": {
430
- "input": 0.0575,
431
- "output": 0.0975,
432
- "cacheRead": 0.02875,
462
+ "input": 0.069667,
463
+ "output": 0.116667,
464
+ "cacheRead": 0.034834,
433
465
  "cacheWrite": 0.04
434
466
  },
435
467
  "contextWindow": 128000,
@@ -443,9 +475,9 @@
443
475
  "text"
444
476
  ],
445
477
  "cost": {
446
- "input": 0.047,
447
- "output": 0.198,
448
- "cacheRead": 0.0235,
478
+ "input": 0.059,
479
+ "output": 0.216,
480
+ "cacheRead": 0.0295,
449
481
  "cacheWrite": 0.03
450
482
  },
451
483
  "contextWindow": 64000,
@@ -459,9 +491,9 @@
459
491
  "text"
460
492
  ],
461
493
  "cost": {
462
- "input": 0.5526,
463
- "output": 1.0746,
464
- "cacheRead": 0.2763,
494
+ "input": 0.5126,
495
+ "output": 1.0446,
496
+ "cacheRead": 0.2563,
465
497
  "cacheWrite": 0.2
466
498
  },
467
499
  "contextWindow": 128000,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-io-provider",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "IO Intelligence provider extension for pi - Access DeepSeek, Kimi, GLM, Llama, Qwen, Mistral, and more through the IO Intelligence API",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -328,6 +328,67 @@ MIT
328
328
 
329
329
  // ─── Main ────────────────────────────────────────────────────────────────────
330
330
 
331
+ // Grace period for delisted models: update-models.js moves models the API no
332
+ // longer lists into deprecated-models.json (stamped with deprecatedAt) instead
333
+ // of dropping them; the runtime appends them back so sessions and saved model
334
+ // settings keep working, and after 14 days they are evicted permanently.
335
+ const DEPRECATED_MODEL_TTL_MS = 14 * 24 * 60 * 60 * 1000;
336
+
337
+ /**
338
+ * Reconcile deprecated-models.json against the freshly fetched model list.
339
+ * - in old models.json but not the API: moved into the deprecated file
340
+ * (deprecatedAt = now; preserved on repeat runs so the grace clock is not reset)
341
+ * - back in the API: resurrected (dropped from the deprecated file)
342
+ * - deprecatedAt older than 14 days: evicted permanently
343
+ * Must run BEFORE the new models.json is written; it reads the old file itself.
344
+ */
345
+ function updateDeprecatedModels(modelsJsonPath, newModels) {
346
+ const deprecatedPath = path.join(path.dirname(modelsJsonPath), 'deprecated-models.json');
347
+
348
+ let oldModels = [];
349
+ try {
350
+ const parsed = JSON.parse(fs.readFileSync(modelsJsonPath, 'utf8'));
351
+ if (Array.isArray(parsed)) oldModels = parsed;
352
+ } catch { /* first run: no previous models.json */ }
353
+
354
+ let deprecated = {};
355
+ try {
356
+ const parsed = JSON.parse(fs.readFileSync(deprecatedPath, 'utf8'));
357
+ if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) deprecated = parsed;
358
+ } catch { /* no graveyard yet */ }
359
+
360
+ const currentIds = new Set(newModels.map(m => m.id));
361
+ const now = new Date().toISOString();
362
+ const added = [];
363
+ const resurrected = [];
364
+ const evicted = [];
365
+
366
+ for (const old of oldModels) {
367
+ if (old && old.id && !currentIds.has(old.id) && !deprecated[old.id]) {
368
+ deprecated[old.id] = { ...old, deprecatedAt: now };
369
+ added.push(old.id);
370
+ }
371
+ }
372
+
373
+ for (const [id, entry] of Object.entries(deprecated)) {
374
+ if (currentIds.has(id)) {
375
+ delete deprecated[id];
376
+ resurrected.push(id);
377
+ continue;
378
+ }
379
+ const removedAt = Date.parse(entry && entry.deprecatedAt ? entry.deprecatedAt : '');
380
+ if (Number.isNaN(removedAt) || Date.now() - removedAt > DEPRECATED_MODEL_TTL_MS) {
381
+ delete deprecated[id];
382
+ evicted.push(id);
383
+ }
384
+ }
385
+
386
+ if (added.length > 0 || resurrected.length > 0 || evicted.length > 0) {
387
+ fs.writeFileSync(deprecatedPath, JSON.stringify(deprecated, null, 2) + '\n');
388
+ console.log('Updated deprecated-models.json ' + JSON.stringify({ added, resurrected, evicted }));
389
+ }
390
+ }
391
+
331
392
  async function main() {
332
393
  const apiKey = process.env.IOINTELLIGENCE_API_KEY;
333
394
  if (!apiKey) {
@@ -362,6 +423,8 @@ async function main() {
362
423
  console.log(`Converted ${models.length} models`);
363
424
 
364
425
  // Save models.json (pure API output, no patch/custom baked in)
426
+ // Move delisted models to deprecated-models.json BEFORE models.json is overwritten
427
+ updateDeprecatedModels(MODELS_PATH, models);
365
428
  fs.writeFileSync(MODELS_PATH, JSON.stringify(models, null, 2) + '\n');
366
429
  console.log(`✓ Saved ${models.length} models to models.json`);
367
430