From f6c75cc4682ddabb0fbf7f14f5d2ca97c58675c5 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Fri, 5 Sep 2025 09:22:23 +0000 Subject: [PATCH 1/2] feat: add Kimi K2-0905 model to Chutes provider - Added moonshotai/Kimi-K2-Instruct-0905 to ChutesModelId type - Added model configuration with 256k context window - Added test coverage for the new model Fixes #7700 --- .../src/providers/__tests__/chutes.spec.ts | 21 +++++++++++++++++++ packages/types/src/providers/chutes.ts | 10 +++++++++ 2 files changed, 31 insertions(+) create mode 100644 packages/types/src/providers/__tests__/chutes.spec.ts diff --git a/packages/types/src/providers/__tests__/chutes.spec.ts b/packages/types/src/providers/__tests__/chutes.spec.ts new file mode 100644 index 00000000000..0d5ee0a85d7 --- /dev/null +++ b/packages/types/src/providers/__tests__/chutes.spec.ts @@ -0,0 +1,21 @@ +import { chutesModels } from "../chutes.js" + +describe("chutesModels", () => { + test("should include Kimi K2-0905 model", () => { + expect(chutesModels["moonshotai/Kimi-K2-Instruct-0905"]).toBeDefined() + expect(chutesModels["moonshotai/Kimi-K2-Instruct-0905"].maxTokens).toBe(32768) + expect(chutesModels["moonshotai/Kimi-K2-Instruct-0905"].contextWindow).toBe(262144) + expect(chutesModels["moonshotai/Kimi-K2-Instruct-0905"].supportsImages).toBe(false) + expect(chutesModels["moonshotai/Kimi-K2-Instruct-0905"].supportsPromptCache).toBe(false) + expect(chutesModels["moonshotai/Kimi-K2-Instruct-0905"].inputPrice).toBe(0.1999) + expect(chutesModels["moonshotai/Kimi-K2-Instruct-0905"].outputPrice).toBe(0.8001) + expect(chutesModels["moonshotai/Kimi-K2-Instruct-0905"].description).toBe( + "Moonshot AI Kimi K2 Instruct 0905 model with 256k context window.", + ) + }) + + test("should include Kimi K2-75k model", () => { + expect(chutesModels["moonshotai/Kimi-K2-Instruct-75k"]).toBeDefined() + expect(chutesModels["moonshotai/Kimi-K2-Instruct-75k"].contextWindow).toBe(75000) + }) +}) diff --git a/packages/types/src/providers/chutes.ts b/packages/types/src/providers/chutes.ts index 33b01499895..7060cdad821 100644 --- a/packages/types/src/providers/chutes.ts +++ b/packages/types/src/providers/chutes.ts @@ -30,6 +30,7 @@ export type ChutesModelId = | "zai-org/GLM-4.5-Air" | "zai-org/GLM-4.5-FP8" | "moonshotai/Kimi-K2-Instruct-75k" + | "moonshotai/Kimi-K2-Instruct-0905" | "Qwen/Qwen3-235B-A22B-Thinking-2507" export const chutesDefaultModelId: ChutesModelId = "deepseek-ai/DeepSeek-R1-0528" @@ -289,6 +290,15 @@ export const chutesModels = { outputPrice: 0.5926, description: "Moonshot AI Kimi K2 Instruct model with 75k context window.", }, + "moonshotai/Kimi-K2-Instruct-0905": { + maxTokens: 32768, + contextWindow: 262144, + supportsImages: false, + supportsPromptCache: false, + inputPrice: 0.1999, + outputPrice: 0.8001, + description: "Moonshot AI Kimi K2 Instruct 0905 model with 256k context window.", + }, "Qwen/Qwen3-235B-A22B-Thinking-2507": { maxTokens: 32768, contextWindow: 262144, From ba19d204652588b2f11302364dbc786b7d2a6ad9 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Fri, 5 Sep 2025 10:10:53 +0000 Subject: [PATCH 2/2] fix: remove duplicate test file and add Kimi K2-0905 test to correct location - Removed duplicate test file at packages/types/src/providers/__tests__/chutes.spec.ts - Added test for moonshotai/Kimi-K2-Instruct-0905 model to src/api/providers/__tests__/chutes.spec.ts - All tests passing successfully --- .../src/providers/__tests__/chutes.spec.ts | 21 ------------------ src/api/providers/__tests__/chutes.spec.ts | 22 +++++++++++++++++++ 2 files changed, 22 insertions(+), 21 deletions(-) delete mode 100644 packages/types/src/providers/__tests__/chutes.spec.ts diff --git a/packages/types/src/providers/__tests__/chutes.spec.ts b/packages/types/src/providers/__tests__/chutes.spec.ts deleted file mode 100644 index 0d5ee0a85d7..00000000000 --- a/packages/types/src/providers/__tests__/chutes.spec.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { chutesModels } from "../chutes.js" - -describe("chutesModels", () => { - test("should include Kimi K2-0905 model", () => { - expect(chutesModels["moonshotai/Kimi-K2-Instruct-0905"]).toBeDefined() - expect(chutesModels["moonshotai/Kimi-K2-Instruct-0905"].maxTokens).toBe(32768) - expect(chutesModels["moonshotai/Kimi-K2-Instruct-0905"].contextWindow).toBe(262144) - expect(chutesModels["moonshotai/Kimi-K2-Instruct-0905"].supportsImages).toBe(false) - expect(chutesModels["moonshotai/Kimi-K2-Instruct-0905"].supportsPromptCache).toBe(false) - expect(chutesModels["moonshotai/Kimi-K2-Instruct-0905"].inputPrice).toBe(0.1999) - expect(chutesModels["moonshotai/Kimi-K2-Instruct-0905"].outputPrice).toBe(0.8001) - expect(chutesModels["moonshotai/Kimi-K2-Instruct-0905"].description).toBe( - "Moonshot AI Kimi K2 Instruct 0905 model with 256k context window.", - ) - }) - - test("should include Kimi K2-75k model", () => { - expect(chutesModels["moonshotai/Kimi-K2-Instruct-75k"]).toBeDefined() - expect(chutesModels["moonshotai/Kimi-K2-Instruct-75k"].contextWindow).toBe(75000) - }) -}) diff --git a/src/api/providers/__tests__/chutes.spec.ts b/src/api/providers/__tests__/chutes.spec.ts index 7a6b1aaa706..f6fd1ef0456 100644 --- a/src/api/providers/__tests__/chutes.spec.ts +++ b/src/api/providers/__tests__/chutes.spec.ts @@ -297,6 +297,28 @@ describe("ChutesHandler", () => { ) }) + it("should return moonshotai/Kimi-K2-Instruct-0905 model with correct configuration", () => { + const testModelId: ChutesModelId = "moonshotai/Kimi-K2-Instruct-0905" + const handlerWithModel = new ChutesHandler({ + apiModelId: testModelId, + chutesApiKey: "test-chutes-api-key", + }) + const model = handlerWithModel.getModel() + expect(model.id).toBe(testModelId) + expect(model.info).toEqual( + expect.objectContaining({ + maxTokens: 32768, + contextWindow: 262144, + supportsImages: false, + supportsPromptCache: false, + inputPrice: 0.1999, + outputPrice: 0.8001, + description: "Moonshot AI Kimi K2 Instruct 0905 model with 256k context window.", + temperature: 0.5, // Default temperature for non-DeepSeek models + }), + ) + }) + it("completePrompt method should return text from Chutes API", async () => { const expectedResponse = "This is a test response from Chutes" mockCreate.mockResolvedValueOnce({ choices: [{ message: { content: expectedResponse } }] })