Merge pull request #7175 from su0as/fix/openrouter-kimi-free-tools

fix: disable tool support for moonshotai/kimi-k2:free model
This commit is contained in:
Dallin Romney 2025-08-18 17:18:31 -07:00 • committed by GitHub
commit e699c73127
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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),