You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/providers/ollama.md
+101Lines changed: 101 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -304,6 +304,107 @@ The new model will be automatically discovered and available to use.
304
304
If you set `models.providers.ollama` explicitly, or configure a custom remote provider such as `models.providers.ollama-cloud` with `api: "ollama"`, auto-discovery is skipped and you must define models manually. Loopback custom providers such as `http://127.0.0.2:11434` are still treated as local. See the explicit config section below.
305
305
</Note>
306
306
307
+
## Node-local inference
308
+
309
+
Agents can delegate a short task to an Ollama model installed on a paired
310
+
desktop or server node. The prompt and response cross the existing authenticated
311
+
Gateway/node connection; the model request runs on the selected node against
312
+
its standard loopback Ollama endpoint (`http://127.0.0.1:11434`).
313
+
314
+
<Steps>
315
+
<Steptitle="Start Ollama on the node">
316
+
Pull at least one chat model and keep Ollama running:
317
+
318
+
```bash
319
+
ollama pull qwen3:0.6b
320
+
ollama list
321
+
```
322
+
323
+
</Step>
324
+
<Steptitle="Connect the node host">
325
+
On the same machine as Ollama, connect a node host to the Gateway:
326
+
327
+
```bash
328
+
openclaw node run \
329
+
--host <gateway-host> \
330
+
--port 18789 \
331
+
--display-name "Local inference"
332
+
```
333
+
334
+
Approve the new device and its declared node commands on the Gateway host,
335
+
then verify the node:
336
+
337
+
```bash
338
+
openclaw devices list
339
+
openclaw devices approve <deviceRequestId>
340
+
openclaw nodes pending
341
+
openclaw nodes approve <nodeRequestId>
342
+
openclaw nodes status --connected
343
+
```
344
+
345
+
A first connection and an upgrade that adds the Ollama commands can both
346
+
trigger node-command approval. If the node connects without advertising
347
+
`ollama.models` and `ollama.chat`, check `openclaw nodes pending` again.
348
+
349
+
</Step>
350
+
<Steptitle="Ask an agent to use local inference">
351
+
The bundled Ollama plugin exposes the `node_inference` tool. Agents first
352
+
use `action: "discover"`, then `action: "run"` with a returned node and
353
+
model. If exactly one capable node is connected, `run` can omit the node.
354
+
355
+
For example: “Discover the Ollama models on my nodes, then use the fastest
356
+
loaded model to summarize this text.”
357
+
358
+
</Step>
359
+
</Steps>
360
+
361
+
Discovery reads `/api/tags`, checks `/api/show` capabilities, and uses `/api/ps`
362
+
when available to rank already-loaded models first. It returns only local
363
+
chat-capable models: Ollama Cloud rows and embedding-only models are excluded.
364
+
Each run asks Ollama to disable model thinking and caps output at 512 tokens
365
+
unless the tool call requests a different `maxTokens` value. Some models, such
366
+
as GPT-OSS, do not support disabling thinking and may still use reasoning tokens.
367
+
368
+
To keep Ollama running on a node without making it available to agents, set the
369
+
following in the config used by that node host:
370
+
371
+
```bash
372
+
openclaw config set plugins.entries.ollama.config.nodeInference.enabled false
373
+
```
374
+
375
+
If the node uses the foreground `openclaw node run` command from the setup
376
+
above, stop that process and run the command again. If it uses an installed node
377
+
service, run `openclaw node restart`.
378
+
379
+
The node stops advertising `ollama.models` and `ollama.chat`; Ollama itself and
380
+
the Gateway's Ollama provider remain unchanged. Set the value to `true` and
381
+
restart the node to advertise local inference again. A changed command surface
382
+
may require approval through `openclaw nodes pending` after reconnect.
383
+
384
+
You can verify the same node commands without an agent turn:
385
+
386
+
```bash
387
+
openclaw nodes invoke \
388
+
--node "Local inference" \
389
+
--command ollama.models \
390
+
--params '{}' \
391
+
--invoke-timeout 90000 \
392
+
--timeout 100000
393
+
394
+
openclaw nodes invoke \
395
+
--node "Local inference" \
396
+
--command ollama.chat \
397
+
--params '{"model":"qwen3:0.6b","prompt":"Reply with exactly: pong","maxTokens":32,"timeoutMs":120000}' \
398
+
--invoke-timeout 130000 \
399
+
--timeout 140000
400
+
```
401
+
402
+
Node-local inference intentionally does not reuse a remote or cloud
403
+
`models.providers.ollama.baseUrl`. Start Ollama on the node's standard loopback
404
+
endpoint. The node commands are available by default on macOS, Linux, and
405
+
Windows node hosts and remain subject to the normal node pairing and command
406
+
policy.
407
+
307
408
## Vision and image description
308
409
309
410
The bundled Ollama plugin registers Ollama as an image-capable media-understanding provider. This lets OpenClaw route explicit image-description requests and configured image-model defaults through local or hosted Ollama vision models.
0 commit comments