@tbui17/omp-neuralwatt-provider 0.1.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.
- package/LICENSE +21 -0
- package/README.md +48 -0
- package/extension.ts +500 -0
- package/package.json +24 -0
- package/test/integration.test.ts +38 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tbui17
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @tbui17/omp-neuralwatt-provider
|
|
2
|
+
|
|
3
|
+
Neuralwatt OpenAI-compatible provider plugin for [oh-my-pi](https://github.com/can1357/oh-my-pi).
|
|
4
|
+
|
|
5
|
+
Provides GLM, Kimi, and Qwen models hosted on the Neuralwatt API (`https://api.neuralwatt.com/v1`).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
omp install @tbui17/omp-neuralwatt-provider
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Set your API key
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
export NEURALWATT_API_KEY=your-key-here
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The plugin reads the key from the `NEURALWATT_API_KEY` environment variable. Set it before starting `omp`.
|
|
20
|
+
|
|
21
|
+
## Models
|
|
22
|
+
|
|
23
|
+
16 models are registered under the `neuralwatt` provider:
|
|
24
|
+
|
|
25
|
+
| Model ID | Family | Reasoning | Input |
|
|
26
|
+
|---|---|---|---|
|
|
27
|
+
| `glm-5.2` | GLM | yes | text |
|
|
28
|
+
| `glm-5.2-fast` | GLM | no | text |
|
|
29
|
+
| `glm-5.2-short` | GLM (200K ctx) | yes | text |
|
|
30
|
+
| `glm-5.2-short-fast` | GLM (200K ctx) | no | text |
|
|
31
|
+
| `kimi-k2.6` | Kimi | yes | text + image |
|
|
32
|
+
| `kimi-k2.6-fast` | Kimi | no | text + image |
|
|
33
|
+
| `qwen3.5-397b` | Qwen | yes | text |
|
|
34
|
+
| `qwen3.5-397b-fast` | Qwen | no | text |
|
|
35
|
+
| `qwen3.6-35b` | Qwen | yes | text + image |
|
|
36
|
+
| `kimi-k2.7-code` | Kimi | yes | text + image |
|
|
37
|
+
| `glm-5.2-short-fast-flex` | GLM flex | no | text |
|
|
38
|
+
| `glm-5.2-short-flex` | GLM flex | yes | text |
|
|
39
|
+
| `kimi-k2.6-flex` | Kimi flex | yes | text + image |
|
|
40
|
+
| `kimi-k2.7-code-flex` | Kimi flex | yes | text + image |
|
|
41
|
+
| `glm-5.2-flex` | GLM flex | yes | text |
|
|
42
|
+
| `qwen3.6-35b-fast` | Qwen | no | text + image |
|
|
43
|
+
|
|
44
|
+
Use with: `omp -p --model neuralwatt/glm-5.2 "your prompt"`
|
|
45
|
+
|
|
46
|
+
## License
|
|
47
|
+
|
|
48
|
+
MIT
|
package/extension.ts
ADDED
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* omp-neuralwatt-provider — Neuralwatt OpenAI-compatible provider for oh-my-pi.
|
|
3
|
+
*
|
|
4
|
+
* Neuralwatt exposes an OpenAI-compatible API at https://api.neuralwatt.com/v1
|
|
5
|
+
* with GLM, Kimi, and Qwen models.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Host types (inlined from @earendil-works/pi-coding-agent for standalone use)
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// These are structural subsets of the host's ExtensionAPI / ProviderConfig /
|
|
12
|
+
// ProviderModelConfig. The host injects ExtensionAPI at runtime; these types
|
|
13
|
+
// exist only for authoring ergonomics and are erased by Bun's transpiler.
|
|
14
|
+
// If the host schema drifts, update these interfaces to match.
|
|
15
|
+
|
|
16
|
+
/** OpenAI compatibility settings for a model. */
|
|
17
|
+
interface ProviderModelCompat {
|
|
18
|
+
supportsDeveloperRole?: boolean;
|
|
19
|
+
maxTokensField?: string;
|
|
20
|
+
requiresReasoningContentOnAssistantMessages?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Configuration for a model within a provider. */
|
|
24
|
+
interface ProviderModelConfig {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
api?: string;
|
|
28
|
+
reasoning: boolean;
|
|
29
|
+
thinking?: unknown;
|
|
30
|
+
thinkingLevelMap?: Record<string, string | null>;
|
|
31
|
+
input: ("text" | "image")[];
|
|
32
|
+
cost: { input: number; output: number; cacheRead: number; cacheWrite: number };
|
|
33
|
+
premiumMultiplier?: number;
|
|
34
|
+
contextWindow: number;
|
|
35
|
+
maxTokens: number;
|
|
36
|
+
headers?: Record<string, string>;
|
|
37
|
+
compat?: ProviderModelCompat;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Configuration for registering a provider via pi.registerProvider(). */
|
|
41
|
+
interface ProviderConfig {
|
|
42
|
+
baseUrl?: string;
|
|
43
|
+
apiKey?: string;
|
|
44
|
+
api?: string;
|
|
45
|
+
headers?: Record<string, string>;
|
|
46
|
+
authHeader?: boolean;
|
|
47
|
+
models?: ProviderModelConfig[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Minimal host API surface used by this extension. */
|
|
51
|
+
interface ExtensionAPI {
|
|
52
|
+
registerProvider(name: string, config: ProviderConfig): void;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ============================================================================
|
|
56
|
+
// Model definitions
|
|
57
|
+
// ============================================================================
|
|
58
|
+
|
|
59
|
+
const NEURALWATT_MODELS: ProviderModelConfig[] = [
|
|
60
|
+
// GLM-5.2 - ZhipuAI
|
|
61
|
+
{
|
|
62
|
+
id: "glm-5.2",
|
|
63
|
+
name: "GLM-5.2",
|
|
64
|
+
reasoning: true,
|
|
65
|
+
input: ["text"],
|
|
66
|
+
cost: {
|
|
67
|
+
input: 1.45,
|
|
68
|
+
output: 4.5,
|
|
69
|
+
cacheRead: 0.3625,
|
|
70
|
+
cacheWrite: 0,
|
|
71
|
+
},
|
|
72
|
+
contextWindow: 1048560,
|
|
73
|
+
maxTokens: 65536,
|
|
74
|
+
thinkingLevelMap: {
|
|
75
|
+
off: "none",
|
|
76
|
+
minimal: null,
|
|
77
|
+
low: null,
|
|
78
|
+
medium: null,
|
|
79
|
+
high: "high",
|
|
80
|
+
xhigh: "max",
|
|
81
|
+
},
|
|
82
|
+
compat: {
|
|
83
|
+
supportsDeveloperRole: false,
|
|
84
|
+
maxTokensField: "max_tokens",
|
|
85
|
+
requiresReasoningContentOnAssistantMessages: true,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
// GLM-5.2 Fast - ZhipuAI
|
|
89
|
+
{
|
|
90
|
+
id: "glm-5.2-fast",
|
|
91
|
+
name: "GLM-5.2 Fast",
|
|
92
|
+
reasoning: false,
|
|
93
|
+
input: ["text"],
|
|
94
|
+
cost: {
|
|
95
|
+
input: 1.45,
|
|
96
|
+
output: 4.5,
|
|
97
|
+
cacheRead: 0.3625,
|
|
98
|
+
cacheWrite: 0,
|
|
99
|
+
},
|
|
100
|
+
contextWindow: 1048560,
|
|
101
|
+
maxTokens: 65536,
|
|
102
|
+
compat: {
|
|
103
|
+
supportsDeveloperRole: false,
|
|
104
|
+
maxTokensField: "max_tokens",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
// GLM-5.2 Short - ZhipuAI (200K context, bounded reasoning budget)
|
|
108
|
+
{
|
|
109
|
+
id: "glm-5.2-short",
|
|
110
|
+
name: "GLM-5.2 Short",
|
|
111
|
+
reasoning: true,
|
|
112
|
+
input: ["text"],
|
|
113
|
+
cost: {
|
|
114
|
+
input: 1.45,
|
|
115
|
+
output: 4.5,
|
|
116
|
+
cacheRead: 0.3625,
|
|
117
|
+
cacheWrite: 0,
|
|
118
|
+
},
|
|
119
|
+
contextWindow: 199984,
|
|
120
|
+
maxTokens: 65536,
|
|
121
|
+
thinkingLevelMap: {
|
|
122
|
+
off: "none",
|
|
123
|
+
minimal: null,
|
|
124
|
+
low: null,
|
|
125
|
+
medium: null,
|
|
126
|
+
high: "high",
|
|
127
|
+
xhigh: "max",
|
|
128
|
+
},
|
|
129
|
+
compat: {
|
|
130
|
+
supportsDeveloperRole: false,
|
|
131
|
+
maxTokensField: "max_tokens",
|
|
132
|
+
requiresReasoningContentOnAssistantMessages: true,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
// GLM-5.2 Short Fast - ZhipuAI (200K context, reasoning disabled)
|
|
136
|
+
{
|
|
137
|
+
id: "glm-5.2-short-fast",
|
|
138
|
+
name: "GLM-5.2 Short Fast",
|
|
139
|
+
reasoning: false,
|
|
140
|
+
input: ["text"],
|
|
141
|
+
cost: {
|
|
142
|
+
input: 1.45,
|
|
143
|
+
output: 4.5,
|
|
144
|
+
cacheRead: 0.3625,
|
|
145
|
+
cacheWrite: 0,
|
|
146
|
+
},
|
|
147
|
+
contextWindow: 199984,
|
|
148
|
+
maxTokens: 65536,
|
|
149
|
+
compat: {
|
|
150
|
+
supportsDeveloperRole: false,
|
|
151
|
+
maxTokensField: "max_tokens",
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
// Kimi K2.6 - MoonshotAI
|
|
155
|
+
{
|
|
156
|
+
id: "kimi-k2.6",
|
|
157
|
+
name: "Kimi K2.6",
|
|
158
|
+
reasoning: true,
|
|
159
|
+
input: ["text", "image"],
|
|
160
|
+
cost: {
|
|
161
|
+
input: 0.69,
|
|
162
|
+
output: 3.22,
|
|
163
|
+
cacheRead: 0.1725,
|
|
164
|
+
cacheWrite: 0,
|
|
165
|
+
},
|
|
166
|
+
contextWindow: 262128,
|
|
167
|
+
maxTokens: 65536,
|
|
168
|
+
thinkingLevelMap: {
|
|
169
|
+
minimal: null,
|
|
170
|
+
low: null,
|
|
171
|
+
medium: "medium",
|
|
172
|
+
high: null,
|
|
173
|
+
xhigh: null,
|
|
174
|
+
},
|
|
175
|
+
compat: {
|
|
176
|
+
supportsDeveloperRole: false,
|
|
177
|
+
maxTokensField: "max_tokens",
|
|
178
|
+
requiresReasoningContentOnAssistantMessages: true,
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
// Kimi K2.6 Fast - MoonshotAI
|
|
182
|
+
{
|
|
183
|
+
id: "kimi-k2.6-fast",
|
|
184
|
+
name: "Kimi K2.6 Fast",
|
|
185
|
+
reasoning: false,
|
|
186
|
+
input: ["text", "image"],
|
|
187
|
+
cost: {
|
|
188
|
+
input: 0.69,
|
|
189
|
+
output: 3.22,
|
|
190
|
+
cacheRead: 0.1725,
|
|
191
|
+
cacheWrite: 0,
|
|
192
|
+
},
|
|
193
|
+
contextWindow: 262128,
|
|
194
|
+
maxTokens: 65536,
|
|
195
|
+
compat: {
|
|
196
|
+
supportsDeveloperRole: false,
|
|
197
|
+
maxTokensField: "max_tokens",
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
// Qwen3.5 397B - Qwen
|
|
201
|
+
{
|
|
202
|
+
id: "qwen3.5-397b",
|
|
203
|
+
name: "Qwen3.5 397B",
|
|
204
|
+
reasoning: true,
|
|
205
|
+
input: ["text"],
|
|
206
|
+
cost: {
|
|
207
|
+
input: 0.69,
|
|
208
|
+
output: 4.14,
|
|
209
|
+
cacheRead: 0.1725,
|
|
210
|
+
cacheWrite: 0,
|
|
211
|
+
},
|
|
212
|
+
contextWindow: 262128,
|
|
213
|
+
maxTokens: 65536,
|
|
214
|
+
thinkingLevelMap: {
|
|
215
|
+
minimal: null,
|
|
216
|
+
low: null,
|
|
217
|
+
medium: "medium",
|
|
218
|
+
high: null,
|
|
219
|
+
xhigh: null,
|
|
220
|
+
},
|
|
221
|
+
compat: {
|
|
222
|
+
supportsDeveloperRole: false,
|
|
223
|
+
maxTokensField: "max_tokens",
|
|
224
|
+
requiresReasoningContentOnAssistantMessages: true,
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
// Qwen3.5 397B Fast - Qwen
|
|
228
|
+
{
|
|
229
|
+
id: "qwen3.5-397b-fast",
|
|
230
|
+
name: "Qwen3.5 397B Fast",
|
|
231
|
+
reasoning: false,
|
|
232
|
+
input: ["text"],
|
|
233
|
+
cost: {
|
|
234
|
+
input: 0.69,
|
|
235
|
+
output: 4.14,
|
|
236
|
+
cacheRead: 0.1725,
|
|
237
|
+
cacheWrite: 0,
|
|
238
|
+
},
|
|
239
|
+
contextWindow: 262128,
|
|
240
|
+
maxTokens: 65536,
|
|
241
|
+
compat: {
|
|
242
|
+
supportsDeveloperRole: false,
|
|
243
|
+
maxTokensField: "max_tokens",
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
// Qwen3.6 35B - Qwen
|
|
247
|
+
{
|
|
248
|
+
id: "qwen3.6-35b",
|
|
249
|
+
name: "Qwen3.6 35B",
|
|
250
|
+
reasoning: true,
|
|
251
|
+
input: ["text", "image"],
|
|
252
|
+
cost: {
|
|
253
|
+
input: 0.29,
|
|
254
|
+
output: 1.15,
|
|
255
|
+
cacheRead: 0.0725,
|
|
256
|
+
cacheWrite: 0,
|
|
257
|
+
},
|
|
258
|
+
contextWindow: 131056,
|
|
259
|
+
maxTokens: 65536,
|
|
260
|
+
thinkingLevelMap: {
|
|
261
|
+
minimal: null,
|
|
262
|
+
low: null,
|
|
263
|
+
medium: "medium",
|
|
264
|
+
high: null,
|
|
265
|
+
xhigh: null,
|
|
266
|
+
},
|
|
267
|
+
compat: {
|
|
268
|
+
supportsDeveloperRole: false,
|
|
269
|
+
maxTokensField: "max_tokens",
|
|
270
|
+
requiresReasoningContentOnAssistantMessages: true,
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
// Kimi K2.7 Code - MoonshotAI
|
|
274
|
+
{
|
|
275
|
+
id: "kimi-k2.7-code",
|
|
276
|
+
name: "Kimi K2.7 Code",
|
|
277
|
+
reasoning: true,
|
|
278
|
+
input: ["text", "image"],
|
|
279
|
+
cost: {
|
|
280
|
+
input: 0.95,
|
|
281
|
+
output: 4.0,
|
|
282
|
+
cacheRead: 0.2375,
|
|
283
|
+
cacheWrite: 0,
|
|
284
|
+
},
|
|
285
|
+
contextWindow: 262128,
|
|
286
|
+
maxTokens: 65536,
|
|
287
|
+
thinkingLevelMap: {
|
|
288
|
+
off: null,
|
|
289
|
+
minimal: null,
|
|
290
|
+
low: null,
|
|
291
|
+
medium: "medium",
|
|
292
|
+
high: null,
|
|
293
|
+
xhigh: null,
|
|
294
|
+
},
|
|
295
|
+
compat: {
|
|
296
|
+
supportsDeveloperRole: false,
|
|
297
|
+
maxTokensField: "max_tokens",
|
|
298
|
+
requiresReasoningContentOnAssistantMessages: true,
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
// GLM-5.2 Short Fast Flex - ZhipuAI (flex variant, reasoning disabled)
|
|
302
|
+
{
|
|
303
|
+
id: "glm-5.2-short-fast-flex",
|
|
304
|
+
name: "GLM-5.2 (short, fast, flex)",
|
|
305
|
+
reasoning: false,
|
|
306
|
+
input: ["text"],
|
|
307
|
+
cost: {
|
|
308
|
+
input: 1.45,
|
|
309
|
+
output: 4.5,
|
|
310
|
+
cacheRead: 0.3625,
|
|
311
|
+
cacheWrite: 0,
|
|
312
|
+
},
|
|
313
|
+
contextWindow: 199984,
|
|
314
|
+
maxTokens: 65536,
|
|
315
|
+
compat: {
|
|
316
|
+
supportsDeveloperRole: false,
|
|
317
|
+
maxTokensField: "max_tokens",
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
// GLM-5.2 Short Flex - ZhipuAI (flex variant)
|
|
321
|
+
{
|
|
322
|
+
id: "glm-5.2-short-flex",
|
|
323
|
+
name: "GLM-5.2 (short, flex)",
|
|
324
|
+
reasoning: true,
|
|
325
|
+
input: ["text"],
|
|
326
|
+
cost: {
|
|
327
|
+
input: 1.45,
|
|
328
|
+
output: 4.5,
|
|
329
|
+
cacheRead: 0.3625,
|
|
330
|
+
cacheWrite: 0,
|
|
331
|
+
},
|
|
332
|
+
contextWindow: 199984,
|
|
333
|
+
maxTokens: 65536,
|
|
334
|
+
thinkingLevelMap: {
|
|
335
|
+
off: "none",
|
|
336
|
+
minimal: null,
|
|
337
|
+
low: null,
|
|
338
|
+
medium: null,
|
|
339
|
+
high: "high",
|
|
340
|
+
xhigh: "max",
|
|
341
|
+
},
|
|
342
|
+
compat: {
|
|
343
|
+
supportsDeveloperRole: false,
|
|
344
|
+
maxTokensField: "max_tokens",
|
|
345
|
+
requiresReasoningContentOnAssistantMessages: true,
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
// Kimi K2.6 Flex - MoonshotAI (flex variant)
|
|
349
|
+
{
|
|
350
|
+
id: "kimi-k2.6-flex",
|
|
351
|
+
name: "Kimi K2.6 (flex)",
|
|
352
|
+
reasoning: true,
|
|
353
|
+
input: ["text", "image"],
|
|
354
|
+
cost: {
|
|
355
|
+
input: 0.69,
|
|
356
|
+
output: 3.22,
|
|
357
|
+
cacheRead: 0.1725,
|
|
358
|
+
cacheWrite: 0,
|
|
359
|
+
},
|
|
360
|
+
contextWindow: 262128,
|
|
361
|
+
maxTokens: 65536,
|
|
362
|
+
thinkingLevelMap: {
|
|
363
|
+
minimal: null,
|
|
364
|
+
low: null,
|
|
365
|
+
medium: "medium",
|
|
366
|
+
high: null,
|
|
367
|
+
xhigh: null,
|
|
368
|
+
},
|
|
369
|
+
compat: {
|
|
370
|
+
supportsDeveloperRole: false,
|
|
371
|
+
maxTokensField: "max_tokens",
|
|
372
|
+
requiresReasoningContentOnAssistantMessages: true,
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
// Kimi K2.7 Code Flex - MoonshotAI (flex variant)
|
|
376
|
+
{
|
|
377
|
+
id: "kimi-k2.7-code-flex",
|
|
378
|
+
name: "Kimi K2.7 Code (flex)",
|
|
379
|
+
reasoning: true,
|
|
380
|
+
input: ["text", "image"],
|
|
381
|
+
cost: {
|
|
382
|
+
input: 0.95,
|
|
383
|
+
output: 4.0,
|
|
384
|
+
cacheRead: 0.2375,
|
|
385
|
+
cacheWrite: 0,
|
|
386
|
+
},
|
|
387
|
+
contextWindow: 262128,
|
|
388
|
+
maxTokens: 65536,
|
|
389
|
+
thinkingLevelMap: {
|
|
390
|
+
off: null,
|
|
391
|
+
minimal: null,
|
|
392
|
+
low: null,
|
|
393
|
+
medium: "medium",
|
|
394
|
+
high: null,
|
|
395
|
+
xhigh: null,
|
|
396
|
+
},
|
|
397
|
+
compat: {
|
|
398
|
+
supportsDeveloperRole: false,
|
|
399
|
+
maxTokensField: "max_tokens",
|
|
400
|
+
requiresReasoningContentOnAssistantMessages: true,
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
// GLM-5.2 Flex - ZhipuAI (flex variant)
|
|
404
|
+
{
|
|
405
|
+
id: "glm-5.2-flex",
|
|
406
|
+
name: "GLM-5.2 (flex)",
|
|
407
|
+
reasoning: true,
|
|
408
|
+
input: ["text"],
|
|
409
|
+
cost: {
|
|
410
|
+
input: 1.45,
|
|
411
|
+
output: 4.5,
|
|
412
|
+
cacheRead: 0.3625,
|
|
413
|
+
cacheWrite: 0,
|
|
414
|
+
},
|
|
415
|
+
contextWindow: 1048560,
|
|
416
|
+
maxTokens: 65536,
|
|
417
|
+
thinkingLevelMap: {
|
|
418
|
+
off: "none",
|
|
419
|
+
minimal: null,
|
|
420
|
+
low: null,
|
|
421
|
+
medium: null,
|
|
422
|
+
high: "high",
|
|
423
|
+
xhigh: "max",
|
|
424
|
+
},
|
|
425
|
+
compat: {
|
|
426
|
+
supportsDeveloperRole: false,
|
|
427
|
+
maxTokensField: "max_tokens",
|
|
428
|
+
requiresReasoningContentOnAssistantMessages: true,
|
|
429
|
+
},
|
|
430
|
+
},
|
|
431
|
+
// Qwen3.6 35B Fast - Qwen
|
|
432
|
+
{
|
|
433
|
+
id: "qwen3.6-35b-fast",
|
|
434
|
+
name: "Qwen3.6 35B Fast",
|
|
435
|
+
reasoning: false,
|
|
436
|
+
input: ["text", "image"],
|
|
437
|
+
cost: {
|
|
438
|
+
input: 0.29,
|
|
439
|
+
output: 1.15,
|
|
440
|
+
cacheRead: 0.0725,
|
|
441
|
+
cacheWrite: 0,
|
|
442
|
+
},
|
|
443
|
+
contextWindow: 131056,
|
|
444
|
+
maxTokens: 65536,
|
|
445
|
+
compat: {
|
|
446
|
+
supportsDeveloperRole: false,
|
|
447
|
+
maxTokensField: "max_tokens",
|
|
448
|
+
},
|
|
449
|
+
},
|
|
450
|
+
];
|
|
451
|
+
|
|
452
|
+
// Legacy model ID aliases that map to canonical public models.
|
|
453
|
+
const LEGACY_MODEL_ALIAS_MAP: Record<string, string> = {
|
|
454
|
+
"glm-5.1": "glm-5.2",
|
|
455
|
+
"glm-5.1-fast": "glm-5.2-fast",
|
|
456
|
+
"zai-org/GLM-5.1-FP8": "glm-5.2",
|
|
457
|
+
"moonshotai/Kimi-K2.5": "kimi-k2.6",
|
|
458
|
+
"kimi-k2.5-fast": "kimi-k2.6-fast",
|
|
459
|
+
"moonshotai/Kimi-K2.6": "kimi-k2.6",
|
|
460
|
+
"Qwen/Qwen3.5-397B-A17B-FP8": "qwen3.5-397b",
|
|
461
|
+
"Qwen/Qwen3.6-35B-A3B": "qwen3.6-35b",
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
function resolveLegacyModels(): ProviderModelConfig[] {
|
|
465
|
+
return Object.entries(LEGACY_MODEL_ALIAS_MAP).map(
|
|
466
|
+
([legacyId, canonicalId]) => {
|
|
467
|
+
const canonical = NEURALWATT_MODELS.find(
|
|
468
|
+
(model) => model.id === canonicalId,
|
|
469
|
+
);
|
|
470
|
+
if (!canonical) {
|
|
471
|
+
throw new Error(`Missing canonical model for legacy alias ${legacyId}`);
|
|
472
|
+
}
|
|
473
|
+
return {
|
|
474
|
+
...canonical,
|
|
475
|
+
id: legacyId,
|
|
476
|
+
name: `${canonical.name} (legacy ID)`,
|
|
477
|
+
};
|
|
478
|
+
},
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
// ============================================================================
|
|
483
|
+
// Extension entry point
|
|
484
|
+
// ============================================================================
|
|
485
|
+
|
|
486
|
+
export default function neuralwattExtension(pi: ExtensionAPI): void {
|
|
487
|
+
const config: Parameters<typeof pi.registerProvider>[1] = {
|
|
488
|
+
baseUrl: "https://api.neuralwatt.com/v1",
|
|
489
|
+
apiKey: "NEURALWATT_API_KEY",
|
|
490
|
+
api: "openai-completions",
|
|
491
|
+
authHeader: true,
|
|
492
|
+
headers: {
|
|
493
|
+
Referer: "https://pi.dev",
|
|
494
|
+
"X-Title": "omp:@tbui17/omp-neuralwatt-provider",
|
|
495
|
+
},
|
|
496
|
+
models: NEURALWATT_MODELS,
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
pi.registerProvider("neuralwatt", config);
|
|
500
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tbui17/omp-neuralwatt-provider",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Neuralwatt OpenAI-compatible provider for oh-my-pi",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./extension.ts",
|
|
7
|
+
"files": ["extension.ts", "README.md", "LICENSE", "test"],
|
|
8
|
+
"scripts": {
|
|
9
|
+
"test": "bun test"
|
|
10
|
+
},
|
|
11
|
+
"keywords": ["omp", "omp-extension", "omp-plugin", "neuralwatt", "ai", "llm"],
|
|
12
|
+
"omp": {
|
|
13
|
+
"extensions": ["./extension.ts"]
|
|
14
|
+
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"bun": ">=1.3.0"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "github:tbui17/omp-neuralwatt-provider"
|
|
22
|
+
},
|
|
23
|
+
"author": "tbui17"
|
|
24
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { describe, test, expect } from "bun:test";
|
|
2
|
+
|
|
3
|
+
const NEURALWATT_API_KEY = process.env.NEURALWATT_API_KEY;
|
|
4
|
+
const BASE_URL = "https://api.neuralwatt.com/v1";
|
|
5
|
+
|
|
6
|
+
describe.skipIf(!NEURALWATT_API_KEY)("neuralwatt integration", () => {
|
|
7
|
+
test("qwen3.6-35b-fast responds to a chat completion request", async () => {
|
|
8
|
+
const res = await fetch(`${BASE_URL}/chat/completions`, {
|
|
9
|
+
method: "POST",
|
|
10
|
+
headers: {
|
|
11
|
+
Authorization: `Bearer ${NEURALWATT_API_KEY}`,
|
|
12
|
+
"Content-Type": "application/json",
|
|
13
|
+
},
|
|
14
|
+
body: JSON.stringify({
|
|
15
|
+
model: "qwen3.6-35b-fast",
|
|
16
|
+
messages: [{ role: "user", content: "reply with exactly: pong" }],
|
|
17
|
+
max_tokens: 50,
|
|
18
|
+
}),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
expect(res.ok).toBe(true);
|
|
22
|
+
expect(res.status).toBe(200);
|
|
23
|
+
|
|
24
|
+
const data = await res.json();
|
|
25
|
+
expect(data.object).toBe("chat.completion");
|
|
26
|
+
expect(data.model).toBe("qwen3.6-35b-fast");
|
|
27
|
+
expect(data.choices).toBeInstanceOf(Array);
|
|
28
|
+
expect(data.choices.length).toBeGreaterThan(0);
|
|
29
|
+
|
|
30
|
+
const message = data.choices[0]?.message;
|
|
31
|
+
expect(message?.role).toBe("assistant");
|
|
32
|
+
expect(message?.content).toBe("pong");
|
|
33
|
+
|
|
34
|
+
expect(data.usage).toBeDefined();
|
|
35
|
+
expect(typeof data.usage.prompt_tokens).toBe("number");
|
|
36
|
+
expect(typeof data.usage.completion_tokens).toBe("number");
|
|
37
|
+
});
|
|
38
|
+
});
|