fix: add API key placeholders for LM Studio and Ollama in OpenClaw and Claude Code#13552
Merged
kangfenmao merged 3 commits intomainfrom Mar 25, 2026
Merged
fix: add API key placeholders for LM Studio and Ollama in OpenClaw and Claude Code#13552kangfenmao merged 3 commits intomainfrom
kangfenmao merged 3 commits intomainfrom
Conversation
…d Claude Code services For local providers like LM Studio and Ollama that don't require authentication, OpenClaw and Claude Code services need non-empty placeholder API key values. - OpenClawService: Added NO_KEY_PLACEHOLDERS map to provide fallback values - ClaudeCodeService: Separated apiKey validation from provider type check and added placeholder assignment logic matching BaseService.validateAgentModels pattern Fixes clients attempting to use LM Studio/Ollama with Claude Code agent. Signed-off-by: suyao <[email protected]>
kangfenmao
approved these changes
Mar 25, 2026
MyPrototypeWhat
pushed a commit
that referenced
this pull request
Mar 30, 2026
…d Claude Code (#13552) ### What this PR does Before this PR: - LM Studio and Ollama clients would fail when trying to use Claude Code agent because the services rejected empty API keys, even though these providers don't require authentication. After this PR: - OpenClawService and ClaudeCodeService now assign placeholder API key values for local providers that don't require real API keys (Ollama, LM Studio), allowing these providers to work with Claude Code agent. Fixes # ### Why we need it and why it was done in this way The following tradeoffs were made: - Used provider ID as the placeholder value in ClaudeCodeService (matching the pattern in BaseService.validateAgentModels) - Used a lookup map in OpenClawService to support both provider ID and type-based fallback, with a final fallback to 'no-key-required' The following alternatives were considered: - Modifying the SDK itself to skip API key validation for local providers (not feasible, SDK is external) - Using environment variables to indicate which providers don't need keys (more complex than simple placeholder assignment) Links to places where the discussion took place: - https://lmstudio.ai/docs/developer/anthropic-compat - https://docs.openclaw.ai/providers/ollama - https://docs.ollama.com/api/anthropic-compatibility ### Breaking changes None. ### Special notes for your reviewer The fix follows the existing pattern established in `BaseService.validateAgentModels()` which already uses provider ID as a placeholder for keyless providers. The changes are minimal and focused on enabling these providers without affecting other functionality. ### Checklist - [x] PR: The PR description is expressive enough and will help future contributors - [x] Code: [Write code that humans can understand](https://en.wikiquote.org/wiki/Martin_Fowler#code-for-humans) and [Keep it simple](https://en.wikipedia.org/wiki/KISS_principle) - [x] Refactor: You have [left the code cleaner than you found it (Boy Scout Rule)](https://learning.oreilly.com/library/view/97-things-every/9780596809515/ch08.html) - [x] Upgrade: Impact of this change on upgrade flows was considered and addressed if required - [ ] Documentation: A [user-guide update](https://docs.cherry-ai.com) was considered and is present (link) or not required. Check this only when the PR introduces or changes a user-facing feature or behavior. - [x] Self-review: I have reviewed my own code (e.g., via [`/gh-pr-review`](/.claude/skills/gh-pr-review/SKILL.md), `gh pr diff`, or GitHub UI) before requesting review from others ### Release note ```release-note NONE ``` Signed-off-by: suyao <[email protected]>
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.
What this PR does
Before this PR:
After this PR:
Fixes #
Why we need it and why it was done in this way
The following tradeoffs were made:
The following alternatives were considered:
Links to places where the discussion took place:
Breaking changes
None.
Special notes for your reviewer
The fix follows the existing pattern established in
BaseService.validateAgentModels()which already uses provider ID as a placeholder for keyless providers. The changes are minimal and focused on enabling these providers without affecting other functionality.Checklist
/gh-pr-review,gh pr diff, or GitHub UI) before requesting review from othersRelease note