fix: Auto-discover Ollama models without requiring API key#20872
Closed
marcodelpin wants to merge 2 commits intoopenclaw:mainfrom
Closed
fix: Auto-discover Ollama models without requiring API key#20872marcodelpin wants to merge 2 commits intoopenclaw:mainfrom
marcodelpin wants to merge 2 commits intoopenclaw:mainfrom
Conversation
9d7b731 to
2699028
Compare
…4544) Ollama is a local service that doesn't require authentication, but the provider was only registered when OLLAMA_API_KEY was set. This caused locally installed models to show as "missing" in openclaw models list. Changes: - Always attempt Ollama model discovery via /api/tags - Register provider with placeholder key "ollama-local" when models found - Add quiet flag to suppress warnings during implicit auto-discovery, so users without Ollama won't see noisy console output - Preserve existing behavior when API key is explicitly configured Fixes openclaw#4544 Ref openclaw#4782
2699028 to
2440409
Compare
18 tasks
Member
|
Superseded by #29201, which carries this fix forward with conflict resolution and additional hardening. Credit to @marcodelpin for the core implementation direction in this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4544
Ref #4782
Ollama is a local service that doesn't require API authentication, but
resolveImplicitProviders()only registered the Ollama provider whenOLLAMA_API_KEYwas explicitly configured. This caused locally installed models to show as "missing" inopenclaw models listand fail with "Unknown model" at runtime.Root Cause
In
src/agents/models-config.providers.ts, the Ollama provider registration was gated behind:Since Ollama runs locally without authentication, most users never set
OLLAMA_API_KEY, so discovery never ran.Changes
buildOllamaProvider()— if models are found via/api/tags, the provider is registered with a placeholder"ollama-local"API keyquietoption todiscoverOllamaModels()to suppressconsole.warnwhen the user hasn't explicitly configured Ollama. This prevents noisy warnings for users who don't have Ollama installed (addresses review feedback on fix: Auto-discover Ollama models without requiring explicit API key #4782)OLLAMA_API_KEYor auth profile configuration still works as before, with warnings preserved when Ollama is unreachableFiles Changed (2)
src/agents/models-config.providers.ts— provider resolution logic + quiet flag (+28/-10)src/agents/models-config.providers.ollama-autodiscovery.test.ts— 3 new testsTest Plan
openclaw models listshows it without API keyGreptile Summary
Enables Ollama models to be auto-discovered without requiring
OLLAMA_API_KEY, fixing a key usability issue where locally installed Ollama models appeared as "missing". The implementation adds aquietparameter to suppress warnings when Ollama isn't explicitly configured, preventing noise for users without Ollama while preserving warnings for users who explicitly set up Ollama but can't reach it."ollama-local"API key when models are foundquiet: true) when no API key configured prevents unnecessary warnings for users without OllamaConfidence Score: 5/5
Last reviewed commit: 81c8562
🤖 Generated with Claude Code
Testing: fully tested (automated + manual verification)
I understand and can explain all changes in this PR.