@openclaw/kimi-provider 2026.7.2-beta.2 → 2026.7.2-beta.3
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/index.js +7 -22
- package/dist/provider-catalog.js +12 -14
- package/dist/provider-policy-api.js +30 -0
- package/dist/stream.js +30 -8
- package/npm-shrinkwrap.json +2 -2
- package/openclaw.plugin.json +2 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isKimiK3ModelId, resolveThinkingProfile } from "./provider-policy-api.js";
|
|
2
|
+
import { buildKimiCodingProvider, normalizeKimiCodingModelId } from "./provider-catalog.js";
|
|
2
3
|
import { KIMI_CODING_MODEL_REF, applyKimiCodeConfig } from "./onboard.js";
|
|
3
4
|
import { KIMI_REPLAY_POLICY } from "./replay-policy.js";
|
|
4
5
|
import { wrapKimiProviderStream } from "./stream.js";
|
|
@@ -30,7 +31,7 @@ var kimi_coding_default = definePluginEntry({
|
|
|
30
31
|
providerId: PROVIDER_ID,
|
|
31
32
|
methodId: "api-key",
|
|
32
33
|
label: "Kimi Code API key (subscription)",
|
|
33
|
-
hint: "Kimi
|
|
34
|
+
hint: "Kimi Code membership · https://www.kimi.com/membership/pricing",
|
|
34
35
|
optionKey: "kimiCodeApiKey",
|
|
35
36
|
flagName: "--kimi-code-api-key",
|
|
36
37
|
envVar: "KIMI_API_KEY",
|
|
@@ -42,14 +43,14 @@ var kimi_coding_default = definePluginEntry({
|
|
|
42
43
|
"kimi-coding"
|
|
43
44
|
],
|
|
44
45
|
applyConfig: (cfg) => applyKimiCodeConfig(cfg),
|
|
45
|
-
noteMessage: ["Kimi uses a dedicated coding endpoint and API key.", "Get your API key at: https://www.kimi.com/code/
|
|
46
|
+
noteMessage: ["Kimi uses a dedicated coding endpoint and API key.", "Get your API key at: https://www.kimi.com/code/console"].join("\n"),
|
|
46
47
|
noteTitle: "Kimi",
|
|
47
48
|
wizard: {
|
|
48
49
|
choiceId: "kimi-code-api-key",
|
|
49
50
|
choiceLabel: "Kimi Code API key (subscription)",
|
|
50
51
|
groupId: "moonshot",
|
|
51
|
-
groupLabel: "Moonshot AI (Kimi
|
|
52
|
-
groupHint: "Kimi
|
|
52
|
+
groupLabel: "Moonshot AI (Kimi)",
|
|
53
|
+
groupHint: "Kimi Code membership · https://www.kimi.com/membership/pricing"
|
|
53
54
|
}
|
|
54
55
|
})],
|
|
55
56
|
catalog: {
|
|
@@ -80,23 +81,7 @@ var kimi_coding_default = definePluginEntry({
|
|
|
80
81
|
id: normalizedId
|
|
81
82
|
};
|
|
82
83
|
},
|
|
83
|
-
resolveThinkingProfile
|
|
84
|
-
levels: [{
|
|
85
|
-
id: "max",
|
|
86
|
-
label: "max"
|
|
87
|
-
}],
|
|
88
|
-
defaultLevel: "max",
|
|
89
|
-
preserveWhenCatalogReasoningFalse: true
|
|
90
|
-
} : {
|
|
91
|
-
levels: [{
|
|
92
|
-
id: "off",
|
|
93
|
-
label: "off"
|
|
94
|
-
}, {
|
|
95
|
-
id: "low",
|
|
96
|
-
label: "on"
|
|
97
|
-
}],
|
|
98
|
-
defaultLevel: "off"
|
|
99
|
-
},
|
|
84
|
+
resolveThinkingProfile,
|
|
100
85
|
wrapSimpleCompletionStreamFn: (ctx) => isKimiK3ModelId(ctx.modelId) ? wrapKimiProviderStream(ctx) : ctx.streamFn,
|
|
101
86
|
wrapStreamFn: wrapKimiProviderStream
|
|
102
87
|
});
|
package/dist/provider-catalog.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { KIMI_K3_MODEL_IDS } from "./provider-policy-api.js";
|
|
1
2
|
//#region extensions/kimi-coding/provider-catalog.ts
|
|
2
3
|
const KIMI_BASE_URL = "https://api.kimi.com/coding/";
|
|
3
4
|
const KIMI_CODING_USER_AGENT = "claude-code/0.1.0";
|
|
4
5
|
const KIMI_DEFAULT_MODEL_ID = "kimi-for-coding";
|
|
5
|
-
const
|
|
6
|
+
const KIMI_HIGHSPEED_MODEL_ID = "kimi-for-coding-highspeed";
|
|
6
7
|
const KIMI_LEGACY_MODEL_IDS = ["kimi-code", "k2p5"];
|
|
7
8
|
const KIMI_CODING_DEFAULT_CONTEXT_WINDOW = 262144;
|
|
8
9
|
const KIMI_CODING_DEFAULT_MAX_TOKENS = 32768;
|
|
@@ -28,6 +29,15 @@ function buildKimiCodingProvider() {
|
|
|
28
29
|
contextWindow: KIMI_CODING_DEFAULT_CONTEXT_WINDOW,
|
|
29
30
|
maxTokens: KIMI_CODING_DEFAULT_MAX_TOKENS
|
|
30
31
|
},
|
|
32
|
+
{
|
|
33
|
+
id: KIMI_HIGHSPEED_MODEL_ID,
|
|
34
|
+
name: "Kimi K2.7 Code HighSpeed",
|
|
35
|
+
reasoning: true,
|
|
36
|
+
input: [...KIMI_CODING_INPUT],
|
|
37
|
+
cost: KIMI_CODING_DEFAULT_COST,
|
|
38
|
+
contextWindow: KIMI_CODING_DEFAULT_CONTEXT_WINDOW,
|
|
39
|
+
maxTokens: KIMI_CODING_DEFAULT_MAX_TOKENS
|
|
40
|
+
},
|
|
31
41
|
...KIMI_K3_MODEL_IDS.map((id) => ({
|
|
32
42
|
id,
|
|
33
43
|
name: id === "k3" ? "Kimi K3" : "Kimi K3 (1M)",
|
|
@@ -45,15 +55,6 @@ function buildKimiCodingProvider() {
|
|
|
45
55
|
cost: KIMI_CODING_DEFAULT_COST,
|
|
46
56
|
contextWindow: id === "k3" ? KIMI_CODING_DEFAULT_CONTEXT_WINDOW : 1048576,
|
|
47
57
|
maxTokens: KIMI_CODING_DEFAULT_MAX_TOKENS
|
|
48
|
-
})),
|
|
49
|
-
...KIMI_LEGACY_MODEL_IDS.map((id) => ({
|
|
50
|
-
id,
|
|
51
|
-
name: `Kimi Code (legacy ${id})`,
|
|
52
|
-
reasoning: true,
|
|
53
|
-
input: [...KIMI_CODING_INPUT],
|
|
54
|
-
cost: KIMI_CODING_DEFAULT_COST,
|
|
55
|
-
contextWindow: KIMI_CODING_DEFAULT_CONTEXT_WINDOW,
|
|
56
|
-
maxTokens: KIMI_CODING_DEFAULT_MAX_TOKENS
|
|
57
58
|
}))
|
|
58
59
|
]
|
|
59
60
|
};
|
|
@@ -61,11 +62,8 @@ function buildKimiCodingProvider() {
|
|
|
61
62
|
function normalizeKimiCodingModelId(modelId) {
|
|
62
63
|
return KIMI_LEGACY_MODEL_IDS.includes(modelId) ? KIMI_DEFAULT_MODEL_ID : modelId;
|
|
63
64
|
}
|
|
64
|
-
function isKimiK3ModelId(modelId) {
|
|
65
|
-
return KIMI_K3_MODEL_IDS.includes(modelId);
|
|
66
|
-
}
|
|
67
65
|
const KIMI_CODING_BASE_URL = KIMI_BASE_URL;
|
|
68
66
|
const KIMI_CODING_DEFAULT_MODEL_ID = KIMI_DEFAULT_MODEL_ID;
|
|
69
67
|
const KIMI_CODING_LEGACY_MODEL_IDS = KIMI_LEGACY_MODEL_IDS;
|
|
70
68
|
//#endregion
|
|
71
|
-
export { KIMI_CODING_BASE_URL, KIMI_CODING_DEFAULT_MODEL_ID, KIMI_CODING_LEGACY_MODEL_IDS, buildKimiCodingProvider,
|
|
69
|
+
export { KIMI_CODING_BASE_URL, KIMI_CODING_DEFAULT_MODEL_ID, KIMI_CODING_LEGACY_MODEL_IDS, buildKimiCodingProvider, normalizeKimiCodingModelId };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region extensions/kimi-coding/provider-policy-api.ts
|
|
2
|
+
const KIMI_K3_MODEL_IDS = ["k3", "k3[1m]"];
|
|
3
|
+
function isKimiK3ModelId(modelId) {
|
|
4
|
+
return KIMI_K3_MODEL_IDS.includes(modelId.trim().toLowerCase());
|
|
5
|
+
}
|
|
6
|
+
function resolveThinkingProfile({ modelId }) {
|
|
7
|
+
if (isKimiK3ModelId(modelId)) return {
|
|
8
|
+
levels: [{
|
|
9
|
+
id: "off",
|
|
10
|
+
label: "off"
|
|
11
|
+
}, {
|
|
12
|
+
id: "max",
|
|
13
|
+
label: "max"
|
|
14
|
+
}],
|
|
15
|
+
defaultLevel: "max",
|
|
16
|
+
preserveWhenCatalogReasoningFalse: true
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
levels: [{
|
|
20
|
+
id: "off",
|
|
21
|
+
label: "off"
|
|
22
|
+
}, {
|
|
23
|
+
id: "low",
|
|
24
|
+
label: "on"
|
|
25
|
+
}],
|
|
26
|
+
defaultLevel: "off"
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { KIMI_K3_MODEL_IDS, isKimiK3ModelId, resolveThinkingProfile };
|
package/dist/stream.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isKimiK3ModelId } from "./provider-
|
|
1
|
+
import { isKimiK3ModelId } from "./provider-policy-api.js";
|
|
2
2
|
import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { streamSimple } from "openclaw/plugin-sdk/llm";
|
|
4
4
|
import { streamWithPayloadPatch } from "openclaw/plugin-sdk/provider-stream-shared";
|
|
@@ -101,6 +101,11 @@ function resolveKimiThinkingConfig(params) {
|
|
|
101
101
|
budget_tokens: levelBudgetTokens
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
|
+
function resolveKimiK3ThinkingType(params) {
|
|
105
|
+
const configured = normalizeKimiThinkingConfig(params.configuredThinking);
|
|
106
|
+
if (configured) return configured.type;
|
|
107
|
+
return params.thinkingLevel === "off" ? "disabled" : "enabled";
|
|
108
|
+
}
|
|
104
109
|
function stripTaggedToolCallCounter(value) {
|
|
105
110
|
return value.trim().replace(/:\d+$/, "");
|
|
106
111
|
}
|
|
@@ -216,16 +221,29 @@ function createKimiToolCallMarkupWrapper(baseStreamFn) {
|
|
|
216
221
|
return wrapStreamMessageObjects(maybeStream, rewriteKimiTaggedToolCallsInMessage);
|
|
217
222
|
};
|
|
218
223
|
}
|
|
219
|
-
function createKimiThinkingWrapper(baseStreamFn, thinkingConfig) {
|
|
224
|
+
function createKimiThinkingWrapper(baseStreamFn, thinkingConfig, k3ThinkingType) {
|
|
220
225
|
const underlying = baseStreamFn ?? streamSimple;
|
|
221
226
|
return (model, context, options) => streamWithPayloadPatch(underlying, model, context, options, (payloadObj) => {
|
|
222
227
|
if (model.api === "anthropic-messages" && isKimiK3ModelId(model.id)) {
|
|
223
|
-
payloadObj.thinking = { type: "adaptive" };
|
|
224
228
|
const outputConfig = payloadObj.output_config;
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
+
if (k3ThinkingType === "disabled") {
|
|
230
|
+
payloadObj.thinking = { type: "disabled" };
|
|
231
|
+
if (outputConfig && typeof outputConfig === "object" && !Array.isArray(outputConfig)) {
|
|
232
|
+
const nextOutputConfig = { ...outputConfig };
|
|
233
|
+
delete nextOutputConfig.effort;
|
|
234
|
+
if (Object.keys(nextOutputConfig).length > 0) payloadObj.output_config = nextOutputConfig;
|
|
235
|
+
else delete payloadObj.output_config;
|
|
236
|
+
} else delete payloadObj.output_config;
|
|
237
|
+
} else {
|
|
238
|
+
payloadObj.thinking = {
|
|
239
|
+
type: "adaptive",
|
|
240
|
+
display: "summarized"
|
|
241
|
+
};
|
|
242
|
+
payloadObj.output_config = outputConfig && typeof outputConfig === "object" && !Array.isArray(outputConfig) ? {
|
|
243
|
+
...outputConfig,
|
|
244
|
+
effort: "max"
|
|
245
|
+
} : { effort: "max" };
|
|
246
|
+
}
|
|
229
247
|
delete payloadObj.reasoning;
|
|
230
248
|
delete payloadObj.reasoning_effort;
|
|
231
249
|
delete payloadObj.reasoningEffort;
|
|
@@ -266,7 +284,11 @@ function wrapKimiProviderStream(ctx) {
|
|
|
266
284
|
configuredThinking: ctx.extraParams?.thinking,
|
|
267
285
|
thinkingLevel: ctx.thinkingLevel
|
|
268
286
|
});
|
|
269
|
-
|
|
287
|
+
const k3ThinkingType = resolveKimiK3ThinkingType({
|
|
288
|
+
configuredThinking: ctx.extraParams?.thinking,
|
|
289
|
+
thinkingLevel: ctx.thinkingLevel
|
|
290
|
+
});
|
|
291
|
+
return createKimiToolCallMarkupWrapper(createKimiThinkingWrapper(ctx.streamFn, thinkingConfig, k3ThinkingType));
|
|
270
292
|
}
|
|
271
293
|
//#endregion
|
|
272
294
|
export { wrapKimiProviderStream };
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/kimi-provider",
|
|
3
|
-
"version": "2026.7.2-beta.
|
|
3
|
+
"version": "2026.7.2-beta.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/kimi-provider",
|
|
9
|
-
"version": "2026.7.2-beta.
|
|
9
|
+
"version": "2026.7.2-beta.3"
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
}
|
package/openclaw.plugin.json
CHANGED
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"appGuidedSecret": true,
|
|
58
58
|
"choiceLabel": "Kimi Code API key (subscription)",
|
|
59
59
|
"groupId": "moonshot",
|
|
60
|
-
"groupLabel": "Moonshot AI (Kimi
|
|
61
|
-
"groupHint": "Kimi
|
|
60
|
+
"groupLabel": "Moonshot AI (Kimi)",
|
|
61
|
+
"groupHint": "Kimi Code membership · https://www.kimi.com/membership/pricing",
|
|
62
62
|
"optionKey": "kimiCodeApiKey",
|
|
63
63
|
"cliFlag": "--kimi-code-api-key",
|
|
64
64
|
"cliOption": "--kimi-code-api-key <key>",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/kimi-provider",
|
|
3
|
-
"version": "2026.7.2-beta.
|
|
3
|
+
"version": "2026.7.2-beta.3",
|
|
4
4
|
"description": "OpenClaw Kimi provider plugin.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"minHostVersion": ">=2026.6.8"
|
|
19
19
|
},
|
|
20
20
|
"compat": {
|
|
21
|
-
"pluginApi": ">=2026.7.2-beta.
|
|
21
|
+
"pluginApi": ">=2026.7.2-beta.3"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.7.2-beta.
|
|
24
|
+
"openclawVersion": "2026.7.2-beta.3",
|
|
25
25
|
"bundledDist": false
|
|
26
26
|
},
|
|
27
27
|
"release": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"README.md"
|
|
40
40
|
],
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"openclaw": ">=2026.7.2-beta.
|
|
42
|
+
"openclaw": ">=2026.7.2-beta.3"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
45
45
|
"openclaw": {
|