Skip to content

fix: add API key placeholders for LM Studio and Ollama in OpenClaw and Claude Code#13552

Draft
DeJeune wants to merge 1 commit intomainfrom
DeJeune/openclaw-apikey-placeholder
Draft

fix: add API key placeholders for LM Studio and Ollama in OpenClaw and Claude Code#13552
DeJeune wants to merge 1 commit intomainfrom
DeJeune/openclaw-apikey-placeholder

Conversation

@DeJeune
Copy link
Collaborator

@DeJeune DeJeune commented Mar 17, 2026

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:

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

Release note

NONE

…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 <sy20010504@gmail.com>
@DeJeune DeJeune marked this pull request as draft March 17, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant