@bubblebrain-ai/bubble 0.0.60 → 0.0.62
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/dist/model-catalog.js +36 -1
- package/dist/model-pricing.js +17 -0
- package/dist/provider-ai-sdk.d.ts +2 -1
- package/dist/provider-ai-sdk.js +26 -9
- package/dist/provider-transform.js +57 -2
- package/dist/tui/composer-autocomplete.js +9 -4
- package/dist/variant/variant-resolver.d.ts +4 -2
- package/dist/variant/variant-resolver.js +7 -5
- package/package.json +1 -1
package/dist/model-catalog.js
CHANGED
|
@@ -62,8 +62,16 @@ const KIMI_THINKING_ONLY_LEVELS = ["medium"];
|
|
|
62
62
|
// verified against the live endpoint: low spent 92 reasoning tokens on a task
|
|
63
63
|
// where high spent 1310. Thinking is disableable on k3 (thinking.type
|
|
64
64
|
// "disabled"); the 256k variant exposes effort only, so it has no "off".
|
|
65
|
+
// K3.1 Pro (and its highspeed slot) is effort-only too: GET /coding/v1/models
|
|
66
|
+
// reports reasoning.type "only" and the endpoint 400s on thinking disabled.
|
|
67
|
+
// The default of "high" is Bubble's choice and matches the coding endpoint's
|
|
68
|
+
// reported default; Moonshot's open platform defaults to max server-side.
|
|
65
69
|
const KIMI_K3_LEVELS = ["off", "low", "high", "max"];
|
|
66
70
|
const KIMI_K3_EFFORT_ONLY_LEVELS = ["low", "high", "max"];
|
|
71
|
+
// DashScope's Moonshot passthrough (kimi/ ids) documents K3 as thinking-only
|
|
72
|
+
// with reasoning_effort "max" as its sole value. Not live-verified: the probing
|
|
73
|
+
// account has the passthrough product disabled.
|
|
74
|
+
const KIMI_PASSTHROUGH_K3_LEVELS = ["max"];
|
|
67
75
|
// DeepSeek V4 defaults to thinking/high, but the OpenAI-compatible API also
|
|
68
76
|
// supports disabling thinking and selecting low/high/max effort explicitly.
|
|
69
77
|
const DEEPSEEK_V4_LEVELS = ["off", "low", "high", "max"];
|
|
@@ -88,6 +96,9 @@ const ANTHROPIC_CHAT_LEVELS = ["off"];
|
|
|
88
96
|
// Grok 4.5 exposes low/medium/high effort with no "off" (thinking always on);
|
|
89
97
|
// the composer model declares no effort support at all.
|
|
90
98
|
const GROK_45_LEVELS = ["low", "medium", "high"];
|
|
99
|
+
// Gemini 4 documents only low/medium (default)/high. Verified live on
|
|
100
|
+
// 2026-10-13: thinkingLevel=minimal returns 400, so there is no off/minimal.
|
|
101
|
+
const GEMINI_4_LEVELS = ["low", "medium", "high"];
|
|
91
102
|
const GEMINI_3_LEVELS = ["low", "medium", "high"];
|
|
92
103
|
const GEMINI_3_FLASH_LEVELS = ["minimal", "low", "medium", "high"];
|
|
93
104
|
// Verified against the native API on 2026-09-02: Gemini 3.7/3.8 Flash reject
|
|
@@ -149,6 +160,9 @@ export const BUILTIN_MODELS = [
|
|
|
149
160
|
// list via fetchGeminiModels (GET /v1beta/models, newest five). Gemini 3
|
|
150
161
|
// thinking support varies by release: 3.7/3.8 Flash support off/low/medium/high
|
|
151
162
|
// while older Flash releases expose minimal/low/medium/high.
|
|
163
|
+
// Gemini 4 Argon: 1,048,576-token window shared by input, thinking and output.
|
|
164
|
+
// https://ai.google.dev/gemini-api/docs/models/gemini-4-argon
|
|
165
|
+
{ id: "gemini-4-argon", name: "Gemini 4 Argon", providerId: "google", tier: "strong", reasoningLevels: GEMINI_4_LEVELS, defaultReasoningLevel: "medium", contextWindow: 1048576 },
|
|
152
166
|
{ id: "gemini-3.8-flash", name: "Gemini 3.8 Flash", providerId: "google", tier: "fast", reasoningLevels: GEMINI_37_38_FLASH_LEVELS, contextWindow: 1048576 },
|
|
153
167
|
{ id: "gemini-3.7-flash", name: "Gemini 3.7 Flash", providerId: "google", tier: "fast", reasoningLevels: GEMINI_37_38_FLASH_LEVELS, contextWindow: 1048576 },
|
|
154
168
|
{ id: "gemini-3.5-flash", name: "Gemini 3.5 Flash", providerId: "google", tier: "fast", reasoningLevels: GEMINI_3_FLASH_LEVELS, contextWindow: 1048576 },
|
|
@@ -182,6 +196,20 @@ export const BUILTIN_MODELS = [
|
|
|
182
196
|
{ id: "glm-4.6", name: "GLM-4.6", providerId: "zai-coding-plan", reasoningLevels: TOGGLE_THINKING_LEVELS, contextWindow: 200000 },
|
|
183
197
|
{ id: "qwen3.6-plus", name: "Qwen3.6 Plus", providerId: "alibaba", tier: "balanced", reasoningLevels: ["off"], contextWindow: 1048576 },
|
|
184
198
|
{ id: "qwen3.7-max", name: "Qwen3.7 Max", providerId: "alibaba", tier: "strong", reasoningLevels: ["off"], contextWindow: 1048576 },
|
|
199
|
+
// DashScope Kimi, first-party ids (probed 2026-10-26: kimi-k3 tiers track
|
|
200
|
+
// upstream, k2.5/k2.6 default to thinking off, K2.7 Code always thinks).
|
|
201
|
+
{ id: "kimi-k3", name: "Kimi K3", providerId: "alibaba", tier: "strong", reasoningLevels: KIMI_K3_LEVELS, defaultReasoningLevel: "high", contextWindow: 1048576 },
|
|
202
|
+
{ id: "kimi-k2.7-code", name: "Kimi K2.7 Code", providerId: "alibaba", tier: "strong", reasoningLevels: KIMI_THINKING_ONLY_LEVELS, contextWindow: 262144 },
|
|
203
|
+
{ id: "kimi-k2.6", name: "Kimi K2.6", providerId: "alibaba", reasoningLevels: TOGGLE_THINKING_LEVELS, contextWindow: 256000 },
|
|
204
|
+
{ id: "kimi-k2.5", name: "Kimi K2.5", providerId: "alibaba", reasoningLevels: TOGGLE_THINKING_LEVELS, contextWindow: 256000 },
|
|
205
|
+
// Moonshot passthrough ids, per DashScope's Kimi doc: K3 is max-only, K2.7
|
|
206
|
+
// Code always thinks, K2.6 toggles via enable_thinking.
|
|
207
|
+
{ id: "kimi/kimi-k3.1-pro", name: "Kimi K3.1 Pro", providerId: "alibaba", tier: "strong", reasoningLevels: KIMI_PASSTHROUGH_K3_LEVELS, defaultReasoningLevel: "max", contextWindow: 1048576 },
|
|
208
|
+
{ id: "kimi/kimi-k3.1-pro-highspeed", name: "Kimi K3.1 Pro Highspeed", providerId: "alibaba", tier: "fast", reasoningLevels: KIMI_PASSTHROUGH_K3_LEVELS, defaultReasoningLevel: "max", contextWindow: 1048576 },
|
|
209
|
+
{ id: "kimi/kimi-k3", name: "Kimi K3 (Moonshot)", providerId: "alibaba", tier: "strong", reasoningLevels: KIMI_PASSTHROUGH_K3_LEVELS, defaultReasoningLevel: "max", contextWindow: 1048576 },
|
|
210
|
+
{ id: "kimi/kimi-k2.7-code", name: "Kimi K2.7 Code (Moonshot)", providerId: "alibaba", tier: "strong", reasoningLevels: KIMI_THINKING_ONLY_LEVELS, contextWindow: 262144 },
|
|
211
|
+
{ id: "kimi/kimi-k2.7-code-highspeed", name: "Kimi K2.7 Code Highspeed", providerId: "alibaba", tier: "fast", reasoningLevels: KIMI_THINKING_ONLY_LEVELS, contextWindow: 262144 },
|
|
212
|
+
{ id: "kimi/kimi-k2.6", name: "Kimi K2.6 (Moonshot)", providerId: "alibaba", reasoningLevels: TOGGLE_THINKING_LEVELS, contextWindow: 256000 },
|
|
185
213
|
// Bailian token plan (GET /models on the plan endpoint, probed 2026-08-04).
|
|
186
214
|
// Image/TTS entries from that list are omitted — this is a text agent.
|
|
187
215
|
{ id: "qwen3.8-max", name: "Qwen3.8 Max", providerId: "bailian-token-plan", tier: "strong", reasoningLevels: BAILIAN_FULL_LEVELS, defaultReasoningLevel: "high", contextWindow: 1048576 },
|
|
@@ -214,17 +242,24 @@ export const BUILTIN_MODELS = [
|
|
|
214
242
|
{ id: "kimi-k2.7-code", name: "Kimi K2.7 Code", providerId: "moonshot-cn", tier: "strong", reasoningLevels: KIMI_THINKING_ONLY_LEVELS, contextWindow: 262144 },
|
|
215
243
|
{ id: "kimi-k2.7-code-highspeed", name: "Kimi K2.7 Code Highspeed", providerId: "moonshot-cn", tier: "fast", reasoningLevels: KIMI_THINKING_ONLY_LEVELS, contextWindow: 262144 },
|
|
216
244
|
{ id: "kimi-k3", name: "Kimi K3", providerId: "moonshot-cn", tier: "strong", reasoningLevels: KIMI_K3_LEVELS, defaultReasoningLevel: "high", contextWindow: 1048576 },
|
|
245
|
+
{ id: "kimi-k3.1-pro", name: "Kimi K3.1 Pro", providerId: "moonshot-cn", tier: "strong", reasoningLevels: KIMI_K3_EFFORT_ONLY_LEVELS, defaultReasoningLevel: "high", contextWindow: 1048576 },
|
|
246
|
+
{ id: "kimi-k3.1-pro-highspeed", name: "Kimi K3.1 Pro Highspeed", providerId: "moonshot-cn", tier: "fast", reasoningLevels: KIMI_K3_EFFORT_ONLY_LEVELS, defaultReasoningLevel: "high", contextWindow: 1048576 },
|
|
217
247
|
{ id: "kimi-k2.6", name: "Kimi K2.6", providerId: "moonshot-cn", reasoningLevels: TOGGLE_THINKING_LEVELS, contextWindow: 256000 },
|
|
218
248
|
{ id: "kimi-k2.5", name: "Kimi K2.5", providerId: "moonshot-cn", reasoningLevels: TOGGLE_THINKING_LEVELS, contextWindow: 256000 },
|
|
219
249
|
{ id: "kimi-k2.7-code", name: "Kimi K2.7 Code", providerId: "moonshot-intl", tier: "strong", reasoningLevels: KIMI_THINKING_ONLY_LEVELS, contextWindow: 262144 },
|
|
220
250
|
{ id: "kimi-k2.7-code-highspeed", name: "Kimi K2.7 Code Highspeed", providerId: "moonshot-intl", tier: "fast", reasoningLevels: KIMI_THINKING_ONLY_LEVELS, contextWindow: 262144 },
|
|
221
251
|
{ id: "kimi-k3", name: "Kimi K3", providerId: "moonshot-intl", tier: "strong", reasoningLevels: KIMI_K3_LEVELS, defaultReasoningLevel: "high", contextWindow: 1048576 },
|
|
252
|
+
{ id: "kimi-k3.1-pro", name: "Kimi K3.1 Pro", providerId: "moonshot-intl", tier: "strong", reasoningLevels: KIMI_K3_EFFORT_ONLY_LEVELS, defaultReasoningLevel: "high", contextWindow: 1048576 },
|
|
253
|
+
{ id: "kimi-k3.1-pro-highspeed", name: "Kimi K3.1 Pro Highspeed", providerId: "moonshot-intl", tier: "fast", reasoningLevels: KIMI_K3_EFFORT_ONLY_LEVELS, defaultReasoningLevel: "high", contextWindow: 1048576 },
|
|
222
254
|
{ id: "kimi-k2.6", name: "Kimi K2.6", providerId: "moonshot-intl", reasoningLevels: TOGGLE_THINKING_LEVELS, contextWindow: 256000 },
|
|
223
255
|
{ id: "kimi-k2.5", name: "Kimi K2.5", providerId: "moonshot-intl", reasoningLevels: TOGGLE_THINKING_LEVELS, contextWindow: 256000 },
|
|
224
256
|
// Kimi for Coding serves plan-slot ids (verified via GET /coding/v1/models):
|
|
225
|
-
// k3, k3-256k,
|
|
257
|
+
// k3, k3-256k, k3.1-pro, k3.1-pro-highspeed, kimi-for-coding,
|
|
258
|
+
// kimi-for-coding-highspeed.
|
|
226
259
|
{ id: "k3", name: "Kimi K3", providerId: "kimi-for-coding", tier: "strong", reasoningLevels: KIMI_K3_LEVELS, defaultReasoningLevel: "high", contextWindow: 1048576 },
|
|
227
260
|
{ id: "k3-256k", name: "Kimi K3 256K", providerId: "kimi-for-coding", tier: "strong", reasoningLevels: KIMI_K3_EFFORT_ONLY_LEVELS, defaultReasoningLevel: "high", contextWindow: 262144 },
|
|
261
|
+
{ id: "k3.1-pro", name: "Kimi K3.1 Pro", providerId: "kimi-for-coding", tier: "strong", reasoningLevels: KIMI_K3_EFFORT_ONLY_LEVELS, defaultReasoningLevel: "high", contextWindow: 1048576 },
|
|
262
|
+
{ id: "k3.1-pro-highspeed", name: "Kimi K3.1 Pro Highspeed", providerId: "kimi-for-coding", tier: "fast", reasoningLevels: KIMI_K3_EFFORT_ONLY_LEVELS, defaultReasoningLevel: "high", contextWindow: 1048576 },
|
|
228
263
|
{ id: "kimi-for-coding", name: "Kimi for Coding", providerId: "kimi-for-coding", tier: "strong", reasoningLevels: KIMI_THINKING_ONLY_LEVELS, contextWindow: 262144 },
|
|
229
264
|
{ id: "kimi-for-coding-highspeed", name: "Kimi for Coding Highspeed", providerId: "kimi-for-coding", tier: "fast", reasoningLevels: KIMI_THINKING_ONLY_LEVELS, contextWindow: 262144 },
|
|
230
265
|
{ id: "kimi-k2.7-code", name: "Kimi K2.7 Code", providerId: "kimi-for-coding", tier: "strong", reasoningLevels: KIMI_THINKING_ONLY_LEVELS, contextWindow: 262144 },
|
package/dist/model-pricing.js
CHANGED
|
@@ -64,6 +64,23 @@ export const MODEL_PRICING_OVERRIDES = [
|
|
|
64
64
|
outputPerMillion: 7.5,
|
|
65
65
|
},
|
|
66
66
|
})),
|
|
67
|
+
// Gemini 4 Argon introductory pricing through 2026-11-30; standard rates from
|
|
68
|
+
// 2026-12-01. Implicit caching only (95% off input), so no cache-write rate.
|
|
69
|
+
// https://ai.google.dev/gemini-api/docs/pricing
|
|
70
|
+
{
|
|
71
|
+
providerId: "google",
|
|
72
|
+
modelId: "gemini-4-argon",
|
|
73
|
+
currency: "USD",
|
|
74
|
+
inputCacheHitPerMillion: 0.1,
|
|
75
|
+
inputCacheMissPerMillion: 2,
|
|
76
|
+
outputPerMillion: 10,
|
|
77
|
+
effectiveUntil: "2026-12-01T00:00:00Z",
|
|
78
|
+
original: {
|
|
79
|
+
inputCacheHitPerMillion: 0.2,
|
|
80
|
+
inputCacheMissPerMillion: 4,
|
|
81
|
+
outputPerMillion: 20,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
67
84
|
{
|
|
68
85
|
providerId: "deepseek",
|
|
69
86
|
modelId: "deepseek-flash",
|
|
@@ -50,7 +50,8 @@ export declare function fetchGeminiModels(options: {
|
|
|
50
50
|
}): Promise<GeminiModelDescriptor[]>;
|
|
51
51
|
/**
|
|
52
52
|
* Ranking: one entry per (version, tier) family — GA ids beat dated previews —
|
|
53
|
-
* then newest version first, pro before flash before
|
|
53
|
+
* then newest version first, flagship (pro/argon) before flash before
|
|
54
|
+
* flash-lite, top N.
|
|
54
55
|
*/
|
|
55
56
|
export declare function selectLatestGeminiModels(entries: GeminiModelListEntry[], limit?: number): GeminiModelDescriptor[];
|
|
56
57
|
/** Mirrors the static catalog's per-family thinking support. */
|
package/dist/provider-ai-sdk.js
CHANGED
|
@@ -137,17 +137,23 @@ function buildCallOptions(messages, chatOptions, providerOptions) {
|
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
|
-
* Gemini 3 models take a graded thinking_level; 2.5-era models take a token
|
|
140
|
+
* Gemini 3+ models take a graded thinking_level; 2.5-era models take a token
|
|
141
141
|
* budget. "off" (budget 0) is only offered in the catalog for models that
|
|
142
142
|
* accept it (2.5 Flash); xhigh/max/ultra clamp to high.
|
|
143
143
|
*/
|
|
144
144
|
function buildGoogleThinkingOptions(modelId, level) {
|
|
145
145
|
if (!level)
|
|
146
146
|
return undefined;
|
|
147
|
+
const version = geminiVersion(modelId);
|
|
148
|
+
// Gemini 4 accepts only low/medium/high: MINIMAL is a 400 and thinkingBudget
|
|
149
|
+
// is undocumented. Side calls (titles, compaction) request "off" by default,
|
|
150
|
+
// so floor those at low rather than sending a value the API rejects.
|
|
151
|
+
if (version >= 4 && (level === "off" || level === "minimal"))
|
|
152
|
+
level = "low";
|
|
147
153
|
if (level === "off")
|
|
148
154
|
return { thinkingConfig: { thinkingBudget: 0 } };
|
|
149
155
|
const clamped = level === "xhigh" || level === "max" || level === "ultra" ? "high" : level;
|
|
150
|
-
if (
|
|
156
|
+
if (version >= 3) {
|
|
151
157
|
return { thinkingConfig: { thinkingLevel: clamped, includeThoughts: true } };
|
|
152
158
|
}
|
|
153
159
|
const budgets = { minimal: 512, low: 2048, medium: 8192, high: 24576 };
|
|
@@ -459,10 +465,13 @@ export async function fetchGeminiModels(options) {
|
|
|
459
465
|
}
|
|
460
466
|
/**
|
|
461
467
|
* Ranking: one entry per (version, tier) family — GA ids beat dated previews —
|
|
462
|
-
* then newest version first, pro before flash before
|
|
468
|
+
* then newest version first, flagship (pro/argon) before flash before
|
|
469
|
+
* flash-lite, top N.
|
|
463
470
|
*/
|
|
464
471
|
export function selectLatestGeminiModels(entries, limit = 5) {
|
|
465
|
-
|
|
472
|
+
// Gemini 4 introduced named flagship tiers (gemini-4-argon). Unknown names
|
|
473
|
+
// stay excluded rather than guessing whether they are text models.
|
|
474
|
+
const TIER_RANK = { argon: 0, pro: 0, flash: 1, "flash-lite": 2 };
|
|
466
475
|
const candidates = [];
|
|
467
476
|
for (const entry of entries) {
|
|
468
477
|
const id = (entry.name ?? "").replace(/^models\//, "");
|
|
@@ -472,21 +481,23 @@ export function selectLatestGeminiModels(entries, limit = 5) {
|
|
|
472
481
|
continue;
|
|
473
482
|
if (entry.supportedGenerationMethods && !entry.supportedGenerationMethods.includes("generateContent"))
|
|
474
483
|
continue;
|
|
475
|
-
const match = /^gemini-(\d+(?:\.\d+)?)-(pro|flash)(-lite)?/.exec(id);
|
|
484
|
+
const match = /^gemini-(\d+(?:\.\d+)?)-(argon|pro|flash)(-lite)?/.exec(id);
|
|
476
485
|
if (!match)
|
|
477
486
|
continue;
|
|
487
|
+
const tier = `${match[2]}${match[3] ?? ""}`;
|
|
478
488
|
candidates.push({
|
|
479
489
|
id,
|
|
480
490
|
entry,
|
|
481
491
|
version: Number.parseFloat(match[1]),
|
|
482
|
-
|
|
492
|
+
tier,
|
|
493
|
+
tierRank: TIER_RANK[tier] ?? 3,
|
|
483
494
|
isPreview: id.includes("preview") || id.includes("exp"),
|
|
484
495
|
});
|
|
485
496
|
}
|
|
486
497
|
// One winner per family: GA over preview, then the shortest (least-suffixed) id.
|
|
487
498
|
const families = new Map();
|
|
488
499
|
for (const candidate of candidates) {
|
|
489
|
-
const key = `${candidate.version}-${candidate.
|
|
500
|
+
const key = `${candidate.version}-${candidate.tier}`;
|
|
490
501
|
const current = families.get(key);
|
|
491
502
|
if (!current
|
|
492
503
|
|| (current.isPreview && !candidate.isPreview)
|
|
@@ -502,13 +513,19 @@ export function selectLatestGeminiModels(entries, limit = 5) {
|
|
|
502
513
|
name: candidate.entry.displayName || candidate.id,
|
|
503
514
|
contextWindow: Number.isFinite(candidate.entry.inputTokenLimit) ? candidate.entry.inputTokenLimit : undefined,
|
|
504
515
|
reasoningLevels: geminiReasoningLevels(candidate.id),
|
|
505
|
-
|
|
516
|
+
// Argon defaults to Google's recommended medium via the catalog.
|
|
517
|
+
...(candidate.tier === "pro" ? { defaultReasoningLevel: "high" } : {}),
|
|
506
518
|
}));
|
|
507
519
|
}
|
|
520
|
+
function geminiVersion(modelId) {
|
|
521
|
+
return Number.parseFloat(/^gemini-(\d+(?:\.\d+)?)/.exec(modelId)?.[1] ?? "0");
|
|
522
|
+
}
|
|
508
523
|
/** Mirrors the static catalog's per-family thinking support. */
|
|
509
524
|
export function geminiReasoningLevels(modelId) {
|
|
510
|
-
const version =
|
|
525
|
+
const version = geminiVersion(modelId);
|
|
511
526
|
const isPro = modelId.includes("-pro");
|
|
527
|
+
if (version >= 4)
|
|
528
|
+
return ["low", "medium", "high"];
|
|
512
529
|
// Live probes show 3.7 and 3.8 Flash share this newer ladder. Keep the
|
|
513
530
|
// exception bounded to verified releases instead of guessing for 3.9+.
|
|
514
531
|
if (!isPro && (version === 3.7 || version === 3.8)) {
|
|
@@ -12,7 +12,17 @@ const KIMI_K27_FAMILY = new Set([
|
|
|
12
12
|
// K3 takes OpenAI-style reasoning_effort (low/high/max, no "medium"); "off"
|
|
13
13
|
// disables thinking via top-level thinking.type. Verified live: effort changes
|
|
14
14
|
// reasoning-token spend, and nested extra_body.thinking is ignored server-side.
|
|
15
|
-
|
|
15
|
+
// K3.1 Pro takes the same body but is thinking-only (thinking.type "disabled"
|
|
16
|
+
// 400s); its catalog levels have no "off", so the disabled branch never fires.
|
|
17
|
+
const KIMI_K3_FAMILY = new Set([
|
|
18
|
+
"k3",
|
|
19
|
+
"k3-256k",
|
|
20
|
+
"kimi-k3",
|
|
21
|
+
"k3.1-pro",
|
|
22
|
+
"k3.1-pro-highspeed",
|
|
23
|
+
"kimi-k3.1-pro",
|
|
24
|
+
"kimi-k3.1-pro-highspeed",
|
|
25
|
+
]);
|
|
16
26
|
const KIMI_TOGGLE_THINKING_FAMILY = new Set(["kimi-k2.5", "kimi-k2.6"]);
|
|
17
27
|
const KIMI_K26_DEFAULT_MAX_TOKENS = 32768;
|
|
18
28
|
const MINIMAX_M3_FAMILY = new Set(["MiniMax-M3"]);
|
|
@@ -22,6 +32,21 @@ const DEEPSEEK_V4_FAMILY = new Set([
|
|
|
22
32
|
"deepseek-v4-flash-vision-exp",
|
|
23
33
|
"deepseek-v4-pro",
|
|
24
34
|
]);
|
|
35
|
+
// DashScope serves Kimi first-party ("kimi-k3") and as a Moonshot passthrough
|
|
36
|
+
// under a vendor prefix ("kimi/kimi-k3.1-pro"). The two take different thinking
|
|
37
|
+
// controls; the passthrough contract comes from DashScope's Kimi doc
|
|
38
|
+
// (help.aliyun.com/zh/model-studio/kimi-api-by-moonshot-ai): its K3 ids accept
|
|
39
|
+
// reasoning_effort "max" only, K2.6 toggles via enable_thinking, and the K2.7
|
|
40
|
+
// Code ids take no thinking parameter at all.
|
|
41
|
+
const ALIBABA_KIMI_PASSTHROUGH_EFFORT = new Set([
|
|
42
|
+
"kimi/kimi-k3",
|
|
43
|
+
"kimi/kimi-k3.1-pro",
|
|
44
|
+
"kimi/kimi-k3.1-pro-highspeed",
|
|
45
|
+
]);
|
|
46
|
+
const ALIBABA_KIMI_PASSTHROUGH_TOGGLE = new Set(["kimi/kimi-k2.6"]);
|
|
47
|
+
function isAlibabaKimi(providerId, modelId) {
|
|
48
|
+
return providerId === "alibaba" && /^(kimi\/)?kimi-/i.test(modelId);
|
|
49
|
+
}
|
|
25
50
|
function isFireworksKimi(providerId, modelId) {
|
|
26
51
|
const model = modelId.toLowerCase();
|
|
27
52
|
return providerId === "fireworks" && (model.includes("kimi")
|
|
@@ -120,6 +145,31 @@ export function resolveProviderRequestConfig(providerId, modelId, requestedLevel
|
|
|
120
145
|
},
|
|
121
146
|
};
|
|
122
147
|
}
|
|
148
|
+
// DashScope-hosted Kimi: the server rejects any temperature but the locked
|
|
149
|
+
// one ("Parameter 'temperature'=0.2 is not supported for kimi-k3 model").
|
|
150
|
+
// First-party ids take reasoning_effort validated against DashScope's own
|
|
151
|
+
// list, where "none" disables thinking (verified on kimi-k3/k2.5/k2.6; K2.7
|
|
152
|
+
// Code stays in thinking mode whatever is sent). Passthrough ids follow the
|
|
153
|
+
// documented contract above. Models missing from the catalog get no
|
|
154
|
+
// thinking field, so a thinking-only newcomer is never switched off.
|
|
155
|
+
if (isAlibabaKimi(providerId, modelId)) {
|
|
156
|
+
let extraBody;
|
|
157
|
+
if (ALIBABA_KIMI_PASSTHROUGH_EFFORT.has(modelId)) {
|
|
158
|
+
extraBody = { reasoning_effort: effectiveThinkingLevel };
|
|
159
|
+
}
|
|
160
|
+
else if (ALIBABA_KIMI_PASSTHROUGH_TOGGLE.has(modelId)) {
|
|
161
|
+
extraBody = { enable_thinking: effectiveThinkingLevel !== "off" };
|
|
162
|
+
}
|
|
163
|
+
else if (!modelId.toLowerCase().startsWith("kimi/") && getBuiltinModel(providerId, modelId)) {
|
|
164
|
+
extraBody = { reasoning_effort: effectiveThinkingLevel === "off" ? "none" : effectiveThinkingLevel };
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
effectiveThinkingLevel,
|
|
168
|
+
omitTemperature: true,
|
|
169
|
+
reasoningContentEcho: "tool_calls",
|
|
170
|
+
extraBody,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
123
173
|
if (providerId === "stepfun-api") {
|
|
124
174
|
return { effectiveThinkingLevel, reasoningContentEcho: "none" };
|
|
125
175
|
}
|
|
@@ -223,7 +273,12 @@ export function resolveProviderRequestConfig(providerId, modelId, requestedLevel
|
|
|
223
273
|
},
|
|
224
274
|
};
|
|
225
275
|
}
|
|
226
|
-
|
|
276
|
+
// Unlisted Moonshot models: every generation since K2.5 locks temperature
|
|
277
|
+
// and 400s on any other value, so let the server pick its own default.
|
|
278
|
+
// Pre-K2.5 ids (moonshot-v1, kimi-k2-*-preview) are deliberately not
|
|
279
|
+
// supported: the endpoints no longer list them, and they would merely lose
|
|
280
|
+
// the 0.2 default here rather than fail.
|
|
281
|
+
return { effectiveThinkingLevel, omitTemperature: true };
|
|
227
282
|
}
|
|
228
283
|
if (providerId === "openai"
|
|
229
284
|
|| providerId === "google"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CombinedAutocompleteProvider, } from "@bubblebrain-ai/pi-tui";
|
|
2
2
|
import { BUILTIN_PROVIDERS, encodeModel, isUserVisibleProvider, } from "../provider-registry.js";
|
|
3
|
-
import { getAvailableThinkingLevels, isThinkingToggleModel, normalizeThinkingLevel, } from "../provider-transform.js";
|
|
3
|
+
import { getAvailableThinkingLevels, isThinkingOnlyLevels, isThinkingToggleModel, normalizeThinkingLevel, } from "../provider-transform.js";
|
|
4
4
|
import { GROK_SUBSCRIPTION_PROVIDER_ID, isGrokSubscriptionProviderId, } from "../external-runtime/grok-provider.js";
|
|
5
5
|
import { discoverModelProviderGroups, getVisibleModelProviders, localModelsForProvider, } from "./model-picker-data.js";
|
|
6
6
|
const MODEL_COMMAND_PREFIX = "/model ";
|
|
@@ -109,9 +109,14 @@ export function buildModelAutocompleteItems(groups, argumentPrefix = "", current
|
|
|
109
109
|
for (const selection of selections) {
|
|
110
110
|
const { provider, model, value, levels } = selection;
|
|
111
111
|
const label = model.name || model.id;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
// A model with one fixed grade skips the effort step, so name the grade
|
|
113
|
+
// here or the user never learns which effort it runs at.
|
|
114
|
+
const fixedEffort = levels.length === 1 && levels[0] !== "off" && !isThinkingOnlyLevels(levels)
|
|
115
|
+
? `${levels[0]} effort`
|
|
116
|
+
: undefined;
|
|
117
|
+
const description = [provider.name, label === model.id ? undefined : model.id, fixedEffort]
|
|
118
|
+
.filter(Boolean)
|
|
119
|
+
.join(" · ");
|
|
115
120
|
const searchable = `${value} ${label} ${description}`.toLowerCase();
|
|
116
121
|
if (query && !searchable.includes(query))
|
|
117
122
|
continue;
|
|
@@ -2,9 +2,11 @@ import type { ThinkingLevel } from "../types.js";
|
|
|
2
2
|
export declare function getAvailableThinkingLevels(providerId: string, modelId: string): ThinkingLevel[];
|
|
3
3
|
export declare function getDefaultThinkingLevel(providerId: string, modelId: string): ThinkingLevel;
|
|
4
4
|
/**
|
|
5
|
-
* A
|
|
5
|
+
* A lone "medium" means the model is always in thinking mode with no
|
|
6
6
|
* user-facing grades (e.g. kimi-k2.7-code) — the level value is an internal
|
|
7
|
-
* placeholder and must not be shown to the user as an effort grade.
|
|
7
|
+
* placeholder and must not be shown to the user as an effort grade. Any other
|
|
8
|
+
* lone level (e.g. DashScope's max-only Kimi K3) is a real fixed grade that
|
|
9
|
+
* the provider sends verbatim, so it is shown.
|
|
8
10
|
*/
|
|
9
11
|
export declare function isThinkingOnlyLevels(levels: readonly ThinkingLevel[]): boolean;
|
|
10
12
|
export declare function isThinkingOnlyModel(providerId?: string, modelId?: string): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getBuiltinModel, getModelDefaultReasoningLevel } from "../model-catalog.js";
|
|
2
2
|
import { clampThinkingLevel } from "./thinking-level.js";
|
|
3
|
-
const KIMI_TOGGLE_PROVIDER_IDS = new Set(["moonshot-cn", "moonshot-intl", "kimi-for-coding"]);
|
|
4
|
-
const KIMI_THINKING_TOGGLE_MODELS = new Set(["kimi-k2.5", "kimi-k2.6"]);
|
|
3
|
+
const KIMI_TOGGLE_PROVIDER_IDS = new Set(["moonshot-cn", "moonshot-intl", "kimi-for-coding", "alibaba"]);
|
|
4
|
+
const KIMI_THINKING_TOGGLE_MODELS = new Set(["kimi-k2.5", "kimi-k2.6", "kimi/kimi-k2.6"]);
|
|
5
5
|
export function getAvailableThinkingLevels(providerId, modelId) {
|
|
6
6
|
return getBuiltinModel(providerId, modelId)?.reasoningLevels ?? ["off"];
|
|
7
7
|
}
|
|
@@ -13,12 +13,14 @@ export function getDefaultThinkingLevel(providerId, modelId) {
|
|
|
13
13
|
return levels.includes("medium") ? "medium" : levels[0] || "off";
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* A
|
|
16
|
+
* A lone "medium" means the model is always in thinking mode with no
|
|
17
17
|
* user-facing grades (e.g. kimi-k2.7-code) — the level value is an internal
|
|
18
|
-
* placeholder and must not be shown to the user as an effort grade.
|
|
18
|
+
* placeholder and must not be shown to the user as an effort grade. Any other
|
|
19
|
+
* lone level (e.g. DashScope's max-only Kimi K3) is a real fixed grade that
|
|
20
|
+
* the provider sends verbatim, so it is shown.
|
|
19
21
|
*/
|
|
20
22
|
export function isThinkingOnlyLevels(levels) {
|
|
21
|
-
return levels.length === 1 && levels[0]
|
|
23
|
+
return levels.length === 1 && levels[0] === "medium";
|
|
22
24
|
}
|
|
23
25
|
export function isThinkingOnlyModel(providerId = "", modelId = "") {
|
|
24
26
|
return isThinkingOnlyLevels(getAvailableThinkingLevels(providerId, modelId));
|