@openclaw/moonshot-provider 2026.7.2-beta.5 → 2026.8.1-beta.2
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 +21 -20
- package/dist/{kimi-web-search-provider-DGFWylD8.js → kimi-web-search-provider-DDPS6Tkx.js} +3 -3
- package/dist/{kimi-web-search-provider.runtime-B6y-kz4c.js → kimi-web-search-provider.runtime-37xzGdoQ.js} +6 -5
- package/dist/media-understanding-provider.js +2 -2
- package/dist/native-video.js +53 -0
- package/dist/onboard.js +3 -4
- package/dist/provider-catalog.js +2 -5
- package/dist/provider-contract-api.js +7 -13
- package/dist/provider-policy-api.js +24 -17
- package/dist/web-search-provider.js +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,35 +1,28 @@
|
|
|
1
|
+
import { t as openclaw_plugin_default } from "./openclaw.plugin-BLi5Z-ZR.js";
|
|
1
2
|
import { MOONSHOT_DEFAULT_MODEL_REF, applyMoonshotNativeStreamingUsageCompat, buildMoonshotProvider } from "./provider-catalog.js";
|
|
2
3
|
import "./api.js";
|
|
3
4
|
import { moonshotMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
5
|
+
import { isMoonshotAlwaysThinkingModelId, isMoonshotK3NativeVideoRoute, resolveThinkingProfile } from "./provider-policy-api.js";
|
|
6
|
+
import { wrapMoonshotStream } from "./native-video.js";
|
|
4
7
|
import { applyMoonshotConfig, applyMoonshotConfigCn } from "./onboard.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
8
|
+
import { t as createKimiWebSearchProvider } from "./kimi-web-search-provider-DDPS6Tkx.js";
|
|
9
|
+
import { createProviderApiKeyAuthMethod } from "openclaw/plugin-sdk/provider-auth-api-key";
|
|
7
10
|
import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
|
|
8
11
|
import { buildOpenAICompatibleReplayPolicy } from "openclaw/plugin-sdk/provider-model-shared";
|
|
9
|
-
import { buildProviderStreamFamilyHooks } from "openclaw/plugin-sdk/provider-stream-family";
|
|
10
12
|
//#region extensions/moonshot/index.ts
|
|
11
13
|
const PROVIDER_ID = "moonshot";
|
|
12
|
-
const moonshotThinkingStreamHooks = buildProviderStreamFamilyHooks("moonshot-thinking");
|
|
13
14
|
var moonshot_default = defineSingleProviderPluginEntry({
|
|
14
15
|
id: PROVIDER_ID,
|
|
15
16
|
name: "Moonshot Provider",
|
|
16
17
|
description: "Bundled Moonshot provider plugin",
|
|
18
|
+
manifest: openclaw_plugin_default,
|
|
17
19
|
provider: {
|
|
18
20
|
label: "Moonshot",
|
|
19
21
|
docsPath: "/providers/moonshot",
|
|
20
22
|
aliases: ["moonshotai", "moonshot-ai"],
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
hint: "Kimi API models · https://platform.kimi.ai/docs/pricing/chat",
|
|
25
|
-
optionKey: "moonshotApiKey",
|
|
26
|
-
flagName: "--moonshot-api-key",
|
|
27
|
-
envVar: "MOONSHOT_API_KEY",
|
|
28
|
-
promptMessage: "Enter Moonshot API key",
|
|
29
|
-
defaultModel: MOONSHOT_DEFAULT_MODEL_REF,
|
|
30
|
-
applyConfig: (cfg) => applyMoonshotConfig(cfg),
|
|
31
|
-
wizard: { groupLabel: "Moonshot AI (Kimi)" }
|
|
32
|
-
}, {
|
|
23
|
+
manifestAuth: { applyConfig: applyMoonshotConfig },
|
|
24
|
+
extraAuth: [createProviderApiKeyAuthMethod({
|
|
25
|
+
providerId: PROVIDER_ID,
|
|
33
26
|
methodId: "api-key-cn",
|
|
34
27
|
label: "Kimi API key (.cn)",
|
|
35
28
|
hint: "Kimi API models · https://platform.kimi.ai/docs/pricing/chat",
|
|
@@ -38,9 +31,9 @@ var moonshot_default = defineSingleProviderPluginEntry({
|
|
|
38
31
|
envVar: "MOONSHOT_API_KEY",
|
|
39
32
|
promptMessage: "Enter Moonshot API key (.cn)",
|
|
40
33
|
defaultModel: MOONSHOT_DEFAULT_MODEL_REF,
|
|
41
|
-
applyConfig:
|
|
34
|
+
applyConfig: applyMoonshotConfigCn,
|
|
42
35
|
wizard: { groupLabel: "Moonshot AI (Kimi)" }
|
|
43
|
-
}],
|
|
36
|
+
})],
|
|
44
37
|
catalog: {
|
|
45
38
|
buildProvider: buildMoonshotProvider,
|
|
46
39
|
buildStaticProvider: buildMoonshotProvider,
|
|
@@ -48,14 +41,22 @@ var moonshot_default = defineSingleProviderPluginEntry({
|
|
|
48
41
|
liveModelDiscovery: true
|
|
49
42
|
},
|
|
50
43
|
applyNativeStreamingUsageCompat: ({ providerConfig }) => applyMoonshotNativeStreamingUsageCompat(providerConfig),
|
|
44
|
+
normalizeResolvedModel: (ctx) => ({
|
|
45
|
+
...ctx.model,
|
|
46
|
+
input: ctx.model.input.filter((type) => type !== "video").concat(isMoonshotK3NativeVideoRoute({
|
|
47
|
+
...ctx.model,
|
|
48
|
+
provider: ctx.provider,
|
|
49
|
+
modelId: ctx.modelId
|
|
50
|
+
}) ? "video" : [])
|
|
51
|
+
}),
|
|
51
52
|
buildReplayPolicy: ({ modelApi, modelId }) => buildOpenAICompatibleReplayPolicy(modelApi, {
|
|
52
53
|
modelId,
|
|
53
54
|
sanitizeToolCallIds: modelApi === "openai-completions",
|
|
54
55
|
duplicateToolCallIdStyle: "openai",
|
|
55
56
|
dropReasoningFromHistory: false
|
|
56
57
|
}),
|
|
57
|
-
|
|
58
|
-
wrapSimpleCompletionStreamFn: (ctx) =>
|
|
58
|
+
wrapStreamFn: (ctx) => wrapMoonshotStream(ctx),
|
|
59
|
+
wrapSimpleCompletionStreamFn: (ctx) => wrapMoonshotStream(ctx, true),
|
|
59
60
|
resolveThinkingProfile,
|
|
60
61
|
isModernModelRef: ({ modelId }) => isMoonshotAlwaysThinkingModelId(modelId)
|
|
61
62
|
},
|
|
@@ -2,7 +2,7 @@ import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
|
2
2
|
import { createWebSearchProviderContractFields } from "openclaw/plugin-sdk/provider-web-search-config-contract";
|
|
3
3
|
//#region extensions/moonshot/src/kimi-web-search-provider.ts
|
|
4
4
|
const KIMI_CREDENTIAL_PATH = "plugins.entries.moonshot.config.webSearch.apiKey";
|
|
5
|
-
const loadKimiWebSearchProviderRuntime = createLazyRuntimeModule(() => import("./kimi-web-search-provider.runtime-
|
|
5
|
+
const loadKimiWebSearchProviderRuntime = createLazyRuntimeModule(() => import("./kimi-web-search-provider.runtime-37xzGdoQ.js"));
|
|
6
6
|
const KimiSearchSchema = {
|
|
7
7
|
type: "object",
|
|
8
8
|
properties: {
|
|
@@ -66,9 +66,9 @@ function createKimiWebSearchProvider() {
|
|
|
66
66
|
createTool: (ctx) => ({
|
|
67
67
|
description: "Search the web using Kimi by Moonshot. Returns AI-synthesized answers with citations from native $web_search.",
|
|
68
68
|
parameters: KimiSearchSchema,
|
|
69
|
-
execute: async (args) => {
|
|
69
|
+
execute: async (args, context) => {
|
|
70
70
|
const { executeKimiWebSearchProviderTool } = await loadKimiWebSearchProviderRuntime();
|
|
71
|
-
return await executeKimiWebSearchProviderTool(ctx, args);
|
|
71
|
+
return await executeKimiWebSearchProviderTool(ctx, args, { signal: context?.signal });
|
|
72
72
|
}
|
|
73
73
|
})
|
|
74
74
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MOONSHOT_BASE_URL, MOONSHOT_CN_BASE_URL, isNativeMoonshotBaseUrl } from "./provider-catalog.js";
|
|
2
2
|
import { createProviderHttpError, readProviderJsonObjectResponse } from "openclaw/plugin-sdk/provider-http";
|
|
3
|
-
import { DEFAULT_SEARCH_COUNT, MAX_SEARCH_COUNT, buildSearchCacheKey, buildUnsupportedSearchFilterResponse, mergeScopedSearchConfig, readCachedSearchPayload, readConfiguredSecretString, readPositiveIntegerParam, readProviderEnvValue, readStringParam, resolveProviderWebSearchPluginConfig, resolveSearchCacheTtlMs, resolveSearchCount, resolveSearchTimeoutSeconds, setProviderWebSearchPluginConfigValue, withTrustedWebSearchEndpoint, wrapWebContent, writeCachedSearchPayload } from "openclaw/plugin-sdk/provider-web-search";
|
|
4
3
|
import { isRecord, normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
+
import { DEFAULT_SEARCH_COUNT, MAX_SEARCH_COUNT, buildSearchCacheKey, buildUnsupportedSearchFilterResponse, mergeScopedSearchConfig, readCachedSearchPayload, readConfiguredSecretString, readPositiveIntegerParam, readProviderEnvValue, readStringParam, resolveProviderWebSearchPluginConfig, resolveSearchCacheTtlMs, resolveSearchCount, resolveSearchTimeoutSeconds, setProviderWebSearchPluginConfigValue, withTrustedWebSearchEndpoint, wrapWebContent, writeCachedSearchPayload } from "openclaw/plugin-sdk/provider-web-search";
|
|
5
5
|
//#region extensions/moonshot/src/kimi-web-search-provider.runtime.ts
|
|
6
6
|
const DEFAULT_KIMI_BASE_URL = MOONSHOT_BASE_URL;
|
|
7
7
|
const DEFAULT_KIMI_SEARCH_MODEL = "kimi-k2.6";
|
|
@@ -89,6 +89,7 @@ async function runKimiSearch(params) {
|
|
|
89
89
|
const next = await withTrustedWebSearchEndpoint({
|
|
90
90
|
url: endpoint,
|
|
91
91
|
timeoutSeconds: params.timeoutSeconds,
|
|
92
|
+
signal: params.signal,
|
|
92
93
|
init: {
|
|
93
94
|
method: "POST",
|
|
94
95
|
headers: {
|
|
@@ -166,7 +167,7 @@ async function runKimiSearch(params) {
|
|
|
166
167
|
grounded: hasGroundingEvidence
|
|
167
168
|
};
|
|
168
169
|
}
|
|
169
|
-
async function executeKimiWebSearchProviderTool(ctx, args) {
|
|
170
|
+
async function executeKimiWebSearchProviderTool(ctx, args, opts) {
|
|
170
171
|
const searchConfig = mergeScopedSearchConfig(ctx.searchConfig, "kimi", resolveProviderWebSearchPluginConfig(ctx.config, "moonshot"));
|
|
171
172
|
const unsupportedResponse = buildUnsupportedSearchFilterResponse(args, "kimi");
|
|
172
173
|
if (unsupportedResponse) return unsupportedResponse;
|
|
@@ -199,7 +200,8 @@ async function executeKimiWebSearchProviderTool(ctx, args) {
|
|
|
199
200
|
apiKey,
|
|
200
201
|
baseUrl,
|
|
201
202
|
model,
|
|
202
|
-
timeoutSeconds: resolveSearchTimeoutSeconds(searchConfig)
|
|
203
|
+
timeoutSeconds: resolveSearchTimeoutSeconds(searchConfig),
|
|
204
|
+
signal: opts?.signal
|
|
203
205
|
});
|
|
204
206
|
if (!result.grounded) return {
|
|
205
207
|
error: "kimi_web_search_ungrounded",
|
|
@@ -289,8 +291,7 @@ const testing = {
|
|
|
289
291
|
resolveKimiModel,
|
|
290
292
|
resolveKimiBaseUrl,
|
|
291
293
|
extractKimiCitations,
|
|
292
|
-
hasKimiSearchResults,
|
|
293
294
|
extractKimiToolResultContent
|
|
294
295
|
};
|
|
295
296
|
//#endregion
|
|
296
|
-
export {
|
|
297
|
+
export { executeKimiWebSearchProviderTool, runKimiSearchProviderSetup, testing };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as openclaw_plugin_default } from "./openclaw.plugin-BLi5Z-ZR.js";
|
|
2
|
+
import { MOONSHOT_BASE_URL } from "./provider-catalog.js";
|
|
2
3
|
import { buildOpenAiCompatibleVideoRequestBody, coerceOpenAiCompatibleVideoText, describeImageWithModel, describeImagesWithModel, resolveMediaUnderstandingString } from "openclaw/plugin-sdk/media-understanding";
|
|
3
4
|
import { assertOkOrThrowHttpError, postJsonRequest, readProviderJsonResponse, resolveProviderHttpRequestConfig } from "openclaw/plugin-sdk/provider-http";
|
|
4
5
|
//#region extensions/moonshot/media-understanding-provider.ts
|
|
5
|
-
const DEFAULT_MOONSHOT_VIDEO_BASE_URL = "https://api.moonshot.ai/v1";
|
|
6
6
|
const DEFAULT_MOONSHOT_IMAGE_MODEL = openclaw_plugin_default.mediaUnderstandingProviderMetadata.moonshot.defaultModels.image;
|
|
7
7
|
const DEFAULT_MOONSHOT_VIDEO_MODEL = openclaw_plugin_default.mediaUnderstandingProviderMetadata.moonshot.defaultModels.video;
|
|
8
8
|
const DEFAULT_MOONSHOT_VIDEO_PROMPT = "Describe the video.";
|
|
@@ -13,7 +13,7 @@ async function describeMoonshotVideo(params) {
|
|
|
13
13
|
const prompt = resolveMediaUnderstandingString(params.prompt, DEFAULT_MOONSHOT_VIDEO_PROMPT);
|
|
14
14
|
const { baseUrl, allowPrivateNetwork, headers, dispatcherPolicy } = resolveProviderHttpRequestConfig({
|
|
15
15
|
baseUrl: params.baseUrl,
|
|
16
|
-
defaultBaseUrl:
|
|
16
|
+
defaultBaseUrl: MOONSHOT_BASE_URL,
|
|
17
17
|
headers: params.headers,
|
|
18
18
|
request: params.request,
|
|
19
19
|
defaultHeaders: {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { isMoonshotAlwaysThinkingModelId, isMoonshotK3NativeVideoRoute } from "./provider-policy-api.js";
|
|
2
|
+
import { resolveProviderContext, streamSimple } from "openclaw/plugin-sdk/llm";
|
|
3
|
+
import { createMoonshotThinkingWrapper, resolveMoonshotThinkingKeep, resolveMoonshotThinkingType } from "openclaw/plugin-sdk/provider-stream-shared";
|
|
4
|
+
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
|
+
//#region extensions/moonshot/native-video.ts
|
|
6
|
+
const VIDEO_PREFIX = "data:video/mp4;base64,";
|
|
7
|
+
const VIDEO_OMISSION = "(video omitted: untrusted or unsupported Moonshot video)";
|
|
8
|
+
const MOONSHOT_REQUEST_BYTES_EXCLUSIVE = 1e8;
|
|
9
|
+
function forEachUserContentPart(payload, visit) {
|
|
10
|
+
const messages = isRecord(payload) && Array.isArray(payload.messages) ? payload.messages : [];
|
|
11
|
+
for (const message of messages) {
|
|
12
|
+
if (!isRecord(message) || message.role !== "user" || !Array.isArray(message.content)) continue;
|
|
13
|
+
for (const part of message.content) if (isRecord(part)) visit(part);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function partUrl(part, field) {
|
|
17
|
+
const url = isRecord(part[field]) ? part[field].url : void 0;
|
|
18
|
+
return typeof url === "string" ? url : void 0;
|
|
19
|
+
}
|
|
20
|
+
function replacePart(part, text) {
|
|
21
|
+
Object.keys(part).forEach((key) => Reflect.deleteProperty(part, key));
|
|
22
|
+
Object.assign(part, {
|
|
23
|
+
type: "text",
|
|
24
|
+
text
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function finalizePayload(result, payload, requestBytesExclusive) {
|
|
28
|
+
const admitted = [];
|
|
29
|
+
forEachUserContentPart(payload, (part) => {
|
|
30
|
+
const videoUrl = partUrl(part, "video_url");
|
|
31
|
+
const imageUrl = partUrl(part, "image_url");
|
|
32
|
+
if (part.type === "video_url" && videoUrl?.startsWith(VIDEO_PREFIX)) admitted.push(part);
|
|
33
|
+
else if (part.type === "video_url" || imageUrl?.startsWith("data:video/")) replacePart(part, VIDEO_OMISSION);
|
|
34
|
+
});
|
|
35
|
+
const isOversized = () => Buffer.byteLength(JSON.stringify(payload), "utf8") >= requestBytesExclusive;
|
|
36
|
+
while (admitted.length > 0 && isOversized()) replacePart(admitted.pop(), "(video omitted: Moonshot request size limit)");
|
|
37
|
+
if (isOversized()) throw new Error(`Moonshot request body must be smaller than ${requestBytesExclusive} bytes`);
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
function wrapMoonshotStream(ctx, simple = false, requestBytesExclusive = MOONSHOT_REQUEST_BYTES_EXCLUSIVE) {
|
|
41
|
+
const underlying = ctx.streamFn ?? streamSimple;
|
|
42
|
+
if (simple && !isMoonshotAlwaysThinkingModelId(ctx.modelId)) return underlying;
|
|
43
|
+
const withVideoContext = (model, context, options) => isMoonshotK3NativeVideoRoute({
|
|
44
|
+
...model,
|
|
45
|
+
modelId: model.id
|
|
46
|
+
}) ? resolveProviderContext(context, options).then((providerContext) => underlying(model, providerContext, options)) : underlying(model, context, options);
|
|
47
|
+
return createMoonshotThinkingWrapper(withVideoContext, resolveMoonshotThinkingType({
|
|
48
|
+
configuredThinking: ctx.extraParams?.thinking,
|
|
49
|
+
thinkingLevel: ctx.thinkingLevel
|
|
50
|
+
}), resolveMoonshotThinkingKeep({ configuredThinking: ctx.extraParams?.thinking }), (result, payload) => finalizePayload(result, payload, requestBytesExclusive));
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { wrapMoonshotStream };
|
package/dist/onboard.js
CHANGED
|
@@ -4,9 +4,8 @@ import { createDefaultModelPresetAppliers } from "openclaw/plugin-sdk/provider-o
|
|
|
4
4
|
const moonshotPresetAppliers = createDefaultModelPresetAppliers({
|
|
5
5
|
primaryModelRef: MOONSHOT_DEFAULT_MODEL_REF,
|
|
6
6
|
resolveParams: (_cfg, baseUrl) => {
|
|
7
|
-
const defaultModel = buildMoonshotProvider().models.find((
|
|
8
|
-
|
|
9
|
-
return {
|
|
7
|
+
const defaultModel = buildMoonshotProvider().models.find(({ id }) => id === MOONSHOT_DEFAULT_MODEL_ID);
|
|
8
|
+
return defaultModel ? {
|
|
10
9
|
providerId: "moonshot",
|
|
11
10
|
api: "openai-completions",
|
|
12
11
|
baseUrl,
|
|
@@ -16,7 +15,7 @@ const moonshotPresetAppliers = createDefaultModelPresetAppliers({
|
|
|
16
15
|
modelRef: MOONSHOT_DEFAULT_MODEL_REF,
|
|
17
16
|
alias: "Kimi"
|
|
18
17
|
}]
|
|
19
|
-
};
|
|
18
|
+
} : null;
|
|
20
19
|
}
|
|
21
20
|
});
|
|
22
21
|
function applyMoonshotConfig(cfg) {
|
package/dist/provider-catalog.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { t as openclaw_plugin_default } from "./openclaw.plugin-BLi5Z-ZR.js";
|
|
2
|
-
import { applyProviderNativeStreamingUsageCompat, buildManifestModelProviderConfig, readManifestProviderDefaultModelRef
|
|
2
|
+
import { applyProviderNativeStreamingUsageCompat, buildManifestModelProviderConfig, readManifestProviderDefaultModelRef } from "openclaw/plugin-sdk/provider-catalog-shared";
|
|
3
3
|
//#region extensions/moonshot/provider-catalog.ts
|
|
4
4
|
const MOONSHOT_BASE_URL = "https://api.moonshot.ai/v1";
|
|
5
5
|
const MOONSHOT_CN_BASE_URL = "https://api.moonshot.cn/v1";
|
|
6
6
|
const MOONSHOT_DEFAULT_MODEL_REF = readManifestProviderDefaultModelRef(openclaw_plugin_default, "moonshot");
|
|
7
7
|
const MOONSHOT_DEFAULT_MODEL_ID = MOONSHOT_DEFAULT_MODEL_REF.slice(9);
|
|
8
8
|
function isNativeMoonshotBaseUrl(baseUrl) {
|
|
9
|
-
return
|
|
10
|
-
providerId: "moonshot",
|
|
11
|
-
baseUrl
|
|
12
|
-
});
|
|
9
|
+
return [MOONSHOT_BASE_URL, MOONSHOT_CN_BASE_URL].some((official) => baseUrl === official || baseUrl === `${official}/`);
|
|
13
10
|
}
|
|
14
11
|
function applyMoonshotNativeStreamingUsageCompat(provider) {
|
|
15
12
|
return applyProviderNativeStreamingUsageCompat({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as openclaw_plugin_default } from "./openclaw.plugin-BLi5Z-ZR.js";
|
|
1
2
|
//#region extensions/moonshot/provider-contract-api.ts
|
|
2
3
|
const noopAuth = async () => ({ profiles: [] });
|
|
3
4
|
function createMoonshotProvider() {
|
|
@@ -6,21 +7,14 @@ function createMoonshotProvider() {
|
|
|
6
7
|
label: "Moonshot",
|
|
7
8
|
docsPath: "/providers/moonshot",
|
|
8
9
|
aliases: ["moonshotai", "moonshot-ai"],
|
|
9
|
-
auth:
|
|
10
|
-
id:
|
|
10
|
+
auth: openclaw_plugin_default.providerAuthChoices.map((choice) => ({
|
|
11
|
+
id: choice.method,
|
|
11
12
|
kind: "api_key",
|
|
12
|
-
label:
|
|
13
|
-
hint:
|
|
13
|
+
label: choice.choiceLabel,
|
|
14
|
+
hint: choice.groupHint,
|
|
14
15
|
run: noopAuth,
|
|
15
|
-
wizard: { groupLabel:
|
|
16
|
-
}
|
|
17
|
-
id: "api-key-cn",
|
|
18
|
-
kind: "api_key",
|
|
19
|
-
label: "Kimi API key (.cn)",
|
|
20
|
-
hint: "Kimi API models · https://platform.kimi.ai/docs/pricing/chat",
|
|
21
|
-
run: noopAuth,
|
|
22
|
-
wizard: { groupLabel: "Moonshot AI (Kimi)" }
|
|
23
|
-
}]
|
|
16
|
+
wizard: { groupLabel: choice.groupLabel }
|
|
17
|
+
}))
|
|
24
18
|
};
|
|
25
19
|
}
|
|
26
20
|
//#endregion
|
|
@@ -1,27 +1,34 @@
|
|
|
1
|
+
import { isNativeMoonshotBaseUrl } from "./provider-catalog.js";
|
|
1
2
|
//#region extensions/moonshot/provider-policy-api.ts
|
|
2
3
|
const KIMI_K2_7_CODE_MODEL_ID = "kimi-k2.7-code";
|
|
3
4
|
const KIMI_K2_7_CODE_HIGHSPEED_MODEL_ID = "kimi-k2.7-code-highspeed";
|
|
4
5
|
const KIMI_K3_MODEL_ID = "kimi-k3";
|
|
6
|
+
const ALWAYS_THINKING_PROFILES = {
|
|
7
|
+
[KIMI_K3_MODEL_ID]: {
|
|
8
|
+
id: "max",
|
|
9
|
+
label: "max"
|
|
10
|
+
},
|
|
11
|
+
[KIMI_K2_7_CODE_MODEL_ID]: {
|
|
12
|
+
id: "low",
|
|
13
|
+
label: "on"
|
|
14
|
+
},
|
|
15
|
+
[KIMI_K2_7_CODE_HIGHSPEED_MODEL_ID]: {
|
|
16
|
+
id: "low",
|
|
17
|
+
label: "on"
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
function isMoonshotK3NativeVideoRoute(route) {
|
|
21
|
+
return route.provider === "moonshot" && route.modelId === "kimi-k3" && route.api === "openai-completions" && isNativeMoonshotBaseUrl(route.baseUrl);
|
|
22
|
+
}
|
|
5
23
|
function isMoonshotAlwaysThinkingModelId(modelId) {
|
|
6
|
-
|
|
7
|
-
return normalized === "kimi-k2.7-code" || normalized === "kimi-k2.7-code-highspeed" || normalized === "kimi-k3";
|
|
24
|
+
return modelId.trim().toLowerCase() in ALWAYS_THINKING_PROFILES;
|
|
8
25
|
}
|
|
9
26
|
function resolveThinkingProfile(context) {
|
|
10
27
|
const modelId = context.modelId.trim().toLowerCase();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}],
|
|
16
|
-
defaultLevel: "max",
|
|
17
|
-
preserveWhenCatalogReasoningFalse: true
|
|
18
|
-
};
|
|
19
|
-
if (modelId === "kimi-k2.7-code" || modelId === "kimi-k2.7-code-highspeed") return {
|
|
20
|
-
levels: [{
|
|
21
|
-
id: "low",
|
|
22
|
-
label: "on"
|
|
23
|
-
}],
|
|
24
|
-
defaultLevel: "low",
|
|
28
|
+
const profile = ALWAYS_THINKING_PROFILES[modelId];
|
|
29
|
+
if (profile) return {
|
|
30
|
+
levels: [profile],
|
|
31
|
+
defaultLevel: profile.id,
|
|
25
32
|
preserveWhenCatalogReasoningFalse: true
|
|
26
33
|
};
|
|
27
34
|
return {
|
|
@@ -36,4 +43,4 @@ function resolveThinkingProfile(context) {
|
|
|
36
43
|
};
|
|
37
44
|
}
|
|
38
45
|
//#endregion
|
|
39
|
-
export { KIMI_K2_7_CODE_HIGHSPEED_MODEL_ID, KIMI_K2_7_CODE_MODEL_ID, KIMI_K3_MODEL_ID, isMoonshotAlwaysThinkingModelId, resolveThinkingProfile };
|
|
46
|
+
export { KIMI_K2_7_CODE_HIGHSPEED_MODEL_ID, KIMI_K2_7_CODE_MODEL_ID, KIMI_K3_MODEL_ID, isMoonshotAlwaysThinkingModelId, isMoonshotK3NativeVideoRoute, resolveThinkingProfile };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createKimiWebSearchProvider } from "./kimi-web-search-provider-
|
|
1
|
+
import { t as createKimiWebSearchProvider } from "./kimi-web-search-provider-DDPS6Tkx.js";
|
|
2
2
|
export { createKimiWebSearchProvider };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/moonshot-provider",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.8.1-beta.2",
|
|
4
4
|
"description": "OpenClaw Moonshot provider plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"openclaw": {
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"minHostVersion": ">=2026.6.9"
|
|
15
15
|
},
|
|
16
16
|
"compat": {
|
|
17
|
-
"pluginApi": ">=2026.
|
|
17
|
+
"pluginApi": ">=2026.8.1-beta.2"
|
|
18
18
|
},
|
|
19
19
|
"build": {
|
|
20
|
-
"openclawVersion": "2026.
|
|
20
|
+
"openclawVersion": "2026.8.1-beta.2",
|
|
21
21
|
"bundledDist": false
|
|
22
22
|
},
|
|
23
23
|
"release": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"README.md"
|
|
39
39
|
],
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"openclaw": ">=2026.
|
|
41
|
+
"openclaw": ">=2026.8.1-beta.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"openclaw": {
|