Cannot switch embedding model to Ollama (Defaults to OpenAI / 401 Error)

What are you trying to do?
I am trying to set up a fully local agent using Ollama for both the main inference model and memory embeddings, ensuring there are no cloud dependencies or external API calls.

Describe the outcome you expected.
Because I used the manual onboarding wizard, explicitly skipped cloud plugins, and selected Ollama as my provider, OpenClaw should route memory embedding tasks to my local Ollama instance. It should not attempt to contact OpenAI at any point during startup or runtime.

Environment

  • OpenClaw version (openclaw --version): 2026.10.9
  • Operating system and version: Windows (using PowerShell)
  • Installation method: npm (npm install -g openclaw@latest)
  • Where the Gateway runs: this machine (local, no background service)
  • Relevant model provider, channel, node, or integration: @openclaw/ollama-provider (Models: qwen3.5:latest for chat, Ollama local embeddings for memory)

What happened?
The memory subsystem ignores the local-only configuration and silently falls back to OpenAI’s default embedding model (text-embedding-3-small). Because I did not configure an OpenAI API key (as I want a 100% local setup), the gateway crashes memory syncs with a 401 Authentication error.

Exact error text:

23:56:36 [memory] sync failed (session-startup-catchup): Error: openai embeddings failed (model: text-embedding-3-small, batch size: 11) (401): Incorrect API key provided: ***. You can find your API key at https://platform.openai.com/account/api-keys. [type=invalid_request_error, code=invalid_api_key] [request_id=req_e4ef042b29fb4b4792bd100e3908d5ea].

What have you tried?

  • Performed a “scorched earth” reset: uninstalled OpenClaw, ran npm cache clean --force, and deleted all configuration files/startup folders.
  • Ran a clean reinstall using npm.
  • Used openclaw onboard --classic to run the manual setup.
  • Explicitly avoided QuickStart. Selected “Off” for Tailscale, “No” for channels, and “Skip” for all third-party dependencies and cloud plugins (including OpenAI).
  • Enabled only the @openclaw/ollama-provider.
  • Opted not to install the Gateway service so I could run it manually via openclaw gateway run.

Safe diagnostics

23:56:28 [gateway] slow chat send 22090ms stage=startup ack=144ms preparation=12578ms replyContext=0ms authoring=4ms replyInitialization=9499ms snapshot=75ms dispatch=2ms
23:56:29 [memory] sync failed (watch): Error: openai embeddings failed (model: text-embedding-3-small, batch size: 11) (401): Incorrect API key provided: ***.
23:56:36 [memory] sync failed (session-startup-catchup): Error: openai embeddings failed (model: text-embedding-3-small, batch size: 11) (401): Incorrect API key provided: ***.

Here’s a solution that might help:

Try merging/appending this into ~/.openclaw/openclaw.json, preserving existing settings:

{
  "memory": {
    "search": {
      "provider": "ollama",
      "model": "nomic-embed-text",
      "fallback": "none",
      "remote": {
        "baseUrl": "http://127.0.0.1:11434"
      }
    }
  }
}

Stop the foreground Gateway with Ctrl+C, then run:

ollama pull nomic-embed-text
openclaw memory status --deep --agent main
openclaw memory index --force --agent main
openclaw gateway run

Thanks a ton for your timely help.