mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 01:29:56 +00:00
Declare the documented kimi-code, k2p5, and k3[1m] aliases before provider runtime loads. Read the same manifest map from the existing public helper so cold model selection and runtime normalization share one policy. Preserve registered hooks and public exports, and remove the obsolete type-assertion allowance. Static parser regressions fail for all three legacy IDs on the baseline and retain canonical model controls. Related: #130706 Prerequisite: #146183
25 lines
1 KiB
TypeScript
25 lines
1 KiB
TypeScript
// Kimi Coding provider module implements model/runtime integration.
|
|
import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
|
|
import type { ModelProviderConfig } from "openclaw/plugin-sdk/provider-model-shared";
|
|
import manifest from "./openclaw.plugin.json" with { type: "json" };
|
|
|
|
const KIMI_PROVIDER_ID = "kimi";
|
|
const KIMI_CODING_CATALOG = manifest.modelCatalog.providers.kimi;
|
|
const KIMI_MODEL_ALIASES = new Map(
|
|
Object.entries(manifest.modelIdNormalization.providers.kimi.aliases),
|
|
);
|
|
|
|
export const KIMI_CODING_BASE_URL = KIMI_CODING_CATALOG.baseUrl;
|
|
export const KIMI_CODING_DEFAULT_MODEL_ID = KIMI_CODING_CATALOG.defaultModel;
|
|
export const KIMI_CODING_LEGACY_MODEL_IDS = ["kimi-code", "k2p5"] as const;
|
|
|
|
export function buildKimiCodingProvider(): ModelProviderConfig {
|
|
return buildManifestModelProviderConfig({
|
|
providerId: KIMI_PROVIDER_ID,
|
|
catalog: KIMI_CODING_CATALOG,
|
|
});
|
|
}
|
|
|
|
export function normalizeKimiCodingModelId(modelId: string): string {
|
|
return KIMI_MODEL_ALIASES.get(modelId) ?? modelId;
|
|
}
|