@openclaw/kimi-provider 2026.9.4 → 2026.9.5

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.
@@ -0,0 +1,30 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2
+ <!--
3
+ Adapted from OpenClaw ui/public/provider-icons/ProviderIcon-kimi.svg.
4
+ Source: https://github.com/steipete/CodexBar/blob/215efbd39ad58acb4b0cd637c407d63e6183bc8d/Sources/CodexBar/Resources/ProviderIcon-kimi.svg
5
+
6
+ MIT License
7
+ Copyright (c) 2026 Peter Steinberger
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ Names and marks remain the property of their respective owners.
28
+ -->
29
+ <path fill="currentColor" fill-rule="evenodd" stroke="none" transform="translate(0 -0.56)" d="M21.7202 0.939941C22.9502 0.939941 23.9502 1.93994 23.9502 3.16994C23.9502 4.39994 22.9502 5.39994 21.7202 5.39994H19.7502C19.6002 5.39994 19.4902 5.27994 19.4902 5.13994V3.16994C19.4902 1.93994 20.4902 0.939941 21.7202 0.939941ZM9.39 13.9501L17.82 5.59012C17.98 5.43012 17.89 5.12012 17.68 5.12012H13.14C13.14 5.12012 13.04 5.14012 13 5.18012L3.92 14.1901C3.78 14.3301 3.57 14.2101 3.57 13.9801V5.39012C3.57 5.24012 3.47 5.12012 3.35 5.12012H0.219999C0.0999993 5.12012 0 5.24012 0 5.39012V23.9201C0 24.0701 0.0999993 24.1901 0.219999 24.1901H3.35C3.47 24.1901 3.57 24.0701 3.57 23.9201V20.1401C3.57 20.0601 3.6 19.9801 3.65 19.9301L6.47 17.1401C6.54 17.0701 6.63 17.0601 6.71 17.1101L14.24 22.6501C15.47 23.4801 16.85 23.9901 18.25 24.1401C18.37 24.1501 18.48 24.0301 18.48 23.8701V20.3101C18.48 20.1701 18.4 20.0601 18.29 20.0501C17.47 19.9201 16.66 19.6001 15.94 19.1101L9.42 14.3901C9.28 14.3001 9.27 14.0701 9.39 13.9501Z" />
30
+ </svg>
Binary file
@@ -10,6 +10,11 @@ var openclaw_plugin_default = {
10
10
  "kimi-code",
11
11
  "kimi-coding"
12
12
  ],
