Skip to content

Ollama provider not registered in gateway runtime despite OLLAMA_API_KEY=ollama-local and implicit config #61209

Description

@rimkute

Summary

OpenClaw gateway on macOS/launchd still fails to register the Ollama provider at runtime even after:

  • removing models.providers.ollama from ~/.openclaw/openclaw.json
  • setting OLLAMA_API_KEY=ollama-local
  • restarting the gateway cleanly

Startup logs show the session/agent model as ollama/qwen3.5:4b, but live requests still fail with Unknown model: ollama/qwen3.5:4b and silently fall back to openai-codex/gpt-5.4.

Environment

  • OpenClaw: 2026.3.31
  • OS: macOS (LaunchAgent / launchd)
  • Gateway label: ai.openclaw.gateway
  • Ollama local API working directly outside gateway
  • Local test model: ollama/qwen3.5:4b

Expected behavior

If:

  1. models.providers.ollama is absent (implicit behavior)
  2. LaunchAgent env contains OLLAMA_API_KEY=ollama-local
  3. gateway is restarted

then ollama/qwen3.5:4b should register and serve requests without fallback.

Actual behavior

Gateway startup shows Ollama as the configured model:

[lcm] Compaction summarization model: ollama/qwen3.5:4b (default)
agent model: ollama/qwen3.5:4b

But live requests fail immediately:

FailoverError: Unknown model: ollama/qwen3.5:4b. Ollama requires authentication to be registered as a provider. Set OLLAMA_API_KEY="ollama-local" (any value works) or run "openclaw configure".

and then:

Model "ollama/qwen3.5:4b" not found. Fell back to "openai-codex/gpt-5.4".

Repro steps

  1. Ensure local Ollama is running and the model is available directly.
  2. Remove models.providers.ollama from ~/.openclaw/openclaw.json.
  3. Set LaunchAgent env:
    • OLLAMA_API_KEY=ollama-local
  4. Restart gateway.
  5. Request ollama/qwen3.5:4b in a live session.
  6. Inspect gateway log.

Evidence

Config state

  • models.providers no longer contains ollama
  • active provider keys in config: anthropic, google, minimax-portal

LaunchAgent env

Persisted plist env now contains:

"OLLAMA_API_KEY" => "ollama-local"

Fresh startup log

2026-04-05T01:51:47 [lcm] Compaction summarization model: ollama/qwen3.5:4b (default)
2026-04-05T01:51:48 agent model: ollama/qwen3.5:4b

Fresh failure log after restart

2026-04-05T01:52:27 lane task error: lane=main durationMs=858 error="FailoverError: Unknown model: ollama/qwen3.5:4b. Ollama requires authentication to be registered as a provider. Set OLLAMA_API_KEY=\"ollama-local\" (any value works) or run \"openclaw configure\". See: https://docs.openclaw.ai/providers/ollama"

2026-04-05T01:52:27 model_fallback_decision: candidate_failed requestedProvider=ollama requestedModel=qwen3.5:4b reason=model_not_found nextCandidateProvider=openai-codex nextCandidateModel=gpt-5.4

2026-04-05T01:52:31 Model "ollama/qwen3.5:4b" not found. Fell back to "openai-codex/gpt-5.4".

Notes

This may be one of:

  • LaunchAgent env not being used by Ollama provider registration path
  • wrong env key being checked by provider bootstrap
  • implicit Ollama provider registration not occurring in gateway runtime on macOS launchd
  • session/agent startup path believing the model exists before provider registration actually succeeds

Impact

This is confusing because session_status / startup logs can imply Ollama is active, while actual serving silently falls back to a cloud model.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions