hoomanjs 1.42.0 → 1.43.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 -3
- package/dist/acp/acp-agent.js +21 -3
- package/dist/acp/acp-agent.js.map +1 -1
- package/dist/chat/app.js +19 -2
- package/dist/chat/app.js.map +1 -1
- package/dist/chat/components/BottomChrome.d.ts +1 -0
- package/dist/chat/components/BottomChrome.js.map +1 -1
- package/dist/chat/components/StatusBar.d.ts +1 -0
- package/dist/chat/components/StatusBar.js +3 -0
- package/dist/chat/components/StatusBar.js.map +1 -1
- package/dist/configure/app.js +153 -4
- package/dist/configure/app.js.map +1 -1
- package/dist/configure/types.d.ts +3 -0
- package/dist/core/config.d.ts +75 -5
- package/dist/core/config.js +43 -0
- package/dist/core/config.js.map +1 -1
- package/dist/core/models/hub-download.d.ts +27 -0
- package/dist/core/models/hub-download.js +136 -0
- package/dist/core/models/hub-download.js.map +1 -0
- package/dist/core/models/index.js +1 -0
- package/dist/core/models/index.js.map +1 -1
- package/dist/core/models/llama-cpp/index.js +6 -3
- package/dist/core/models/llama-cpp/index.js.map +1 -1
- package/dist/core/models/llama-cpp/resolve-model.js +3 -132
- package/dist/core/models/llama-cpp/resolve-model.js.map +1 -1
- package/dist/core/models/llama-cpp/strands-llama-cpp.d.ts +7 -1
- package/dist/core/models/llama-cpp/strands-llama-cpp.js +9 -3
- package/dist/core/models/llama-cpp/strands-llama-cpp.js.map +1 -1
- package/dist/core/models/mlx/index.d.ts +13 -0
- package/dist/core/models/mlx/index.js +47 -0
- package/dist/core/models/mlx/index.js.map +1 -0
- package/dist/core/models/mlx/resolve-model.d.ts +31 -0
- package/dist/core/models/mlx/resolve-model.js +149 -0
- package/dist/core/models/mlx/resolve-model.js.map +1 -0
- package/dist/core/models/mlx/strands-mlx.d.ts +45 -0
- package/dist/core/models/mlx/strands-mlx.js +439 -0
- package/dist/core/models/mlx/strands-mlx.js.map +1 -0
- package/dist/core/models/types.d.ts +168 -14
- package/dist/core/models/types.js +43 -3
- package/dist/core/models/types.js.map +1 -1
- package/dist/core/skills/built-in/hooman-config/SKILL.md +40 -5
- package/dist/core/skills/built-in/hooman-config/providers.md +4 -1
- package/dist/core/utils/billing.d.ts +29 -2
- package/dist/core/utils/billing.js +45 -4
- package/dist/core/utils/billing.js.map +1 -1
- package/dist/core/utils/reasoning-effort.d.ts +1 -0
- package/package.json +2 -1
|
@@ -7,6 +7,7 @@ export declare enum LlmProvider {
|
|
|
7
7
|
Groq = "groq",
|
|
8
8
|
LlamaCpp = "llama-cpp",
|
|
9
9
|
Minimax = "minimax",
|
|
10
|
+
Mlx = "mlx",
|
|
10
11
|
Moonshot = "moonshot",
|
|
11
12
|
Ollama = "ollama",
|
|
12
13
|
OpenAI = "openai",
|
|
@@ -49,6 +50,16 @@ export type LlmOptions = {
|
|
|
49
50
|
model: string;
|
|
50
51
|
temperature?: number;
|
|
51
52
|
maxTokens?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Context size in tokens for this model. Only honored by the local
|
|
55
|
+
* `llama-cpp` and `mlx` providers (overrides the provider-level
|
|
56
|
+
* `context`); other providers ignore it. For llama-cpp it sizes the
|
|
57
|
+
* actual llama.cpp context; for mlx (where MLX allocates KV state
|
|
58
|
+
* dynamically) it declares the model's usable window. Both feed the
|
|
59
|
+
* context-usage gauge, taking precedence over the models.dev catalog
|
|
60
|
+
* (an explicit `billing.context` still wins).
|
|
61
|
+
*/
|
|
62
|
+
context?: number;
|
|
52
63
|
};
|
|
53
64
|
/**
|
|
54
65
|
* Per-million-token USD prices for a model. `cache/m` is the cached-input
|
|
@@ -138,15 +149,22 @@ export type LlamaCppProviderOptions = {
|
|
|
138
149
|
*/
|
|
139
150
|
hfToken?: string;
|
|
140
151
|
/**
|
|
141
|
-
* GPU backend forwarded to node-llama-cpp's `getLlama
|
|
142
|
-
* Set `false` to force CPU-only inference.
|
|
152
|
+
* GPU backend forwarded to node-llama-cpp's `getLlama`. Defaults to
|
|
153
|
+
* `"auto"` when unset. Set `false` to force CPU-only inference.
|
|
143
154
|
*/
|
|
144
155
|
gpu?: "auto" | "metal" | "cuda" | "vulkan" | false;
|
|
145
156
|
/**
|
|
146
|
-
* Context size in tokens for the llama.cpp context.
|
|
157
|
+
* Context size in tokens for the llama.cpp context. Per-LLM
|
|
158
|
+
* `options.context` takes precedence; when both are omitted,
|
|
147
159
|
* node-llama-cpp adapts it to the model's training context and free memory.
|
|
148
160
|
*/
|
|
149
|
-
|
|
161
|
+
context?: number;
|
|
162
|
+
/**
|
|
163
|
+
* Whether turns may reuse KV state already evaluated by a previous turn
|
|
164
|
+
* (llama.cpp context-sequence state reuse). Defaults to `true`; set
|
|
165
|
+
* `false` to re-prefill the full conversation from scratch every turn.
|
|
166
|
+
*/
|
|
167
|
+
promptCache?: boolean;
|
|
150
168
|
/**
|
|
151
169
|
* Reasoning controls. Providing `reasoning` enables thinking: the chat
|
|
152
170
|
* template is configured to allow thought segments (Qwen `thoughts: "auto"`,
|
|
@@ -169,6 +187,48 @@ export type MinimaxProviderOptions = {
|
|
|
169
187
|
*/
|
|
170
188
|
reasoning?: ReasoningOptions;
|
|
171
189
|
};
|
|
190
|
+
/**
|
|
191
|
+
* Sizing for mlex's internal prompt-cache pool (LRU + idle-TTL eviction,
|
|
192
|
+
* keyed by longest exact-prefix match on token ids), applied once when the
|
|
193
|
+
* model is loaded. All fields are optional overrides of mlex's own
|
|
194
|
+
* defaults (`maxEntries` 16, `ttl` 300s, `minTokens` 8).
|
|
195
|
+
*/
|
|
196
|
+
export type MlxPromptCacheConfig = {
|
|
197
|
+
minTokens?: number;
|
|
198
|
+
maxEntries?: number;
|
|
199
|
+
ttl?: number;
|
|
200
|
+
};
|
|
201
|
+
export type MlxProviderOptions = {
|
|
202
|
+
/**
|
|
203
|
+
* Hugging Face access token used when downloading MLX-format weights from
|
|
204
|
+
* the Hub (gated/private repos). Falls back to the `HF_TOKEN` env var when
|
|
205
|
+
* unset.
|
|
206
|
+
*/
|
|
207
|
+
hfToken?: string;
|
|
208
|
+
/**
|
|
209
|
+
* Default context size in tokens for this provider's models. MLX
|
|
210
|
+
* allocates KV state dynamically, so this doesn't size an allocation —
|
|
211
|
+
* it declares the usable window for the context-usage gauge. Per-LLM
|
|
212
|
+
* `options.context` takes precedence.
|
|
213
|
+
*/
|
|
214
|
+
context?: number;
|
|
215
|
+
/**
|
|
216
|
+
* Whether turns may reuse KV state from mlex's internal prompt-cache
|
|
217
|
+
* pool (prefix matching against previous calls), applied once when the
|
|
218
|
+
* model is loaded. `undefined`, `null`, and `false` all disable caching
|
|
219
|
+
* entirely; an object (even `{}`) enables it, optionally overriding
|
|
220
|
+
* mlex's own pool-sizing defaults via its fields.
|
|
221
|
+
*/
|
|
222
|
+
promptCache?: MlxPromptCacheConfig | false | null;
|
|
223
|
+
/**
|
|
224
|
+
* Reasoning controls. Providing `reasoning` enables thinking: the model
|
|
225
|
+
* thinks naturally and `effort` caps thought tokens via the runtime's
|
|
226
|
+
* thinking-token budget (1024/2048/4096/8192, default `medium`). Omit
|
|
227
|
+
* `reasoning` to disable thinking (the chat template closes the think block
|
|
228
|
+
* immediately and reasoning content is dropped).
|
|
229
|
+
*/
|
|
230
|
+
reasoning?: ReasoningOptions;
|
|
231
|
+
};
|
|
172
232
|
export type MoonshotProviderOptions = {
|
|
173
233
|
apiKey?: string;
|
|
174
234
|
baseURL?: string;
|
|
@@ -238,7 +298,7 @@ export type XaiProviderOptions = {
|
|
|
238
298
|
*/
|
|
239
299
|
reasoning?: ReasoningOptions;
|
|
240
300
|
};
|
|
241
|
-
export type ProviderOptions = AnthropicProviderOptions | AzureProviderOptions | BedrockProviderOptions | GoogleProviderOptions | GroqProviderOptions | LlamaCppProviderOptions | MinimaxProviderOptions | MoonshotProviderOptions | OllamaProviderOptions | OpenAIProviderOptions | OpenRouterProviderOptions | XaiProviderOptions;
|
|
301
|
+
export type ProviderOptions = AnthropicProviderOptions | AzureProviderOptions | BedrockProviderOptions | GoogleProviderOptions | GroqProviderOptions | LlamaCppProviderOptions | MinimaxProviderOptions | MlxProviderOptions | MoonshotProviderOptions | OllamaProviderOptions | OpenAIProviderOptions | OpenRouterProviderOptions | XaiProviderOptions;
|
|
242
302
|
export declare const OpenAIApiSchema: z.ZodEnum<{
|
|
243
303
|
chat: "chat";
|
|
244
304
|
responses: "responses";
|
|
@@ -281,6 +341,7 @@ export declare const LlmOptionsSchema: z.ZodObject<{
|
|
|
281
341
|
model: z.ZodString;
|
|
282
342
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
283
343
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
344
|
+
context: z.ZodOptional<z.ZodNumber>;
|
|
284
345
|
}, z.core.$strict>;
|
|
285
346
|
export declare const LlmBillingCostsSchema: z.ZodObject<{
|
|
286
347
|
"input/m": z.ZodNumber;
|
|
@@ -414,7 +475,7 @@ export declare const GroqProviderOptionsSchema: z.ZodObject<{
|
|
|
414
475
|
}>>;
|
|
415
476
|
}, z.core.$strict>>;
|
|
416
477
|
}, z.core.$strict>;
|
|
417
|
-
export declare const LlamaCppProviderOptionsSchema: z.ZodObject<{
|
|
478
|
+
export declare const LlamaCppProviderOptionsSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
|
|
418
479
|
hfToken: z.ZodOptional<z.ZodString>;
|
|
419
480
|
gpu: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
420
481
|
auto: "auto";
|
|
@@ -422,7 +483,8 @@ export declare const LlamaCppProviderOptionsSchema: z.ZodObject<{
|
|
|
422
483
|
cuda: "cuda";
|
|
423
484
|
vulkan: "vulkan";
|
|
424
485
|
}>, z.ZodLiteral<false>]>>;
|
|
425
|
-
|
|
486
|
+
context: z.ZodOptional<z.ZodNumber>;
|
|
487
|
+
promptCache: z.ZodOptional<z.ZodBoolean>;
|
|
426
488
|
reasoning: z.ZodOptional<z.ZodObject<{
|
|
427
489
|
effort: z.ZodOptional<z.ZodEnum<{
|
|
428
490
|
minimal: "minimal";
|
|
@@ -441,7 +503,7 @@ export declare const LlamaCppProviderOptionsSchema: z.ZodObject<{
|
|
|
441
503
|
omitted: "omitted";
|
|
442
504
|
}>>;
|
|
443
505
|
}, z.core.$strict>>;
|
|
444
|
-
}, z.core.$strict
|
|
506
|
+
}, z.core.$strict>>;
|
|
445
507
|
export declare const MinimaxProviderOptionsSchema: z.ZodObject<{
|
|
446
508
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
447
509
|
baseURL: z.ZodOptional<z.ZodString>;
|
|
@@ -465,6 +527,38 @@ export declare const MinimaxProviderOptionsSchema: z.ZodObject<{
|
|
|
465
527
|
}>>;
|
|
466
528
|
}, z.core.$strict>>;
|
|
467
529
|
}, z.core.$strict>;
|
|
530
|
+
export declare const MlxPromptCacheConfigSchema: z.ZodObject<{
|
|
531
|
+
minTokens: z.ZodOptional<z.ZodNumber>;
|
|
532
|
+
maxEntries: z.ZodOptional<z.ZodNumber>;
|
|
533
|
+
ttl: z.ZodOptional<z.ZodNumber>;
|
|
534
|
+
}, z.core.$strict>;
|
|
535
|
+
export declare const MlxProviderOptionsSchema: z.ZodObject<{
|
|
536
|
+
hfToken: z.ZodOptional<z.ZodString>;
|
|
537
|
+
context: z.ZodOptional<z.ZodNumber>;
|
|
538
|
+
promptCache: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
539
|
+
minTokens: z.ZodOptional<z.ZodNumber>;
|
|
540
|
+
maxEntries: z.ZodOptional<z.ZodNumber>;
|
|
541
|
+
ttl: z.ZodOptional<z.ZodNumber>;
|
|
542
|
+
}, z.core.$strict>, z.ZodLiteral<false>, z.ZodNull]>>;
|
|
543
|
+
reasoning: z.ZodOptional<z.ZodObject<{
|
|
544
|
+
effort: z.ZodOptional<z.ZodEnum<{
|
|
545
|
+
minimal: "minimal";
|
|
546
|
+
low: "low";
|
|
547
|
+
medium: "medium";
|
|
548
|
+
high: "high";
|
|
549
|
+
}>>;
|
|
550
|
+
summary: z.ZodOptional<z.ZodEnum<{
|
|
551
|
+
auto: "auto";
|
|
552
|
+
concise: "concise";
|
|
553
|
+
detailed: "detailed";
|
|
554
|
+
none: "none";
|
|
555
|
+
}>>;
|
|
556
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
557
|
+
summarized: "summarized";
|
|
558
|
+
omitted: "omitted";
|
|
559
|
+
}>>;
|
|
560
|
+
}, z.core.$strict>>;
|
|
561
|
+
}, z.core.$strict>;
|
|
468
562
|
export declare const MoonshotProviderOptionsSchema: z.ZodObject<{
|
|
469
563
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
470
564
|
baseURL: z.ZodOptional<z.ZodString>;
|
|
@@ -701,7 +795,7 @@ export declare const ProviderOptionsSchemas: {
|
|
|
701
795
|
}>>;
|
|
702
796
|
}, z.core.$strict>>;
|
|
703
797
|
}, z.core.$strict>;
|
|
704
|
-
readonly "llama-cpp": z.ZodObject<{
|
|
798
|
+
readonly "llama-cpp": z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
|
|
705
799
|
hfToken: z.ZodOptional<z.ZodString>;
|
|
706
800
|
gpu: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
707
801
|
auto: "auto";
|
|
@@ -709,7 +803,8 @@ export declare const ProviderOptionsSchemas: {
|
|
|
709
803
|
cuda: "cuda";
|
|
710
804
|
vulkan: "vulkan";
|
|
711
805
|
}>, z.ZodLiteral<false>]>>;
|
|
712
|
-
|
|
806
|
+
context: z.ZodOptional<z.ZodNumber>;
|
|
807
|
+
promptCache: z.ZodOptional<z.ZodBoolean>;
|
|
713
808
|
reasoning: z.ZodOptional<z.ZodObject<{
|
|
714
809
|
effort: z.ZodOptional<z.ZodEnum<{
|
|
715
810
|
minimal: "minimal";
|
|
@@ -728,7 +823,7 @@ export declare const ProviderOptionsSchemas: {
|
|
|
728
823
|
omitted: "omitted";
|
|
729
824
|
}>>;
|
|
730
825
|
}, z.core.$strict>>;
|
|
731
|
-
}, z.core.$strict
|
|
826
|
+
}, z.core.$strict>>;
|
|
732
827
|
readonly minimax: z.ZodObject<{
|
|
733
828
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
734
829
|
baseURL: z.ZodOptional<z.ZodString>;
|
|
@@ -752,6 +847,33 @@ export declare const ProviderOptionsSchemas: {
|
|
|
752
847
|
}>>;
|
|
753
848
|
}, z.core.$strict>>;
|
|
754
849
|
}, z.core.$strict>;
|
|
850
|
+
readonly mlx: z.ZodObject<{
|
|
851
|
+
hfToken: z.ZodOptional<z.ZodString>;
|
|
852
|
+
context: z.ZodOptional<z.ZodNumber>;
|
|
853
|
+
promptCache: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
854
|
+
minTokens: z.ZodOptional<z.ZodNumber>;
|
|
855
|
+
maxEntries: z.ZodOptional<z.ZodNumber>;
|
|
856
|
+
ttl: z.ZodOptional<z.ZodNumber>;
|
|
857
|
+
}, z.core.$strict>, z.ZodLiteral<false>, z.ZodNull]>>;
|
|
858
|
+
reasoning: z.ZodOptional<z.ZodObject<{
|
|
859
|
+
effort: z.ZodOptional<z.ZodEnum<{
|
|
860
|
+
minimal: "minimal";
|
|
861
|
+
low: "low";
|
|
862
|
+
medium: "medium";
|
|
863
|
+
high: "high";
|
|
864
|
+
}>>;
|
|
865
|
+
summary: z.ZodOptional<z.ZodEnum<{
|
|
866
|
+
auto: "auto";
|
|
867
|
+
concise: "concise";
|
|
868
|
+
detailed: "detailed";
|
|
869
|
+
none: "none";
|
|
870
|
+
}>>;
|
|
871
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
872
|
+
summarized: "summarized";
|
|
873
|
+
omitted: "omitted";
|
|
874
|
+
}>>;
|
|
875
|
+
}, z.core.$strict>>;
|
|
876
|
+
}, z.core.$strict>;
|
|
755
877
|
readonly moonshot: z.ZodObject<{
|
|
756
878
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
757
879
|
baseURL: z.ZodOptional<z.ZodString>;
|
|
@@ -1006,7 +1128,7 @@ export declare const NamedProviderConfigSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
1006
1128
|
}, z.core.$strict>, z.ZodObject<{
|
|
1007
1129
|
name: z.ZodString;
|
|
1008
1130
|
provider: z.ZodLiteral<LlmProvider.LlamaCpp>;
|
|
1009
|
-
options: z.ZodObject<{
|
|
1131
|
+
options: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
|
|
1010
1132
|
hfToken: z.ZodOptional<z.ZodString>;
|
|
1011
1133
|
gpu: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
1012
1134
|
auto: "auto";
|
|
@@ -1014,7 +1136,8 @@ export declare const NamedProviderConfigSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
1014
1136
|
cuda: "cuda";
|
|
1015
1137
|
vulkan: "vulkan";
|
|
1016
1138
|
}>, z.ZodLiteral<false>]>>;
|
|
1017
|
-
|
|
1139
|
+
context: z.ZodOptional<z.ZodNumber>;
|
|
1140
|
+
promptCache: z.ZodOptional<z.ZodBoolean>;
|
|
1018
1141
|
reasoning: z.ZodOptional<z.ZodObject<{
|
|
1019
1142
|
effort: z.ZodOptional<z.ZodEnum<{
|
|
1020
1143
|
minimal: "minimal";
|
|
@@ -1033,7 +1156,7 @@ export declare const NamedProviderConfigSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
1033
1156
|
omitted: "omitted";
|
|
1034
1157
|
}>>;
|
|
1035
1158
|
}, z.core.$strict>>;
|
|
1036
|
-
}, z.core.$strict
|
|
1159
|
+
}, z.core.$strict>>;
|
|
1037
1160
|
}, z.core.$strict>, z.ZodObject<{
|
|
1038
1161
|
name: z.ZodString;
|
|
1039
1162
|
provider: z.ZodLiteral<LlmProvider.Minimax>;
|
|
@@ -1060,6 +1183,36 @@ export declare const NamedProviderConfigSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
1060
1183
|
}>>;
|
|
1061
1184
|
}, z.core.$strict>>;
|
|
1062
1185
|
}, z.core.$strict>;
|
|
1186
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1187
|
+
name: z.ZodString;
|
|
1188
|
+
provider: z.ZodLiteral<LlmProvider.Mlx>;
|
|
1189
|
+
options: z.ZodObject<{
|
|
1190
|
+
hfToken: z.ZodOptional<z.ZodString>;
|
|
1191
|
+
context: z.ZodOptional<z.ZodNumber>;
|
|
1192
|
+
promptCache: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1193
|
+
minTokens: z.ZodOptional<z.ZodNumber>;
|
|
1194
|
+
maxEntries: z.ZodOptional<z.ZodNumber>;
|
|
1195
|
+
ttl: z.ZodOptional<z.ZodNumber>;
|
|
1196
|
+
}, z.core.$strict>, z.ZodLiteral<false>, z.ZodNull]>>;
|
|
1197
|
+
reasoning: z.ZodOptional<z.ZodObject<{
|
|
1198
|
+
effort: z.ZodOptional<z.ZodEnum<{
|
|
1199
|
+
minimal: "minimal";
|
|
1200
|
+
low: "low";
|
|
1201
|
+
medium: "medium";
|
|
1202
|
+
high: "high";
|
|
1203
|
+
}>>;
|
|
1204
|
+
summary: z.ZodOptional<z.ZodEnum<{
|
|
1205
|
+
auto: "auto";
|
|
1206
|
+
concise: "concise";
|
|
1207
|
+
detailed: "detailed";
|
|
1208
|
+
none: "none";
|
|
1209
|
+
}>>;
|
|
1210
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
1211
|
+
summarized: "summarized";
|
|
1212
|
+
omitted: "omitted";
|
|
1213
|
+
}>>;
|
|
1214
|
+
}, z.core.$strict>>;
|
|
1215
|
+
}, z.core.$strict>;
|
|
1063
1216
|
}, z.core.$strict>, z.ZodObject<{
|
|
1064
1217
|
name: z.ZodString;
|
|
1065
1218
|
provider: z.ZodLiteral<LlmProvider.Moonshot>;
|
|
@@ -1200,6 +1353,7 @@ export declare const NamedLlmConfigSchema: z.ZodObject<{
|
|
|
1200
1353
|
model: z.ZodString;
|
|
1201
1354
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
1202
1355
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
1356
|
+
context: z.ZodOptional<z.ZodNumber>;
|
|
1203
1357
|
}, z.core.$strict>;
|
|
1204
1358
|
billing: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1205
1359
|
name: z.ZodString;
|
|
@@ -8,6 +8,7 @@ export var LlmProvider;
|
|
|
8
8
|
LlmProvider["Groq"] = "groq";
|
|
9
9
|
LlmProvider["LlamaCpp"] = "llama-cpp";
|
|
10
10
|
LlmProvider["Minimax"] = "minimax";
|
|
11
|
+
LlmProvider["Mlx"] = "mlx";
|
|
11
12
|
LlmProvider["Moonshot"] = "moonshot";
|
|
12
13
|
LlmProvider["Ollama"] = "ollama";
|
|
13
14
|
LlmProvider["OpenAI"] = "openai";
|
|
@@ -53,6 +54,7 @@ export const LlmOptionsSchema = z
|
|
|
53
54
|
model: NonEmptyStringSchema,
|
|
54
55
|
temperature: z.number().finite().optional(),
|
|
55
56
|
maxTokens: z.number().int().positive().optional(),
|
|
57
|
+
context: z.number().int().positive().optional(),
|
|
56
58
|
})
|
|
57
59
|
.strict();
|
|
58
60
|
export const LlmBillingCostsSchema = z
|
|
@@ -122,16 +124,29 @@ export const GroqProviderOptionsSchema = z
|
|
|
122
124
|
reasoning: ReasoningOptionsSchema.optional(),
|
|
123
125
|
})
|
|
124
126
|
.strict();
|
|
125
|
-
export const LlamaCppProviderOptionsSchema = z
|
|
127
|
+
export const LlamaCppProviderOptionsSchema = z.preprocess(
|
|
128
|
+
// Legacy alias: `contextSize` was renamed to `context`.
|
|
129
|
+
(value) => {
|
|
130
|
+
if (typeof value === "object" &&
|
|
131
|
+
value !== null &&
|
|
132
|
+
!Array.isArray(value) &&
|
|
133
|
+
"contextSize" in value &&
|
|
134
|
+
!("context" in value)) {
|
|
135
|
+
const { contextSize, ...rest } = value;
|
|
136
|
+
return { ...rest, context: contextSize };
|
|
137
|
+
}
|
|
138
|
+
return value;
|
|
139
|
+
}, z
|
|
126
140
|
.object({
|
|
127
141
|
hfToken: NonEmptyStringSchema.optional(),
|
|
128
142
|
gpu: z
|
|
129
143
|
.union([z.enum(["auto", "metal", "cuda", "vulkan"]), z.literal(false)])
|
|
130
144
|
.optional(),
|
|
131
|
-
|
|
145
|
+
context: z.number().int().positive().optional(),
|
|
146
|
+
promptCache: z.boolean().optional(),
|
|
132
147
|
reasoning: ReasoningOptionsSchema.optional(),
|
|
133
148
|
})
|
|
134
|
-
.strict();
|
|
149
|
+
.strict());
|
|
135
150
|
export const MinimaxProviderOptionsSchema = z
|
|
136
151
|
.object({
|
|
137
152
|
apiKey: NonEmptyStringSchema.optional(),
|
|
@@ -140,6 +155,23 @@ export const MinimaxProviderOptionsSchema = z
|
|
|
140
155
|
reasoning: ReasoningOptionsSchema.optional(),
|
|
141
156
|
})
|
|
142
157
|
.strict();
|
|
158
|
+
export const MlxPromptCacheConfigSchema = z
|
|
159
|
+
.object({
|
|
160
|
+
minTokens: z.number().int().nonnegative().optional(),
|
|
161
|
+
maxEntries: z.number().int().positive().optional(),
|
|
162
|
+
ttl: z.number().int().positive().optional(),
|
|
163
|
+
})
|
|
164
|
+
.strict();
|
|
165
|
+
export const MlxProviderOptionsSchema = z
|
|
166
|
+
.object({
|
|
167
|
+
hfToken: NonEmptyStringSchema.optional(),
|
|
168
|
+
context: z.number().int().positive().optional(),
|
|
169
|
+
promptCache: z
|
|
170
|
+
.union([MlxPromptCacheConfigSchema, z.literal(false), z.null()])
|
|
171
|
+
.optional(),
|
|
172
|
+
reasoning: ReasoningOptionsSchema.optional(),
|
|
173
|
+
})
|
|
174
|
+
.strict();
|
|
143
175
|
export const MoonshotProviderOptionsSchema = z
|
|
144
176
|
.object({
|
|
145
177
|
apiKey: NonEmptyStringSchema.optional(),
|
|
@@ -187,6 +219,7 @@ export const ProviderOptionsSchemas = {
|
|
|
187
219
|
[LlmProvider.Groq]: GroqProviderOptionsSchema,
|
|
188
220
|
[LlmProvider.LlamaCpp]: LlamaCppProviderOptionsSchema,
|
|
189
221
|
[LlmProvider.Minimax]: MinimaxProviderOptionsSchema,
|
|
222
|
+
[LlmProvider.Mlx]: MlxProviderOptionsSchema,
|
|
190
223
|
[LlmProvider.Moonshot]: MoonshotProviderOptionsSchema,
|
|
191
224
|
[LlmProvider.Ollama]: OllamaProviderOptionsSchema,
|
|
192
225
|
[LlmProvider.OpenAI]: OpenAIProviderOptionsSchema,
|
|
@@ -243,6 +276,13 @@ export const NamedProviderConfigSchema = z.discriminatedUnion("provider", [
|
|
|
243
276
|
options: MinimaxProviderOptionsSchema,
|
|
244
277
|
})
|
|
245
278
|
.strict(),
|
|
279
|
+
z
|
|
280
|
+
.object({
|
|
281
|
+
name: NonEmptyStringSchema,
|
|
282
|
+
provider: z.literal(LlmProvider.Mlx),
|
|
283
|
+
options: MlxProviderOptionsSchema,
|
|
284
|
+
})
|
|
285
|
+
.strict(),
|
|
246
286
|
z
|
|
247
287
|
.object({
|
|
248
288
|
name: NonEmptyStringSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/models/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/models/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAN,IAAY,WAcX;AAdD,WAAY,WAAW;IACrB,sCAAuB,CAAA;IACvB,8BAAe,CAAA;IACf,kCAAmB,CAAA;IACnB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,qCAAsB,CAAA;IACtB,kCAAmB,CAAA;IACnB,0BAAW,CAAA;IACX,oCAAqB,CAAA;IACrB,gCAAiB,CAAA;IACjB,gCAAiB,CAAA;IACjB,wCAAyB,CAAA;IACzB,0BAAW,CAAA;AACb,CA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AE,2BAA2B;KACrC,CAAC;SACD,MAAM,EAAE;IACX,CAAC;SACE,MAAM,CAAC;QACN,IAAI,EAAE,oBAAoB;QAC1B,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC;QACvC,OAAO,EAAE,2BAA2B;KACrC,CAAC;SACD,MAAM,EAAE;IACX,CAAC;SACE,MAAM,CAAC;QACN,IAAI,EAAE,oBAAoB;QAC1B,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC;QAC3C,OAAO,EAAE,+BAA+B;KACzC,CAAC;SACD,MAAM,EAAE;IACX,CAAC;SACE,MAAM,CAAC;QACN,IAAI,EAAE,oBAAoB;QAC1B,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC;QACpC,OAAO,EAAE,wBAAwB;KAClC,CAAC;SACD,MAAM,EAAE;CACZ,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,MAAM,CAAC;IACN,IAAI,EAAE,oBAAoB;IAC1B,QAAQ,EAAE,oBAAoB;IAC9B,OAAO,EAAE,gBAAgB;IACzB,OAAO,EAAE,gBAAgB,CAAC,OAAO,EAAE;IACnC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;CACpC,CAAC;KACD,MAAM,EAAE,CAAC"}
|
|
@@ -50,6 +50,11 @@ This is the default shape Hooman writes when `~/.hooman/config.json` is missing:
|
|
|
50
50
|
"name": "llama.cpp",
|
|
51
51
|
"provider": "llama-cpp",
|
|
52
52
|
"options": {}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "mlx",
|
|
56
|
+
"provider": "mlx",
|
|
57
|
+
"options": { "promptCache": {} }
|
|
53
58
|
}
|
|
54
59
|
],
|
|
55
60
|
"llms": [
|
|
@@ -57,7 +62,8 @@ This is the default shape Hooman writes when `~/.hooman/config.json` is missing:
|
|
|
57
62
|
"name": "Qwen3 1.7B",
|
|
58
63
|
"provider": "llama.cpp",
|
|
59
64
|
"options": {
|
|
60
|
-
"model": "Qwen/Qwen3-1.7B-GGUF:Q8_0"
|
|
65
|
+
"model": "Qwen/Qwen3-1.7B-GGUF:Q8_0",
|
|
66
|
+
"context": 32768
|
|
61
67
|
},
|
|
62
68
|
"default": true
|
|
63
69
|
},
|
|
@@ -65,7 +71,8 @@ This is the default shape Hooman writes when `~/.hooman/config.json` is missing:
|
|
|
65
71
|
"name": "Qwen3.5 0.8B",
|
|
66
72
|
"provider": "llama.cpp",
|
|
67
73
|
"options": {
|
|
68
|
-
"model": "unsloth/Qwen3.5-0.8B-MTP-GGUF:Q8_0"
|
|
74
|
+
"model": "unsloth/Qwen3.5-0.8B-MTP-GGUF:Q8_0",
|
|
75
|
+
"context": 262144
|
|
69
76
|
},
|
|
70
77
|
"default": false
|
|
71
78
|
},
|
|
@@ -73,7 +80,35 @@ This is the default shape Hooman writes when `~/.hooman/config.json` is missing:
|
|
|
73
80
|
"name": "Gemma 4 E2B",
|
|
74
81
|
"provider": "llama.cpp",
|
|
75
82
|
"options": {
|
|
76
|
-
"model": "unsloth/gemma-4-E2B-it-GGUF:Q8_0"
|
|
83
|
+
"model": "unsloth/gemma-4-E2B-it-GGUF:Q8_0",
|
|
84
|
+
"context": 131072
|
|
85
|
+
},
|
|
86
|
+
"default": false
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "Qwen3.5 9B (MLX)",
|
|
90
|
+
"provider": "mlx",
|
|
91
|
+
"options": {
|
|
92
|
+
"model": "mlx-community/Qwen3.5-9B-OptiQ-4bit",
|
|
93
|
+
"context": 262144
|
|
94
|
+
},
|
|
95
|
+
"default": false
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "Nemotron 3 Nano 4B (MLX)",
|
|
99
|
+
"provider": "mlx",
|
|
100
|
+
"options": {
|
|
101
|
+
"model": "mlx-community/NVIDIA-Nemotron-3-Nano-4B-OptiQ-4bit",
|
|
102
|
+
"context": 262144
|
|
103
|
+
},
|
|
104
|
+
"default": false
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "Gemma 4 12B (MLX)",
|
|
108
|
+
"provider": "mlx",
|
|
109
|
+
"options": {
|
|
110
|
+
"model": "mlx-community/gemma-4-12B-it-qat-OptiQ-4bit",
|
|
111
|
+
"context": 262144
|
|
77
112
|
},
|
|
78
113
|
"default": false
|
|
79
114
|
}
|
|
@@ -114,8 +149,8 @@ Hooman fills all optional sections with defaults on load and persist, so a minim
|
|
|
114
149
|
## Top-Level Options
|
|
115
150
|
|
|
116
151
|
- `name`: non-empty display name for the agent.
|
|
117
|
-
- `providers`: required reusable provider definitions. Each entry has `name`, runtime `provider`, and provider-specific `options`. Supported runtime providers: `anthropic`, `azure`, `bedrock`, `google`, `groq`, `minimax`, `moonshot`, `ollama`, `openai`, `openrouter`, `xai` — details in `providers.md`.
|
|
118
|
-
- `llms`: required non-empty list of named LLM configs. Each entry has `name`, provider reference `provider`, model `options` (`model`, optional `temperature`, optional `maxTokens`), and `default` (mark exactly one entry `true`). Details in `providers.md`.
|
|
152
|
+
- `providers`: required reusable provider definitions. Each entry has `name`, runtime `provider`, and provider-specific `options`. Supported runtime providers: `anthropic`, `azure`, `bedrock`, `google`, `groq`, `llama-cpp`, `minimax`, `mlx`, `moonshot`, `ollama`, `openai`, `openrouter`, `xai` — details in `providers.md`.
|
|
153
|
+
- `llms`: required non-empty list of named LLM configs. Each entry has `name`, provider reference `provider`, model `options` (`model`, optional `temperature`, optional `maxTokens`, optional `context` — local llama-cpp/mlx providers only), and `default` (mark exactly one entry `true`). Details in `providers.md`.
|
|
119
154
|
- `search`: optional web search config; defaults to disabled Brave. Details in `search.md`.
|
|
120
155
|
- `prompts`: optional built-in static prompt toggles; omitted fields default to `true`. Custom user instructions live in `~/.hooman/instructions.md`.
|
|
121
156
|
- `tools`: optional tool toggles and tool-specific settings.
|
|
@@ -11,6 +11,7 @@ Each element of `llms` has:
|
|
|
11
11
|
- `options.model`: model id passed to the resolved runtime provider.
|
|
12
12
|
- `options.temperature`: optional normalized temperature override.
|
|
13
13
|
- `options.maxTokens`: optional normalized output token limit.
|
|
14
|
+
- `options.context`: optional context size in tokens; only honored by the local `llama-cpp` and `mlx` providers (overrides the provider-level `context`), other providers ignore it. For llama-cpp it sizes the actual llama.cpp context; for mlx it declares the usable window. Both feed the context-usage gauge (an explicit `billing.context` still wins).
|
|
14
15
|
- `default`: boolean; mark one entry `"default": true` for the active model.
|
|
15
16
|
- `billing`: optional billing metadata used for context-window utilization and session-cost display. When present, `billing.name` is required — the model identifier looked up on models.dev (defaults to `options.model` when `billing` is omitted). Optional overrides: `billing.context` (context window size in tokens) and `billing.costs` (USD per million tokens: required `"input/m"` and `"output/m"`, optional `"cache/m"` for cached-input reads). Anything not provided is resolved from the models.dev catalog; when neither source resolves, context usage and cost are simply not shown.
|
|
16
17
|
|
|
@@ -49,6 +50,7 @@ Supported `providers[].provider` values:
|
|
|
49
50
|
"groq",
|
|
50
51
|
"llama-cpp",
|
|
51
52
|
"minimax",
|
|
53
|
+
"mlx",
|
|
52
54
|
"moonshot",
|
|
53
55
|
"ollama",
|
|
54
56
|
"openai",
|
|
@@ -92,8 +94,9 @@ Common shape:
|
|
|
92
94
|
- `bedrock`: provider `options` support `region`, `accessKeyId`, `secretAccessKey`, `sessionToken`, optional `apiKey`, and optional `reasoning` (an object with optional `effort` and optional `display` — `"summarized"` or `"omitted"`). Providing `reasoning` enables extended thinking on supported models (e.g. Claude); because Bedrock's Converse API requires a budget, `effort` (default `"medium"`) maps to `budget_tokens` (`minimal`→1024, `low`→2048, `medium`→4096, `high`→8192). Ensure the LLM `maxTokens` exceeds the budget. Newer Bedrock Claude (e.g. Opus 4.7+) hide reasoning by default and reject `type: "enabled"`; set `display: "summarized"` to reveal it — this switches to `thinking: { type: "adaptive", display }` with `output_config.effort` (`minimal`→`low`, else passthrough) sent via `additionalRequestFields`. LLM `options` support `model`, `temperature`, and `maxTokens`.
|
|
93
95
|
- `google`: provider `options` support `apiKey` and optional `reasoning` (an object with optional `effort`). Setting `reasoning.effort` enables Gemini thinking with a dynamic budget (`thinkingConfig: { includeThoughts: true, thinkingBudget: -1 }`). LLM `options` support `model`, `temperature`, and `maxTokens` (Hooman maps this to the Google SDK's `maxOutputTokens` internally).
|
|
94
96
|
- `groq`: provider `options` support `apiKey`, optional `baseURL`, optional `headers`, and optional `reasoning` (an object with optional `effort`). `reasoning.effort` maps to Groq's `reasoning_effort` (`minimal`→`low`) and streams reasoning via `reasoning_format: "parsed"`. Only reasoning models honor it. LLM `options` support `model`, `temperature`, and `maxTokens`.
|
|
95
|
-
- `llama-cpp`: runs GGUF models in-process via node-llama-cpp (no server needed); weights are downloaded from the Hugging Face Hub into `~/.hooman/cache/huggingface` on first use. Provider `options` support optional `hfToken` (Hugging Face access token for gated/private repos; falls back to the `HF_TOKEN` env var), optional `gpu` (`"auto"` — default, `"metal"`, `"cuda"`, `"vulkan"`, or `false` for CPU-only), optional `
|
|
97
|
+
- `llama-cpp`: runs GGUF models in-process via node-llama-cpp (no server needed); weights are downloaded from the Hugging Face Hub into `~/.hooman/cache/huggingface` on first use. Provider `options` support optional `hfToken` (Hugging Face access token for gated/private repos; falls back to the `HF_TOKEN` env var), optional `gpu` (`"auto"` — default when unset, `"metal"`, `"cuda"`, `"vulkan"`, or `false` for CPU-only), optional `context` (tokens; overridden by a per-LLM `options.context`; when both are absent it adapts to the model and available memory), optional `promptCache` (boolean, default `true`; reuse KV state evaluated by previous turns — set `false` to re-prefill the full conversation every turn), and optional `reasoning` (an object with optional `effort`). Providing `reasoning` enables thinking (the chat template is configured to allow thought segments — Qwen3 thinking mode, Gemma 4 reasoning turns, gpt-oss/Harmony native effort levels — with `effort` capping thought tokens via a budget: `minimal`→1024, `low`→2048, `medium`→4096, `high`→8192, default `medium`); omitting it disables thinking (templates discourage thoughts, thought budget forced to 0). LLM `options.model` accepts a Hugging Face repo (`owner/repo`, GGUF auto-detected preferring common quantizations like Q4_K_M), a repo with a quant tag (`owner/repo:Q8_0`), an exact file (`owner/repo/path/to/file.gguf`), or a local `.gguf` path; the out-of-the-box config ships three entries — `Qwen/Qwen3-1.7B-GGUF:Q8_0` (default, `context` 32768), `unsloth/Qwen3.5-0.8B-MTP-GGUF:Q8_0` (`context` 262144), and `unsloth/gemma-4-E2B-it-GGUF:Q8_0` (`context` 131072); `temperature`, `maxTokens`, and `context` are supported.
|
|
96
98
|
- `minimax`: provider `options` support `apiKey`, optional `headers`, and optional `reasoning` (an object with optional `effort` — `"minimal"`, `"low"`, `"medium"`, `"high"` — and optional `display` — `"summarized"` or `"omitted"`). Providing `reasoning` enables thinking, normalized to MiniMax's `thinking: { type: "adaptive", budget_tokens }`; `effort` defaults to `"medium"` and maps to an explicit budget (`minimal`→1024, `low`→2048, `medium`→4096, `high`→8192). Setting `display` switches to `thinking: { type: "adaptive", display }` with `output_config.effort` instead of a budget. Omit `reasoning` to keep thinking off. Hooman routes this through the Anthropic-compatible MiniMax endpoint automatically.
|
|
99
|
+
- `mlx`: runs MLX-format models in-process on Apple Silicon via `mlex.js` (Metal GPU; macOS 26+ for the prebuilt binaries); weights are downloaded from the Hugging Face Hub into `~/.hooman/cache/huggingface` on first use. Supported architectures: Qwen2/2.5, Qwen3, Qwen3.5/3.6 (dense and MoE), Gemma 4 (including multi-modal vision/audio variants), Nemotron 3 (hybrid Mamba2/attention), DharaAR — the repo must be MLX format (e.g. `mlx-community/...`), and every MLX quantization scheme loads (bf16/fp16, affine 2-8 bit, mxfp4/mxfp8/nvfp4, and mixed-precision OptiQ/Google-QAT exports). Provider `options` support optional `hfToken` (Hugging Face access token for gated/private repos; falls back to the `HF_TOKEN` env var), optional `context` (tokens; overridden by a per-LLM `options.context` — MLX allocates KV state dynamically, so this declares the usable window for the context-usage gauge rather than sizing an allocation), optional `promptCache` (`{ minTokens?, maxEntries?, ttl? }`, or `false`/`null`/unset; sizes and gates mlex's internal prompt-cache pool, applied once when the model loads — `undefined`, `null`, and `false` all disable caching entirely, while an object, even `{}`, enables it, with `maxEntries`/`ttl` (seconds)/`minTokens` overriding mlex's own defaults of 16/300/8 where set; the out-of-the-box `mlx` provider ships `{ "promptCache": {} }`), and optional `reasoning` (an object with optional `effort`). Providing `reasoning` enables thinking (the model thinks naturally with `effort` capping thought tokens via a budget: `minimal`→1024, `low`→2048, `medium`→4096, `high`→8192, default `medium`; when the budget runs out the runtime force-closes the reasoning span and moves on to the answer); omitting it disables thinking. Tools use standard JSON Schema natively — no grammar-subset conversion applies. LLM `options.model` accepts a Hugging Face repo (`owner/repo`) or a local MLX model directory (containing `config.json` + safetensors); the out-of-the-box config ships three entries (none the default, each with `context` 262144 — the models' full training window) — `mlx-community/Qwen3.5-9B-OptiQ-4bit` ("Qwen3.5 9B (MLX)"), `mlx-community/NVIDIA-Nemotron-3-Nano-4B-OptiQ-4bit` ("Nemotron 3 Nano 4B (MLX)"), and `mlx-community/gemma-4-12B-it-qat-OptiQ-4bit` ("Gemma 4 12B (MLX)"); `temperature`, `maxTokens`, and `context` are supported.
|
|
97
100
|
- `moonshot`: provider `options` support `apiKey`, optional `baseURL`, optional `headers`, and optional `reasoning` (an object with optional `effort`). Setting `reasoning.effort` enables Kimi thinking (`thinking: { type: "enabled" }`). Served through the reasoning-aware openai-compatible adapter, so Kimi's `reasoning_content` is surfaced as thinking. When `baseURL` is omitted, Hooman defaults it to `https://api.moonshot.ai/v1`. To reach Kimi through an OpenAI-compatible proxy (e.g. LiteLLM), use this provider with `baseURL` set to the proxy's `/v1` endpoint — the `openai` provider's Chat adapter would otherwise drop Kimi's reasoning.
|
|
98
101
|
- `ollama`: provider `options` support optional `baseURL` and optional `reasoning` (an object with optional `effort`). Setting `reasoning.effort` enables thinking, mapped to Ollama's `think` level (`minimal`/`low`→`"low"`, `medium`→`"medium"`, `high`→`"high"`). LLM `options` support `model`, `temperature`, and `maxTokens`.
|
|
99
102
|
- `openai`: provider `options` support `apiKey`, optional `baseURL`, optional `headers`, optional `api` (`"responses"` or `"chat"`, defaults to `"responses"`), and optional `reasoning` (an object with optional `effort` — `"minimal"`, `"low"`, `"medium"`, `"high"` — and optional `summary` — `"auto"` (default), `"concise"`, `"detailed"`, `"none"`). LLM `options` support `model`, `temperature`, and `maxTokens`. Use `"responses"` (the default) to surface model reasoning/thinking; set `"chat"` for OpenAI-compatible endpoints/proxies that do not implement the Responses API. Reasoning summaries stream only on the Responses API, and some models (e.g. GPT-5) require `reasoning.effort` of `"medium"` or higher to emit them; set `reasoning.summary` to `"none"` for non-reasoning models that reject the `reasoning` parameter. Note: `"chat"` mode does NOT surface reasoning (the Chat adapter drops `reasoning_content`); for a proxy that only exposes thinking via chat `reasoning_content` (e.g. Kimi/Moonshot), use the `moonshot` or `openrouter` provider instead. Also note the Responses API may return an empty reasoning item for non-OpenAI backends behind a proxy (they won't stream summary text).
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LlmProvider } from "../models/types.js";
|
|
2
|
+
import type { LlmBilling, ProviderOptions } from "../models/types.js";
|
|
2
3
|
/** Resolved per-million-token USD prices (cache tiers fall back to `inputPerM`). */
|
|
3
4
|
export type ResolvedBillingCosts = {
|
|
4
5
|
inputPerM: number;
|
|
@@ -17,14 +18,40 @@ export type ResolvedLlmBilling = {
|
|
|
17
18
|
context?: number;
|
|
18
19
|
costs?: ResolvedBillingCosts;
|
|
19
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* The context size configured on a resolved LLM entry, when the provider
|
|
23
|
+
* actually honors one: for the local `llama-cpp` and `mlx` providers this is
|
|
24
|
+
* the per-LLM `options.context` (falling back to the provider-level
|
|
25
|
+
* `context`). Other providers' windows are fixed server-side, so config
|
|
26
|
+
* context is ignored for them. Feed the result into
|
|
27
|
+
* {@link resolveLlmBilling}'s `configuredContext` so the context gauge
|
|
28
|
+
* reflects the actual runtime window rather than the catalog's training
|
|
29
|
+
* window.
|
|
30
|
+
*/
|
|
31
|
+
export declare function configuredLlmContext(llm: {
|
|
32
|
+
provider: LlmProvider;
|
|
33
|
+
providerOptions: ProviderOptions;
|
|
34
|
+
llmOptions: {
|
|
35
|
+
context?: number;
|
|
36
|
+
};
|
|
37
|
+
}): number | undefined;
|
|
20
38
|
/**
|
|
21
39
|
* Resolve billing metadata for a model: config-provided `billing` fields win,
|
|
22
40
|
* anything missing is filled from the models.dev catalog, and the billing
|
|
23
41
|
* name defaults to the raw model id when no `billing` block is configured.
|
|
24
42
|
* Returns `null` when neither source yields a context size nor prices — in
|
|
25
43
|
* that case nothing billing-related should be reported or displayed.
|
|
44
|
+
*
|
|
45
|
+
* When `provider` is a local provider (llama.cpp, Ollama), catalog costs are
|
|
46
|
+
* discarded — the catalog prices the hosted API for the same model id, not
|
|
47
|
+
* the free local inference — so only the context window resolves (config
|
|
48
|
+
* `billing.costs`, if explicitly set, is still honored).
|
|
49
|
+
*
|
|
50
|
+
* `configuredContext` (the runtime context actually configured on the LLM
|
|
51
|
+
* entry — see {@link configuredLlmContext}) sits between the two sources:
|
|
52
|
+
* an explicit `billing.context` wins over it, and it wins over the catalog.
|
|
26
53
|
*/
|
|
27
|
-
export declare function resolveLlmBilling(billing: LlmBilling | null | undefined, modelId: string): Promise<ResolvedLlmBilling | null>;
|
|
54
|
+
export declare function resolveLlmBilling(billing: LlmBilling | null | undefined, modelId: string, provider?: LlmProvider, configuredContext?: number): Promise<ResolvedLlmBilling | null>;
|
|
28
55
|
/**
|
|
29
56
|
* USD cost of one request's token usage. Expects usage already normalized to
|
|
30
57
|
* the additive shape (see `toAdditiveUsage`): cache reads/writes are separate
|