Files
openclaw/extensions/kimi-coding/provider-catalog.ts
Peter Steinberger 99ec30b44b feat(plugins): catch code-mode drift between catalogs shipping the same model (#115183)
* feat(plugins): catch code-mode drift between catalogs sharing one model

Adds a contract test that groups bundled catalog rows by shared upstream
model and requires every row in a group to declare compat.codeMode once any
sibling does. Rows sharing a model id group automatically; rows under
different ids opt in with the new manifest-only `upstreamModel` marker.

Moves the kimi catalog into its manifest so the scan can see it, and records
the tier reseller catalogs were silently missing as explicit "capable".

* docs: regenerate docs map for the shared-model code-mode section
2026-07-28 08:52:21 -04:00

30 lines
1.2 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_LEGACY_MODEL_IDS = ["kimi-code", "k2p5"] as const;
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_LEGACY_MODEL_IDS;
export function buildKimiCodingProvider(): ModelProviderConfig {
return buildManifestModelProviderConfig({
providerId: KIMI_PROVIDER_ID,
catalog: KIMI_CODING_CATALOG,
});
}
export function normalizeKimiCodingModelId(modelId: string): string {
// Legacy k3[1m] was retired upstream and normalizes to k3 for shipped configurations.
if (modelId === "k3[1m]") {
return "k3";
}
return KIMI_LEGACY_MODEL_IDS.includes(modelId as (typeof KIMI_LEGACY_MODEL_IDS)[number])
? KIMI_CODING_DEFAULT_MODEL_ID
: modelId;
}