Skip to content

Configuring local model backends (Ollama, MiniMax) in OpenClaw

Wire OpenClaw to a self-hosted or hosted local-friendly model server — Ollama on the same machine or a remote GPU host, MiniMax via API key or OAuth — with correct base URLs, model strings, timeouts, and the keep-alive settings that prevent stalls on cold loads.

You picked a local model backend after weighing the trade-offs — you want data to stay on your network, your hardware can stream tokens fast enough, or you are routing a specific class of sensitive turn away from a hosted provider. Now you need OpenClaw to actually talk to it. This guide walks through the configuration for Ollama on the same host, Ollama on a remote GPU server, and MiniMax via both API key and OAuth — with the exact config keys, the URL gotcha that breaks tool calling, and the timeout settings that keep slow loads from looking like failures.

Outcome and prerequisites

By the end you will have:

  • An Ollama or MiniMax backend wired into ~/.openclaw/openclaw.json
  • The agent’s primary model set to a local-or-hosted-local model string
  • Provider-level timeouts that match your hardware so slow first-token loads do not look like outages
  • A passing openclaw models list and a working openclaw agent --message "..." turn

You need:

If you have not yet decided which backend fits your use case, read Choosing an LLM backend for OpenClaw first.

Time

20 minutes for a local Ollama configuration on the same machine, 30-40 minutes for a remote Ollama with network and firewall changes, 10 minutes for MiniMax.

Steps

1. Ollama on the same host

The simplest case: Ollama and OpenClaw running on the same workstation.

First, confirm Ollama is reachable:

curl http://127.0.0.1:11434/api/tags

You should see a JSON list of pulled models. If you do not, start Ollama (ollama serve if installed manually, or open the Ollama app on macOS).

Then add the provider block to ~/.openclaw/openclaw.json:

{
  models: {
    providers: {
      ollama: {
        baseUrl: "http://127.0.0.1:11434",
        apiKey: "ollama-local",
        timeoutSeconds: 120,
      },
    },
  },
  agents: {
    defaults: {
      model: {
        primary: "ollama/llama3.1:70b",
      },
    },
  },
}

Three things matter here:

  • baseUrl has no /v1 suffix. The native Ollama path is what you want. The /v1 path runs in OpenAI-compatibility mode, where the documentation is explicit that tool calling is not reliable (OpenClaw docs — Ollama provider).
  • apiKey is the placeholder "ollama-local". Local and LAN Ollama hosts do not authenticate, but the OpenClaw provider abstraction still wants a token. The literal string "ollama-local" is the documented sentinel.
  • timeoutSeconds is generous. Cold-loading a 70B model on consumer hardware easily takes a minute or more, and the default timeout will fail the first call. 120 seconds covers most cases; bump to 300 for very large models.

Reload the Gateway so the new provider takes effect:

openclaw gateway restart

2. Ollama on a remote GPU host

If your GPU lives on a different machine, the same config applies with two changes — the base URL points at the remote host, and you must either keep the call on a trusted network or set a real OLLAMA_API_KEY on the Ollama side.

{
  models: {
    providers: {
      ollama: {
        baseUrl: "http://gpu-host.tail-abc123.ts.net:11434",
        apiKey: "${OLLAMA_API_KEY}",
        timeoutSeconds: 180,
        models: [
          {
            id: "llama3.1:70b",
            params: { keep_alive: "15m" },
          },
        ],
      },
    },
  },
}

A few practical notes:

  • Use Tailscale or a VPN rather than exposing port 11434 to the internet. Ollama has no authentication of its own; any network it is reachable from can run inference on your hardware. A Tailscale tail-net hostname like gpu-host.tail-abc123.ts.net keeps the connection inside your overlay network.
  • keep_alive: "15m" keeps the model loaded in GPU memory between requests. Without this, the model unloads after a few minutes idle and the next request pays the cold-load cost again. The models[].params block passes through to the Ollama API (Ollama docs).
  • Set ${OLLAMA_API_KEY} via ~/.openclaw/.env with chmod 600 if you have set Ollama’s own auth. Ollama itself does not ship auth by default; this matters when you have a reverse proxy in front of it.

3. Auto-discovery

If you set OLLAMA_API_KEY in the environment but do not explicitly configure the Ollama provider, OpenClaw auto-discovers available models from the endpoint (OpenClaw docs — Ollama provider). That is convenient for personal use but brittle in production — pin the base URL and the model list explicitly so a new model showing up on the Ollama host does not silently become the agent’s primary.

4. LM Studio and vLLM

