Files
openclaw/extensions/moonshot/web-search-contract-api.ts
2026-04-07 07:53:59 +01:00

34 lines
1.4 KiB
TypeScript

import {
getScopedCredentialValue,
resolveProviderWebSearchPluginConfig,
setProviderWebSearchPluginConfigValue,
setScopedCredentialValue,
type WebSearchProviderPlugin,
} from "openclaw/plugin-sdk/provider-web-search-contract";
export function createKimiWebSearchProvider(): WebSearchProviderPlugin {
return {
id: "kimi",
label: "Kimi (Moonshot)",
hint: "Requires Moonshot / Kimi API key · Moonshot web search",
onboardingScopes: ["text-inference"],
credentialLabel: "Moonshot / Kimi API key",
envVars: ["KIMI_API_KEY", "MOONSHOT_API_KEY"],
placeholder: "sk-...",
signupUrl: "https://platform.moonshot.cn/",
docsUrl: "https://docs.openclaw.ai/tools/web",
autoDetectOrder: 40,
credentialPath: "plugins.entries.moonshot.config.webSearch.apiKey",
inactiveSecretPaths: ["plugins.entries.moonshot.config.webSearch.apiKey"],
getCredentialValue: (searchConfig) => getScopedCredentialValue(searchConfig, "kimi"),
setCredentialValue: (searchConfigTarget, value) =>
setScopedCredentialValue(searchConfigTarget, "kimi", value),
getConfiguredCredentialValue: (config) =>
resolveProviderWebSearchPluginConfig(config, "moonshot")?.apiKey,
setConfiguredCredentialValue: (configTarget, value) => {
setProviderWebSearchPluginConfigValue(configTarget, "moonshot", "apiKey", value);
},
createTool: () => null,
};
}