Skip to content

fix(openclaw): rename virtual provider to llmspy for cloud model routing#149

Merged
bussyjd merged 1 commit intointegration-okr-1from
fix/openclaw-llmspy-provider
Feb 13, 2026
Merged

fix(openclaw): rename virtual provider to llmspy for cloud model routing#149
bussyjd merged 1 commit intointegration-okr-1from
fix/openclaw-llmspy-provider

Conversation

@bussyjd
Copy link
Collaborator

@bussyjd bussyjd commented Feb 12, 2026

Summary

  • Renames the virtual provider in buildLLMSpyRoutedOverlay() from "ollama" to "llmspy" so OpenClaw correctly resolves cloud models through the llmspy gateway
  • Adds llmspy/ prefix to AgentModel (e.g., llmspy/claude-sonnet-4-5-20250929) — required by OpenClaw's parseModelRef() which splits on / for provider routing
  • Disables the default ollama provider when a cloud provider is selected to prevent dual-provider confusion
  • Adds llmspy provider entry to chart values, _helpers.tpl, and deployment.yaml provider iteration lists
  • Default Ollama-only path is unchanged (still uses ollama/glm-4.7-flash)

Root Cause

OpenClaw's model resolution (src/agents/model-selection.ts) requires provider/model format. Without a /, bare model names fall back to a hardcoded anthropic provider — which is disabled in the cloud overlay, silently breaking chat requests.

Request Chain (cloud path)

OpenClaw: model = "llmspy/claude-sonnet-4-5-20250929"
  → parseModelRef() → provider="llmspy", model="claude-sonnet-4-5-20250929"
  → llmspy provider → baseUrl: http://llmspy.llm.svc.cluster.local:8000/v1
  → llmspy resolves model to Anthropic → forwards upstream

Test plan

  • All 30 openclaw tests pass (go test ./internal/openclaw/ -v)
  • go build ./cmd/obol compiles successfully
  • Deploy with obol openclaw setup using Anthropic/OpenAI and verify chat works
  • Verify default Ollama path still works (no cloud provider selected)

@bussyjd bussyjd changed the base branch from main to integration-okr-1 February 12, 2026 19:49
if p.APIKey != "" && !isEnvVarRef(p.APIKey) {
ip.APIKey = p.APIKey
} else if p.APIKey != "" {
fmt.Printf(" Note: provider '%s' uses env-var reference %s (will need manual configuration)\n", name, p.APIKey)

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information

[Sensitive data returned by an access to APIKey](1) flows to a logging call.

Copilot Autofix

AI 1 day ago

To fix the problem, we should ensure that no sensitive information (API keys or their direct representations) is written to logs or stdout. Instead of interpolating p.APIKey into the fmt.Printf message, we can log only that the provider uses an env-var reference, without revealing its exact value. This preserves all functional behavior: the configuration parsing and result construction remain unchanged; only the informational note is redacted.

Concretely, in internal/openclaw/import.go, within detectExistingConfigAt, update the else if p.APIKey != "" branch (around line 146) to remove %s and the p.APIKey argument from the format string. A safe message would be " Note: provider '%s' uses env-var reference (will need manual configuration)\n", which still tells the user what to do but does not leak the value. No extra imports, methods, or type changes are needed; this is a minimal logging-format change.

Suggested changeset 1
internal/openclaw/import.go

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/internal/openclaw/import.go b/internal/openclaw/import.go
--- a/internal/openclaw/import.go
+++ b/internal/openclaw/import.go
@@ -143,7 +143,7 @@
 		if p.APIKey != "" && !isEnvVarRef(p.APIKey) {
 			ip.APIKey = p.APIKey
 		} else if p.APIKey != "" {
-			fmt.Printf("  Note: provider '%s' uses env-var reference %s (will need manual configuration)\n", name, p.APIKey)
+			fmt.Printf("  Note: provider '%s' uses env-var reference (will need manual configuration)\n", name)
 		}
 		for _, m := range p.Models {
 			ip.Models = append(ip.Models, ImportedModel{ID: m.ID, Name: m.Name})
EOF
@@ -143,7 +143,7 @@
if p.APIKey != "" && !isEnvVarRef(p.APIKey) {
ip.APIKey = p.APIKey
} else if p.APIKey != "" {
fmt.Printf(" Note: provider '%s' uses env-var reference %s (will need manual configuration)\n", name, p.APIKey)
fmt.Printf(" Note: provider '%s' uses env-var reference (will need manual configuration)\n", name)
}
for _, m := range p.Models {
ip.Models = append(ip.Models, ImportedModel{ID: m.ID, Name: m.Name})
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
…cloud model routing

OpenClaw requires provider/model format (e.g. "llmspy/claude-sonnet-4-5-20250929")
for model resolution. Without a provider prefix, it hardcodes a fallback to the
"anthropic" provider — which is disabled in the llmspy-routed overlay, causing
chat requests to fail silently.

This renames the virtual provider used for cloud model routing from "ollama" to
"llmspy", adds the proper provider prefix to AgentModel, and disables the default
"ollama" provider when a cloud provider is selected. The default Ollama-only path
is unchanged since it genuinely routes Ollama models.
@bussyjd bussyjd force-pushed the fix/openclaw-llmspy-provider branch from 7b6db92 to 5e6c751 Compare February 13, 2026 13:01
@bussyjd bussyjd merged commit 1fd4b88 into integration-okr-1 Feb 13, 2026
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.

2 participants