Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Route a NanoClaw agent group to a local Ollama model instead of the Anthropic API. Ollama speaks the Anthropic API natively (v1/messages), so no provider code changes are needed — just env var overrides and a model setting. Use when the user wants to run their agent locally, cut API costs, or experiment with open-weight models. See docs/ollama.md for background.
.claude/skills/nanocoai-add-ollama-provider/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-06 | ✗→✓ | ▲ Improved | 201% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 4% | 0% |
| case-08 | ✗→✓ | ▲ Improved | -15% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 5% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 78% | 0% |
Routes an agent group to a local Ollama instance instead of the Anthropic API. See docs/ollama.md for how this works and the tradeoffs involved.
curl -s http://localhost:11434/api/tagsollama pull gemma4 or ollama pull qwen3-coder/init-first-agent first if neededThe feature requires two fields in ContainerConfig (env and blockedHosts) and their corresponding wiring in container-runner.ts. Check if already present:
bashgrep -c 'blockedHosts' src/container-config.ts src/container-runner.ts
If either count is 0, apply the changes in steps 1a and 1b. Otherwise skip to step 2.
In src/container-config.ts, add to the ContainerConfig interface:
typescriptenv?: Record<string, string>; blockedHosts?: string[];
And in readContainerConfig, add inside the returned object:
typescriptenv: raw.env, blockedHosts: raw.blockedHosts,
In src/container-runner.ts, after the NANOCLAW_MCP_SERVERS block, add:
typescript// Per-agent-group env overrides — applied last to win over OneCLI values. if (containerConfig.env) { for (const [key, value] of Object.entries(containerConfig.env)) { args.push('-e', `${key}=${value}`); } } // Blocked hosts: resolve to 0.0.0.0 so they are unreachable inside the container. if (containerConfig.blockedHosts) { for (const host of containerConfig.blockedHosts) { args.push('--add-host', `${host}:0.0.0.0`); } }
The container may run as your host uid (not uid 1000). Check the Dockerfile:
bashgrep 'chmod.*home/node' container/Dockerfile
If it shows chmod 755, change it to chmod 777 so any uid can write there. Then rebuild the container image: ./container/build.sh
Ask the user (plain text, not AskUserQuestion):
pnpm exec tsx scripts/q.ts data/v2.db "SELECT folder, name FROM agent_groups;"curl -s http://localhost:11434/api/tags | grep '"name"'Record as FOLDER, MODEL, and BLOCK_ANTHROPIC.
Read groups/<FOLDER>/container.json. Add (or merge into) an env block and optionally blockedHosts:
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"] }
Omit blockedHosts if the user declined step 2.
Why these vars: ANTHROPIC_BASE_URL redirects the Anthropic SDK to Ollama. ANTHROPIC_API_KEY=ollama satisfies the SDK's key requirement (Ollama ignores it). NO_PROXY bypasses the OneCLI HTTPS proxy for requests to host.docker.internal so they reach Ollama directly instead of going through the credential gateway.
Read the agent group's shared Claude settings:
bash# Find the agent group ID AG_ID=$(pnpm exec tsx scripts/q.ts data/v2.db "SELECT id FROM agent_groups WHERE folder='<FOLDER>';") SETTINGS=data/v2-sessions/$AG_ID/.claude-shared/settings.json
Add "model": "<MODEL>" to that settings file. Create the file if it doesn't exist:
json{ "model": "gemma4:latest" }
If the file already has content, merge the model key in — don't overwrite existing keys.
Why here and not container.json: Claude Code reads its model from its own settings file, not from env vars. This file is bind-mounted into the container as ~/.claude/settings.json.
Run from your NanoClaw project root:
bashexport PATH="/opt/homebrew/bin:$PATH" pnpm run build source setup/lib/install-slug.sh launchctl unload ~/Library/LaunchAgents/$(launchd_label).plist launchctl load ~/Library/LaunchAgents/$(launchd_label).plist # Linux: systemctl --user restart $(systemd_unit)
Send a message to the agent. Then confirm:
bash# Ollama shows the model as active curl -s http://localhost:11434/api/ps | grep '"name"' # Container has the right env vars CTR=$(docker ps --filter "name=nanoclaw-v2-<FOLDER>" --format "{{.Names}}" | head -1) docker inspect "$CTR" --format '{{json .HostConfig.ExtraHosts}}' docker exec "$CTR" env | grep ANTHROPIC
Expected: api.anthropic.com:0.0.0.0 in ExtraHosts, ANTHROPIC_BASE_URL=http://host.docker.internal:11434.
To switch back to the Anthropic API:
env and blockedHosts keys from groups/<FOLDER>/container.json"model" from the shared settings fileNo rebuild needed — both files are read at container spawn time.
Agent hangs, no response: Ollama may be loading the model cold (large models take 10–30s). Watch curl -s http://localhost:11434/api/ps — the model appears once loaded.
"model not found" error in container logs: The model name in settings.json doesn't match what Ollama has. Run ollama list on the host and use the exact name shown.
Responses claim to be Claude: The model was trained on data that includes Claude conversations. Add a line to groups/<FOLDER>/CLAUDE.md telling it what model it runs on.
Agent responds but Ollama shows no activity: NO_PROXY may not have taken effect for http_proxy (lowercase). Add both NO_PROXY and no_proxy to the env block.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 2,703 | 4,610 | +71% | 1 | 1 | 0% | 316 | 2,111 | +568% | 0 | 0 | — |
case-02 | fail→fail | 12,620 | 4,103 | -67% | 1 | 1 | 0% | 2,127 | 1,900 | -11% | 0 | 0 | — |
case-03 | fail→fail | 6,984 | 4,238 | -39% | 1 | 1 | 0% | 1,172 | 1,901 | +62% | 0 | 0 | — |
case-04 | pass→pass | 9,193 | 6,218 | -32% | 1 | 1 | 0% | 1,600 | 2,814 | +76% | 0 | 0 | — |
case-05 | pass→pass | 11,457 | 11,681 | +2% | 1 | 1 | 0% | 1,886 | 3,868 | +105% | 0 | 0 | — |
case-06 | fail→pass | 23,899 | 10,702 | -55% | 1 | 1 | 0% | 1,297 | 3,910 | +201% | 0 | 0 | — |
case-07 | fail→pass | 71,353 | 2,163 | -97% | 1 | 1 | 0% | 1,975 | 2,057 | +4% | 0 | 0 | — |
case-08 | fail→pass | 14,146 | 2,318 | -84% | 1 | 1 | 0% | 2,542 | 2,151 | -15% | 0 | 0 | — |
case-09 | pass→pass | 14,048 | 3,542 | -75% | 1 | 1 | 0% | 2,654 | 2,345 | -12% | 0 | 0 | — |
case-10 | fail→pass | 12,028 | 2,941 | -76% | 1 | 1 | 0% | 2,126 | 2,230 | +5% | 0 | 0 | — |
case-11 | fail→pass | 5,856 | 2,125 | -64% | 1 | 1 | 0% | 1,192 | 2,127 | +78% | 0 | 0 | — |
case-12 | pass→pass | 6,633 | 2,309 | -65% | 1 | 1 | 0% | 1,365 | 2,162 | +58% | 0 | 0 | — |
case-13 | pass→pass | 10,265 | 4,694 | -54% | 1 | 1 | 0% | 1,866 | 2,651 | +42% | 0 | 0 | — |
case-14 | pass→pass | 56,274 | 3,551 | -94% | 1 | 1 | 0% | 1,355 | 2,232 | +65% | 0 | 0 | — |
case-15 | fail→pass | 18,316 | 2,164 | -88% | 1 | 1 | 0% | 3,182 | 2,083 | -35% | 0 | 0 | — |
case-16 | fail→fail | 4,831 | 1,790 | -63% | 1 | 1 | 0% | 831 | 2,073 | +149% | 0 | 0 | — |
case-17 | fail→pass | 10,306 | 4,193 | -59% | 1 | 1 | 0% | 1,855 | 2,497 | +35% | 0 | 0 | — |
case-18 | fail→pass | 5,853 | 2,507 | -57% | 1 | 1 | 0% | 1,043 | 2,035 | +95% | 0 | 0 | — |
case-19 | pass→pass | 8,775 | 65,924 | +651% | 1 | 1 | 0% | 1,611 | 2,369 | +47% | 0 | 0 | — |
case-20 | pass→pass | 5,972 | 1,935 | -68% | 1 | 1 | 0% | 1,066 | 2,003 | +88% | 0 | 0 | — |
case-21 | fail→pass | 10,786 | 3,061 | -72% | 1 | 1 | 0% | 1,841 | 2,177 | +18% | 0 | 0 | — |
case-22 | pass→pass | 4,687 | 3,267 | -30% | 1 | 1 | 0% | 824 | 2,318 | +181% | 0 | 0 | — |
case-23 | pass→pass | 9,930 | 2,132 | -79% | 1 | 1 | 0% | 1,614 | 2,021 | +25% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted, and 19 counted toward the lift figure. The other 4 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +39 percentage points is the difference between those two pass rates over the 19 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.