From 8b9373707845631ad286580b1d2c3f938e5c263f Mon Sep 17 00:00:00 2001 From: David Brailovsky Date: Mon, 20 Jul 2026 09:00:15 +0000 Subject: [PATCH] kimi: add low,high to k3 and remove k2p7 references --- packages/ai/scripts/generate-models.ts | 5 ++--- packages/ai/src/providers/kimi-coding.models.ts | 8 ++++---- packages/ai/test/abort.test.ts | 2 +- .../ai/test/anthropic-adaptive-thinking-models.test.ts | 2 +- .../ai/test/anthropic-force-adaptive-thinking.test.ts | 2 +- packages/ai/test/context-overflow.test.ts | 4 ++-- packages/ai/test/cross-provider-handoff.test.ts | 2 +- packages/ai/test/empty.test.ts | 2 +- packages/ai/test/image-tool-result.test.ts | 4 ++-- packages/ai/test/providers.test.ts | 1 - packages/ai/test/stream.test.ts | 4 ++-- packages/ai/test/supports-xhigh.test.ts | 4 ++-- packages/ai/test/tokens.test.ts | 2 +- packages/ai/test/tool-call-without-result.test.ts | 2 +- packages/ai/test/total-tokens.test.ts | 4 ++-- packages/ai/test/unicode-surrogate.test.ts | 2 +- 16 files changed, 24 insertions(+), 26 deletions(-) diff --git a/packages/ai/scripts/generate-models.ts b/packages/ai/scripts/generate-models.ts index 53d5a00a..38c1464e 100644 --- a/packages/ai/scripts/generate-models.ts +++ b/packages/ai/scripts/generate-models.ts @@ -245,9 +245,9 @@ const DEEPSEEK_V4_THINKING_LEVEL_MAP = { const KIMI_K3_THINKING_LEVEL_MAP = { off: null, minimal: null, - low: null, + low: "low", medium: null, - high: null, + high: "high", xhigh: null, max: "max", } as const; @@ -261,7 +261,6 @@ const KIMI_K3_COST = { // Kimi Coding is subscription-backed, so models.dev reports zero cost. Use the // equivalent Moonshot API rates to estimate the value of subscription usage. const KIMI_CODING_IMPLIED_COSTS: Record["cost"]> = { - k2p7: { input: 0.95, output: 4, cacheRead: 0.19, cacheWrite: 0 }, k3: KIMI_K3_COST, "kimi-for-coding": { input: 0.95, output: 4, cacheRead: 0.19, cacheWrite: 0 }, "kimi-for-coding-highspeed": { input: 1.9, output: 8, cacheRead: 0.38, cacheWrite: 0 }, diff --git a/packages/ai/src/providers/kimi-coding.models.ts b/packages/ai/src/providers/kimi-coding.models.ts index cfd4c68e..ac810a75 100644 --- a/packages/ai/src/providers/kimi-coding.models.ts +++ b/packages/ai/src/providers/kimi-coding.models.ts @@ -5,14 +5,14 @@ import values from "./data/kimi-coding.json" with { type: "json" }; import type { Model } from "../types.ts"; export const KIMI_CODING_MODELS = values as { - "k2p7": Model<"anthropic-messages"> & { - id: "k2p7"; - provider: "kimi-coding"; - }; "k3": Model<"anthropic-messages"> & { id: "k3"; provider: "kimi-coding"; }; + "kimi-for-coding": Model<"anthropic-messages"> & { + id: "kimi-for-coding"; + provider: "kimi-coding"; + }; "kimi-for-coding-highspeed": Model<"anthropic-messages"> & { id: "kimi-for-coding-highspeed"; provider: "kimi-coding"; diff --git a/packages/ai/test/abort.test.ts b/packages/ai/test/abort.test.ts index ce81422c..c79cf540 100644 --- a/packages/ai/test/abort.test.ts +++ b/packages/ai/test/abort.test.ts @@ -250,7 +250,7 @@ describe("AI Providers Abort Tests", () => { }); describe.skipIf(!process.env.KIMI_API_KEY)("Kimi For Coding Provider Abort", () => { - const llm = getModel("kimi-coding", "k2p7"); + const llm = getModel("kimi-coding", "kimi-for-coding"); it("should abort mid-stream", { retry: 3 }, async () => { await testAbortSignal(llm); diff --git a/packages/ai/test/anthropic-adaptive-thinking-models.test.ts b/packages/ai/test/anthropic-adaptive-thinking-models.test.ts index 7807ffc1..329c8a72 100644 --- a/packages/ai/test/anthropic-adaptive-thinking-models.test.ts +++ b/packages/ai/test/anthropic-adaptive-thinking-models.test.ts @@ -7,7 +7,7 @@ const EXPECTED_CURRENT_ADAPTIVE_THINKING_MODELS = [ "anthropic/claude-opus-4-8", "anthropic/claude-sonnet-5", "cloudflare-ai-gateway/claude-fable-5", - "kimi-coding/k2p7", + "kimi-coding/kimi-for-coding", "kimi-coding/k3", "kimi-coding/kimi-for-coding-highspeed", "opencode/claude-opus-4-8", diff --git a/packages/ai/test/anthropic-force-adaptive-thinking.test.ts b/packages/ai/test/anthropic-force-adaptive-thinking.test.ts index 0a922db7..ffaf48db 100644 --- a/packages/ai/test/anthropic-force-adaptive-thinking.test.ts +++ b/packages/ai/test/anthropic-force-adaptive-thinking.test.ts @@ -90,7 +90,7 @@ describe("Anthropic forceAdaptiveThinking compat override", () => { }); it.each([ - ["k2p7", "medium", "medium"], + ["kimi-for-coding", "medium", "medium"], ["k3", "max", "max"], ["kimi-for-coding-highspeed", "medium", "medium"], ] as const)( diff --git a/packages/ai/test/context-overflow.test.ts b/packages/ai/test/context-overflow.test.ts index e5acb6f3..2a8b6284 100644 --- a/packages/ai/test/context-overflow.test.ts +++ b/packages/ai/test/context-overflow.test.ts @@ -471,8 +471,8 @@ describe("Context overflow error handling", () => { // ============================================================================= describe.skipIf(!process.env.KIMI_API_KEY)("Kimi For Coding", () => { - it("k2p7 - should detect overflow via isContextOverflow", async () => { - const model = getModel("kimi-coding", "k2p7"); + it("kimi-for-coding - should detect overflow via isContextOverflow", async () => { + const model = getModel("kimi-coding", "kimi-for-coding"); const result = await testContextOverflow(model, process.env.KIMI_API_KEY!); logResult(result); diff --git a/packages/ai/test/cross-provider-handoff.test.ts b/packages/ai/test/cross-provider-handoff.test.ts index fe3b7ada..08da44de 100644 --- a/packages/ai/test/cross-provider-handoff.test.ts +++ b/packages/ai/test/cross-provider-handoff.test.ts @@ -109,7 +109,7 @@ const PROVIDER_MODEL_PAIRS: ProviderModelPair[] = [ // Together AI { provider: "together", model: "moonshotai/Kimi-K2.6", label: "together-kimi-k2.6" }, // Kimi For Coding - { provider: "kimi-coding", model: "k2p7", label: "kimi-coding-k2p7" }, + { provider: "kimi-coding", model: "kimi-for-coding", label: "kimi-for-coding" }, // Mistral { provider: "mistral", model: "devstral-medium-latest", label: "mistral-devstral-medium" }, // MiniMax diff --git a/packages/ai/test/empty.test.ts b/packages/ai/test/empty.test.ts index 2f75f888..502764c9 100644 --- a/packages/ai/test/empty.test.ts +++ b/packages/ai/test/empty.test.ts @@ -536,7 +536,7 @@ describe("AI Providers Empty Message Tests", () => { ); describe.skipIf(!process.env.KIMI_API_KEY)("Kimi For Coding Provider Empty Messages", () => { - const llm = getModel("kimi-coding", "k2p7"); + const llm = getModel("kimi-coding", "kimi-for-coding"); it("should handle empty content array", { retry: 3, timeout: 30000 }, async () => { await testEmptyMessage(llm); diff --git a/packages/ai/test/image-tool-result.test.ts b/packages/ai/test/image-tool-result.test.ts index 7c96d6cc..946a443a 100644 --- a/packages/ai/test/image-tool-result.test.ts +++ b/packages/ai/test/image-tool-result.test.ts @@ -381,8 +381,8 @@ describe("Tool Results with Images", () => { }, ); - describe.skipIf(!process.env.KIMI_API_KEY)("Kimi For Coding Provider (k2p7)", () => { - const llm = getModel("kimi-coding", "k2p7"); + describe.skipIf(!process.env.KIMI_API_KEY)("Kimi For Coding Provider (kimi-for-coding)", () => { + const llm = getModel("kimi-coding", "kimi-for-coding"); it("should handle tool result with only image", { retry: 3, timeout: 30000 }, async () => { await handleToolWithImageResult(llm); diff --git a/packages/ai/test/providers.test.ts b/packages/ai/test/providers.test.ts index fb2f67a3..e034ebec 100644 --- a/packages/ai/test/providers.test.ts +++ b/packages/ai/test/providers.test.ts @@ -59,7 +59,6 @@ describe("builtin providers", () => { it("uses API-equivalent implied pricing for Kimi Coding subscription models", () => { const models = builtinModels(); const expectedCosts = { - k2p7: { input: 0.95, output: 4, cacheRead: 0.19, cacheWrite: 0 }, k3: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 0 }, "kimi-for-coding-highspeed": { input: 1.9, output: 8, cacheRead: 0.38, cacheWrite: 0 }, }; diff --git a/packages/ai/test/stream.test.ts b/packages/ai/test/stream.test.ts index 13a53c91..4209f94d 100644 --- a/packages/ai/test/stream.test.ts +++ b/packages/ai/test/stream.test.ts @@ -1017,8 +1017,8 @@ describe("Generate E2E Tests", () => { }); }); - describe.skipIf(!process.env.KIMI_API_KEY)("Kimi For Coding Provider (k2p7 via Anthropic Messages)", () => { - const llm = getModel("kimi-coding", "k2p7"); + describe.skipIf(!process.env.KIMI_API_KEY)("Kimi For Coding Provider (kimi-for-coding via Anthropic Messages)", () => { + const llm = getModel("kimi-coding", "kimi-for-coding"); it("should complete basic text generation", { retry: 3 }, async () => { await basicTextGeneration(llm); diff --git a/packages/ai/test/supports-xhigh.test.ts b/packages/ai/test/supports-xhigh.test.ts index fa1eba91..b6988ba0 100644 --- a/packages/ai/test/supports-xhigh.test.ts +++ b/packages/ai/test/supports-xhigh.test.ts @@ -110,10 +110,10 @@ describe("getSupportedThinkingLevels", () => { } }); - it("includes only max for Kimi Coding K3", () => { + it("includes only low, high, max for Kimi Coding K3", () => { const model = getModel("kimi-coding", "k3"); expect(model).toBeDefined(); - expect(getSupportedThinkingLevels(model!)).toEqual(["max"]); + expect(getSupportedThinkingLevels(model!)).toEqual(["low", "high", "max"]); }); it("includes only high for OpenCode Grok Build", () => { diff --git a/packages/ai/test/tokens.test.ts b/packages/ai/test/tokens.test.ts index 9422a86e..42e6932d 100644 --- a/packages/ai/test/tokens.test.ts +++ b/packages/ai/test/tokens.test.ts @@ -218,7 +218,7 @@ describe("Token Statistics on Abort", () => { }); describe.skipIf(!process.env.KIMI_API_KEY)("Kimi For Coding Provider", () => { - const llm = getModel("kimi-coding", "k2p7"); + const llm = getModel("kimi-coding", "kimi-for-coding"); it("should include token stats when aborted mid-stream", { retry: 3, timeout: 30000 }, async () => { await testTokensOnAbort(llm); diff --git a/packages/ai/test/tool-call-without-result.test.ts b/packages/ai/test/tool-call-without-result.test.ts index 22fb6949..439b9758 100644 --- a/packages/ai/test/tool-call-without-result.test.ts +++ b/packages/ai/test/tool-call-without-result.test.ts @@ -255,7 +255,7 @@ describe("Tool Call Without Result Tests", () => { }); describe.skipIf(!process.env.KIMI_API_KEY)("Kimi For Coding Provider", () => { - const model = getModel("kimi-coding", "k2p7"); + const model = getModel("kimi-coding", "kimi-for-coding"); it("should filter out tool calls without corresponding tool results", { retry: 3, timeout: 30000 }, async () => { await testToolCallWithoutResult(model); diff --git a/packages/ai/test/total-tokens.test.ts b/packages/ai/test/total-tokens.test.ts index 93f06c1f..827dcdb1 100644 --- a/packages/ai/test/total-tokens.test.ts +++ b/packages/ai/test/total-tokens.test.ts @@ -567,8 +567,8 @@ describe("totalTokens field", () => { // ========================================================================= describe.skipIf(!process.env.KIMI_API_KEY)("Kimi For Coding", () => { - it("k2p7 - should return totalTokens equal to sum of components", { retry: 3, timeout: 60000 }, async () => { - const llm = getModel("kimi-coding", "k2p7"); + it("kimi-for-coding - should return totalTokens equal to sum of components", { retry: 3, timeout: 60000 }, async () => { + const llm = getModel("kimi-coding", "kimi-for-coding"); console.log(`\nKimi For Coding / ${llm.id}:`); const { first, second } = await testTotalTokensWithCache(llm, { apiKey: process.env.KIMI_API_KEY }); diff --git a/packages/ai/test/unicode-surrogate.test.ts b/packages/ai/test/unicode-surrogate.test.ts index baf4df10..8e059d1d 100644 --- a/packages/ai/test/unicode-surrogate.test.ts +++ b/packages/ai/test/unicode-surrogate.test.ts @@ -696,7 +696,7 @@ describe("AI Providers Unicode Surrogate Pair Tests", () => { ); describe.skipIf(!process.env.KIMI_API_KEY)("Kimi For Coding Provider Unicode Handling", () => { - const llm = getModel("kimi-coding", "k2p7"); + const llm = getModel("kimi-coding", "kimi-for-coding"); it("should handle emoji in tool results", { retry: 3, timeout: 30000 }, async () => { await testEmojiInToolResults(llm);