From a2e6ab6c577f7869d2319e1e30b4fca980b5e1e7 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 13 May 2025 10:43:09 -0700 Subject: [PATCH 1/2] openrouter default tool support --- core/llm/toolSupport.ts | 66 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/core/llm/toolSupport.ts b/core/llm/toolSupport.ts index 4174c0ab7..9f0bfb21f 100644 --- a/core/llm/toolSupport.ts +++ b/core/llm/toolSupport.ts @@ -165,4 +165,70 @@ export const PROVIDER_TOOL_SUPPORT: Record< ) return true; }, + openrouter: (model) => { + if ( + ["vision", "math", "guard", "mistrallite", "mistral-openorca"].some( + (part) => model.toLowerCase().includes(part), + ) + ) { + return false; + } + + const supportedPrefixes = [ + "openai/gpt-3.5", + "openai/gpt-4", + "openai/o1", + "openai/o3", + "openai/o4", + "anthropic/claude-3", + "microsoft/phi-3", + "google/gemini-flash-1.5", + "google/gemini-2", + "google/gemini-pro", + "x-ai/grok", + "qwen/qwen3", + "qwen/qwen-", + "cohere/command-r", + "ai21/jamba-1.6", + "mistralai/mistral", + "mistralai/ministral", + "mistralai/codestral", + "mistralai/mixtral", + "mistral/ministral", + "mistralai/pixtral", + "meta-llama/llama-3.3", + "amazon/nova", + "deepseek/deepseek-r1", + "deepseek/deepseek-chat", + "meta-llama/llama-4", + "all-hands/openhands-lm-32b", + ]; + for (const prefix of supportedPrefixes) { + if (model.toLowerCase().startsWith(prefix)) { + return true; + } + } + + const specificModels = [ + "qwen/qwq-32b", + "qwen/qwen-2.5-72b-instruct", + "meta-llama/llama-3.2-3b-instruct", + "meta-llama/llama-3-8b-instruct", + "meta-llama/llama-3-70b-instruct", + "arcee-ai/caller-large", + "nousresearch/hermes-3-llama-3.1-70b", + ]; + for (const model of specificModels) { + if (model.toLowerCase() === model) { + return true; + } + } + + const supportedContains = ["llama-3.1"]; + for (const model of supportedContains) { + if (model.toLowerCase().includes(model)) { + return true; + } + } + }, }; From 1479dfbf191808c6c2911a0e22f691fe8bd9e7f3 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 13 May 2025 12:02:16 -0700 Subject: [PATCH 2/2] add comment link to openrouter models that support tools --- core/llm/toolSupport.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/core/llm/toolSupport.ts b/core/llm/toolSupport.ts index 9f0bfb21f..8a96a4d60 100644 --- a/core/llm/toolSupport.ts +++ b/core/llm/toolSupport.ts @@ -166,6 +166,7 @@ export const PROVIDER_TOOL_SUPPORT: Record< return true; }, openrouter: (model) => { + // https://openrouter.ai/models?fmt=cards&supported_parameters=tools if ( ["vision", "math", "guard", "mistrallite", "mistral-openorca"].some( (part) => model.toLowerCase().includes(part),