From e4a6723bb679b13401020bb4953cd7c4c9564e8c Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 26 Apr 2026 08:50:20 +0300 Subject: feat: optional API key for Ollama provider (Ollama Cloud) Adds an optional HEXAI_OLLAMA_API_KEY (with OLLAMA_API_KEY fallback) so the existing Ollama provider can target Ollama Cloud (ollama.ai) in addition to a local server. When the key is empty the request is unauthenticated, preserving local-server behavior byte-for-byte; when set, an Authorization: Bearer header is attached for both Chat and ChatStream. Documented cloud usage in config.toml.example. Co-Authored-By: Claude Opus 4.7 (1M context) --- internal/llmutils/client.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'internal/llmutils') diff --git a/internal/llmutils/client.go b/internal/llmutils/client.go index 3641556..ef24571 100644 --- a/internal/llmutils/client.go +++ b/internal/llmutils/client.go @@ -103,5 +103,11 @@ func NewClientFromApp(cfg appconfig.App) (llm.Client, error) { if strings.TrimSpace(anKey) == "" { anKey = os.Getenv("ANTHROPIC_API_KEY") } - return llm.NewFromConfig(llmCfg, oaKey, orKey, anKey) + // Ollama API key is optional: only needed for Ollama Cloud (ollama.ai). + // A local Ollama server keeps working when this is empty. + olKey := os.Getenv("HEXAI_OLLAMA_API_KEY") + if strings.TrimSpace(olKey) == "" { + olKey = os.Getenv("OLLAMA_API_KEY") + } + return llm.NewFromConfig(llmCfg, oaKey, orKey, anKey, olKey) } -- cgit v1.2.3