@denizokcu/haze 1.7.10 → 1.7.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +18 -8
  3. package/dist/buildInfo.json +3 -3
  4. package/dist/cli/chat/BusyBar.d.ts +2 -1
  5. package/dist/cli/chat/BusyBar.js +2 -2
  6. package/dist/cli/chat/chatMetrics.d.ts +25 -0
  7. package/dist/cli/chat/chatMetrics.js +36 -0
  8. package/dist/cli/chat/sessionLifecycle.d.ts +2 -0
  9. package/dist/cli/chat/sessionLifecycle.js +27 -18
  10. package/dist/cli/chat/sessionRecorder.d.ts +2 -1
  11. package/dist/cli/chat/sessionRecorder.js +25 -8
  12. package/dist/cli/chat/transcriptPartition.js +10 -4
  13. package/dist/cli/chat/wizard/providerHandlers.js +57 -9
  14. package/dist/cli/chat/wizard/sessionThemeHandlers.js +5 -1
  15. package/dist/cli/commands/chat.js +39 -7
  16. package/dist/cli/commands/commandHelp.js +2 -2
  17. package/dist/cli/commands/providerWizard.js +9 -17
  18. package/dist/cli/commands/reasoningCommand.d.ts +1 -0
  19. package/dist/cli/commands/reasoningCommand.js +32 -4
  20. package/dist/cli/commands/runCommand.js +7 -1
  21. package/dist/cli/commands/streaming/attemptLifecycle.js +1 -0
  22. package/dist/cli/commands/streaming/attemptOutcome.js +5 -1
  23. package/dist/cli/commands/streaming/attemptSetup.js +5 -3
  24. package/dist/cli/commands/streaming/goalSupervisor.d.ts +1 -1
  25. package/dist/cli/commands/streaming/goalSupervisor.js +20 -1
  26. package/dist/cli/commands/streaming/streamLoop.js +11 -10
  27. package/dist/cli/commands/streaming.d.ts +2 -0
  28. package/dist/cli/commands/wizardFlow.d.ts +1 -0
  29. package/dist/cli/commands/wizardFlow.js +10 -4
  30. package/dist/cli/index.js +5 -3
  31. package/dist/config/hazeBuild.d.ts +2 -2
  32. package/dist/config/hazeBuild.js +2 -2
  33. package/dist/config/modelDiscovery.d.ts +1 -1
  34. package/dist/config/modelDiscovery.js +8 -8
  35. package/dist/config/{modelCatalog.d.ts → providerModelFacts.d.ts} +13 -2
  36. package/dist/config/{modelCatalog.js → providerModelFacts.js} +145 -21
  37. package/dist/config/providerPresets.d.ts +8 -19
  38. package/dist/config/providerPresets.js +86 -555
  39. package/dist/config/providerReasoning.d.ts +16 -0
  40. package/dist/config/providerReasoning.js +56 -0
  41. package/dist/config/providers.d.ts +4 -0
  42. package/dist/config/providers.js +19 -2
  43. package/dist/config/settings.d.ts +14 -0
  44. package/dist/config/settings.js +5 -0
  45. package/dist/core/agent/events.d.ts +1 -1
  46. package/dist/core/agent/providerTransition.d.ts +8 -0
  47. package/dist/core/agent/providerTransition.js +47 -0
  48. package/dist/core/agent/reasoningPolicy.d.ts +1 -1
  49. package/dist/core/agent/reasoningPolicy.js +4 -2
  50. package/dist/core/limits.d.ts +0 -2
  51. package/dist/core/limits.js +0 -2
  52. package/dist/core/providerContracts.d.ts +9 -8
  53. package/dist/core/providerContracts.js +21 -1
  54. package/dist/core/safety/redaction.js +12 -2
  55. package/dist/core/session/sessionSlimming.js +5 -59
  56. package/dist/core/session/sessionStore.d.ts +4 -0
  57. package/dist/core/session/sessionStore.js +149 -9
  58. package/dist/core/session/snapshotCodec.d.ts +5 -0
  59. package/dist/core/session/snapshotCodec.js +47 -0
  60. package/dist/core/shellOutput/registry.js +2 -46
  61. package/dist/core/subagent/executionProfiles.js +4 -1
  62. package/dist/core/toolOutput/reduction.d.ts +55 -2
  63. package/dist/core/toolOutput/reduction.js +77 -2
  64. package/dist/llm/client.d.ts +4 -2
  65. package/dist/llm/client.js +104 -55
  66. package/dist/llm/hazeTools.d.ts +16 -16
  67. package/dist/llm/mistralReasoning.d.ts +2 -0
  68. package/dist/llm/mistralReasoning.js +17 -0
  69. package/dist/llm/mistralVibeAuth.d.ts +5 -0
  70. package/dist/llm/mistralVibeAuth.js +63 -0
  71. package/dist/llm/requestContext.js +8 -7
  72. package/dist/llm/subagentRunner.js +15 -7
  73. package/dist/llm/toolResultTypes.js +7 -1
  74. package/dist/llm/tools/fetchTool.d.ts +16 -16
  75. package/dist/llm/tools/outputCap.d.ts +2 -7
  76. package/dist/llm/tools/outputCap.js +3 -11
  77. package/dist/llm/tools/replaceInFiles.js +5 -0
  78. package/package.json +14 -8
