@openclaw/kimi-provider 2026.9.3 → 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.
- package/README.md +8 -0
- package/assets/activity.svg +30 -0
- package/assets/icon.png +0 -0
- package/dist/{provider-catalog-CLUjA3y1.js → .setup/provider-catalog-CTBTXcRa.mjs} +14 -7
- package/dist/api.js +1 -1
- package/dist/index.js +9 -2
- package/dist/onboard.js +1 -1
- package/dist/provider-catalog.js +1 -1
- package/dist/stream.js +52 -78
- package/openclaw.plugin.json +13 -3
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -11,6 +11,14 @@ openclaw gateway restart
|
|
|
11
11
|
|
|
12
12
|
See <https://docs.openclaw.ai/providers/moonshot> for setup and configuration.
|
|
13
13
|
|
|
14
|
+
## Quota errors
|
|
15
|
+
|
|
16
|
+
Kimi can return HTTP 403 when a weekly usage limit is exhausted. OpenClaw treats
|
|
17
|
+
explicit weekly, seven-day, or quota-reset errors as rate limits. Wait for the
|
|
18
|
+
provider's quota window to reset or use another configured provider; replacing a
|
|
19
|
+
valid API key does not restore quota. Invalid keys and access restrictions keep
|
|
20
|
+
their authentication error handling.
|
|
21
|
+
|
|
14
22
|
## Catalog notes
|
|
15
23
|
|
|
16
24
|
Model rows live in `openclaw.plugin.json` under `modelCatalog.providers.kimi`.
|
|
@@ -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>
|
package/assets/icon.png
ADDED
|
Binary file
|
|
@@ -2,9 +2,19 @@ import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-c
|
|
|
2
2
|
//#region extensions/kimi-coding/openclaw.plugin.json
|
|
3
3
|
var openclaw_plugin_default = {
|
|
4
4
|
id: "kimi",
|
|
5
|
+
categories: ["models"],
|
|
5
6
|
activation: { "onStartup": false },
|
|
6
7
|
enabledByDefault: true,
|
|
7
|
-
providers: [
|
|
8
|
+
providers: [
|
|
9
|
+
"kimi",
|
|
10
|
+
"kimi-code",
|
|
11
|
+
"kimi-coding"
|
|
12
|
+
],
|
|
13
|
+
modelIdNormalization: { "providers": { "kimi": { "aliases": {
|
|
14
|
+
"kimi-code": "kimi-for-coding",
|
|
15
|
+
"k2p5": "kimi-for-coding",
|
|
16
|
+
"k3[1m]": "k3"
|
|
17
|
+
} } } },
|
|
8
18
|
providerRequest: { "providers": {
|
|
9
19
|
"kimi": {
|
|
10
20
|
"family": "moonshot",
|
|
@@ -29,7 +39,6 @@ var openclaw_plugin_default = {
|
|
|
29
39
|
"reasoning": true,
|
|
30
40
|
"upstreamModel": "moonshot/kimi-k3",
|
|
31
41
|
"thinkingLevelMap": {
|
|
32
|
-
"off": null,
|
|
33
42
|
"minimal": "low",
|
|
34
43
|
"low": "low",
|
|
35
44
|
"medium": "high",
|
|
@@ -54,7 +63,6 @@ var openclaw_plugin_default = {
|
|
|
54
63
|
"reasoning": true,
|
|
55
64
|
"upstreamModel": "moonshot/kimi-k3",
|
|
56
65
|
"thinkingLevelMap": {
|
|
57
|
-
"off": null,
|
|
58
66
|
"minimal": "low",
|
|
59
67
|
"low": "low",
|
|
60
68
|
"medium": "high",
|
|
@@ -146,10 +154,10 @@ var openclaw_plugin_default = {
|
|
|
146
154
|
//#region extensions/kimi-coding/provider-catalog.ts
|
|
147
155
|
const KIMI_PROVIDER_ID = "kimi";
|
|
148
156
|
const KIMI_CODING_CATALOG = openclaw_plugin_default.modelCatalog.providers.kimi;
|
|
149
|
-
const
|
|
157
|
+
const KIMI_MODEL_ALIASES = new Map(Object.entries(openclaw_plugin_default.modelIdNormalization.providers.kimi.aliases));
|
|
150
158
|
const KIMI_CODING_BASE_URL = KIMI_CODING_CATALOG.baseUrl;
|
|
151
159
|
const KIMI_CODING_DEFAULT_MODEL_ID = KIMI_CODING_CATALOG.defaultModel;
|
|
152
|
-
const KIMI_CODING_LEGACY_MODEL_IDS =
|
|
160
|
+
const KIMI_CODING_LEGACY_MODEL_IDS = ["kimi-code", "k2p5"];
|
|
153
161
|
function buildKimiCodingProvider() {
|
|
154
162
|
return buildManifestModelProviderConfig({
|
|
155
163
|
providerId: KIMI_PROVIDER_ID,
|
|
@@ -157,8 +165,7 @@ function buildKimiCodingProvider() {
|
|
|
157
165
|
});
|
|
158
166
|
}
|
|
159
167
|
function normalizeKimiCodingModelId(modelId) {
|
|
160
|
-
|
|
161
|
-
return KIMI_LEGACY_MODEL_IDS.includes(modelId) ? KIMI_CODING_DEFAULT_MODEL_ID : modelId;
|
|
168
|
+
return KIMI_MODEL_ALIASES.get(modelId) ?? modelId;
|
|
162
169
|
}
|
|
163
170
|
//#endregion
|
|
164
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 "
|
|
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 "
|
|
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";
|
|
@@ -9,6 +9,7 @@ import { isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-co
|
|
|
9
9
|
//#region extensions/kimi-coding/index.ts
|
|
10
10
|
const PLUGIN_ID = "kimi";
|
|
11
11
|
const PROVIDER_ID = "kimi";
|
|
12
|
+
const PROVIDER_ALIASES = ["kimi-code", "kimi-coding"];
|
|
12
13
|
function findExplicitProviderConfig(providers, providerId) {
|
|
13
14
|
if (!providers) return;
|
|
14
15
|
const normalizedProviderId = normalizeProviderId(providerId);
|
|
@@ -23,7 +24,7 @@ var kimi_coding_default = defineSingleProviderPluginEntry({
|
|
|
23
24
|
provider: {
|
|
24
25
|
id: PROVIDER_ID,
|
|
25
26
|
label: "Kimi",
|
|
26
|
-
aliases:
|
|
27
|
+
aliases: PROVIDER_ALIASES,
|
|
27
28
|
docsPath: "/providers/moonshot",
|
|
28
29
|
envVars: ["KIMI_API_KEY", "KIMICODE_API_KEY"],
|
|
29
30
|
manifestAuth: {
|
|
@@ -58,6 +59,12 @@ var kimi_coding_default = defineSingleProviderPluginEntry({
|
|
|
58
59
|
} };
|
|
59
60
|
}
|
|
60
61
|
},
|
|
62
|
+
classifyFailoverReason: ({ provider, status, errorMessage }) => {
|
|
63
|
+
if (!provider || status !== 403) return;
|
|
64
|
+
const providerId = normalizeProviderId(provider);
|
|
65
|
+
if (providerId !== PROVIDER_ID && !PROVIDER_ALIASES.includes(providerId)) return;
|
|
66
|
+
return /\b(?:weekly(?:\s+\(7-day\))?|(?:7|seven)[ -]day)\s+(?:usage\s+)?limit\b/i.test(errorMessage) || /\bquota\s+will\s+reset\b/i.test(errorMessage) ? "rate_limit" : void 0;
|
|
67
|
+
},
|
|
61
68
|
buildReplayPolicy: () => KIMI_REPLAY_POLICY,
|
|
62
69
|
normalizeResolvedModel: ({ model }) => {
|
|
63
70
|
const normalizedId = normalizeKimiCodingModelId(model.id);
|
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 "
|
|
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}`;
|
package/dist/provider-catalog.js
CHANGED
|
@@ -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 "
|
|
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 {
|
|
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 (
|
|
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 (!
|
|
73
|
-
const
|
|
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
|
|
81
|
-
|
|
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 (!
|
|
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 (!
|
|
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
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
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
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
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 };
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "kimi",
|
|
3
|
+
"categories": ["models"],
|
|
3
4
|
"activation": {
|
|
4
5
|
"onStartup": false
|
|
5
6
|
},
|
|
6
7
|
"enabledByDefault": true,
|
|
7
|
-
"providers": ["kimi", "kimi-coding"],
|
|
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
|
+
},
|
|
8
20
|
"providerRequest": {
|
|
9
21
|
"providers": {
|
|
10
22
|
"kimi": {
|
|
@@ -36,7 +48,6 @@
|
|
|
36
48
|
"reasoning": true,
|
|
37
49
|
"upstreamModel": "moonshot/kimi-k3",
|
|
38
50
|
"thinkingLevelMap": {
|
|
39
|
-
"off": null,
|
|
40
51
|
"minimal": "low",
|
|
41
52
|
"low": "low",
|
|
42
53
|
"medium": "high",
|
|
@@ -63,7 +74,6 @@
|
|
|
63
74
|
"reasoning": true,
|
|
64
75
|
"upstreamModel": "moonshot/kimi-k3",
|
|
65
76
|
"thinkingLevelMap": {
|
|
66
|
-
"off": null,
|
|
67
77
|
"minimal": "low",
|
|
68
78
|
"low": "low",
|
|
69
79
|
"medium": "high",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/kimi-provider",
|
|
3
|
-
"version": "2026.9.
|
|
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.
|
|
21
|
+
"pluginApi": ">=2026.9.5"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.9.
|
|
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.
|
|
43
|
+
"openclaw": ">=2026.9.5"
|
|
42
44
|
},
|
|
43
45
|
"peerDependenciesMeta": {
|
|
44
46
|
"openclaw": {
|