From cbdd187bbb494b2c7cd978728788bea4273b7ab9 Mon Sep 17 00:00:00 2001 From: Suhas S Date: Fri, 15 Aug 2025 21:20:53 +0800 Subject: [PATCH 1/2] fix: disable tool support for moonshotai/kimi-k2:free model Fixes #6619 where moonshotai/kimi-k2:free was causing 400 errors in agent mode because it doesn't support tool calls. This is a minimal, targeted fix that only affects the specific model reported in the issue. --- core/llm/toolSupport.test.ts | 9 +++++++++ core/llm/toolSupport.ts | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/core/llm/toolSupport.test.ts b/core/llm/toolSupport.test.ts index c3397878c..51502bfe8 100644 --- a/core/llm/toolSupport.test.ts +++ b/core/llm/toolSupport.test.ts @@ -280,6 +280,15 @@ describe("PROVIDER_TOOL_SUPPORT", () => { }); }); + describe("openrouter", () => { + const supportsFn = PROVIDER_TOOL_SUPPORT["openrouter"]; + + it("should return false for moonshotai/kimi-k2:free model", () => { + // This fixes issue #6619 + expect(supportsFn("moonshotai/kimi-k2:free")).toBe(false); + }); + }); + describe("edge cases", () => { it("should handle empty model names", () => { expect(PROVIDER_TOOL_SUPPORT["continue-proxy"]("")).toBe(false); diff --git a/core/llm/toolSupport.ts b/core/llm/toolSupport.ts index 40648c702..a94cec81a 100644 --- a/core/llm/toolSupport.ts +++ b/core/llm/toolSupport.ts @@ -239,6 +239,13 @@ export const PROVIDER_TOOL_SUPPORT: Record boolean> = }, openrouter: (model) => { // https://openrouter.ai/models?fmt=cards&supported_parameters=tools + + // Specific free models that don't support tools + // Fixes issue #6619 - moonshotai/kimi-k2:free causing 400 errors + if (model.toLowerCase() === "moonshotai/kimi-k2:free") { + return false; + } + if ( ["vision", "math", "guard", "mistrallite", "mistral-openorca"].some( (part) => model.toLowerCase().includes(part), From 89c52cad9b9201529c66f403c92d428ccdba3d8e Mon Sep 17 00:00:00 2001 From: Suhas S Date: Sat, 16 Aug 2025 09:24:20 +0800 Subject: [PATCH 2/2] style: apply prettier formatting to toolSupport.ts --- core/llm/toolSupport.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/llm/toolSupport.ts b/core/llm/toolSupport.ts index a94cec81a..7c89dbfa4 100644 --- a/core/llm/toolSupport.ts +++ b/core/llm/toolSupport.ts @@ -239,13 +239,13 @@ export const PROVIDER_TOOL_SUPPORT: Record boolean> = }, openrouter: (model) => { // https://openrouter.ai/models?fmt=cards&supported_parameters=tools - + // Specific free models that don't support tools // Fixes issue #6619 - moonshotai/kimi-k2:free causing 400 errors if (model.toLowerCase() === "moonshotai/kimi-k2:free") { return false; } - + if ( ["vision", "math", "guard", "mistrallite", "mistral-openorca"].some( (part) => model.toLowerCase().includes(part),