pi-opencode-go-provider 1.0.9 → 1.0.11
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 +5 -5
- package/models.json +146 -146
- package/package.json +1 -1
- package/scripts/update-models.js +28 -2
package/README.md
CHANGED
|
@@ -68,8 +68,8 @@ pi
|
|
|
68
68
|
|
|
69
69
|
| Model | API | Type | Context | Max Tokens | Input Cost | Output Cost |
|
|
70
70
|
|-------|-----|------|---------|------------|------------|-------------|
|
|
71
|
-
| DeepSeek V4 Flash | Completions | Text | 1.0M | 384K | $0.
|
|
72
|
-
| DeepSeek V4 Pro (New) | Completions | Text | 1.0M | 384K | $0.
|
|
71
|
+
| DeepSeek V4 Flash | Completions | Text | 1.0M | 384K | $0.22 | $0.66 |
|
|
72
|
+
| DeepSeek V4 Pro (New) | Completions | Text | 1.0M | 384K | $0.66 | $1.98 |
|
|
73
73
|
| GLM-5.1 | Completions | Text | 203K | 33K | $1.40 | $4.40 |
|
|
74
74
|
| GLM-5.2 | Completions | Text | 1.0M | 131K | $1.40 | $4.40 |
|
|
75
75
|
| GLM-5.3 | Completions | Text | 1.0M | 131K | $1.40 | $4.40 |
|
|
@@ -84,9 +84,9 @@ pi
|
|
|
84
84
|
| MiniMax-M2.7 | Completions | Text | 205K | 131K | $0.30 | $1.20 |
|
|
85
85
|
| MiniMax-M3 | Anthropic | Text + Image | 1.0M | 131K | $0.30 | $1.20 |
|
|
86
86
|
| Qwen3.6 Plus | Completions | Text + Image | 1.0M | 66K | $0.50 | $3.00 |
|
|
87
|
-
| Qwen3.7 Max |
|
|
88
|
-
| Qwen3.7 Plus |
|
|
89
|
-
| Qwen3.8 Max |
|
|
87
|
+
| Qwen3.7 Max | Completions | Text | 1.0M | 66K | $2.50 | $7.50 |
|
|
88
|
+
| Qwen3.7 Plus | Completions | Text + Image | 1.0M | 66K | $0.40 | $1.60 |
|
|
89
|
+
| Qwen3.8 Max | Completions | Text + Image | 1.0M | 131K | $2.00 | $6.00 |
|
|
90
90
|
*Costs are per million tokens. Prices subject to change - check [opencode.ai](https://opencode.ai) for current pricing.*
|
|
91
91
|
|
|
92
92
|
## Usage
|
package/models.json
CHANGED
|
@@ -1,62 +1,63 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"id": "
|
|
4
|
-
"name": "
|
|
3
|
+
"id": "kimi-k2.7-code",
|
|
4
|
+
"name": "Kimi K2.7 Code",
|
|
5
5
|
"api": "openai-completions",
|
|
6
6
|
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
7
7
|
"reasoning": true,
|
|
8
8
|
"input": [
|
|
9
|
-
"text"
|
|
9
|
+
"text",
|
|
10
|
+
"image"
|
|
10
11
|
],
|
|
11
12
|
"cost": {
|
|
12
|
-
"input":
|
|
13
|
-
"output": 4
|
|
14
|
-
"cacheRead": 0.
|
|
13
|
+
"input": 0.95,
|
|
14
|
+
"output": 4,
|
|
15
|
+
"cacheRead": 0.19,
|
|
15
16
|
"cacheWrite": 0
|
|
16
17
|
},
|
|
17
|
-
"contextWindow":
|
|
18
|
-
"maxTokens":
|
|
18
|
+
"contextWindow": 262144,
|
|
19
|
+
"maxTokens": 262144
|
|
19
20
|
},
|
|
20
21
|
{
|
|
21
|
-
"id": "qwen3.7-
|
|
22
|
-
"name": "Qwen3.7
|
|
23
|
-
"api": "
|
|
24
|
-
"baseUrl": "https://opencode.ai/zen/go",
|
|
22
|
+
"id": "qwen3.7-max",
|
|
23
|
+
"name": "Qwen3.7 Max",
|
|
24
|
+
"api": "openai-completions",
|
|
25
|
+
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
25
26
|
"reasoning": true,
|
|
26
27
|
"input": [
|
|
27
|
-
"text"
|
|
28
|
-
"image"
|
|
28
|
+
"text"
|
|
29
29
|
],
|
|
30
30
|
"cost": {
|
|
31
|
-
"input":
|
|
32
|
-
"output":
|
|
33
|
-
"cacheRead": 0.
|
|
34
|
-
"cacheWrite":
|
|
31
|
+
"input": 2.5,
|
|
32
|
+
"output": 7.5,
|
|
33
|
+
"cacheRead": 0.5,
|
|
34
|
+
"cacheWrite": 3.125
|
|
35
35
|
},
|
|
36
36
|
"contextWindow": 1000000,
|
|
37
37
|
"maxTokens": 65536
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
|
-
"id": "
|
|
41
|
-
"name": "
|
|
40
|
+
"id": "kimi-k3",
|
|
41
|
+
"name": "Kimi K3",
|
|
42
42
|
"api": "openai-completions",
|
|
43
43
|
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
44
44
|
"reasoning": true,
|
|
45
45
|
"input": [
|
|
46
|
-
"text"
|
|
46
|
+
"text",
|
|
47
|
+
"image"
|
|
47
48
|
],
|
|
48
49
|
"cost": {
|
|
49
|
-
"input":
|
|
50
|
-
"output":
|
|
51
|
-
"cacheRead": 0.
|
|
50
|
+
"input": 3,
|
|
51
|
+
"output": 15,
|
|
52
|
+
"cacheRead": 0.3,
|
|
52
53
|
"cacheWrite": 0
|
|
53
54
|
},
|
|
54
|
-
"contextWindow":
|
|
55
|
-
"maxTokens":
|
|
55
|
+
"contextWindow": 1048576,
|
|
56
|
+
"maxTokens": 131072
|
|
56
57
|
},
|
|
57
58
|
{
|
|
58
59
|
"id": "deepseek-v4-flash",
|
|
59
|
-
"name": "DeepSeek V4 Flash
|
|
60
|
+
"name": "DeepSeek V4 Flash",
|
|
60
61
|
"api": "openai-completions",
|
|
61
62
|
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
62
63
|
"reasoning": true,
|
|
@@ -64,71 +65,73 @@
|
|
|
64
65
|
"text"
|
|
65
66
|
],
|
|
66
67
|
"cost": {
|
|
67
|
-
"input": 0.
|
|
68
|
-
"output": 0.
|
|
69
|
-
"cacheRead": 0.
|
|
68
|
+
"input": 0.22,
|
|
69
|
+
"output": 0.66,
|
|
70
|
+
"cacheRead": 0.007,
|
|
70
71
|
"cacheWrite": 0
|
|
71
72
|
},
|
|
72
73
|
"contextWindow": 1000000,
|
|
73
74
|
"maxTokens": 384000
|
|
74
75
|
},
|
|
75
76
|
{
|
|
76
|
-
"id": "
|
|
77
|
-
"name": "
|
|
78
|
-
"api": "
|
|
79
|
-
"baseUrl": "https://opencode.ai/zen/go",
|
|
77
|
+
"id": "mimo-v2.5",
|
|
78
|
+
"name": "MiMo V2.5",
|
|
79
|
+
"api": "openai-completions",
|
|
80
|
+
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
80
81
|
"reasoning": true,
|
|
81
82
|
"input": [
|
|
82
|
-
"text"
|
|
83
|
+
"text",
|
|
84
|
+
"image"
|
|
83
85
|
],
|
|
84
86
|
"cost": {
|
|
85
|
-
"input": 0.
|
|
86
|
-
"output":
|
|
87
|
-
"cacheRead": 0.
|
|
87
|
+
"input": 0.14,
|
|
88
|
+
"output": 0.28,
|
|
89
|
+
"cacheRead": 0.0028,
|
|
88
90
|
"cacheWrite": 0
|
|
89
91
|
},
|
|
90
|
-
"contextWindow":
|
|
91
|
-
"maxTokens":
|
|
92
|
+
"contextWindow": 1000000,
|
|
93
|
+
"maxTokens": 128000
|
|
92
94
|
},
|
|
93
95
|
{
|
|
94
|
-
"id": "
|
|
95
|
-
"name": "
|
|
96
|
+
"id": "grok-4.5",
|
|
97
|
+
"name": "Grok 4.5",
|
|
96
98
|
"api": "openai-completions",
|
|
97
99
|
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
98
100
|
"reasoning": true,
|
|
99
101
|
"input": [
|
|
100
|
-
"text"
|
|
102
|
+
"text",
|
|
103
|
+
"image"
|
|
101
104
|
],
|
|
102
105
|
"cost": {
|
|
103
|
-
"input":
|
|
104
|
-
"output":
|
|
105
|
-
"cacheRead": 0.
|
|
106
|
+
"input": 2,
|
|
107
|
+
"output": 6,
|
|
108
|
+
"cacheRead": 0.5,
|
|
106
109
|
"cacheWrite": 0
|
|
107
110
|
},
|
|
108
|
-
"contextWindow":
|
|
109
|
-
"maxTokens":
|
|
111
|
+
"contextWindow": 500000,
|
|
112
|
+
"maxTokens": 500000
|
|
110
113
|
},
|
|
111
114
|
{
|
|
112
|
-
"id": "
|
|
113
|
-
"name": "
|
|
114
|
-
"api": "
|
|
115
|
-
"baseUrl": "https://opencode.ai/zen/go",
|
|
115
|
+
"id": "deepseek-v4-pro",
|
|
116
|
+
"name": "DeepSeek V4 Pro (New)",
|
|
117
|
+
"api": "openai-completions",
|
|
118
|
+
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
116
119
|
"reasoning": true,
|
|
117
120
|
"input": [
|
|
118
121
|
"text"
|
|
119
122
|
],
|
|
120
123
|
"cost": {
|
|
121
|
-
"input":
|
|
122
|
-
"output":
|
|
123
|
-
"cacheRead": 0.
|
|
124
|
-
"cacheWrite":
|
|
124
|
+
"input": 0.66,
|
|
125
|
+
"output": 1.98,
|
|
126
|
+
"cacheRead": 0.022,
|
|
127
|
+
"cacheWrite": 0
|
|
125
128
|
},
|
|
126
129
|
"contextWindow": 1000000,
|
|
127
|
-
"maxTokens":
|
|
130
|
+
"maxTokens": 384000
|
|
128
131
|
},
|
|
129
132
|
{
|
|
130
|
-
"id": "
|
|
131
|
-
"name": "
|
|
133
|
+
"id": "gpt-5.6-luna",
|
|
134
|
+
"name": "GPT-5.6 Luna (2x usage)",
|
|
132
135
|
"api": "openai-completions",
|
|
133
136
|
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
134
137
|
"reasoning": true,
|
|
@@ -137,13 +140,13 @@
|
|
|
137
140
|
"image"
|
|
138
141
|
],
|
|
139
142
|
"cost": {
|
|
140
|
-
"input": 0.
|
|
141
|
-
"output":
|
|
142
|
-
"cacheRead": 0.
|
|
143
|
-
"cacheWrite": 0
|
|
143
|
+
"input": 0.1,
|
|
144
|
+
"output": 0.6,
|
|
145
|
+
"cacheRead": 0.01,
|
|
146
|
+
"cacheWrite": 0.125
|
|
144
147
|
},
|
|
145
|
-
"contextWindow":
|
|
146
|
-
"maxTokens":
|
|
148
|
+
"contextWindow": 1050000,
|
|
149
|
+
"maxTokens": 128000
|
|
147
150
|
},
|
|
148
151
|
{
|
|
149
152
|
"id": "minimax-m3",
|
|
@@ -165,46 +168,28 @@
|
|
|
165
168
|
"maxTokens": 131072
|
|
166
169
|
},
|
|
167
170
|
{
|
|
168
|
-
"id": "
|
|
169
|
-
"name": "
|
|
170
|
-
"api": "
|
|
171
|
-
"baseUrl": "https://opencode.ai/zen/go
|
|
172
|
-
"reasoning": true,
|
|
173
|
-
"input": [
|
|
174
|
-
"text"
|
|
175
|
-
],
|
|
176
|
-
"cost": {
|
|
177
|
-
"input": 0.14,
|
|
178
|
-
"output": 0.58,
|
|
179
|
-
"cacheRead": 0.035,
|
|
180
|
-
"cacheWrite": 0
|
|
181
|
-
},
|
|
182
|
-
"contextWindow": 256000,
|
|
183
|
-
"maxTokens": 64000
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
"id": "deepseek-v4-pro",
|
|
187
|
-
"name": "DeepSeek V4 Pro (New)",
|
|
188
|
-
"api": "openai-completions",
|
|
189
|
-
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
171
|
+
"id": "minimax-m2.7",
|
|
172
|
+
"name": "MiniMax-M2.7",
|
|
173
|
+
"api": "anthropic-messages",
|
|
174
|
+
"baseUrl": "https://opencode.ai/zen/go",
|
|
190
175
|
"reasoning": true,
|
|
191
176
|
"input": [
|
|
192
177
|
"text"
|
|
193
178
|
],
|
|
194
179
|
"cost": {
|
|
195
|
-
"input": 0.
|
|
196
|
-
"output":
|
|
197
|
-
"cacheRead": 0.
|
|
180
|
+
"input": 0.3,
|
|
181
|
+
"output": 1.2,
|
|
182
|
+
"cacheRead": 0.06,
|
|
198
183
|
"cacheWrite": 0
|
|
199
184
|
},
|
|
200
|
-
"contextWindow":
|
|
201
|
-
"maxTokens":
|
|
185
|
+
"contextWindow": 204800,
|
|
186
|
+
"maxTokens": 131072
|
|
202
187
|
},
|
|
203
188
|
{
|
|
204
189
|
"id": "qwen3.8-max",
|
|
205
190
|
"name": "Qwen3.8 Max",
|
|
206
|
-
"api": "
|
|
207
|
-
"baseUrl": "https://opencode.ai/zen/go",
|
|
191
|
+
"api": "openai-completions",
|
|
192
|
+
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
208
193
|
"reasoning": true,
|
|
209
194
|
"input": [
|
|
210
195
|
"text",
|
|
@@ -220,8 +205,8 @@
|
|
|
220
205
|
"maxTokens": 131072
|
|
221
206
|
},
|
|
222
207
|
{
|
|
223
|
-
"id": "
|
|
224
|
-
"name": "
|
|
208
|
+
"id": "qwen3.7-plus",
|
|
209
|
+
"name": "Qwen3.7 Plus",
|
|
225
210
|
"api": "openai-completions",
|
|
226
211
|
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
227
212
|
"reasoning": true,
|
|
@@ -230,55 +215,53 @@
|
|
|
230
215
|
"image"
|
|
231
216
|
],
|
|
232
217
|
"cost": {
|
|
233
|
-
"input": 0.
|
|
234
|
-
"output":
|
|
235
|
-
"cacheRead": 0.
|
|
236
|
-
"cacheWrite": 0
|
|
218
|
+
"input": 0.4,
|
|
219
|
+
"output": 1.6,
|
|
220
|
+
"cacheRead": 0.04,
|
|
221
|
+
"cacheWrite": 0.5
|
|
237
222
|
},
|
|
238
223
|
"contextWindow": 1000000,
|
|
239
|
-
"maxTokens":
|
|
224
|
+
"maxTokens": 65536
|
|
240
225
|
},
|
|
241
226
|
{
|
|
242
|
-
"id": "
|
|
243
|
-
"name": "
|
|
227
|
+
"id": "glm-5.3",
|
|
228
|
+
"name": "GLM-5.3",
|
|
244
229
|
"api": "openai-completions",
|
|
245
230
|
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
246
231
|
"reasoning": true,
|
|
247
232
|
"input": [
|
|
248
|
-
"text"
|
|
249
|
-
"image"
|
|
233
|
+
"text"
|
|
250
234
|
],
|
|
251
235
|
"cost": {
|
|
252
|
-
"input":
|
|
253
|
-
"output":
|
|
254
|
-
"cacheRead": 0.
|
|
255
|
-
"cacheWrite": 0
|
|
236
|
+
"input": 1.4,
|
|
237
|
+
"output": 4.4,
|
|
238
|
+
"cacheRead": 0.26,
|
|
239
|
+
"cacheWrite": 0
|
|
256
240
|
},
|
|
257
|
-
"contextWindow":
|
|
258
|
-
"maxTokens":
|
|
241
|
+
"contextWindow": 1000000,
|
|
242
|
+
"maxTokens": 131072
|
|
259
243
|
},
|
|
260
244
|
{
|
|
261
|
-
"id": "
|
|
262
|
-
"name": "
|
|
245
|
+
"id": "glm-5.2",
|
|
246
|
+
"name": "GLM-5.2",
|
|
263
247
|
"api": "openai-completions",
|
|
264
248
|
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
265
249
|
"reasoning": true,
|
|
266
250
|
"input": [
|
|
267
|
-
"text"
|
|
268
|
-
"image"
|
|
251
|
+
"text"
|
|
269
252
|
],
|
|
270
253
|
"cost": {
|
|
271
|
-
"input":
|
|
272
|
-
"output":
|
|
273
|
-
"cacheRead": 0.
|
|
254
|
+
"input": 1.4,
|
|
255
|
+
"output": 4.4,
|
|
256
|
+
"cacheRead": 0.26,
|
|
274
257
|
"cacheWrite": 0
|
|
275
258
|
},
|
|
276
|
-
"contextWindow":
|
|
277
|
-
"maxTokens":
|
|
259
|
+
"contextWindow": 1000000,
|
|
260
|
+
"maxTokens": 131072
|
|
278
261
|
},
|
|
279
262
|
{
|
|
280
|
-
"id": "
|
|
281
|
-
"name": "
|
|
263
|
+
"id": "qwen3.6-plus",
|
|
264
|
+
"name": "Qwen3.6 Plus",
|
|
282
265
|
"api": "openai-completions",
|
|
283
266
|
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
284
267
|
"reasoning": true,
|
|
@@ -287,32 +270,31 @@
|
|
|
287
270
|
"image"
|
|
288
271
|
],
|
|
289
272
|
"cost": {
|
|
290
|
-
"input": 0.
|
|
291
|
-
"output":
|
|
292
|
-
"cacheRead": 0.
|
|
293
|
-
"cacheWrite": 0
|
|
273
|
+
"input": 0.5,
|
|
274
|
+
"output": 3,
|
|
275
|
+
"cacheRead": 0.05,
|
|
276
|
+
"cacheWrite": 0.625
|
|
294
277
|
},
|
|
295
|
-
"contextWindow":
|
|
296
|
-
"maxTokens":
|
|
278
|
+
"contextWindow": 1000000,
|
|
279
|
+
"maxTokens": 65536
|
|
297
280
|
},
|
|
298
281
|
{
|
|
299
|
-
"id": "
|
|
300
|
-
"name": "
|
|
282
|
+
"id": "glm-5.1",
|
|
283
|
+
"name": "GLM-5.1",
|
|
301
284
|
"api": "openai-completions",
|
|
302
285
|
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
303
286
|
"reasoning": true,
|
|
304
287
|
"input": [
|
|
305
|
-
"text"
|
|
306
|
-
"image"
|
|
288
|
+
"text"
|
|
307
289
|
],
|
|
308
290
|
"cost": {
|
|
309
|
-
"input":
|
|
310
|
-
"output":
|
|
311
|
-
"cacheRead": 0.
|
|
291
|
+
"input": 1.4,
|
|
292
|
+
"output": 4.4,
|
|
293
|
+
"cacheRead": 0.26,
|
|
312
294
|
"cacheWrite": 0
|
|
313
295
|
},
|
|
314
|
-
"contextWindow":
|
|
315
|
-
"maxTokens":
|
|
296
|
+
"contextWindow": 202752,
|
|
297
|
+
"maxTokens": 32768
|
|
316
298
|
},
|
|
317
299
|
{
|
|
318
300
|
"id": "mimo-v2.5-pro",
|
|
@@ -333,22 +315,40 @@
|
|
|
333
315
|
"maxTokens": 128000
|
|
334
316
|
},
|
|
335
317
|
{
|
|
336
|
-
"id": "
|
|
337
|
-
"name": "
|
|
338
|
-
"api": "
|
|
339
|
-
"baseUrl": "https://opencode.ai/zen/go",
|
|
318
|
+
"id": "hy3",
|
|
319
|
+
"name": "Hy3",
|
|
320
|
+
"api": "openai-completions",
|
|
321
|
+
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
322
|
+
"reasoning": true,
|
|
323
|
+
"input": [
|
|
324
|
+
"text"
|
|
325
|
+
],
|
|
326
|
+
"cost": {
|
|
327
|
+
"input": 0.14,
|
|
328
|
+
"output": 0.58,
|
|
329
|
+
"cacheRead": 0.035,
|
|
330
|
+
"cacheWrite": 0
|
|
331
|
+
},
|
|
332
|
+
"contextWindow": 256000,
|
|
333
|
+
"maxTokens": 64000
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"id": "kimi-k2.6",
|
|
337
|
+
"name": "Kimi K2.6",
|
|
338
|
+
"api": "openai-completions",
|
|
339
|
+
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
340
340
|
"reasoning": true,
|
|
341
341
|
"input": [
|
|
342
342
|
"text",
|
|
343
343
|
"image"
|
|
344
344
|
],
|
|
345
345
|
"cost": {
|
|
346
|
-
"input": 0.
|
|
347
|
-
"output":
|
|
348
|
-
"cacheRead": 0.
|
|
349
|
-
"cacheWrite": 0
|
|
346
|
+
"input": 0.95,
|
|
347
|
+
"output": 4,
|
|
348
|
+
"cacheRead": 0.16,
|
|
349
|
+
"cacheWrite": 0
|
|
350
350
|
},
|
|
351
|
-
"contextWindow":
|
|
351
|
+
"contextWindow": 262144,
|
|
352
352
|
"maxTokens": 65536
|
|
353
353
|
}
|
|
354
354
|
]
|
package/package.json
CHANGED
package/scripts/update-models.js
CHANGED
|
@@ -44,8 +44,9 @@ function fetchJSON(url) {
|
|
|
44
44
|
|
|
45
45
|
// Format cost for display
|
|
46
46
|
function formatCost(cost) {
|
|
47
|
-
if (cost === 0) return '
|
|
48
|
-
|
|
47
|
+
if (cost === 0) return '—';
|
|
48
|
+
if (cost === null || cost === undefined) return '—';
|
|
49
|
+
return '$' + cost.toFixed(2);
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
// Format number with K/M suffix
|
|
@@ -250,6 +251,31 @@ function updateDeprecatedModels(modelsJsonPath, newModels) {
|
|
|
250
251
|
}
|
|
251
252
|
}
|
|
252
253
|
|
|
254
|
+
/**
|
|
255
|
+
* Grace-period deprecated models (deprecatedAt within TTL) with metadata stripped.
|
|
256
|
+
* Keeps the README table serving models that are delisted but still within their
|
|
257
|
+
* 14-day grace window.
|
|
258
|
+
*/
|
|
259
|
+
function withDeprecatedForReadme(models) {
|
|
260
|
+
const deprecatedPath = path.join(process.cwd(), 'deprecated-models.json');
|
|
261
|
+
let deprecated = {};
|
|
262
|
+
try {
|
|
263
|
+
const parsed = JSON.parse(fs.readFileSync(deprecatedPath, 'utf8'));
|
|
264
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) deprecated = parsed;
|
|
265
|
+
} catch { /* no graveyard yet */ }
|
|
266
|
+
const now = Date.now();
|
|
267
|
+
const seen = new Set(models.map(m => m.id));
|
|
268
|
+
const extras = [];
|
|
269
|
+
for (const entry of Object.values(deprecated)) {
|
|
270
|
+
if (!entry || !entry.id || seen.has(entry.id)) continue;
|
|
271
|
+
const removedAt = Date.parse(entry.deprecatedAt || '');
|
|
272
|
+
if (Number.isNaN(removedAt) || now - removedAt > DEPRECATED_MODEL_TTL_MS) continue;
|
|
273
|
+
const m = { ...entry };
|
|
274
|
+
delete m.deprecatedAt;
|
|
275
|
+
extras.push(m);
|
|
276
|
+
}
|
|
277
|
+
return extras.length > 0 ? [...models, ...extras] : models;
|
|
278
|
+
}
|
|
253
279
|
async function main() {
|
|
254
280
|
console.log('Fetching models from API...');
|
|
255
281
|
|