opencode-commandcode
v0.1.0
Published
OpenCode plugin that registers Command Code as a provider with API-key auth and live model discovery.
Readme
opencode-commandcode
An OpenCode plugin that registers Command Code as a provider. It supports API-key login and live model discovery against the Command Code Provider API.
Install
Add the plugin to your opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-commandcode"]
}Log in
Run the auth flow and paste your API key when prompted:
opencode auth loginSelect Command Code from the provider list. Your key is stored in OpenCode's credential store (auth.json) — the same key used by the Command Code CLI and API.
Alternatively, skip auth login by exporting the key:
export CMD_API_KEY=...Use
Models are discovered automatically from GET https://api.commandcode.ai/provider/v1/models at startup:
opencode run --model commandcode/deepseek/deepseek-v4-flashThe full model list (Claude, GPT, Gemini, DeepSeek, Qwen, Kimi, and more) is available under the commandcode/ prefix. Model names and context limits come from the live endpoint; output limits and vision/reasoning capabilities come from a bundled override table.
How it works
The plugin exposes two hooks:
auth(type: "api") — registers thecommandcodeprovider with OpenCode's login flow soopencode auth logincan store an API key.config— injectsconfig.provider.commandcodewith@ai-sdk/openai-compatiblepointed athttps://api.commandcode.ai/provider/v1, plus the live model list (with a static fallback when the endpoint is unreachable).
If the /models endpoint cannot be reached at startup, a small fallback list is used so the provider remains usable. The list is never left empty.
Development
npm install
npm run buildLicense
MIT