@@ -1,576 +1,107 @@
1
- /**
2
- * Known OpenAI-compatible provider presets derived from provider documentation and
3
- * community conventions. Do not copy native-provider entries from multi-adapter clients:
4
- * every standard preset here must accept OpenAI Chat Completions requests at its base URL.
5
- * The OpenAI Subscription preset is the explicit exception and uses its own Codex adapter.
6
- * Hosted presets carry a pre-configured base URL so users only need to supply an API key
7
- * and model names. Local/keyless providers have sensible localhost defaults.
8
- *
9
- * Presets are authored in a compact definition form (`ProviderPresetDefinition`) and
10
- * expanded once into the public `ProviderPreset` records: each curated model is a single
11
- * `[id, contextWindowTokens, maxOutputTokens]` tuple instead of appearing twice (once in
12
- * `suggestedModels`, once in `modelLimits`), and `needsApiKey` is derived from the
13
- * category (cloud presets need a key unless they carry an explicit OAuth flow; local
14
- * ones never do).
15
- *
16
- * `modelLimits` values are curated from models.dev (the same catalog pi and nanocoder
17
- * consume; recent releases refreshed 2026-10-04 from https://models.dev/api.json). They are keyed by the exact suggested model id for
18
- * THIS preset: aggregators may cap context below the origin model's capability (e.g.
19
- * Together serves DeepSeek-V4-Pro at 512K vs DeepSeek's own 1M), so limits never
20
- * transfer between providers. When the wizard adds a suggested model, these values are
21
- * written into the provider's settings `modelLimits`, where they remain user-editable.
22
- * Local providers (Ollama/llama.cpp/MLX/LM Studio) intentionally carry no limits: their
23
- * effective context depends on the local server configuration, not the model.
24
- */
1
+ import { endpointModelFacts } from './providerModelFacts.js';
25
2
  const PRESET_DEFINITIONS = [
26
- { id: 'haze.build', name: 'haze.build', kind: 'haze-build',
27
- baseUrl: 'https://llm.haze.build/v1', category: 'cloud', models: ['haze1.5-builder-flash'],
28
- apiKeyHint: 'your deployed haze.build inference key' },
29
- // ── Cloud providers (API key required) ──────────────────────────────
30
- {
31
- id: 'openrouter',
32
- name: 'OpenRouter',
33
- baseUrl: 'https://openrouter.ai/api/v1',
34
- apiKeyEnvVar: 'OPENROUTER_API_KEY',
35
- models: [
36
- // SOTA
37
- ['openai/gpt-6.1-sol', 1_050_000, 128_000],
38
- ['openai/gpt-6-astra', 1_050_000, 128_000],
39
- ['anthropic/claude-opus-5.5', 1_000_000, 128_000],
40
- ['anthropic/claude-sonnet-5.5', 1_000_000, 128_000],
41
- ['anthropic/claude-fable-5.1', 1_000_000, 128_000],
42
- ['google/gemini-3.8-flash', 1_048_576, 65_536],
43
- ['anthropic/claude-opus-5', 1_048_576, 128_000],
44
- ['openai/gpt-5.6', 1_050_000, 128_000],
45
- ['google/gemini-3.7-flash', 1_048_576, 65_536],
46
- ['anthropic/claude-sonnet-5', 1_000_000, 128_000],
47
- ['qwen/qwen3.8-2.4t-a95b', 1_048_576, 262_144],
48
- // Fast
49
- ['openai/gpt-6-luna', 1_050_000, 128_000],
50
- ['x-ai/grok-4.7', 500_000, 450_000],
51
- ['deepseek/deepseek-v4.1-flash', 1_048_576, 943_718],
52
- ['z-ai/glm-5.3-prime', 1_000_000, 131_072],
53
- ['x-ai/grok-4.6', 500_000, 500_000],
54
- ['openai/gpt-5.4-mini', 400_000, 128_000],
55
- ['google/gemini-3.5-flash', 1_048_576, 65_536],
56
- ['deepseek/deepseek-v4-flash', 1_048_576, 384_000],
57
- ],
58
- category: 'cloud',
59
- },
60
- {
61
- id: 'openai-api-key',
62
- name: 'OpenAI API Key',
63
- baseUrl: 'https://api.openai.com/v1',
64
- apiKeyEnvVar: 'OPENAI_API_KEY',
65
- models: [
66
- // SOTA
67
- ['gpt-6.1-sol', 1_050_000, 128_000],
68
- ['gpt-6-astra', 1_050_000, 128_000],
69
- ['gpt-6-sol', 1_050_000, 128_000],
70
- ['gpt-6-luna', 1_050_000, 128_000],
71
- ['gpt-5.6', 1_050_000, 128_000],
72
- ['gpt-5.6-sol', 1_050_000, 128_000],
73
- ['gpt-5.6-terra', 1_050_000, 128_000],
74
- ['gpt-5.5-pro', 1_050_000, 128_000],
75
- ['o3', 200_000, 100_000],
76
- // Fast
77
- ['gpt-5.6-luna', 1_050_000, 128_000],
78
- ['gpt-5.5', 1_050_000, 128_000],
79
- ['gpt-5.4', 1_050_000, 128_000],
80
- ['gpt-5.4-mini', 400_000, 128_000],
81
- ],
82
- category: 'cloud',
83
- },
84
- {
85
- id: 'google-gemini',
86
- name: 'Google Gemini',
87
- baseUrl: 'https://generativelanguage.googleapis.com/v1beta/openai',
88
- apiKeyHint: 'API Key (from https://aistudio.google.com/apikey)',
89
- apiKeyEnvVar: 'GEMINI_API_KEY',
90
- models: [
91
- // SOTA
92
- ['gemini-3.8-flash', 1_048_576, 65_536],
93
- ['gemini-3.1-pro-preview', 1_048_576, 65_536],
94
- ['gemini-3.7-flash', 1_048_576, 65_536],
95
- // Fast
96
- ['gemini-3.6-flash', 1_048_576, 65_536],
97
- ['gemini-3.5-flash', 1_048_576, 65_536],
98
- ['gemini-3.5-flash-lite', 1_048_576, 65_536],
99
- ['gemini-3.1-flash-lite', 1_048_576, 65_536],
100
- ['gemini-2.5-pro', 1_048_576, 65_536],
101
- ],
102
- category: 'cloud',
103
- },
104
- {
105
- id: 'mistral',
106
- name: 'Mistral AI',
107
- baseUrl: 'https://api.mistral.ai/v1',
108
- apiKeyEnvVar: 'MISTRAL_API_KEY',
109
- models: [
110
- // SOTA
111
- ['mistral-large-2512', 262_144, 262_144],
112
- ['mistral-medium-2604', 262_144, 262_144],
113
- // Fast
114
- ['mistral-small-2603', 256_000, 256_000],
115
- ['codestral-latest', 256_000, 4_096],
116
- ],
117
- category: 'cloud',
118
- },
119
- {
120
- id: 'deepseek',
121
- name: 'DeepSeek',
122
- baseUrl: 'https://api.deepseek.com/v1',
123
- apiKeyEnvVar: 'DEEPSEEK_API_KEY',
124
- models: [
125
- // SOTA
126
- ['deepseek-v4-pro', 1_000_000, 393_216],
127
- // Fast
128
- ['deepseek-flash', 1_000_000, 393_216],
129
- ['deepseek-v4-flash', 1_000_000, 393_216],
130
- ],
131
- category: 'cloud',
132
- },
133
- {
134
- id: 'xai',
135
- name: 'xAI Grok',
136
- baseUrl: 'https://api.x.ai/v1',
137
- apiKeyEnvVar: 'XAI_API_KEY',
138
- models: [
139
- // SOTA
140
- ['grok-4.7', 500_000, 500_000],
141
- ['grok-4.6', 500_000, 500_000],
142
- ['grok-4.5', 500_000, 500_000],
143
- ['grok-4.3', 1_000_000, 30_000],
144
- // Fast
145
- ['grok-build-0.1', 256_000, 256_000],
146
- ],
147
- category: 'cloud',
148
- },
149
- {
150
- id: 'z-ai',
151
- name: 'Z.ai',
152
- baseUrl: 'https://api.z.ai/api/paas/v4/',
153
- apiKeyEnvVar: 'ZAI_API_KEY',
154
- models: [
155
- ['glm-5.3-flash', 1_000_000, 131_072],
156
- ['glm-5.3-flashx', 1_000_000, 131_072],
157
- ['glm-5.2', 1_000_000, 131_072],
158
- ['glm-5.1', 200_000, 131_072],
159
- ['glm-5-turbo', 200_000, 131_072],
160
- ['glm-4.7', 204_800, 131_072],
161
- ],
162
- category: 'cloud',
163
- },
164
- {
165
- id: 'z-ai-coding',
166
- name: 'Z.ai Coding Subscription',
167
- baseUrl: 'https://api.z.ai/api/coding/paas/v4/',
168
- apiKeyEnvVar: 'ZAI_API_KEY',
169
- models: [
170
- ['glm-5.3', 1_000_000, 131_072],
171
- ['glm-5.2', 1_000_000, 131_072],
172
- ['glm-5.2-highspeed', 1_000_000, 131_072],
173
- ['glm-5-turbo', 200_000, 131_072],
174
- ],
175
- category: 'cloud',
176
- },
177
- {
178
- id: 'kimi-code',
179
- name: 'Kimi Code',
180
- baseUrl: 'https://api.kimi.com/coding/v1',
181
- apiKeyEnvVar: 'KIMI_API_KEY',
182
- models: [
183
- ['k3', 1_048_576, 131_072],
184
- ['k3-256k', 262_144, 131_072],
185
- ['kimi-for-coding', 262_144, 32_768],
186
- ['kimi-for-coding-highspeed', 262_144, 32_768],
187
- ],
188
- category: 'cloud',
189
- },
190
- {
191
- id: 'moonshot',
192
- name: 'Moonshot AI (Kimi API)',
193
- baseUrl: 'https://api.moonshot.ai/v1',
194
- apiKeyEnvVar: 'MOONSHOT_API_KEY',
195
- models: [
196
- // SOTA
197
- ['kimi-k3', 1_048_576, 131_072],
198
- ['kimi-k2.7-code', 262_144, 262_144],
199
- // Fast
200
- ['kimi-k2.6', 262_144, 262_144],
201
- ['kimi-k2.5', 262_144, 262_144],
202
- ],
203
- category: 'cloud',
204
- },
205
- {
206
- id: 'groq',
207
- name: 'Groq',
208
- baseUrl: 'https://api.groq.com/openai/v1',
209
- apiKeyEnvVar: 'GROQ_API_KEY',
210
- models: [
211
- ['openai/gpt-oss-120b', 131_072, 65_536],
212
- ['qwen/qwen3.6-27b', 131_072, 16_384],
213
- ['llama-3.3-70b-versatile', 131_072, 32_768],
214
- ],
215
- category: 'cloud',
216
- },
217
- {
218
- id: 'cerebras',
219
- name: 'Cerebras',
220
- baseUrl: 'https://api.cerebras.ai/v1',
221
- apiKeyEnvVar: 'CEREBRAS_API_KEY',
222
- models: [
223
- ['gpt-oss-120b', 131_072, 40_960],
224
- ['zai-glm-4.7', 131_072, 40_960],
225
- ],
226
- category: 'cloud',
227
- },
228
- {
229
- // Router-specific caps: Together serves some models below the origin's window.
230
- id: 'together',
231
- name: 'Together AI',
232
- baseUrl: 'https://api.together.ai/v1',
233
- apiKeyEnvVar: 'TOGETHER_API_KEY',
234
- models: [
235
- // SOTA
236
- ['moonshotai/Kimi-K3', 1_048_576, 131_072],
237
- ['deepseek-ai/DeepSeek-V4-Pro', 512_000, 384_000],
238
- ['Qwen/Qwen3.7-Max', 1_000_000, 500_000],
239
- // Fast
240
- ['moonshotai/Kimi-K2.7-Code', 262_144, 131_072],
241
- ['zai-org/GLM-5.2', 512_000, 164_000],
242
- ['MiniMaxAI/MiniMax-M3', 524_288, 250_000],
243
- ],
244
- category: 'cloud',
245
- },
246
- {
247
- id: 'fireworks',
248
- name: 'Fireworks AI',
249
- baseUrl: 'https://api.fireworks.ai/inference/v1',
250
- apiKeyEnvVar: 'FIREWORKS_API_KEY',
251
- models: [
252
- // SOTA
253
- ['accounts/fireworks/models/kimi-k3', 1_048_576, 131_072],
254
- ['accounts/fireworks/models/glm-5p2', 1_048_575, 131_072],
255
- // Fast
256
- ['accounts/fireworks/routers/kimi-k3-fast', 1_048_576, 131_072],
257
- ['accounts/fireworks/models/minimax-m3', 512_000, 512_000],
258
- ['accounts/fireworks/models/deepseek-v4-flash', 1_000_000, 384_000],
259
- ['accounts/fireworks/models/deepseek-v4-pro-0813', 1_000_000, 384_000],
260
- ],
261
- category: 'cloud',
262
- },
263
- {
264
- id: 'huggingface',
265
- name: 'Hugging Face Router',
266
- baseUrl: 'https://router.huggingface.co/v1',
267
- apiKeyHint: 'Hugging Face token (from https://huggingface.co/settings/tokens)',
268
- apiKeyEnvVar: 'HF_TOKEN',
269
- models: [
270
- // SOTA
271
- ['moonshotai/Kimi-K3', 1_048_576, 131_072],
272
- ['zai-org/GLM-5.2', 262_144, 131_072],
273
- ['thinkingmachines/Inkling', 1_048_576, 1_048_576],
274
- // Fast
275
- ['deepseek-ai/DeepSeek-V4-Flash', 1_048_576, 384_000],
276
- ['Qwen/Qwen3-Coder-Next', 262_144, 65_536],
277
- ],
278
- category: 'cloud',
279
- },
280
- {
281
- id: 'nvidia',
282
- name: 'NVIDIA NIM',
283
- baseUrl: 'https://integrate.api.nvidia.com/v1',
284
- apiKeyEnvVar: 'NVIDIA_API_KEY',
285
- models: [
286
- ['nvidia/nemotron-3-ultra-550b-a55b', 1_000_000, 65_536],
287
- ['nvidia/nemotron-3.5-lightning-30b-a3b', 262_144, 262_144],
288
- ['nvidia/nemotron-3-super-120b-a12b', 262_144, 262_144],
289
- ['minimaxai/minimax-m3', 1_000_000, 16_384],
290
- ],
291
- category: 'cloud',
292
- },
293
- {
294
- id: 'qwen-token-plan',
295
- name: 'Qwen Token Plan',
296
- baseUrl: 'https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1',
297
- apiKeyHint: 'Alibaba Cloud Model Studio API key with a token plan',
298
- apiKeyEnvVar: 'QWEN_TOKEN_PLAN_API_KEY',
299
- models: [
300
- // SOTA
301
- ['qwen3.8-max', 1_000_000, 131_072],
302
- ['qwen3.7-max', 1_000_000, 131_072],
303
- ['glm-5.2', 1_000_000, 131_072],
304
- ['deepseek-v4-pro', 1_000_000, 384_000],
305
- // Fast
306
- ['qwen3.7-plus', 1_000_000, 65_536],
307
- ['kimi-k2.7-code', 262_144, 262_144],
308
- ['deepseek-v4-flash', 1_000_000, 384_000],
309
- ],
310
- category: 'cloud',
311
- },
312
- {
313
- id: 'opencode-zen',
314
- name: 'OpenCode Zen',
315
- baseUrl: 'https://opencode.ai/zen/v1',
316
- apiKeyEnvVar: 'OPENCODE_API_KEY',
317
- models: [
318
- // SOTA
319
- ['gpt-6.1-sol', 1_050_000, 128_000],
320
- ['gpt-6-astra', 1_050_000, 128_000],
321
- ['claude-opus-5-5', 1_000_000, 128_000],
322
- ['claude-sonnet-5-5', 1_000_000, 128_000],
323
- ['gemini-3.8-flash', 1_048_576, 65_536],
324
- ['claude-opus-5', 1_000_000, 128_000],
325
- ['gpt-5.5', 1_050_000, 128_000],
326
- ['claude-opus-4-8', 1_000_000, 128_000],
327
- // Fast
328
- ['claude-sonnet-4-6', 1_000_000, 64_000],
329
- ['kimi-k3', 1_048_576, 131_072],
330
- ['gemini-3.7-flash', 1_048_576, 65_536],
331
- ['minimax-m3', 512_000, 128_000],
332
- ],
333
- category: 'cloud',
334
- },
335
- {
336
- id: 'requesty',
337
- name: 'Requesty',
338
- baseUrl: 'https://router.requesty.ai/v1',
339
- apiKeyHint: 'API Key (from https://app.requesty.ai/api-keys)',
340
- models: [
341
- ['gpt-6.1-sol', 1_050_000, 128_000],
342
- ['gpt-6.1-sol@eu', 1_050_000, 128_000],
343
- ['claude-opus-5-5', 1_000_000, 128_000],
344
- ['claude-sonnet-5-5', 1_000_000, 128_000],
345
- ['gemini-3.8-flash', 1_048_576, 65_535],
346
- ['deepseek-v4.1-flash', 1_048_576, 393_216],
347
- ['claude-opus-4-8', 1_000_000, 128_000],
348
- ['gpt-5.5@eu', 1_050_000, 128_000],
349
- ['gemini-3.5-flash', 1_048_576, 65_535],
350
- ['kimi-k3', 1_048_576, 262_144],
351
- ],
352
- category: 'cloud',
353
- },
354
- {
355
- id: 'thesean',
356
- name: 'Thesean AI',
357
- baseUrl: 'https://api.thesean.ai',
358
- apiKeyHint: 'API Key (from https://app.thesean.ai/)',
359
- models: [
360
- 'ship-like/claude-opus-4-8',
361
- ],
362
- category: 'cloud',
363
- },
364
- {
365
- id: 'atlas-cloud',
366
- name: 'Atlas Cloud',
367
- baseUrl: 'https://api.atlascloud.ai/v1',
368
- apiKeyHint: 'API Key (from atlascloud.ai/developer)',
369
- models: [
370
- // No models.dev entry for Atlas; the gpt-5.6 family reports an identical
371
- // window across every catalogued provider that serves it.
372
- ['gpt-5.6-sol', 1_050_000, 128_000],
373
- ],
374
- category: 'cloud',
375
- },
376
- {
377
- id: 'openai-subscription',
378
- name: 'OpenAI Subscription',
379
- baseUrl: 'https://chatgpt.com/backend-api/codex',
380
- auth: 'chatgpt-oauth',
381
- models: [
382
- ['gpt-6.1-sol', 1_050_000, 128_000],
383
- ['gpt-6-astra', 1_050_000, 128_000],
384
- ['gpt-6-sol', 1_050_000, 128_000],
385
- ['gpt-6-luna', 1_050_000, 128_000],
386
- ['gpt-5.6-sol', 1_050_000, 128_000],
387
- ['gpt-5.6-terra', 1_050_000, 128_000],
388
- ['gpt-5.6-luna', 1_050_000, 128_000],
389
- ['gpt-5.5', 1_050_000, 128_000],
390
- ['gpt-5.4', 1_050_000, 128_000],
391
- ['gpt-5.4-mini', 400_000, 128_000],
392
- // The spark variant is the lightweight Codex line: 128K context, 32K output.
393
- ['gpt-5.3-codex-spark', 128_000, 32_000],
394
- ],
395
- category: 'cloud',
396
- },
397
- {
398
- // Poe model ids are provider-prefixed, and Poe caps several models below the
399
- // origin window (e.g. gpt-5.5 at 400K despite OpenAI's 1.05M).
400
- id: 'poe',
401
- name: 'Poe',
402
- baseUrl: 'https://api.poe.com/v1',
403
- apiKeyHint: 'API Key (from poe.com/api_key)',
404
- models: [
405
- // SOTA
406
- ['anthropic/claude-opus-4.8', 1_048_576, 128_000],
407
- ['openai/gpt-5.5', 400_000, 128_000],
408
- ['google/gemini-3.5-flash', 1_048_576, 65_536],
409
- // Fast
410
- ['openai/gpt-5.4-mini', 400_000, 128_000],
411
- ['anthropic/claude-sonnet-4.6', 983_040, 128_000],
412
- ['novita/kimi-k2.5', 128_000, 262_144],
413
- ],
414
- category: 'cloud',
415
- },
416
- {
417
- id: 'kilo',
418
- name: 'Kilo Gateway',
419
- baseUrl: 'https://api.kilo.ai/api/gateway',
420
- apiKeyEnvVar: 'KILO_API_KEY',
421
- models: [
422
- // SOTA
423
- ['openai/gpt-6.1-sol', 1_050_000, 128_000],
424
- ['anthropic/claude-opus-5.5', 1_000_000, 128_000],
425
- ['anthropic/claude-sonnet-5.5', 1_000_000, 128_000],
426
- ['google/gemini-3.8-flash', 1_048_576, 65_536],
427
- ['deepseek/deepseek-v4.1-flash', 1_048_576, 943_718],
428
- ['anthropic/claude-opus-5', 1_000_000, 128_000],
429
- ['openai/gpt-5.6-sol', 1_050_000, 128_000],
430
- ['moonshotai/kimi-k3', 1_048_576, 1_048_576],
431
- ['z-ai/glm-5.2', 1_048_576, 131_072],
432
- // Fast
433
- ['google/gemini-3.7-flash', 1_048_576, 65_536],
434
- ['x-ai/grok-4.6', 500_000, 500_000],
435
- ['deepseek/deepseek-v4-pro-0813', 1_048_576, 384_000],
436
- ['kilo-auto/frontier', 1_000_000, 128_000],
437
- ],
438
- category: 'cloud',
439
- },
440
- {
441
- id: 'novita',
442
- name: 'Novita AI',
443
- baseUrl: 'https://api.novita.ai/openai',
444
- apiKeyEnvVar: 'NOVITA_API_KEY',
445
- models: [
446
- // SOTA
447
- ['moonshotai/kimi-k3', 1_048_576, 1_048_576],
448
- ['zai-org/glm-5.2', 1_048_576, 131_072],
449
- ['qwen/qwen3.7-max', 1_000_000, 65_536],
450
- ['deepseek/deepseek-v4-pro', 1_048_576, 393_216],
451
- // Fast
452
- ['moonshotai/kimi-k2.7-code', 262_144, 262_144],
453
- ],
454
- category: 'cloud',
455
- },
456
- {
457
- id: 'deep-infra',
458
- name: 'Deep Infra',
459
- baseUrl: 'https://api.deepinfra.com/v1/openai',
460
- apiKeyEnvVar: 'DEEPINFRA_API_KEY',
461
- models: [
462
- // SOTA
463
- ['moonshotai/Kimi-K3', 1_048_576, 131_072],
464
- ['thinkingmachines/Inkling', 524_288, 1_048_576],
465
- // Fast
466
- ['deepseek-ai/DeepSeek-V4-Flash-0731', 1_048_576, 384_000],
467
- ['MiniMaxAI/MiniMax-M3', 524_288, 128_000],
468
- ['meta-llama/Llama-3.3-70B-Instruct-Turbo', 131_072, 131_072],
469
- ],
470
- category: 'cloud',
471
- },
472
- {
473
- id: 'siliconflow',
474
- name: 'SiliconFlow',
475
- baseUrl: 'https://api.siliconflow.com/v1',
476
- apiKeyEnvVar: 'SILICONFLOW_API_KEY',
477
- models: [
478
- // SOTA
479
- ['zai-org/GLM-5.2', 1_049_000, 262_000],
480
- ['deepseek-ai/DeepSeek-V4-Pro', 1_000_000, 384_000],
481
- // Fast
482
- ['Qwen/Qwen3-Coder-480B-A35B-Instruct', 262_000, 262_000],
483
- ['moonshotai/Kimi-K2.6', 262_000, 262_000],
484
- ],
485
- category: 'cloud',
486
- },
487
- {
488
- id: 'nebius',
489
- name: 'Nebius AI Studio',
490
- baseUrl: 'https://api.studio.nebius.com/v1',
491
- apiKeyEnvVar: 'NEBIUS_API_KEY',
492
- models: [
493
- // SOTA
494
- ['deepseek-ai/DeepSeek-V4-Pro', 1_000_000, 384_000],
495
- ['moonshotai/Kimi-K3', 1_048_576, 8_000],
496
- // Fast
497
- ['zai-org/GLM-5.2', 432_000, 432_000],
498
- ['nvidia/nemotron-3-super-120b-a12b', 256_000, 32_768],
499
- ],
500
- category: 'cloud',
501
- },
502
- // ── Local providers (no API key) ────────────────────────────────────
503
- {
504
- id: 'ollama',
505
- name: 'Ollama',
506
- baseUrl: 'http://localhost:11434/v1',
507
- models: [
508
- 'qwen3-coder',
509
- 'devstral-small-2512',
510
- 'gemma4:26b',
511
- 'llama4:scout',
512
- ],
513
- category: 'local',
514
- },
515
- {
516
- id: 'llamacpp',
517
- name: 'llama.cpp server',
518
- baseUrl: 'http://localhost:8080/v1',
519
- category: 'local',
520
- },
521
- {
522
- id: 'mlx-server',
523
- name: 'MLX Server',
524
- baseUrl: 'http://localhost:8080/v1',
525
- category: 'local',
526
- },
527
- {
528
- id: 'lmstudio',
529
- name: 'LM Studio',
530
- baseUrl: 'http://localhost:1234/v1',
531
- category: 'local',
532
- },
3
+ { id: 'haze.build', name: 'haze.build', kind: 'haze-build', baseUrl: 'https://llm.haze.build/v1', category: 'cloud', models: ['haze1.5-builder-flash'], apiKeyHint: 'your deployed haze.build inference key' },
4
+ { id: 'openrouter', name: 'OpenRouter', baseUrl: 'https://openrouter.ai/api/v1', apiKeyEnvVar: 'OPENROUTER_API_KEY', category: 'cloud', models: [
5
+ 'anthropic/claude-opus-5.5', 'anthropic/claude-sonnet-5.5',
6
+ 'openai/gpt-6.1-sol', 'openai/gpt-6-luna',
7
+ 'google/gemini-4-argon', 'google/gemini-3.8-flash',
8
+ 'mistralai/mistral-large-4-0', 'deepseek/deepseek-v4.1-flash',
9
+ 'moonshotai/kimi-k3.1-pro', 'z-ai/glm-5.3',
10
+ 'qwen/qwen3.8-2.4t-a95b', 'minimax/minimax-m3.1-flash',
11
+ 'x-ai/grok-4.7',
12
+ ] },
13
+ { id: 'openai-api-key', name: 'OpenAI API Key', baseUrl: 'https://api.openai.com/v1', apiKeyEnvVar: 'OPENAI_API_KEY', category: 'cloud', models: [
14
+ 'gpt-6.1-sol', 'gpt-6-astra', 'gpt-6-luna',
15
+ ] },
16
+ { id: 'openai-subscription', name: 'OpenAI Subscription', baseUrl: 'https://chatgpt.com/backend-api/codex', auth: 'chatgpt-oauth', category: 'cloud', models: [
17
+ 'gpt-6.1-sol', 'gpt-6.1-terra', 'gpt-6-luna',
18
+ 'gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.6-luna',
19
+ ] },
20
+ { id: 'google-gemini', name: 'Google Gemini', baseUrl: 'https://generativelanguage.googleapis.com/v1beta/openai', apiKeyHint: 'API Key (from https://aistudio.google.com/apikey)', apiKeyEnvVar: 'GEMINI_API_KEY', category: 'cloud', models: [
21
+ 'gemini-4-argon', 'gemini-3.8-flash',
22
+ ] },
23
+ { id: 'mistral-api', name: 'Mistral AI (API Key)', baseUrl: 'https://api.mistral.ai/v1', apiKeyHint: 'API Key (from https://console.mistral.ai)', apiKeyEnvVar: 'MISTRAL_API_KEY', category: 'cloud', models: [
24
+ 'mistral-large-4', 'mistral-small-latest', 'codestral-latest',
25
+ ] },
26
+ { id: 'mistral-vibe', name: 'Mistral Vibe Subscription', baseUrl: 'https://api.mistral.ai/v1', auth: 'mistral-vibe', category: 'cloud', models: ['mistral-vibe-cli-latest', 'mistral-large-4'] },
27
+ { id: 'deepseek', name: 'DeepSeek', baseUrl: 'https://api.deepseek.com/v1', apiKeyEnvVar: 'DEEPSEEK_API_KEY', category: 'cloud', models: [
28
+ 'deepseek-v4-pro', 'deepseek-flash',
29
+ ] },
30
+ { id: 'xai', name: 'xAI Grok', baseUrl: 'https://api.x.ai/v1', apiKeyEnvVar: 'XAI_API_KEY', category: 'cloud', models: [
31
+ 'grok-4.7', 'grok-4.6',
32
+ ] },
33
+ { id: 'z-ai-api', name: 'Z.ai (General API)', baseUrl: 'https://api.z.ai/api/paas/v4/', apiKeyEnvVar: 'ZAI_API_KEY', category: 'cloud', models: [
34
+ 'glm-5.3', 'glm-5.3-flash',
35
+ ] },
36
+ { id: 'z-ai-coding', name: 'Z.ai (Coding Plan)', baseUrl: 'https://api.z.ai/api/coding/paas/v4/', apiKeyEnvVar: 'ZAI_API_KEY', category: 'cloud', models: [
37
+ 'glm-5.3', 'glm-5.2-highspeed',
38
+ ] },
39
+ { id: 'moonshot', name: 'Moonshot AI (Kimi API)', baseUrl: 'https://api.moonshot.ai/v1', apiKeyEnvVar: 'MOONSHOT_API_KEY', category: 'cloud', models: [
40
+ 'kimi-k3.1-pro', 'kimi-k3',
41
+ ] },
42
+ { id: 'kimi-code', name: 'Kimi Code', baseUrl: 'https://api.kimi.com/coding/v1', apiKeyEnvVar: 'KIMI_API_KEY', category: 'cloud', models: [
43
+ 'k3', 'k3.1-pro', 'kimi-for-coding',
44
+ ] },
45
+ { id: 'groq', name: 'Groq', baseUrl: 'https://api.groq.com/openai/v1', apiKeyEnvVar: 'GROQ_API_KEY', category: 'cloud', models: [
46
+ 'openai/gpt-oss-120b', 'qwen/qwen3.8-27b',
47
+ ] },
48
+ { id: 'together', name: 'Together AI', baseUrl: 'https://api.together.ai/v1', apiKeyEnvVar: 'TOGETHER_API_KEY', category: 'cloud', models: [
49
+ 'deepseek-ai/DeepSeek-V4-Pro-0813', 'moonshotai/Kimi-K3.1-Pro',
50
+ ] },
51
+ { id: 'ollama', name: 'Ollama (Local Server)', baseUrl: 'http://localhost:11434/v1', category: 'local' },
52
+ { id: 'lmstudio', name: 'LM Studio', baseUrl: 'http://localhost:1234/v1', category: 'local' },
53
+ { id: 'llamacpp', name: 'llama.cpp server', baseUrl: 'http://localhost:8080/v1', category: 'local' },
54
+ { id: 'mlx-server', name: 'MLX Server', baseUrl: 'http://localhost:8080/v1', category: 'local' },
55
+ { id: 'vllm', name: 'vLLM', baseUrl: 'http://localhost:8000/v1', category: 'local' },
533
56
  ];
534
- /** Expand one compact definition into the public preset record. */
57
+ // Alias mappings for backward compatibility
58
+ const PRESET_ALIASES = {
59
+ mistral: 'mistral-api', // Legacy → new API preset
60
+ 'z-ai': 'z-ai-api', // Legacy → new general API preset
61
+ openai: 'openai-api-key', // Legacy → new API preset
62
+ 'chatgpt-codex': 'openai-subscription', // Legacy → subscription preset
63
+ 'llama-cpp': 'llamacpp',
64
+ 'lm-studio': 'lmstudio',
65
+ };
535
66
  function expandPreset(definition) {
536
- const tuples = definition.models?.filter((model) => Array.isArray(model)) ?? [];
67
+ const suggestedModels = [];
68
+ const modelLimits = {};
69
+ for (const model of definition.models || []) {
70
+ suggestedModels.push(model);
71
+ const limits = endpointModelFacts(definition.baseUrl, model).limits;
72
+ if (limits)
73
+ modelLimits[model] = limits;
74
+ }
537
75
  return {
538
76
  id: definition.id,
539
- ...(definition.kind ? { kind: definition.kind } : {}),
540
- ...(definition.requiresEndpoint ? { requiresEndpoint: true } : {}),
541
77
  name: definition.name,
542
78
  baseUrl: definition.baseUrl,
543
- needsApiKey: definition.category === 'cloud' && definition.auth == null,
79
+ category: definition.category,
80
+ ...(definition.kind ? { kind: definition.kind } : {}),
81
+ ...(definition.requiresEndpoint ? { requiresEndpoint: true } : {}),
544
82
  ...(definition.auth ? { auth: definition.auth } : {}),
545
83
  ...(definition.apiKeyHint ? { apiKeyHint: definition.apiKeyHint } : {}),
546
84
  ...(definition.apiKeyEnvVar ? { apiKeyEnvVar: definition.apiKeyEnvVar } : {}),
547
- ...(definition.models ? { suggestedModels: definition.models.map(model => typeof model === 'string' ? model : model[0]) } : {}),
548
- ...(tuples.length > 0 ? { modelLimits: Object.fromEntries(tuples.map(([model, contextWindowTokens, maxOutputTokens]) => [model, { contextWindowTokens, maxOutputTokens }])) } : {}),
549
- category: definition.category,
85
+ suggestedModels: suggestedModels.length > 0 ? suggestedModels : undefined,
86
+ modelLimits: Object.keys(modelLimits).length > 0 ? modelLimits : undefined,
87
+ needsApiKey: definition.category === 'cloud' && !definition.auth,
550
88
  };
551
89
  }
