@aliou/pi-neuralwatt 0.10.5 → 0.11.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/README.md +3 -2
- package/extensions/provider/commands/settings/index.ts +46 -80
- package/extensions/provider/index.ts +9 -4
- package/extensions/provider/models/aliases.ts +36 -0
- package/extensions/provider/models/build.ts +119 -0
- package/extensions/provider/models/{hidden.ts → early-access.ts} +46 -45
- package/extensions/provider/models/index.ts +16 -1
- package/extensions/provider/models/legacy.ts +0 -4
- package/extensions/provider/models/public-models.ts +274 -447
- package/extensions/provider/models/refresh.ts +59 -24
- package/package.json +1 -1
- package/schema.json +6 -2
- package/src/config/defaults.ts +2 -1
- package/src/config/index.ts +1 -6
- package/src/config/loader.ts +21 -44
- package/src/config/migration/01-disable-legacy-model-ids-by-default.ts +11 -13
- package/src/config/migration/02-flat-to-nested-config.ts +31 -14
- package/src/config/migration/03-rename-hidden-to-early-access.ts +47 -0
- package/src/config/migration/04-enable-aliases-for-legacy-users.ts +49 -0
- package/src/config/migration/index.ts +8 -2
- package/src/config/types.ts +7 -25
package/README.md
CHANGED
|
@@ -78,7 +78,8 @@ Configure features with `/neuralwatt:settings`:
|
|
|
78
78
|
- **Quota warnings** — Enable/disable low quota notifications
|
|
79
79
|
- **Sub-bar integration** — Show/hide usage in status bar
|
|
80
80
|
- **Legacy model IDs** — Include deprecated model aliases
|
|
81
|
-
- **
|
|
81
|
+
- **Alias model IDs** — Include active creator-scoped model aliases
|
|
82
|
+
- **Early access models** — Include pre-release models available only to the configured API key
|
|
82
83
|
|
|
83
84
|
The provider itself cannot be disabled — it is always loaded.
|
|
84
85
|
|
|
@@ -86,7 +87,7 @@ Configuration uses nested per-feature sections. Existing flat config files are m
|
|
|
86
87
|
|
|
87
88
|
### Model Refresh
|
|
88
89
|
|
|
89
|
-
Neuralwatt registers its public models without network access. When
|
|
90
|
+
Neuralwatt registers its public models without network access. When early-access models are enabled, opening `/model` refreshes the authenticated catalog in the background. `pi update --models` forces an immediate refresh.
|
|
90
91
|
|
|
91
92
|
Pi stores the complete effective Neuralwatt catalog in `~/.pi/agent/models-store.json` for offline startup. Current hardcoded public and legacy definitions remain authoritative when cached models are restored.
|
|
92
93
|
|
|
@@ -7,7 +7,6 @@ import type { SettingItem } from "@earendil-works/pi-tui";
|
|
|
7
7
|
import {
|
|
8
8
|
configLoader,
|
|
9
9
|
type NeuralwattConfig,
|
|
10
|
-
type NeuralwattRawConfig,
|
|
11
10
|
type ResolvedNeuralwattConfig,
|
|
12
11
|
} from "../../../../src/config";
|
|
13
12
|
import {
|
|
@@ -50,51 +49,11 @@ function featureRow(
|
|
|
50
49
|
};
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function featureValue(value: unknown, fallback: boolean): boolean {
|
|
63
|
-
return optionalFeatureValue(value) ?? fallback;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function toNestedConfig(config: NeuralwattRawConfig): NeuralwattConfig {
|
|
67
|
-
const provider = "provider" in config ? config.provider : undefined;
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
provider: {
|
|
71
|
-
...(provider ?? {}),
|
|
72
|
-
includeLegacyModelIds:
|
|
73
|
-
provider?.includeLegacyModelIds ??
|
|
74
|
-
("includeLegacyModelIds" in config
|
|
75
|
-
? config.includeLegacyModelIds
|
|
76
|
-
: undefined),
|
|
77
|
-
includeHiddenModels:
|
|
78
|
-
provider?.includeHiddenModels ??
|
|
79
|
-
("includeHiddenModels" in config
|
|
80
|
-
? config.includeHiddenModels
|
|
81
|
-
: undefined),
|
|
82
|
-
},
|
|
83
|
-
quotaCommand: {
|
|
84
|
-
...(typeof config.quotaCommand === "object" ? config.quotaCommand : {}),
|
|
85
|
-
enabled: optionalFeatureValue(config.quotaCommand),
|
|
86
|
-
},
|
|
87
|
-
quotaWarnings: {
|
|
88
|
-
...(typeof config.quotaWarnings === "object" ? config.quotaWarnings : {}),
|
|
89
|
-
enabled: optionalFeatureValue(config.quotaWarnings),
|
|
90
|
-
},
|
|
91
|
-
subBarIntegration: {
|
|
92
|
-
...(typeof config.subBarIntegration === "object"
|
|
93
|
-
? config.subBarIntegration
|
|
94
|
-
: {}),
|
|
95
|
-
enabled: optionalFeatureValue(config.subBarIntegration),
|
|
96
|
-
},
|
|
97
|
-
};
|
|
52
|
+
function featureValue(
|
|
53
|
+
section: { enabled?: boolean } | undefined,
|
|
54
|
+
fallback: boolean,
|
|
55
|
+
): boolean {
|
|
56
|
+
return section?.enabled ?? fallback;
|
|
98
57
|
}
|
|
99
58
|
|
|
100
59
|
export function registerNeuralwattSettings(
|
|
@@ -103,7 +62,7 @@ export function registerNeuralwattSettings(
|
|
|
103
62
|
): void {
|
|
104
63
|
const { getLoadedFeatures } = options;
|
|
105
64
|
|
|
106
|
-
registerSettingsCommand<
|
|
65
|
+
registerSettingsCommand<NeuralwattConfig, ResolvedNeuralwattConfig>(pi, {
|
|
107
66
|
commandName: "neuralwatt:settings",
|
|
108
67
|
title: "Neuralwatt Settings",
|
|
109
68
|
configStore: configLoader,
|
|
@@ -154,30 +113,32 @@ export function registerNeuralwattSettings(
|
|
|
154
113
|
description:
|
|
155
114
|
"Include deprecated Neuralwatt model IDs as aliases in the model picker",
|
|
156
115
|
currentValue:
|
|
157
|
-
(
|
|
158
|
-
"provider" in tabConfig &&
|
|
159
|
-
tabConfig.provider?.includeLegacyModelIds) ??
|
|
160
|
-
(tabConfig &&
|
|
161
|
-
"includeLegacyModelIds" in tabConfig &&
|
|
162
|
-
tabConfig.includeLegacyModelIds) ??
|
|
116
|
+
(tabConfig?.provider?.includeLegacyModelIds ??
|
|
163
117
|
resolved.provider.includeLegacyModelIds)
|
|
164
118
|
? "include"
|
|
165
119
|
: "ignore",
|
|
166
120
|
values: ["include", "ignore"],
|
|
167
121
|
},
|
|
168
122
|
{
|
|
169
|
-
id: "
|
|
170
|
-
label: "
|
|
123
|
+
id: "includeAliasedModelIds",
|
|
124
|
+
label: "Alias model IDs",
|
|
125
|
+
description:
|
|
126
|
+
"Include active creator-scoped model IDs as aliases in the model picker",
|
|
127
|
+
currentValue:
|
|
128
|
+
(tabConfig?.provider?.includeAliasedModelIds ??
|
|
129
|
+
resolved.provider.includeAliasedModelIds)
|
|
130
|
+
? "include"
|
|
131
|
+
: "ignore",
|
|
132
|
+
values: ["include", "ignore"],
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: "includeEarlyAccessModels",
|
|
136
|
+
label: "Early access models",
|
|
171
137
|
description:
|
|
172
|
-
"Include Neuralwatt models that
|
|
138
|
+
"Include pre-release Neuralwatt models that your API key can reach but that are not yet in the public model list",
|
|
173
139
|
currentValue:
|
|
174
|
-
(
|
|
175
|
-
|
|
176
|
-
tabConfig.provider?.includeHiddenModels) ??
|
|
177
|
-
(tabConfig &&
|
|
178
|
-
"includeHiddenModels" in tabConfig &&
|
|
179
|
-
tabConfig.includeHiddenModels) ??
|
|
180
|
-
resolved.provider.includeHiddenModels)
|
|
140
|
+
(tabConfig?.provider?.includeEarlyAccessModels ??
|
|
141
|
+
resolved.provider.includeEarlyAccessModels)
|
|
181
142
|
? "include"
|
|
182
143
|
: "ignore",
|
|
183
144
|
values: ["include", "ignore"],
|
|
@@ -190,23 +151,31 @@ export function registerNeuralwattSettings(
|
|
|
190
151
|
// Non-feature toggles are handled first so they are not blocked by the
|
|
191
152
|
// loaded-features guard (they are managed directly by the provider).
|
|
192
153
|
if (id === "includeLegacyModelIds") {
|
|
193
|
-
const nestedConfig = toNestedConfig(config);
|
|
194
154
|
return {
|
|
195
|
-
...
|
|
155
|
+
...config,
|
|
196
156
|
provider: {
|
|
197
|
-
...
|
|
157
|
+
...config.provider,
|
|
198
158
|
includeLegacyModelIds: newValue === "include",
|
|
199
159
|
},
|
|
200
160
|
};
|
|
201
161
|
}
|
|
202
162
|
|
|
203
|
-
if (id === "
|
|
204
|
-
const nestedConfig = toNestedConfig(config);
|
|
163
|
+
if (id === "includeAliasedModelIds") {
|
|
205
164
|
return {
|
|
206
|
-
...
|
|
165
|
+
...config,
|
|
207
166
|
provider: {
|
|
208
|
-
...
|
|
209
|
-
|
|
167
|
+
...config.provider,
|
|
168
|
+
includeAliasedModelIds: newValue === "include",
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (id === "includeEarlyAccessModels") {
|
|
174
|
+
return {
|
|
175
|
+
...config,
|
|
176
|
+
provider: {
|
|
177
|
+
...config.provider,
|
|
178
|
+
includeEarlyAccessModels: newValue === "include",
|
|
210
179
|
},
|
|
211
180
|
};
|
|
212
181
|
}
|
|
@@ -219,21 +188,18 @@ export function registerNeuralwattSettings(
|
|
|
219
188
|
switch (id) {
|
|
220
189
|
case "quotaCommand":
|
|
221
190
|
return {
|
|
222
|
-
...
|
|
223
|
-
quotaCommand: { ...
|
|
191
|
+
...config,
|
|
192
|
+
quotaCommand: { ...config.quotaCommand, enabled },
|
|
224
193
|
};
|
|
225
194
|
case "quotaWarnings":
|
|
226
195
|
return {
|
|
227
|
-
...
|
|
228
|
-
quotaWarnings: { ...
|
|
196
|
+
...config,
|
|
197
|
+
quotaWarnings: { ...config.quotaWarnings, enabled },
|
|
229
198
|
};
|
|
230
199
|
case "subBarIntegration":
|
|
231
200
|
return {
|
|
232
|
-
...
|
|
233
|
-
subBarIntegration: {
|
|
234
|
-
...toNestedConfig(config).subBarIntegration,
|
|
235
|
-
enabled,
|
|
236
|
-
},
|
|
201
|
+
...config,
|
|
202
|
+
subBarIntegration: { ...config.subBarIntegration, enabled },
|
|
237
203
|
};
|
|
238
204
|
default:
|
|
239
205
|
return null;
|
|
@@ -44,6 +44,7 @@ function registerNeuralwattProvider(
|
|
|
44
44
|
|
|
45
45
|
const models = getNeuralwattModels({
|
|
46
46
|
includeLegacyModelIds: providerConfig.includeLegacyModelIds,
|
|
47
|
+
includeAliasedModelIds: providerConfig.includeAliasedModelIds,
|
|
47
48
|
});
|
|
48
49
|
|
|
49
50
|
const config: Parameters<ExtensionAPI["registerProvider"]>[1] = {
|
|
@@ -61,8 +62,10 @@ function registerNeuralwattProvider(
|
|
|
61
62
|
refreshNeuralwattModels(context, {
|
|
62
63
|
includeLegacyModelIds:
|
|
63
64
|
configLoader.getConfig().provider.includeLegacyModelIds,
|
|
64
|
-
|
|
65
|
-
configLoader.getConfig().provider.
|
|
65
|
+
includeAliasedModelIds:
|
|
66
|
+
configLoader.getConfig().provider.includeAliasedModelIds,
|
|
67
|
+
includeEarlyAccessModels:
|
|
68
|
+
configLoader.getConfig().provider.includeEarlyAccessModels,
|
|
66
69
|
}),
|
|
67
70
|
};
|
|
68
71
|
|
|
@@ -113,8 +116,10 @@ export default async function (pi: ExtensionAPI) {
|
|
|
113
116
|
if (
|
|
114
117
|
next.includeLegacyModelIds ===
|
|
115
118
|
registeredProviderSettings.includeLegacyModelIds &&
|
|
116
|
-
next.
|
|
117
|
-
registeredProviderSettings.
|
|
119
|
+
next.includeAliasedModelIds ===
|
|
120
|
+
registeredProviderSettings.includeAliasedModelIds &&
|
|
121
|
+
next.includeEarlyAccessModels ===
|
|
122
|
+
registeredProviderSettings.includeEarlyAccessModels
|
|
118
123
|
) {
|
|
119
124
|
return;
|
|
120
125
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ProviderModelConfig } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { NEURALWATT_MODELS } from "./public-models";
|
|
3
|
+
|
|
4
|
+
// Alternate creator-scoped model IDs that Neuralwatt accepts for active models.
|
|
5
|
+
// These are only included when `includeAliasedModelIds` is enabled.
|
|
6
|
+
export const ALIAS_MODEL_MAP = {
|
|
7
|
+
"deepseek-ai/DeepSeek-V4-Flash": "deepseek-v4-flash",
|
|
8
|
+
"zai-org/GLM-5.2-FP8": "glm-5.2",
|
|
9
|
+
"moonshotai/Kimi-K2.6": "kimi-k2.6",
|
|
10
|
+
"moonshotai/Kimi-K2.7-Code": "kimi-k2.7-code",
|
|
11
|
+
"Qwen/Qwen3.5-397B-A17B-FP8": "qwen3.5-397b",
|
|
12
|
+
"Qwen/Qwen3.6-35B-A3B": "qwen3.6-35b",
|
|
13
|
+
"nvidia/Gemma-4-31B-IT-NVFP4": "gemma-4-31b",
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
export const ALIAS_NEURALWATT_MODEL_IDS = new Set<string>(
|
|
17
|
+
Object.keys(ALIAS_MODEL_MAP),
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export function buildAliasNeuralwattModels(
|
|
21
|
+
canonicalModels: ProviderModelConfig[] = NEURALWATT_MODELS,
|
|
22
|
+
): ProviderModelConfig[] {
|
|
23
|
+
return Object.entries(ALIAS_MODEL_MAP).flatMap(([aliasId, canonicalId]) => {
|
|
24
|
+
const canonical = canonicalModels.find((model) => model.id === canonicalId);
|
|
25
|
+
|
|
26
|
+
if (!canonical) return [];
|
|
27
|
+
|
|
28
|
+
return [
|
|
29
|
+
{
|
|
30
|
+
...canonical,
|
|
31
|
+
id: aliasId,
|
|
32
|
+
name: `${canonical.name} (alias ID)`,
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
});
|
|
36
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { ProviderModelConfig } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
|
|
3
|
+
export type ThinkingLevelMap = NonNullable<
|
|
4
|
+
ProviderModelConfig["thinkingLevelMap"]
|
|
5
|
+
>;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Flex tier is billed at 65% of standard pricing (35% off) when the request
|
|
9
|
+
* streams. A non-streaming request to a `-flex` model silently falls back to
|
|
10
|
+
* the standard tier and the standard price.
|
|
11
|
+
*
|
|
12
|
+
* https://portal.neuralwatt.com/docs/guides/flex-tier
|
|
13
|
+
*/
|
|
14
|
+
export const FLEX_COST_MULTIPLIER = 0.65;
|
|
15
|
+
|
|
16
|
+
export interface NeuralwattCost {
|
|
17
|
+
input: number;
|
|
18
|
+
output: number;
|
|
19
|
+
cacheRead: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Shared metadata for every variant of a Neuralwatt model (base, `-fast`,
|
|
24
|
+
* `-flex`, `-short`, ...). Variants only declare what differs.
|
|
25
|
+
*/
|
|
26
|
+
export interface NeuralwattModelFamily {
|
|
27
|
+
cost: NeuralwattCost;
|
|
28
|
+
vision: boolean;
|
|
29
|
+
/** Thinking levels used by reasoning variants of this family. */
|
|
30
|
+
thinkingLevelMap?: ThinkingLevelMap;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface NeuralwattVariantSpec {
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
/** `max_model_len` from /v1/models. */
|
|
37
|
+
contextWindow: number;
|
|
38
|
+
/**
|
|
39
|
+
* `metadata.limits.max_output_tokens` from /v1/models. `null` means the API
|
|
40
|
+
* imposes no separate output cap, so output is bounded by the context window.
|
|
41
|
+
*/
|
|
42
|
+
maxOutputTokens: number | null;
|
|
43
|
+
reasoning: boolean;
|
|
44
|
+
cost?: Partial<NeuralwattCost>;
|
|
45
|
+
/**
|
|
46
|
+
* Multiplier applied to the family cost, e.g. the Flex tier discount.
|
|
47
|
+
* Applied after any per-variant `cost` override.
|
|
48
|
+
*/
|
|
49
|
+
costMultiplier?: number;
|
|
50
|
+
vision?: boolean;
|
|
51
|
+
thinkingLevelMap?: ThinkingLevelMap;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Neuralwatt reports `max_output_tokens: null` for models whose output is only
|
|
56
|
+
* bounded by the context window. Mirror the API instead of inventing a cap.
|
|
57
|
+
*/
|
|
58
|
+
export function resolveMaxTokens(
|
|
59
|
+
maxOutputTokens: number | null | undefined,
|
|
60
|
+
contextWindow: number,
|
|
61
|
+
): number {
|
|
62
|
+
return maxOutputTokens ?? contextWindow;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function buildNeuralwattModel(
|
|
66
|
+
family: NeuralwattModelFamily,
|
|
67
|
+
variant: NeuralwattVariantSpec,
|
|
68
|
+
): ProviderModelConfig {
|
|
69
|
+
const vision = variant.vision ?? family.vision;
|
|
70
|
+
|
|
71
|
+
const compat: NonNullable<ProviderModelConfig["compat"]> = {
|
|
72
|
+
supportsDeveloperRole: false,
|
|
73
|
+
maxTokensField: "max_tokens",
|
|
74
|
+
};
|
|
75
|
+
if (variant.reasoning) {
|
|
76
|
+
compat.requiresReasoningContentOnAssistantMessages = true;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const multiplier = variant.costMultiplier ?? 1;
|
|
80
|
+
const scale = (value: number): number =>
|
|
81
|
+
multiplier === 1 ? value : Number((value * multiplier).toFixed(6));
|
|
82
|
+
|
|
83
|
+
const model: ProviderModelConfig = {
|
|
84
|
+
id: variant.id,
|
|
85
|
+
name: variant.name,
|
|
86
|
+
reasoning: variant.reasoning,
|
|
87
|
+
input: vision ? ["text", "image"] : ["text"],
|
|
88
|
+
cost: {
|
|
89
|
+
input: scale(variant.cost?.input ?? family.cost.input),
|
|
90
|
+
output: scale(variant.cost?.output ?? family.cost.output),
|
|
91
|
+
cacheRead: scale(variant.cost?.cacheRead ?? family.cost.cacheRead),
|
|
92
|
+
cacheWrite: 0,
|
|
93
|
+
},
|
|
94
|
+
contextWindow: variant.contextWindow,
|
|
95
|
+
maxTokens: resolveMaxTokens(variant.maxOutputTokens, variant.contextWindow),
|
|
96
|
+
compat,
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
if (variant.reasoning) {
|
|
100
|
+
const thinkingLevelMap =
|
|
101
|
+
variant.thinkingLevelMap ?? family.thinkingLevelMap;
|
|
102
|
+
if (!thinkingLevelMap) {
|
|
103
|
+
throw new Error(
|
|
104
|
+
`Missing thinkingLevelMap for reasoning model ${variant.id}`,
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
// Clone so variants never share a family map instance.
|
|
108
|
+
model.thinkingLevelMap = { ...thinkingLevelMap };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return model;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function buildNeuralwattFamily(
|
|
115
|
+
family: NeuralwattModelFamily,
|
|
116
|
+
variants: NeuralwattVariantSpec[],
|
|
117
|
+
): ProviderModelConfig[] {
|
|
118
|
+
return variants.map((variant) => buildNeuralwattModel(family, variant));
|
|
119
|
+
}
|
|
@@ -1,55 +1,53 @@
|
|
|
1
1
|
import type { ProviderModelConfig } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { fetchNeuralwattModels } from "../../../src/lib/neuralwatt-api";
|
|
3
3
|
import type { NeuralwattApiModel } from "../../../src/types/models-api";
|
|
4
|
+
import { buildNeuralwattModel, resolveMaxTokens } from "./build";
|
|
4
5
|
import { NEURALWATT_MODELS } from "./public-models";
|
|
5
6
|
|
|
6
|
-
//
|
|
7
|
-
// /v1/models response
|
|
8
|
-
//
|
|
7
|
+
// Pre-release models. Neuralwatt ships these to authorized accounts before they
|
|
8
|
+
// reach the public /v1/models response; most go public eventually. Keep them
|
|
9
|
+
// gated by includeEarlyAccessModels and hardcode entries so they remain
|
|
10
|
+
// available from the offline catalog.
|
|
9
11
|
// Move an entry to public-models.ts once Neuralwatt advertises it publicly.
|
|
10
|
-
export const
|
|
12
|
+
export const EARLY_ACCESS_NEURALWATT_MODELS: ProviderModelConfig[] = [
|
|
11
13
|
// Kimi K3 - early-access MoonshotAI multimodal MoE.
|
|
12
14
|
// Metadata is sourced from Neuralwatt's authenticated model catalog.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
contextWindow: 1048560,
|
|
25
|
-
maxTokens: 65536,
|
|
26
|
-
thinkingLevelMap: {
|
|
27
|
-
minimal: null,
|
|
28
|
-
low: null,
|
|
29
|
-
medium: "medium",
|
|
30
|
-
high: null,
|
|
31
|
-
xhigh: null,
|
|
15
|
+
buildNeuralwattModel(
|
|
16
|
+
{
|
|
17
|
+
cost: { input: 3, output: 15, cacheRead: 0.3 },
|
|
18
|
+
vision: true,
|
|
19
|
+
thinkingLevelMap: {
|
|
20
|
+
minimal: null,
|
|
21
|
+
low: null,
|
|
22
|
+
medium: "medium",
|
|
23
|
+
high: null,
|
|
24
|
+
xhigh: null,
|
|
25
|
+
},
|
|
32
26
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
{
|
|
28
|
+
id: "kimi-k3",
|
|
29
|
+
name: "Kimi K3",
|
|
30
|
+
contextWindow: 1048560,
|
|
31
|
+
maxOutputTokens: null,
|
|
32
|
+
reasoning: true,
|
|
37
33
|
},
|
|
38
|
-
|
|
34
|
+
),
|
|
39
35
|
];
|
|
40
36
|
|
|
41
|
-
// Per-ID overrides for known
|
|
42
|
-
// exposes pricing and capabilities, but some Pi-specific behavior
|
|
43
|
-
// compat flags) has to be supplied by hand.
|
|
44
|
-
//
|
|
45
|
-
const
|
|
37
|
+
// Per-ID overrides for known early-access models. The authenticated /v1/models
|
|
38
|
+
// endpoint exposes pricing and capabilities, but some Pi-specific behavior
|
|
39
|
+
// (thinking levels, compat flags) has to be supplied by hand.
|
|
40
|
+
// Models that have since gone public now live in public-models.ts.
|
|
41
|
+
const EARLY_ACCESS_MODEL_OVERRIDES: Partial<
|
|
46
42
|
Record<string, Partial<ProviderModelConfig>>
|
|
47
43
|
> = {};
|
|
48
44
|
|
|
49
|
-
function
|
|
45
|
+
function buildEarlyAccessModel(
|
|
46
|
+
apiModel: NeuralwattApiModel,
|
|
47
|
+
): ProviderModelConfig {
|
|
50
48
|
const meta = apiModel.metadata;
|
|
51
49
|
const reasoning = meta?.capabilities.reasoning ?? false;
|
|
52
|
-
const override =
|
|
50
|
+
const override = EARLY_ACCESS_MODEL_OVERRIDES[apiModel.id];
|
|
53
51
|
|
|
54
52
|
const compat: NonNullable<ProviderModelConfig["compat"]> = {
|
|
55
53
|
supportsDeveloperRole: false,
|
|
@@ -74,7 +72,10 @@ function buildHiddenModel(apiModel: NeuralwattApiModel): ProviderModelConfig {
|
|
|
74
72
|
cacheWrite: meta?.pricing.cached_output_per_million ?? 0,
|
|
75
73
|
},
|
|
76
74
|
contextWindow: apiModel.max_model_len,
|
|
77
|
-
maxTokens:
|
|
75
|
+
maxTokens: resolveMaxTokens(
|
|
76
|
+
meta?.limits.max_output_tokens,
|
|
77
|
+
apiModel.max_model_len,
|
|
78
|
+
),
|
|
78
79
|
compat,
|
|
79
80
|
};
|
|
80
81
|
|
|
@@ -89,13 +90,13 @@ function buildHiddenModel(apiModel: NeuralwattApiModel): ProviderModelConfig {
|
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
if (override) {
|
|
92
|
-
return
|
|
93
|
+
return applyEarlyAccessOverride(model, override);
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
return model;
|
|
96
97
|
}
|
|
97
98
|
|
|
98
|
-
function
|
|
99
|
+
function applyEarlyAccessOverride(
|
|
99
100
|
model: ProviderModelConfig,
|
|
100
101
|
override: Partial<ProviderModelConfig>,
|
|
101
102
|
): ProviderModelConfig {
|
|
@@ -122,14 +123,14 @@ function applyHiddenOverride(
|
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
/**
|
|
125
|
-
* Load
|
|
126
|
+
* Load early-access models from the authenticated /v1/models endpoint.
|
|
126
127
|
*
|
|
127
|
-
*
|
|
128
|
-
* the public hardcoded list. If the API key is missing or the request
|
|
129
|
-
* `undefined` distinguishes an unavailable/failed request from a
|
|
130
|
-
* empty
|
|
128
|
+
* Early-access models are any models returned by the API that are not already
|
|
129
|
+
* part of the public hardcoded list. If the API key is missing or the request
|
|
130
|
+
* fails, an `undefined` distinguishes an unavailable/failed request from a
|
|
131
|
+
* successful empty list, allowing refresh callers to preserve stale cache.
|
|
131
132
|
*/
|
|
132
|
-
export async function
|
|
133
|
+
export async function loadEarlyAccessModels(
|
|
133
134
|
apiKey: string,
|
|
134
135
|
signal?: AbortSignal,
|
|
135
136
|
): Promise<ProviderModelConfig[] | undefined> {
|
|
@@ -146,5 +147,5 @@ export async function loadHiddenModels(
|
|
|
146
147
|
!model.metadata?.deprecated && !model.metadata?.pricing.pricing_tbd,
|
|
147
148
|
)
|
|
148
149
|
.filter((model) => !publicIds.has(model.id))
|
|
149
|
-
.map(
|
|
150
|
+
.map(buildEarlyAccessModel);
|
|
150
151
|
}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import type { ProviderModelConfig } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { buildAliasNeuralwattModels } from "./aliases";
|
|
2
3
|
import { buildLegacyNeuralwattModels } from "./legacy";
|
|
3
4
|
import { NEURALWATT_MODELS } from "./public-models";
|
|
4
5
|
|
|
5
|
-
export {
|
|
6
|
+
export {
|
|
7
|
+
ALIAS_MODEL_MAP,
|
|
8
|
+
ALIAS_NEURALWATT_MODEL_IDS,
|
|
9
|
+
buildAliasNeuralwattModels,
|
|
10
|
+
} from "./aliases";
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
EARLY_ACCESS_NEURALWATT_MODELS,
|
|
14
|
+
loadEarlyAccessModels,
|
|
15
|
+
} from "./early-access";
|
|
6
16
|
export {
|
|
7
17
|
buildLegacyNeuralwattModels,
|
|
8
18
|
LEGACY_MODEL_ALIAS_MAP,
|
|
@@ -13,6 +23,7 @@ export { refreshNeuralwattModels } from "./refresh";
|
|
|
13
23
|
|
|
14
24
|
export function getNeuralwattModels(options?: {
|
|
15
25
|
includeLegacyModelIds?: boolean;
|
|
26
|
+
includeAliasedModelIds?: boolean;
|
|
16
27
|
}): ProviderModelConfig[] {
|
|
17
28
|
const models: ProviderModelConfig[] = [...NEURALWATT_MODELS];
|
|
18
29
|
|
|
@@ -20,5 +31,9 @@ export function getNeuralwattModels(options?: {
|
|
|
20
31
|
models.push(...buildLegacyNeuralwattModels());
|
|
21
32
|
}
|
|
22
33
|
|
|
34
|
+
if (options?.includeAliasedModelIds) {
|
|
35
|
+
models.push(...buildAliasNeuralwattModels());
|
|
36
|
+
}
|
|
37
|
+
|
|
23
38
|
return models;
|
|
24
39
|
}
|
|
@@ -9,10 +9,6 @@ export const LEGACY_MODEL_ALIAS_MAP = {
|
|
|
9
9
|
"zai-org/GLM-5.1-FP8": "glm-5.2",
|
|
10
10
|
"moonshotai/Kimi-K2.5": "kimi-k2.6",
|
|
11
11
|
"kimi-k2.5-fast": "kimi-k2.6-fast",
|
|
12
|
-
"moonshotai/Kimi-K2.6": "kimi-k2.6",
|
|
13
|
-
"Qwen/Qwen3.5-397B-A17B-FP8": "qwen3.5-397b",
|
|
14
|
-
"Qwen/Qwen3.6-35B-A3B": "qwen3.6-35b",
|
|
15
|
-
"nvidia/Gemma-4-31B-IT-NVFP4": "gemma-4-31b",
|
|
16
12
|
} as const;
|
|
17
13
|
|
|
18
14
|
export const LEGACY_NEURALWATT_MODEL_IDS = new Set<string>(
|