LM Studio and vLLM ship OpenAI-compatible HTTP servers. OpenClaw has first-class providers for both — lmstudio and vllm — and the config shape is the same as Ollama, with a base URL and an optional API key (OpenClaw docs — providers). The same tool-call caveat applies: small open-weights models are uneven for tool use regardless of the server in front of them.

5. MiniMax via API key

For the API-key path, generate a key from the MiniMax console for the region you are targeting — api.minimax.io for international, api.minimaxi.com for China.

{
  models: {
    providers: {
      minimax: {
        apiKey: "${MINIMAX_API_KEY}",
        baseUrl: "https://api.minimax.io",
      },
    },
  },
  agents: {
    defaults: {
      model: {
        primary: "minimax/MiniMax-M2.7",
      },
    },
  },
}

Write MINIMAX_API_KEY into ~/.openclaw/.env rather than the JSON file. Restart the gateway. The model string minimax/MiniMax-M2.7 is the default hosted reasoning model; minimax/MiniMax-M2.7-highspeed is the faster variant when speed matters more than reasoning depth (OpenClaw docs — MiniMax provider).

6. MiniMax via OAuth (Coding Plan)

If you have a MiniMax Coding Plan, the OAuth path is cleaner — no key to rotate, the limits come from your plan. Use the dedicated provider variant minimax-portal and run onboarding non-interactively:

openclaw onboard --auth-choice minimax-global-api

The wizard handles the browser handshake and writes the resulting token into the secret store. The model string becomes minimax-portal/MiniMax-M2.7 (OpenClaw docs — MiniMax provider).

7. Adjust timeouts for the slowest realistic call

Local backends have a much wider distribution of latency than hosted ones. The provider-level timeoutSeconds should accommodate the slowest realistic first-token time. For Ollama on a workstation:

  • 8B-class model on a current consumer GPU: 60s is plenty
  • 70B-class model on a current consumer GPU: 180-300s for cold loads
  • CPU-only: do not bother with anything bigger than 8B; even then expect 300s+ on cold loads

The keep_alive param mitigates the cold-load problem but does not eliminate it. Pair it with a heartbeat that touches the model every few minutes if you want to keep it warm aggressively.

Verification

Three checks confirm the backend is wired correctly:

  1. openclaw models list shows your provider and the configured models, with available: true.
  2. openclaw agent --message "Reply with exactly the word READY." returns the expected response from the local model and does so without timing out.
  3. The agent successfully invokes a tool — try openclaw agent --message "List the files in the workspace root." — and the tool call comes back without parser errors. This is the gate that catches the /v1 URL mistake on Ollama.

Rollback

If the local backend misbehaves and you need to fall back fast, swap the primary model back to your previous hosted provider:

openclaw config set agents.defaults.model.primary "anthropic/claude-opus-4-6"
openclaw gateway restart

The provider block can stay in the config; it just stops being the primary. That keeps the rollback reversible.

Troubleshooting

Every tool call fails to parse. You are almost certainly hitting the /v1 issue on Ollama. Strip the suffix from baseUrl and restart.

First call takes forever, then succeeds, then subsequent calls are fast. The model is cold-loading. Set keep_alive: "15m" on the model and consider a periodic heartbeat to keep it warm.

openclaw models list shows the provider but available: false. The base URL is wrong, the network path is blocked, or the API key is malformed. Run curl directly against the base URL from the OpenClaw host to confirm reachability.

MiniMax replies include visible reasoning tags. OpenClaw disables MiniMax thinking on the Anthropic-compatible streaming path by default; if you are seeing leaked thinking, you are likely on a non-default streaming configuration (OpenClaw docs — MiniMax provider). Revert to defaults.

The agent picks a different model than you expect. Check agents.defaults.model.primary and the fallback list. If auto-discovery is enabled, an unexpected model showing up on Ollama can change which one is primary; pin the list explicitly.

Production-readiness

Before this configuration sees real traffic:

  • Pin every model id in the models[] array. Auto-discovery is for exploration, not production.
  • Set realistic provider-level timeouts and document them in the config with a comment (JSON5 supports them).
  • Monitor Ollama GPU memory; a model that should fit can fail to load on a host that is already running another workload.
  • If you are routing only specific turns to a local model, document the routing rule explicitly — agents drift, and a routing rule that lives only in the model’s persona file is one accidental edit away from changing.

Sources


Last verified on OpenClaw current. Provider config blocks change with the runtime; verify keys against the live docs before deploying.

Talk to a senior operator about your OpenClaw deployment.