552
90
  export const PROVIDER_PRESETS = PRESET_DEFINITIONS.map(expandPreset);
91
+ // Backward-compatible lookup function
553
92
  export function findPreset(id) {
554
- // Accept the former picker ids without keeping duplicate preset records.
555
- const canonicalId = id === 'openai' ? 'openai-api-key' : id === 'chatgpt-codex' ? 'openai-subscription' : id;
556
- return PROVIDER_PRESETS.find(preset => preset.id === canonicalId);
93
+ const resolvedId = PRESET_ALIASES[id] || id;
94
+ return PROVIDER_PRESETS.find(preset => preset.id === resolvedId);
557
95
  }
558
- /**
559
- * Limits for models a wizard flow is adding to a provider, matched by the
560
- * provider's base URL or its name (a provider created from a preset keeps the
561
- * preset's name unless the user renamed it). Returns only entries the caller
562
- * should merge into the provider's settings `modelLimits`; user-configured
563
- * limits always win because callers merge without overwriting existing keys.
564
- */
96
+ /** Only copy limits for selected models and an unambiguous provider endpoint. */
565
97
  export function presetModelLimitsForModels(provider, models) {
566
- const preset = PROVIDER_PRESETS.find(candidate => candidate.modelLimits
567
- && ((provider.url && candidate.baseUrl === provider.url)
568
- || (provider.name && (candidate.name === provider.name || candidate.id === provider.name))));
569
- if (!preset?.modelLimits)
570
- return {};
98
+ const named = PROVIDER_PRESETS.find(p => provider.name && (p.name.toLowerCase() === provider.name.toLowerCase() || p.id === provider.name));
99
+ const endpoint = provider.url ?? named?.baseUrl;
571
100
  const out = {};
101
+ if (!endpoint)
102
+ return out;
572
103
  for (const model of models) {
573
- const limits = preset.modelLimits[model];
104
+ const limits = endpointModelFacts(endpoint, model).limits;
574
105
  if (limits)
575
106
  out[model] = limits;
576
107
  }