pi-opencode-go-provider 1.0.7 → 1.0.9
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 -3
- package/index.ts +23 -6
- package/models.json +42 -5
- package/package.json +1 -1
- package/patch.json +15 -0
package/README.md
CHANGED
|
@@ -68,11 +68,12 @@ 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 | Completions | Text | 1.0M | 384K | $0.43 | $0.87 |
|
|
71
|
+
| DeepSeek V4 Flash | Completions | Text | 1.0M | 384K | $0.07 | $0.14 |
|
|
72
|
+
| DeepSeek V4 Pro (New) | Completions | Text | 1.0M | 384K | $0.43 | $0.87 |
|
|
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 |
|
|
76
|
+
| GPT-5.6 Luna (2x usage) | Responses | Text + Image | 1.1M | 128K | $0.10 | $0.60 |
|
|
76
77
|
| Grok 4.5 | Responses | Text + Image | 500K | 500K | $2.00 | $6.00 |
|
|
77
78
|
| Hy3 | Completions | Text | 256K | 64K | $0.14 | $0.58 |
|
|
78
79
|
| Kimi K2.6 | Completions | Text + Image | 262K | 66K | $0.95 | $4.00 |
|
|
@@ -85,6 +86,7 @@ pi
|
|
|
85
86
|
| Qwen3.6 Plus | Completions | Text + Image | 1.0M | 66K | $0.50 | $3.00 |
|
|
86
87
|
| Qwen3.7 Max | Anthropic | Text | 1.0M | 66K | $2.50 | $7.50 |
|
|
87
88
|
| Qwen3.7 Plus | Anthropic | Text + Image | 1.0M | 66K | $0.40 | $1.60 |
|
|
89
|
+
| Qwen3.8 Max | Anthropic | Text + Image | 1.0M | 131K | $2.00 | $6.00 |
|
|
88
90
|
*Costs are per million tokens. Prices subject to change - check [opencode.ai](https://opencode.ai) for current pricing.*
|
|
89
91
|
|
|
90
92
|
## Usage
|
package/index.ts
CHANGED
|
@@ -52,7 +52,9 @@ interface JsonModel {
|
|
|
52
52
|
cacheRead: number;
|
|
53
53
|
cacheWrite: number;
|
|
54
54
|
};
|
|
55
|
-
|
|
55
|
+
// null between transformApiModel and mergeWithEmbedded: the live /v1/models
|
|
56
|
+
// API omits context data; null = "API silent, prefer curated/default".
|
|
57
|
+
contextWindow: number | null;
|
|
56
58
|
maxTokens: number;
|
|
57
59
|
compat?: Record<string, unknown>;
|
|
58
60
|
}
|
|
@@ -185,7 +187,12 @@ function transformApiModel(apiModel: any): JsonModel {
|
|
|
185
187
|
cacheRead: apiModel.cost?.cache_read || 0,
|
|
186
188
|
cacheWrite: apiModel.cost?.cache_write || 0,
|
|
187
189
|
},
|
|
188
|
-
|
|
190
|
+
// The live /v1/models endpoint exposes only {id, object, created, owned_by}
|
|
191
|
+
// — no `limit`, no `context_length`. A literal `|| 131072` here used to make
|
|
192
|
+
// every "API silent" model truthy 131072, which then clobbered the curated
|
|
193
|
+
// 1M/262K values in mergeWithEmbedded via the `||` truthy check. Use `null`
|
|
194
|
+
// so the embedded curated value is preferred when the API is silent.
|
|
195
|
+
contextWindow: apiModel.limit?.context || apiModel.context_length || null,
|
|
189
196
|
maxTokens: apiModel.limit?.output || 0,
|
|
190
197
|
};
|
|
191
198
|
}
|
|
@@ -246,10 +253,20 @@ function mergeWithEmbedded(liveModels: JsonModel[], embeddedModels: JsonModel[])
|
|
|
246
253
|
cacheRead: liveModel.cost.cacheRead || embedded.cost.cacheRead,
|
|
247
254
|
cacheWrite: liveModel.cost.cacheWrite || embedded.cost.cacheWrite,
|
|
248
255
|
},
|
|
249
|
-
|
|
256
|
+
// Nullish coalesce: if the live API was silent (liveModel.contextWindow
|
|
257
|
+
// is null), fall through to the curated embedded value. The final
|
|
258
|
+
// `?? 131072` is the safe default for the rare case of a Custom-only
|
|
259
|
+
// model with neither live nor curated data. Using `||` here was the
|
|
260
|
+
// bug — it treated the API's 131072-fallback as authoritative and
|
|
261
|
+
// shadowed curated 1M/262K context windows.
|
|
262
|
+
contextWindow: liveModel.contextWindow ?? embedded.contextWindow ?? 131072,
|
|
250
263
|
});
|
|
251
264
|
} else {
|
|
252
|
-
|
|
265
|
+
// API-only model (no curated embedded counterpart). The Live API is silent
|
|
266
|
+
// on contextWindow for all current opencode-go models, so liveModel.contextWindow
|
|
267
|
+
// is null. Apply the safe default here so downstream consumers (e.g. pi core's
|
|
268
|
+
// formatTokenCount → count.toString()) don't crash on null.
|
|
269
|
+
result.push({ ...liveModel, contextWindow: liveModel.contextWindow ?? 131072 });
|
|
253
270
|
}
|
|
254
271
|
}
|
|
255
272
|
// Append any embedded models that the live API didn't return
|
|
@@ -346,7 +363,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
346
363
|
thinkingLevelMap: m.thinkingLevelMap,
|
|
347
364
|
input: m.input,
|
|
348
365
|
cost: m.cost,
|
|
349
|
-
contextWindow: m.contextWindow,
|
|
366
|
+
contextWindow: m.contextWindow ?? 131072,
|
|
350
367
|
maxTokens: m.maxTokens,
|
|
351
368
|
compat: m.compat,
|
|
352
369
|
})),
|
|
@@ -373,7 +390,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
373
390
|
thinkingLevelMap: m.thinkingLevelMap,
|
|
374
391
|
input: m.input,
|
|
375
392
|
cost: m.cost,
|
|
376
|
-
contextWindow: m.contextWindow,
|
|
393
|
+
contextWindow: m.contextWindow ?? 131072,
|
|
377
394
|
maxTokens: m.maxTokens,
|
|
378
395
|
compat: m.compat,
|
|
379
396
|
})),
|
package/models.json
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"id": "glm-5.3",
|
|
4
|
+
"name": "GLM-5.3",
|
|
5
|
+
"api": "openai-completions",
|
|
6
|
+
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
7
|
+
"reasoning": true,
|
|
8
|
+
"input": [
|
|
9
|
+
"text"
|
|
10
|
+
],
|
|
11
|
+
"cost": {
|
|
12
|
+
"input": 1.4,
|
|
13
|
+
"output": 4.4,
|
|
14
|
+
"cacheRead": 0.26,
|
|
15
|
+
"cacheWrite": 0
|
|
16
|
+
},
|
|
17
|
+
"contextWindow": 1000000,
|
|
18
|
+
"maxTokens": 131072
|
|
19
|
+
},
|
|
2
20
|
{
|
|
3
21
|
"id": "qwen3.7-plus",
|
|
4
22
|
"name": "Qwen3.7 Plus",
|
|
@@ -38,7 +56,7 @@
|
|
|
38
56
|
},
|
|
39
57
|
{
|
|
40
58
|
"id": "deepseek-v4-flash",
|
|
41
|
-
"name": "DeepSeek V4 Flash (
|
|
59
|
+
"name": "DeepSeek V4 Flash (2x usage)",
|
|
42
60
|
"api": "openai-completions",
|
|
43
61
|
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
44
62
|
"reasoning": true,
|
|
@@ -46,9 +64,9 @@
|
|
|
46
64
|
"text"
|
|
47
65
|
],
|
|
48
66
|
"cost": {
|
|
49
|
-
"input": 0.
|
|
50
|
-
"output": 0.
|
|
51
|
-
"cacheRead": 0.
|
|
67
|
+
"input": 0.07,
|
|
68
|
+
"output": 0.14,
|
|
69
|
+
"cacheRead": 0.0014,
|
|
52
70
|
"cacheWrite": 0
|
|
53
71
|
},
|
|
54
72
|
"contextWindow": 1000000,
|
|
@@ -166,7 +184,7 @@
|
|
|
166
184
|
},
|
|
167
185
|
{
|
|
168
186
|
"id": "deepseek-v4-pro",
|
|
169
|
-
"name": "DeepSeek V4 Pro",
|
|
187
|
+
"name": "DeepSeek V4 Pro (New)",
|
|
170
188
|
"api": "openai-completions",
|
|
171
189
|
"baseUrl": "https://opencode.ai/zen/go/v1",
|
|
172
190
|
"reasoning": true,
|
|
@@ -182,6 +200,25 @@
|
|
|
182
200
|
"contextWindow": 1000000,
|
|
183
201
|
"maxTokens": 384000
|
|
184
202
|
},
|
|
203
|
+
{
|
|
204
|
+
"id": "qwen3.8-max",
|
|
205
|
+
"name": "Qwen3.8 Max",
|
|
206
|
+
"api": "anthropic-messages",
|
|
207
|
+
"baseUrl": "https://opencode.ai/zen/go",
|
|
208
|
+
"reasoning": true,
|
|
209
|
+
"input": [
|
|
210
|
+
"text",
|
|
211
|
+
"image"
|
|
212
|
+
],
|
|
213
|
+
"cost": {
|
|
214
|
+
"input": 2,
|
|
215
|
+
"output": 6,
|
|
216
|
+
"cacheRead": 0.25,
|
|
217
|
+
"cacheWrite": 2.5
|
|
218
|
+
},
|
|
219
|
+
"contextWindow": 1000000,
|
|
220
|
+
"maxTokens": 131072
|
|
221
|
+
},
|
|
185
222
|
{
|
|
186
223
|
"id": "mimo-v2.5",
|
|
187
224
|
"name": "MiMo V2.5",
|
package/package.json
CHANGED
package/patch.json
CHANGED
|
@@ -148,6 +148,21 @@
|
|
|
148
148
|
"maxTokensField": "max_tokens"
|
|
149
149
|
}
|
|
150
150
|
},
|
|
151
|
+
"gpt-5.6-luna": {
|
|
152
|
+
"api": "openai-responses",
|
|
153
|
+
"thinkingLevelMap": {
|
|
154
|
+
"off": null,
|
|
155
|
+
"minimal": null,
|
|
156
|
+
"low": "low",
|
|
157
|
+
"medium": "medium",
|
|
158
|
+
"high": "high",
|
|
159
|
+
"xhigh": "xhigh",
|
|
160
|
+
"max": "max"
|
|
161
|
+
},
|
|
162
|
+
"compat": {
|
|
163
|
+
"sessionAffinityFormat": "openai-nosession"
|
|
164
|
+
}
|
|
165
|
+
},
|
|
151
166
|
"qwen3.6-plus": {
|
|
152
167
|
"api": "openai-completions",
|
|
153
168
|
"baseUrl": "https://opencode.ai/zen/go/v1",
|