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),