Meet NanoCo, maintainers of NanoClaw: we raised $12M to give every member of your team a professional assistant →
Skills
Enhancement Official

Ollama (Provider)

Route a NanoClaw agent group to a local Ollama model instead of the Anthropic API. No code changes — just env overrides.

What it does

  • Run an entire agent group on a local Ollama model — no API calls
  • Ollama speaks the Anthropic API natively (v1/messages) — no provider code needed
  • Per-group switching: some agents on Claude, some on local
  • Optional API.anthropic.com host blocking to prevent accidental spend
  • Reverts cleanly — remove env block, restart, back on Claude

What you'll need

  • NanoClaw installed and running
  • Ollama installed and running on the host (port 11434)
  • A pulled Ollama model (e.g. gemma4, qwen3-coder)
  • An existing agent group to route

Install

/add-ollama-provider

How it works

The /add-ollama-provider skill routes a NanoClaw agent group to a local Ollama instance instead of the Anthropic API. Because Ollama already speaks the Anthropic API natively (v1/messages), there’s no provider code to change — just an env override telling the Anthropic SDK where to send its requests.

This is a per-group switch. Other groups in the same NanoClaw install can keep talking to Claude.

Setup

The skill is mostly automated:

  1. Source-level prep (one-time per install) — extends ContainerConfig with env and blockedHosts fields and wires them into container-runner.ts so groups can pass per-group env overrides into Docker. Only runs if not already in place.
  2. Per-group config — adds env and blockedHosts to groups/<folder>/container.json:
    {
      "env": {
        "ANTHROPIC_BASE_URL": "http://host.docker.internal:11434",
        "ANTHROPIC_API_KEY": "ollama",
        "NO_PROXY": "host.docker.internal",
        "no_proxy": "host.docker.internal"
      },
      "blockedHosts": ["api.anthropic.com"]
    }
  3. Model selection — adds "model": "<your-model>" to the group’s shared Claude settings at data/v2-sessions/<group-id>/.claude-shared/settings.json. Claude Code reads its model from settings, not env vars.
  4. Restart — the env block is read at container spawn, no rebuild needed.

What you get

  • Local inference — the agent’s reasoning runs on your machine, never crosses the network.
  • Per-group isolation — flip an env block to switch one group to local, leave others on Claude.
  • Safety netblockedHosts: ["api.anthropic.com"] resolves the host to 0.0.0.0 inside that group’s container so a misconfiguration can’t accidentally fall through to paid API.
  • No provider code — Ollama’s Anthropic-API compatibility means this is just configuration, not new TypeScript.

Tips

  • The skill changes chmod 755 to chmod 777 on /home/node in the container Dockerfile (and rebuilds) so any host UID can write there. Ollama’s host integration sometimes runs as a non-1000 UID inside the container.
  • Cold first call: Ollama lazy-loads models. Watching curl -s http://localhost:11434/api/ps shows when the model is in memory.
  • Models trained on Claude conversations sometimes claim to be Claude. Add a line to groups/<folder>/CLAUDE.md telling the model what it is to head this off.
  • If the agent responds but Ollama’s /api/ps shows no activity, double-check both NO_PROXY and no_proxy (lowercase) — some HTTP libraries only honor one.
  • Reverting is just deleting the env and blockedHosts keys from container.json and the model key from settings, then restarting. No rebuild needed.
  • Pair with /add-ollama-tool if you also want Claude (running on the cloud) to call out to an Ollama model as an MCP tool — that’s a different use case.