From b87d00288d68b7e63df86eb0f11134e8f1304ec9 Mon Sep 17 00:00:00 2001 From: Teknium Date: Thu, 9 Apr 2026 18:02:59 -0700 Subject: [PATCH] fix: add actionable hint for OpenRouter 'no tool endpoints' error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When OpenRouter returns 'No endpoints found that support tool use' (HTTP 404), display a hint explaining that provider routing restrictions may be filtering out tool-capable providers. Links the user directly to the model's OpenRouter page to check which providers support tools. The hint fires in the error display block that runs regardless of whether fallback succeeds — so the user always understands WHY the model failed, not just that it fell back. Reported via Discord: GLM-5.1 on OpenRouter with US-based provider restrictions eliminated all 4 tool-supporting endpoints (DeepInfra, Z.AI, Friendli, Venice), leaving only 7 non-tool providers. --- run_agent.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/run_agent.py b/run_agent.py index 94555cbfe..f4367fe7d 100644 --- a/run_agent.py +++ b/run_agent.py @@ -8233,7 +8233,33 @@ class AIAgent: if _err_body_str: self._vprint(f"{self.log_prefix} 📋 Details: {_err_body_str}", force=True) self._vprint(f"{self.log_prefix} ⏱️ Elapsed: {elapsed_time:.2f}s Context: {len(api_messages)} msgs, ~{approx_tokens:,} tokens") - + + # Actionable hint for OpenRouter "no tool endpoints" error. + # This fires regardless of whether fallback succeeds — the + # user needs to know WHY their model failed so they can fix + # their provider routing, not just silently fall back. + if ( + self._is_openrouter_url() + and "support tool use" in error_msg + ): + self._vprint( + f"{self.log_prefix} 💡 No OpenRouter providers for {_model} support tool calling with your current settings.", + force=True, + ) + if self.providers_allowed: + self._vprint( + f"{self.log_prefix} Your provider_routing.only restriction is filtering out tool-capable providers.", + force=True, + ) + self._vprint( + f"{self.log_prefix} Try removing the restriction or adding providers that support tools for this model.", + force=True, + ) + self._vprint( + f"{self.log_prefix} Check which providers support tools: https://openrouter.ai/models/{_model}", + force=True, + ) + # Check for interrupt before deciding to retry if self._interrupt_requested: self._vprint(f"{self.log_prefix}⚡ Interrupt detected during error handling, aborting retries.", force=True)