13
+ modelIdNormalization: { "providers": { "kimi": { "aliases": {
14
+ "kimi-code": "kimi-for-coding",
15
+ "k2p5": "kimi-for-coding",
16
+ "k3[1m]": "k3"
17
+ } } } },
13
18
  providerRequest: { "providers": {
14
19
  "kimi": {
15
20
  "family": "moonshot",
@@ -34,7 +39,6 @@ var openclaw_plugin_default = {
34
39
  "reasoning": true,
35
40
  "upstreamModel": "moonshot/kimi-k3",
36
41
  "thinkingLevelMap": {
37
- "off": null,
38
42
  "minimal": "low",
39
43
  "low": "low",
40
44
  "medium": "high",
@@ -59,7 +63,6 @@ var openclaw_plugin_default = {
59
63
  "reasoning": true,
60
64
  "upstreamModel": "moonshot/kimi-k3",
61
65
  "thinkingLevelMap": {
62
- "off": null,
63
66
  "minimal": "low",
64
67
  "low": "low",
65
68
  "medium": "high",
@@ -151,10 +154,10 @@ var openclaw_plugin_default = {
151
154
  //#region extensions/kimi-coding/provider-catalog.ts
152
155
  const KIMI_PROVIDER_ID = "kimi";
153
156
  const KIMI_CODING_CATALOG = openclaw_plugin_default.modelCatalog.providers.kimi;
154
- const KIMI_LEGACY_MODEL_IDS = ["kimi-code", "k2p5"];
157
+ const KIMI_MODEL_ALIASES = new Map(Object.entries(openclaw_plugin_default.modelIdNormalization.providers.kimi.aliases));
155
158
  const KIMI_CODING_BASE_URL = KIMI_CODING_CATALOG.baseUrl;
156
159
  const KIMI_CODING_DEFAULT_MODEL_ID = KIMI_CODING_CATALOG.defaultModel;
157
- const KIMI_CODING_LEGACY_MODEL_IDS = KIMI_LEGACY_MODEL_IDS;
160
+ const KIMI_CODING_LEGACY_MODEL_IDS = ["kimi-code", "k2p5"];
158
161
  function buildKimiCodingProvider() {
159
162
  return buildManifestModelProviderConfig({
160
163
  providerId: KIMI_PROVIDER_ID,
@@ -162,8 +165,7 @@ function buildKimiCodingProvider() {
162
165
  });
163
166
  }
164
167
  function normalizeKimiCodingModelId(modelId) {
165
- if (modelId === "k3[1m]") return "k3";
166
- return KIMI_LEGACY_MODEL_IDS.includes(modelId) ? KIMI_CODING_DEFAULT_MODEL_ID : modelId;
168
+ return KIMI_MODEL_ALIASES.get(modelId) ?? modelId;
167
169
  }
168
170
  //#endregion
169
171
  export { normalizeKimiCodingModelId as a, buildKimiCodingProvider as i, KIMI_CODING_DEFAULT_MODEL_ID as n, openclaw_plugin_default as o, KIMI_CODING_LEGACY_MODEL_IDS as r, KIMI_CODING_BASE_URL as t };
package/dist/api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as normalizeKimiCodingModelId, i as buildKimiCodingProvider, n as KIMI_CODING_DEFAULT_MODEL_ID, r as KIMI_CODING_LEGACY_MODEL_IDS, t as KIMI_CODING_BASE_URL } from "./provider-catalog-Dlm8Jmp0.js";
1
+ import { a as normalizeKimiCodingModelId, i as buildKimiCodingProvider, n as KIMI_CODING_DEFAULT_MODEL_ID, r as KIMI_CODING_LEGACY_MODEL_IDS, t as KIMI_CODING_BASE_URL } from "./.setup/provider-catalog-CTBTXcRa.mjs";
2
2
  import { KIMI_CODING_MODEL_REF, KIMI_MODEL_REF } from "./onboard.js";
3
3
  export { KIMI_CODING_BASE_URL, KIMI_CODING_DEFAULT_MODEL_ID, KIMI_CODING_LEGACY_MODEL_IDS, KIMI_CODING_MODEL_REF, KIMI_MODEL_REF, buildKimiCodingProvider, normalizeKimiCodingModelId };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as normalizeKimiCodingModelId, i as buildKimiCodingProvider, o as openclaw_plugin_default } from "./provider-catalog-Dlm8Jmp0.js";
1
+ import { a as normalizeKimiCodingModelId, i as buildKimiCodingProvider, o as openclaw_plugin_default } from "./.setup/provider-catalog-CTBTXcRa.mjs";
2
2
  import { KIMI_CODING_MODEL_REF, applyKimiCodeConfig } from "./onboard.js";
3
3
  import { isKimiK3ModelId, resolveThinkingProfile } from "./provider-policy-api.js";
4
4
  import { KIMI_REPLAY_POLICY } from "./replay-policy.js";
package/dist/onboard.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as buildKimiCodingProvider, n as KIMI_CODING_DEFAULT_MODEL_ID, t as KIMI_CODING_BASE_URL } from "./provider-catalog-Dlm8Jmp0.js";
1
+ import { i as buildKimiCodingProvider, n as KIMI_CODING_DEFAULT_MODEL_ID, t as KIMI_CODING_BASE_URL } from "./.setup/provider-catalog-CTBTXcRa.mjs";
2
2
  import { createDefaultModelsPresetAppliers } from "openclaw/plugin-sdk/provider-onboard";
3
3
  //#region extensions/kimi-coding/onboard.ts
4
4
  const KIMI_MODEL_REF = `kimi/${KIMI_CODING_DEFAULT_MODEL_ID}`;
@@ -1,2 +1,2 @@
1
- import { a as normalizeKimiCodingModelId, i as buildKimiCodingProvider, n as KIMI_CODING_DEFAULT_MODEL_ID, r as KIMI_CODING_LEGACY_MODEL_IDS, t as KIMI_CODING_BASE_URL } from "./provider-catalog-Dlm8Jmp0.js";
1
+ import { a as normalizeKimiCodingModelId, i as buildKimiCodingProvider, n as KIMI_CODING_DEFAULT_MODEL_ID, r as KIMI_CODING_LEGACY_MODEL_IDS, t as KIMI_CODING_BASE_URL } from "./.setup/provider-catalog-CTBTXcRa.mjs";
2
2
  export { KIMI_CODING_BASE_URL, KIMI_CODING_DEFAULT_MODEL_ID, KIMI_CODING_LEGACY_MODEL_IDS, buildKimiCodingProvider, normalizeKimiCodingModelId };
package/dist/stream.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { isKimiK3ModelId } from "./provider-policy-api.js";
2
- import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
2
+ import { isRecord, normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import { streamSimple } from "openclaw/plugin-sdk/llm";
4
- import { createPayloadPatchStreamWrapper, normalizeOpenAICompatibleReasoningReplay } from "openclaw/plugin-sdk/provider-stream-shared";
4
+ import { normalizeOpenAICompatibleReasoningReplay, streamWithPayloadPatch } from "openclaw/plugin-sdk/provider-stream-shared";
5
5
  //#region extensions/kimi-coding/stream.ts
6
6
  const TOOL_CALLS_SECTION_BEGIN = "<|tool_calls_section_begin|>";
7
7
  const TOOL_CALLS_SECTION_END = "<|tool_calls_section_end|>";
@@ -63,46 +63,31 @@ function normalizeKimiThinkingType(value) {
63
63
  ].includes(normalized)) return "disabled";
64
64
  return;
65
65
  }
66
- if (value && typeof value === "object" && !Array.isArray(value)) return normalizeKimiThinkingType(value.type);
66
+ if (isRecord(value)) return normalizeKimiThinkingType(value.type);
67
67
  }
68
68
  function normalizeKimiThinkingConfig(value) {
69
69
  const type = normalizeKimiThinkingType(value);
70
70
  if (!type) return;
71
71
  if (type === "disabled") return { type: "disabled" };
72
- if (!value || typeof value !== "object" || Array.isArray(value)) return { type: "enabled" };
73
- const record = value;
74
- const budgetTokens = normalizeKimiThinkingBudgetTokens(record.budget_tokens ?? record.budgetTokens);
72
+ if (!isRecord(value)) return { type: "enabled" };
73
+ const budgetTokens = normalizeKimiThinkingBudgetTokens(value.budget_tokens ?? value.budgetTokens);
75
74
  return budgetTokens === void 0 ? { type: "enabled" } : {
76
75
  type: "enabled",
77
76
  budget_tokens: budgetTokens
78
77
  };
79
78
  }
80
- function resolveKimiAnthropicThinkingBudgetTokens(thinkingLevel) {
81
- if (!thinkingLevel || thinkingLevel === "off") return;
82
- return KIMI_ANTHROPIC_THINKING_BUDGETS[thinkingLevel];
83
- }
84
- function resolveKimiThinkingConfig(params) {
85
- const configured = normalizeKimiThinkingConfig(params.configuredThinking);
86
- const levelBudgetTokens = resolveKimiAnthropicThinkingBudgetTokens(params.thinkingLevel);
79
+ function resolveKimiThinkingConfig(configured, thinkingLevel) {
80
+ const levelBudgetTokens = thinkingLevel && thinkingLevel !== "off" ? KIMI_ANTHROPIC_THINKING_BUDGETS[thinkingLevel] : void 0;
87
81
  if (configured) return configured.type === "enabled" && configured.budget_tokens === void 0 ? {
88
82
  type: "enabled",
89
83
  budget_tokens: levelBudgetTokens ?? 1024
90
84
  } : configured;
91
- if (!params.thinkingLevel || params.thinkingLevel === "off") return { type: "disabled" };
85
+ if (!thinkingLevel || thinkingLevel === "off") return { type: "disabled" };
92
86
  return levelBudgetTokens === void 0 ? { type: "enabled" } : {
93
87
  type: "enabled",
94
88
  budget_tokens: levelBudgetTokens
95
89
  };
96
90
  }
97
- function resolveKimiK3ThinkingConfig(params) {
98
- const configured = normalizeKimiThinkingConfig(params.configuredThinking);
99
- if (configured?.type === "disabled") return { type: "disabled" };
100
- if (!configured && params.thinkingLevel === "off") return { type: "disabled" };
101
- return {
102
- type: "adaptive",
103
- effort: params.thinkingLevel && params.thinkingLevel !== "off" ? KIMI_K3_THINKING_EFFORTS[params.thinkingLevel] : "high"
104
- };
105
- }
106
91
  function stripTaggedToolCallCounter(value) {
107
92
  return value.trim().replace(/:\d+$/, "");
108
93
  }
@@ -131,7 +116,7 @@ function parseKimiTaggedToolCalls(text) {
131
116
  } catch {
132
117
  return null;
133
118
  }
134
- if (!parsedArgs || typeof parsedArgs !== "object" || Array.isArray(parsedArgs)) return null;
119
+ if (!isRecord(parsedArgs)) return null;
135
120
  const name = stripTaggedToolCallCounter(rawId);
136
121
  if (!name) return null;
137
122
  toolCalls.push({
@@ -218,56 +203,56 @@ function createKimiToolCallMarkupWrapper(baseStreamFn) {
218
203
  return wrapStreamMessageObjects(maybeStream, rewriteKimiTaggedToolCallsInMessage);
219
204
  };
220
205
  }
221
- function createKimiThinkingWrapper(baseStreamFn, thinkingConfig, k3ThinkingConfig) {
222
- const payloadWrapper = createPayloadPatchStreamWrapper(baseStreamFn ?? streamSimple, ({ payload: payloadObj, model }) => {
223
- if (model.api === "anthropic-messages" && isKimiK3ModelId(model.id)) {
224
- const outputConfig = payloadObj.output_config;
225
- if (k3ThinkingConfig.type === "disabled") {
226
- payloadObj.thinking = { type: "disabled" };
227
- if (outputConfig && typeof outputConfig === "object" && !Array.isArray(outputConfig)) {
228
- const nextOutputConfig = { ...outputConfig };
229
- delete nextOutputConfig.effort;
230
- if (Object.keys(nextOutputConfig).length > 0) payloadObj.output_config = nextOutputConfig;
231
- else delete payloadObj.output_config;
232
- } else delete payloadObj.output_config;
233
- } else {
234
- payloadObj.thinking = {
235
- type: "adaptive",
236
- display: "summarized"
237
- };
238
- payloadObj.output_config = outputConfig && typeof outputConfig === "object" && !Array.isArray(outputConfig) ? {
239
- ...outputConfig,
240
- effort: k3ThinkingConfig.effort
241
- } : { effort: k3ThinkingConfig.effort };
206
+ function wrapKimiProviderStream(ctx) {
207
+ const configured = normalizeKimiThinkingConfig(ctx.extraParams?.thinking);
208
+ const underlying = ctx.streamFn ?? streamSimple;
209
+ return createKimiToolCallMarkupWrapper((model, context, options) => {
210
+ const anthropic = (ctx.sourceApi ?? model.api) === "anthropic-messages";
211
+ const k3 = anthropic && isKimiK3ModelId(model.id);
212
+ const thinkingLevel = options?.reasoning ?? ctx.thinkingLevel ?? (k3 ? "high" : void 0);
213
+ const thinkingConfig = resolveKimiThinkingConfig(configured, thinkingLevel);
214
+ const enabledLevel = thinkingLevel && thinkingLevel !== "off" ? thinkingLevel : k3 ? "high" : "low";
215
+ const nativeLevel = enabledLevel === "adaptive" ? "high" : enabledLevel;
216
+ const reasoning = thinkingConfig.type === "disabled" ? "off" : k3 ? KIMI_K3_THINKING_EFFORTS[nativeLevel] : nativeLevel;
217
+ const runtimeModel = k3 ? {
218
+ ...model,
219
+ compat: {
220
+ ...model.compat,
221
+ allowEmptySignature: true
242
222
  }
223
+ } : model;
224
+ return streamWithPayloadPatch(underlying, runtimeModel, context, {
225
+ ...options,
226
+ reasoning
227
+ }, (payloadObj) => {
243
228
  delete payloadObj.reasoning;
244
229
  delete payloadObj.reasoning_effort;
245
230
  delete payloadObj.reasoningEffort;
246
231
  stripAnthropicCacheControlMarkers(payloadObj);
247
- return;
248
- }
249
- const normalized = typeof thinkingConfig === "string" ? { type: thinkingConfig } : thinkingConfig;
250
- payloadObj.thinking = model.api === "anthropic-messages" ? { ...normalized } : { type: normalized.type };
251
- if (model.api === "anthropic-messages") ensureKimiAnthropicMaxTokens(payloadObj, normalized);
252
- else normalizeOpenAICompatibleReasoningReplay(payloadObj, {
253
- thinkingEnabled: normalized.type === "enabled",
254
- shouldBackfillAssistantMessage: (message) => Array.isArray(message.tool_calls) && message.tool_calls.length > 0
232
+ if (k3) {
233
+ const outputConfig = isRecord(payloadObj.output_config) ? { ...payloadObj.output_config } : {};
234
+ if (thinkingConfig.type === "disabled") {
235
+ payloadObj.thinking = { type: "disabled" };
236
+ delete outputConfig.effort;
237
+ } else {
238
+ payloadObj.thinking = {
239
+ type: "adaptive",
240
+ display: "summarized"
241
+ };
242
+ outputConfig.effort = reasoning;
243
+ }
244
+ if (Object.keys(outputConfig).length > 0) payloadObj.output_config = outputConfig;
245
+ else delete payloadObj.output_config;
246
+ return;
247
+ }
248
+ payloadObj.thinking = anthropic ? { ...thinkingConfig } : { type: thinkingConfig.type };
249
+ if (anthropic) ensureKimiAnthropicMaxTokens(payloadObj, thinkingConfig);
250
+ else normalizeOpenAICompatibleReasoningReplay(payloadObj, {
251
+ thinkingEnabled: thinkingConfig.type === "enabled",
252
+ shouldBackfillAssistantMessage: (message) => Array.isArray(message.tool_calls) && message.tool_calls.length > 0
253
+ });
255
254
  });
256
- delete payloadObj.reasoning;
257
- delete payloadObj.reasoning_effort;
258
- delete payloadObj.reasoningEffort;
259
- stripAnthropicCacheControlMarkers(payloadObj);
260
255
  });
261
- return (model, context, options) => {
262
- const runtimeModel = model.api === "anthropic-messages" && isKimiK3ModelId(model.id) ? {
263
- ...model,
264
- compat: {
265
- ...model.compat,
266
- allowEmptySignature: true
267
- }
268
- } : model;
269
- return payloadWrapper(runtimeModel, context, options);
270
- };
271
256
  }
272
257
  function stripContentBlockCacheControl(block) {
273
258
  if (!block || typeof block !== "object") return;
@@ -287,16 +272,5 @@ function stripAnthropicCacheControlMarkers(payloadObj) {
287
272
  stripContentArrayCacheControl(message.content);
288
273
  }
289
274
  }
290
- function wrapKimiProviderStream(ctx) {
291
- const thinkingConfig = resolveKimiThinkingConfig({
292
- configuredThinking: ctx.extraParams?.thinking,
293
- thinkingLevel: ctx.thinkingLevel
294
- });
295
- const k3ThinkingConfig = resolveKimiK3ThinkingConfig({
296
- configuredThinking: ctx.extraParams?.thinking,
297
- thinkingLevel: ctx.thinkingLevel
298
- });
299
- return createKimiToolCallMarkupWrapper(createKimiThinkingWrapper(ctx.streamFn, thinkingConfig, k3ThinkingConfig));
300
- }
301
275
  //#endregion
302
276
  export { wrapKimiProviderStream };
@@ -6,6 +6,17 @@
6
6
  },
7
7
  "enabledByDefault": true,
8
8
  "providers": ["kimi", "kimi-code", "kimi-coding"],
9
+ "modelIdNormalization": {
10
+ "providers": {
11
+ "kimi": {
12
+ "aliases": {
13
+ "kimi-code": "kimi-for-coding",
14
+ "k2p5": "kimi-for-coding",
15
+ "k3[1m]": "k3"
16
+ }
17
+ }
18
+ }
19
+ },
9
20
  "providerRequest": {
10
21
  "providers": {
11
22
  "kimi": {
@@ -37,7 +48,6 @@
37
48
  "reasoning": true,
38
49
  "upstreamModel": "moonshot/kimi-k3",
39
50
  "thinkingLevelMap": {
40
- "off": null,
41
51
  "minimal": "low",
42
52
  "low": "low",
43
53
  "medium": "high",
@@ -64,7 +74,6 @@
64
74
  "reasoning": true,
65
75
  "upstreamModel": "moonshot/kimi-k3",
66
76
  "thinkingLevelMap": {
67
- "off": null,
68
77
  "minimal": "low",
69
78
  "low": "low",
70
79
  "medium": "high",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/kimi-provider",
3
- "version": "2026.9.4",
3
+ "version": "2026.9.5",
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.9.4"
21
+ "pluginApi": ">=2026.9.5"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.9.4",
24
+ "openclawVersion": "2026.9.5",
25
25
  "bundledDist": false
26
26
  },
27
27
  "release": {
@@ -35,10 +35,12 @@
35
35
  "files": [
36
36
  "dist/**",
37
37
  "openclaw.plugin.json",
38
- "README.md"
38
+ "README.md",
39
+ "assets/icon.png",
40
+ "assets/activity.svg"
39
41
  ],
40
42
  "peerDependencies": {
41
- "openclaw": ">=2026.9.4"
43
+ "openclaw": ">=2026.9.5"
42
44
  },
43
45
  "peerDependenciesMeta": {
44
46
  "openclaw": {