Delegate tasks to OpenCode from inside Claude Code — for token-efficient codebase exploration, file analysis, and docs updates.
When Claude Code's context window fills up on large codebases, offload heavy tasks to a separate OpenCode session. Results come back as a summary without consuming your main context.
| Command | Description |
|---|---|
/opencode:setup |
Interactive wizard — choose provider, authenticate in terminal, select model from live CLI output |
/opencode:run [task] |
Delegate a task to OpenCode (sync by default, or --background) |
/opencode:status [job-id] |
Check status of background jobs |
/opencode:result [job-id] |
Get output from a completed background job |
/opencode:cancel [job-id] |
Cancel a running background job |
Step 1 — Install OpenCode:
npm install -g opencode-aiStep 2 — Add the marketplace and install the plugin in Claude Code:
/plugin marketplace add Angioz/opencode-plugin-cc
/plugin install opencode@angioz-opencode
/reload-plugins
Step 3 — Run the setup wizard:
/opencode:setup
The wizard guides you through provider selection, authenticates via opencode providers login in your terminal (API key never in chat), then picks a model from real CLI output.
claude --plugin-dir ./plugins/opencodeInteractive wizard that walks through:
- Shell detection — detects bash vs PowerShell for correct command variants
- Config check — skips re-setup if already configured (or lets you reconfigure)
- Provider selection — choose from a menu with free-tier info and key URLs
- Authentication — runs
! opencode providers login -p [provider]in your terminal; API key entered interactively, never in chat - Model selection — Claude runs
opencode models [provider], parses the live output, and presents real model IDs via a widget - Config save — writes
OPENCODE_MODELto~/.opencode-plugin/config.sh(model string only, no API key) - Smoke test — verifies everything works end-to-end
Re-run any time to reconfigure.
Delegates a task to OpenCode synchronously — Claude Code waits for the result and summarizes it.
/opencode:run summarize the src/components/ directory structure
/opencode:run find all TODO and FIXME comments in the codebase
/opencode:run update the API docs in docs/api.md to match the current routes
Use --background for long-running tasks:
/opencode:run --background audit all API routes for missing input validation
Returns a job ID immediately. Check progress with /opencode:status.
/opencode:status # list all jobs
/opencode:status 1712345678-1234 # check a specific job
/opencode:result # result of the most recent job
/opencode:result 1712345678-1234 # result of a specific job
/opencode:cancel # cancel the most recent running job
/opencode:cancel 1712345678-1234 # cancel a specific job
/opencode:run list all exported functions in src/lib/ with their signatures
/opencode:run --background audit all API routes for missing input validation
/opencode:status
# ... continue working in Claude Code ...
/opencode:result
- The plugin stores
OPENCODE_MODELin~/.opencode-plugin/config.sh(chmod 600) — model string only, no credentials - API keys are managed entirely by OpenCode via
opencode providers login— stored in~/.local/share/opencode/auth.json - The plugin uses
opencode run -m [model] [message]for one-shot headless execution - Background jobs are tracked as JSON + log files in
~/.opencode-jobs/ - Zero dependencies — pure POSIX shell scripts, no npm install required
API keys never pass through the Claude Code chat conversation — not as user input, not as Claude output, not as command arguments.
During /opencode:setup, you run ! opencode providers login -p [provider] in your terminal. OpenCode handles the interactive key prompt itself and stores credentials in its own secure store (~/.local/share/opencode/auth.json). The plugin only reads the model choice it saved during setup.
| Provider | Free tier | Key URL |
|---|---|---|
| OpenRouter | Yes — 26 free models | openrouter.ai/keys |
| Yes — Gemini free tier | aistudio.google.com/apikey | |
| Groq | Yes — rate-limited | console.groq.com/keys |
| Anthropic | No | console.anthropic.com/keys |
| OpenAI | No | platform.openai.com/api-keys |
| Ollama | N/A (local) | — |
MIT