Profile
Back to NewsBack
GitHub Trending 8 min
Reader Mode
rashidrazak/opencode-cmd-provider: OpenCode plugin for using CommandCode as provider

rashidrazak/opencode-cmd-provider: OpenCode plugin for using CommandCode as provider

20 hours ago

opencode-cmd-provider

CI</a> npm</a>

Use your Command Code plan inside OpenCode.

This plugin connects OpenCode to Command Code and adds every Command Code model to the model picker, so you can use your Go, GOAT, Pro, Max 10×, Max 20×, Provider, Team, or Enterprise plan from OpenCode. It also adds a **Command Code** section to the session sidebar with your plan's allowances, benchmarks, current deals, and live usage.

Disclaimer: This is an unofficial, community-maintained integration. It is
not affiliated with, endorsed by, or supported by Command Code. You need your
own Command Code account, and Command Code's terms, availability, and pricing
apply.

Before you start

Not sure which OpenCode version you have? Run:
opencode --version

Install on OpenCode v1

opencode plugin opencode-cmd-provider

Run it inside the project where you want the plugin, or add --global to make it available in every project:

opencode plugin opencode-cmd-provider --global

That one command adds the plugin to your OpenCode configuration, registers Command Code and all of its models, and adds the sidebar section. **Restart OpenCode** when it finishes.

Install on OpenCode v2

OpenCode v2 uses a different command — note the add:

opencode plugin add opencode-cmd-provider

This adds the plugin to your global OpenCode configuration, so it works in every project, registers Command Code and all of its models, and adds the sidebar section. Restart OpenCode when it finishes.

If an install command fails on your machine, you can add the plugin to your configuration by hand — see Installation mechanics in the technical reference.

Connect your Command Code account

OpenCode v1: sign in from the browser

In OpenCode, run:

/connect

Select Command Code in the provider list, then pick how to sign in:

  • Command Code — the browser flow. Finish the sign-in in your browser; the
key is stored by OpenCode and reused from then on. Take your time: the plugin waits up to five minutes for the browser to hand the key back, so there is no rush picking an organization or approving access.
  • Command Code API key — paste the key the Command Code studio shows you.
Use this when the browser cannot reach OpenCode's localhost callback, for example when OpenCode runs on a remote host.

OpenCode v2: use your API key

OpenCode v2 has no browser sign-in for Command Code. Set your API key before starting OpenCode:

export COMMANDCODE_API_KEY="user_..."

Or run /connect inside OpenCode and paste the key when asked.

Already signed in with the Command Code CLI?

OpenCode reuses an existing Command Code CLI login automatically, so you may not need to connect at all.

Start using it

  1. Pick a model: run /models and choose any entry starting with [CMD],
for example [CMD] Claude Sonnet 5.
  1. Start chatting. Your Command Code plan handles the requests.
Prefer the command line? Run a single prompt without the interactive interface:
opencode run --model commandcode/claude-sonnet-5 "hello"

What you get

The Command Code sidebar

While a session uses a [CMD] model, the sidebar shows a Command Code section for that model, split into segments:

  • tier and status
  • an Allowance section listing the Go, GOAT, Pro, Max 10×, Max 20× and
Team Pro monthly allowances
  • a Rates section with the published rate bands — peak/off-peak for
time-of-day pricing (DeepSeek) and context-window tiers (OpenAI, Grok, Qwen) — each band showing input, output, cache-read and cache-write rates per million tokens, plus the peak windows; a model with no published band shows its actual per-million price instead
  • an Other Information section with benchmark scores (intelligence,
tokens/second), current deals and was/now rates
  • a Usage section with live 5-hour, weekly and monthly usage plus the
current cycle's requests, tokens and spend, read from the account you're connected with and refreshed as you work (never polled)

Every row is always shown: when a model has nothing for a row, its value reads N/A instead of the row disappearing.

Toggle the sidebar with ctrl+x b. Switch to a model that isn't from Command Code and the section disappears — there is nothing to show for other providers.

