fix(ai,coding-agent): replace deprecated kimi k2p5 model closes #3242
This commit is contained in:
@@ -606,13 +606,22 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
|
||||
|
||||
// Process Kimi For Coding models
|
||||
if (data["kimi-for-coding"]?.models) {
|
||||
for (const [modelId, model] of Object.entries(data["kimi-for-coding"].models)) {
|
||||
const kimiModels = data["kimi-for-coding"].models as Record<string, ModelsDevModel>;
|
||||
const hasCanonicalModel = Object.prototype.hasOwnProperty.call(kimiModels, "kimi-for-coding");
|
||||
|
||||
for (const [modelId, model] of Object.entries(kimiModels)) {
|
||||
const m = model as ModelsDevModel;
|
||||
if (m.tool_call !== true) continue;
|
||||
// models.dev still exposes deprecated "k2p5" in some snapshots.
|
||||
// Normalize to the canonical model id and drop duplicates when canonical exists.
|
||||
if (modelId === "k2p5" && hasCanonicalModel) continue;
|
||||
|
||||
const normalizedId = modelId === "k2p5" ? "kimi-for-coding" : modelId;
|
||||
const normalizedName = modelId === "k2p5" ? "Kimi For Coding" : m.name || normalizedId;
|
||||
|
||||
models.push({
|
||||
id: modelId,
|
||||
name: m.name || modelId,
|
||||
id: normalizedId,
|
||||
name: normalizedName,
|
||||
api: "anthropic-messages",
|
||||
provider: "kimi-coding",
|
||||
// Kimi For Coding's Anthropic-compatible API - SDK appends /v1/messages
|
||||
@@ -1458,42 +1467,6 @@ async function generateModels() {
|
||||
];
|
||||
allModels.push(...vertexModels);
|
||||
|
||||
// Kimi For Coding models (Moonshot AI's Anthropic-compatible coding API)
|
||||
// Static fallback in case models.dev doesn't have them yet
|
||||
const KIMI_CODING_BASE_URL = "https://api.kimi.com/coding";
|
||||
const kimiCodingModels: Model<"anthropic-messages">[] = [
|
||||
{
|
||||
id: "kimi-k2-thinking",
|
||||
name: "Kimi K2 Thinking",
|
||||
api: "anthropic-messages",
|
||||
provider: "kimi-coding",
|
||||
baseUrl: KIMI_CODING_BASE_URL,
|
||||
reasoning: true,
|
||||
input: ["text"],
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
contextWindow: 262144,
|
||||
maxTokens: 32768,
|
||||
},
|
||||
{
|
||||
id: "k2p5",
|
||||
name: "Kimi K2.5",
|
||||
api: "anthropic-messages",
|
||||
provider: "kimi-coding",
|
||||
baseUrl: KIMI_CODING_BASE_URL,
|
||||
reasoning: true,
|
||||
input: ["text"],
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
contextWindow: 262144,
|
||||
maxTokens: 32768,
|
||||
},
|
||||
];
|
||||
// Only add if not already present from models.dev
|
||||
for (const model of kimiCodingModels) {
|
||||
if (!allModels.some(m => m.provider === "kimi-coding" && m.id === model.id)) {
|
||||
allModels.push(model);
|
||||
}
|
||||
}
|
||||
|
||||
const azureOpenAiModels: Model<Api>[] = allModels
|
||||
.filter((model) => model.provider === "openai" && model.api === "openai-responses")
|
||||
.map((model) => ({
|
||||
|
||||
Reference in New Issue
Block a user