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.
This commit is contained in:
Suhas S 2025-08-15 21:20:53 +08:00
parent 85994118e8
commit cbdd187bbb
2 changed files with 16 additions and 0 deletions

View file

@ -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);

View file

@ -239,6 +239,13 @@ export const PROVIDER_TOOL_SUPPORT: Record<string, (model: string) => 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),