Claude Skill MartBrowse skillsWhat is a Skill?
Back to list

Add OpenCode Provider (NanoClaw)

Step-by-step skill for swapping a NanoClaw agent group's backend from the Anthropic SDK to OpenCode (OpenRouter, DeepSeek, Google, Zen, and more).

Dev & CodingAdvanced30,47112,865AI score 6/10Last updated: Aug 9, 2026

What it does

NanoClaw runs agents in a long-lived poll loop inside a container, and the backend is chosen per group by the provider key in container.json (default claude). Trunk only ships the claude provider.

This skill walks through pulling the OpenCode provider sources from the providers branch, registering them in both the host and container barrels, installing @opencode-ai/sdk@1.4.17, adding a version-pinned opencode-ai CLI layer to the Dockerfile, and rebuilding the agent image. It also copies three guard tests — two registration guards plus a structural Dockerfile check — so broken wiring fails loudly.

Configuration coverage is unusually complete: .env shapes for DeepSeek, OpenRouter, Anthropic and OpenCode Zen, OneCLI secret registration (Bearer vs x-api-key), a safe secret-merge pattern, an overlay-refresh loop for pre-existing groups, and troubleshooting for session UUID drift, NO_PROXY, and aggressive buildkit caching.

Who it's for

  • Operators self-hosting NanoClaw who want cheaper or vendor-diverse models
  • Developers comfortable editing Dockerfiles and pnpm/bun build pipelines
  • Teams A/B testing multiple LLM backends group by group

Examples

  1. Cut costs with DeepSeek — set OPENCODE_PROVIDER=deepseek and ANTHROPIC_BASE_URL=https://api.deepseek.com/v1, register the key in OneCLI, then flip one test group.
  2. Compare models via OpenRouter — route heavy work to anthropic/claude-sonnet-4 while OPENCODE_SMALL_MODEL handles light tasks with Haiku.
  3. Fix Unknown provider: opencode after a build — run docker builder prune -f && ./container/build.sh and copy the new provider files into each data/v2-sessions/*/agent-runner-src/providers/ overlay.

· · · Install guide · · ·

Install in the Claude app (no terminal)
  1. Download the ZIP with the button below.
  2. In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
  3. Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Download ZIP
Install in Claude Code

Let Claude do it — paste this into Claude Code

Install the skill I found on Claude Skill Mart.
Copy the .claude/skills/add-opencode folder from the GitHub repo nanocoai/nanoclaw into my ~/.claude/skills/add-opencode/.
When it's done, tell me in one line what this skill can do.

Install with a command instead

git clone https://github.com/nanocoai/nanoclaw.git && mkdir -p ~/.claude/skills && cp -r nanoclaw/.claude/skills/add-opencode ~/.claude/skills/

This is a third-party skill. Check the source repository before installing.

  1. Open a terminal and clone the repo: git clone https://github.com/nanocoai/nanoclaw.git
  2. Copy the skill where Claude Code can find it: mkdir -p ~/.claude/skills && cp -r nanoclaw/.claude/skills/add-opencode ~/.claude/skills/
  3. cd nanoclaw — this skill only works inside the NanoClaw repo. Make sure Docker, pnpm, bun, and OneCLI are installed.
  4. Launch Claude Code and ask: "use the add-opencode skill to wire in the OpenCode provider".
  5. Follow the steps: git fetch origin providers, copy the provider sources, append import './opencode.js'; to both barrels, then bun add @opencode-ai/sdk@1.4.17. Never use latest — SDK and CLI versions must match.
  6. Add ARG OPENCODE_VERSION=1.4.17 and a dedicated pnpm install -g "opencode-ai@${OPENCODE_VERSION}" layer to container/Dockerfile, then rebuild with ./container/build.sh.
  7. Run pnpm run build, the container typecheck, and all three guard tests — everything must be green before moving on.
  8. Fill in the OPENCODE_* variables in .env, register the provider API key in OneCLI, then switch a single test group with ncl groups config update --id <group-id> --provider opencode && ncl groups restart --id <group-id> and send a message to verify.