From 1b5fb36c9d5b6f88a285ce76faea4d808e92e472 Mon Sep 17 00:00:00 2001 From: Teknium Date: Sun, 22 Mar 2026 16:08:21 -0700 Subject: [PATCH] fix(cli): allow custom/local endpoints without API key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Local LLM servers (llama.cpp, ollama, vLLM, etc.) typically don't require authentication. When a custom base_url is configured but no API key is found, use a placeholder instead of failing with 'Provider resolver returned an empty API key.' The OpenAI SDK accepts any string as api_key, and local servers simply ignore the Authorization header. Fixes issue reported by @ThatWolfieGuy — llama.cpp stopped working after updating because the new runtime provider resolver enforces non-empty API keys even for keyless local endpoints. --- cli.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cli.py b/cli.py index 43ae081e..edd0b664 100644 --- a/cli.py +++ b/cli.py @@ -1762,8 +1762,22 @@ class HermesCLI: resolved_acp_command = runtime.get("command") resolved_acp_args = list(runtime.get("args") or []) if not isinstance(api_key, str) or not api_key: - self.console.print("[bold red]Provider resolver returned an empty API key.[/]") - return False + # Custom / local endpoints (llama.cpp, ollama, vLLM, etc.) often + # don't require authentication. When a base_url IS configured but + # no API key was found, use a placeholder so the OpenAI SDK + # doesn't reject the request and local servers just ignore it. + _source = runtime.get("source", "") + _has_custom_base = isinstance(base_url, str) and base_url and "openrouter.ai" not in base_url + if _has_custom_base: + api_key = "no-key-required" + logger.debug( + "No API key for custom endpoint %s (source=%s), " + "using placeholder — local servers typically ignore auth", + base_url, _source, + ) + else: + self.console.print("[bold red]Provider resolver returned an empty API key.[/]") + return False if not isinstance(base_url, str) or not base_url: self.console.print("[bold red]Provider resolver returned an empty base URL.[/]") return False