Plan and deal summaries

Ask OpenCode something like _"Which Command Code plan am I on?"_ or _"How many requests does my Command Code plan cover this month?"_ and it uses the built-in cmd_plan_summary tool: the plan and account the current credential resolves to (or the plan you pinned), its allowances and the current deals, turned into an estimate. If you want to force a plan, add it to the question (for example plan=pro) — a plan pinned that way is marked (pinned) in the header, so it never reads as a plan that was detected.

The summary always says where the credential came from — your OpenCode connection, COMMANDCODE_API_KEY, a legacy Command Code auth file, or the plan you pinned — and names the account it answered for when the API reports one. So an answer that came from a different account than the one you signed in with is visible instead of silent.

Everyday details

  • Reasoning models show their effort levels in OpenCode, so you can pick how
hard the model should think.
  • Vision models accept image input; text-only models will tell you instead of
silently ignoring the image.
  • Costs shown in OpenCode are estimates from Command Code's published
pricing, and some models show $0 because no price is published for them. Check the current Command Code pricing before relying on the numbers.
  • Transient failures are retried. A dropped connection or a temporary server
error is replayed a couple of times before OpenCode sees a failure, so a blip does not end your turn. Permanent answers — a usage-window limit, a rejected request — come straight back as errors, and a turn that already streamed text is never replayed.

Keep it up to date

A new release only reaches you after OpenCode refreshes its cached copy of the plugin.

OpenCode v2:

opencode plugin update

OpenCode v1: delete the cached copy and restart OpenCode:

rm -rf ~/.cache/opencode/packages/opencode-cmd-provider*

The first start after an update takes a little longer because the plugin is downloaded again. You never need to sign in again.

New Command Code models come with plugin updates, so if a model is missing from /models, updating is the fix.

Uninstall

OpenCode v2:

opencode plugin remove opencode-cmd-provider

OpenCode v1: remove opencode-cmd-provider from the plugin list in your opencode.json (and from tui.json if it is listed there).

Then remove the cached copy to free the space:

rm -rf ~/.cache/opencode/packages/opencode-cmd-provider*

The provider and models this plugin registered disappear with it; there is nothing else to clean up.

Troubleshooting

| What you see | What to try | | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | No [CMD] models in /models | Check that your API key is set (or that /connect succeeded), restart OpenCode, and update the plugin if your install is old. | | The sidebar has no Command Code section | Make sure the session uses a [CMD] model, and press ctrl+x b — the sidebar may be hidden. | | Browser sign-in fails (v1) | Run /connect again and pick Command Code API key to paste one, or set COMMANDCODE_API_KEY and restart OpenCode. | | A model shows $0 cost | No published price for that model, so the estimate is 0. See Command Code pricing. | | Command Code rejected this plugin as out of date | Command Code refuses the version your install reports. Update the plugin — see Keep it up to date. | | Something else | See the technical reference or open an issue. |

Learn more

model and deals data comes from, and the decisions behind it. Jump straight to a section: - Hosts and entry points — which OpenCode processes load the plugin and what each one registers - Installation mechanics and caching — where an install lands, how updates work, and why nothing updates by itself - Model discovery and offline behaviour — bundled model lists, the [CMD] name prefix, and mixing in your own model entries - Generated catalogs — the model, capability, and deals data files and how they are refreshed - Deals intelligence — where allowances, benchmarks, and deals come from, and what happens when they are unavailable - Reasoning support — how thinking-effort levels reach the model - Image input — which models accept images - Claude prompt caching — how repeated Claude turns reuse a cached prefix instead of re-billing it - Pricing display — why some models show $0 in OpenCode - Environment variables — credentials, plan pinning, and test/mock overrides - Development and testing — build, test, and end-to-end commands - Troubleshooting — deeper fixes when the table above is not enough - Design records — every design decision, one line each contributors and maintainers.

Credits

Inspired by pi-commandcode-provider.

License

MIT

Chat with me