skip to content

An owner wants private OpenClaw chats kept on a local Ollama model while other chats use a hosted model; how do you decide, configure it, and weigh the cost?

level: principalimportance: nice to knowfreq 6%

answer

  1. privacy against quality
  2. a separate agent for private chats
  3. string model means no fallback
  4. side routes: utility, image, embeddings
  5. small models and tools don't mix

basics

~20 s

Give private chats their own agent with a strict local Ollama model, no hosted fallback, a local-only model allowlist and no hosted utility route. The price is weaker tool use, a smaller context and local hardware to keep running.

solid answer

~50 s

It is a trade between **where prompts go** and **how well the agent works**. If it is worth it, run the private chats on their own agent with `"model": "ollama/gemma4"` in string form, which is strict: during an Ollama outage it fails instead of silently answering from a hosted provider. Add `modelPolicy.allow: ["ollama/*"]` on that agent so `/model` cannot move a private chat to a hosted model, and set its `utilityModel` to `""` so titles and recaps do not go to a hosted utility model inherited from the defaults. Check `agents.defaults.imageModel` and memory embeddings too. The costs: small local models are more prone to tool misuse and prompt injection, local setup in 2026.9.9 runs a 32,768-token context, cold models time out, and the host must stay up. For a chat-only agent with trusted input, that is often acceptable; for a tool-heavy one, often not.

code

json · 12 lines
json
{
  "agents": {
    "entries": {
      "private": {
        "workspace": "~/.openclaw/workspace-private",
        "model": "ollama/gemma4",
        "utilityModel": "",
        "modelPolicy": { "allow": ["ollama/*"] }
      }
    }
  }
}

go deeper

for a junior

Recall that a local Ollama model keeps prompts on your own machine but is usually weaker than a hosted model.

for a middle

Explain how a separate agent with a string-form local model avoids hosted fallback, and why its utility model needs checking.

for a senior

Audit the side routes, image and PDF models, embeddings, utility tasks, and size the tool and sandbox policy to a smaller model's weakness.

for a principal

Own the call: what the private agent must do, how much quality and uptime the owner gives up for privacy, and which alternative fits the household.

## The decision The owner's goal is that private conversations never reach a hosted model provider. OpenClaw can do that, but it is a judgment call between two goods: | | Local model through Ollama | Hosted model | |---|---|---| | Where prompts go | The host or LAN machine running Ollama | The provider's servers | | Model strength | Usually smaller, weaker at tools | Latest, strongest tiers | | Context | Local setup runs 32,768 tokens by default (2026.9.9) | Large hosted windows | | Outage behaviour | Fails when the Ollama host is down | Can fail over to another provider | | Cost | Hardware and power; OpenClaw records zero model cost | Per-token or plan billing | OpenClaw's own security guidance is the deciding input: smaller and older models are **more susceptible to tool misuse and instruction hijacking**, and the docs say not to run tool-enabled agents or agents that read untrusted content on weak tiers. For a **chat-only assistant with trusted input and no tools**, smaller models are usually fine. So the real question is what the private agent must be able to do. This answer assumes OpenClaw 2026.9.9. ## Configuring a private agent Put private chats on a **separate agent** rather than switching models inside one agent. A binding routes those chats to it (agent routing is its own subject). The model settings that matter: - `"model": "ollama/gemma4"` in **string form** is a strict per-agent primary: no fallback. An object with a `fallbacks` list naming a hosted model would undo the whole point during an outage. - `"modelPolicy": { "allow": ["ollama/*"] }` on the agent replaces the default allowlist, so `/model` in a private chat cannot select a hosted model. - `"utilityModel": ""` skips the alternate utility route. Otherwise the agent inherits `agents.defaults.utilityModel`, and generated titles, progress narration and activity recaps send bounded snippets of the conversation to that model's provider. ```json { "agents": { "entries": { "private": { "workspace": "~/.openclaw/workspace-private", "model": "ollama/gemma4", "utilityModel": "", "modelPolicy": { "allow": ["ollama/*"] } } } } } ``` ## Side routes to audit A strict primary does not cover every model call. Check: 1. **Image and PDF models.** `agents.defaults.imageModel` is used when the primary cannot accept images, and the `pdf` tool falls back to it. If it names a hosted model, an image sent in a private chat goes there. 2. **Memory embeddings.** Memory search can use a hosted embedding provider; point it at a local endpoint or accept the leak. 3. **Media generation.** Image, music and video tools infer a provider from what is authenticated. 4. **Cron jobs and heartbeats** that run on the private agent with their own model settings: a cron job that sets only its own model still inherits the default fallbacks unless it sets `fallbacks: []`. ## What the local route costs - **Quality.** Weaker tool use and reasoning. If tools are needed, reduce the blast radius: read-only tools, sandboxing for all sessions, web tools off. OpenClaw's security audit flags small models paired with open tool surfaces. - **Context.** Local setup uses a 32,768-token runtime context, or the model's smaller native window, so long private threads compact sooner. - **Latency and reliability.** A cold local model can time out on its first turn. Provider-scoped `timeoutSeconds` and a per-model `keep_alive` help, and `localService` can start a local server on demand. OpenClaw talks to Ollama's native API; pointing `baseUrl` at the `/v1` compatibility URL breaks tool calling. - **Uptime.** The Ollama host must be awake whenever the Gateway is. ## Questions that settle it 1. Does the private agent need tools, files or web access, or only conversation? 2. Is the content sensitive enough that a failed reply is better than a hosted one? 3. Can the host run a model large enough to be useful, and stay awake? 4. Who maintains the extra agent, its allowlist and its side routes as OpenClaw changes? ## Alternatives a lead should weigh - **Hosted for everything**, with a fallback on a second provider: simplest and strongest, but private text leaves the host. - **Local for private chat-only use, hosted for tool-heavy work**: the split described here, with strictness as a feature. - **A local fallback chain** (`fallbacks` listing only other `ollama/` models): keeps privacy while surviving one model failing, though not a failure of the Ollama host they share. Whatever is chosen, it protects one operator's data inside one trust boundary; it is not a way to share a Gateway safely with people who do not trust each other.

  • The Ollama host reboots at night and the private agent fails every message. Is that a defect?
    For a privacy-first agent it is the intended trade: a strict local primary fails rather than answering from a hosted provider. If availability matters, add `fallbacks` that list only other `ollama/` models, or use `localService` to start the local server on demand; neither sends text off the host.
  • Why not just let users type `/model ollama/gemma4` in private chats instead of creating a separate agent?
    A user pick is strict too, but it depends on someone remembering it in every chat, and any chat that never picked stays on the hosted default with hosted fallbacks. A separate agent makes local routing the default for those chats and lets `modelPolicy.allow` stop anyone switching them to a hosted model.

  • Setting the primary to a local model keeps every model call local
  • A small local model is as safe with tools as a top hosted model
  • Adding a hosted fallback to a private agent keeps chats private
  • Local models in OpenClaw are free, so there is no real cost
  • Separate private agents make one Gateway safe for strangers

Assumes OpenClaw 2026.9.9: local Ollama setup runs a 32,768-token context, and per-agent string models are strict.