Three things magpie's built-in Command Code did that the plugin didn't, ahead of retiring the built-in: - The Credits window had no reset, though the month's credits come back when the plan's period ends, which billing/subscriptions' currentPeriodEnd says (sub.until, already the card's "until"). allowanceOf now puts it on the window as resetsAt (yetone/magpie#2454). No period end, no reset. - The models the CLI marks FREE (magpie's cmdFree, all 11: Space Bunny Alpha, Pixel Canary, Laguna S 2.1, the Ling 3.0/3.1 Flash ones, the MiniMax M3/M2.7 free ids, LongCat 2.0 free, Tencent Hy3) now say free: true on every list: the Provider API's, Go's, and Go's table when the list can't be had. - A Go chat's max_tokens sent to /alpha/generate is kept within 200,000, the most Command Code takes ("Too big: expected number to be <=200000 at params.max_tokens"; magpie's CommandCodeMaxOutput in cmdRequest). Before, a 384,000 ask failed the whole request. Run: bun test in packages/commandcode: 49 pass, 0 fail. parity.test.mjs is new; usage.test.mjs's two plan-with-period cases now expect the reset. Broke each by hand and watched red: no resetsAt, 3 fail; no free flag, 3 fail; no cap, 1 fail. bun scripts/check.mjs commandcode: ok. Live, with the owner's GOAT key: the card's Credits window says resetsAt 2026-10-28T16:16:42Z, the subscription's until; its list (71 models) has poolside/laguna-s-2.1-free free, the only one of the 11 Command Code lists today. Not tried live: a Go request over 200,000 (no Go key here).
@magpie-community/opencode-commandcode-auth
Signs in to a Command Code plan (Pro, GOAT, Max,
Ultra, Go, Teams Pro) and makes its requests, in OpenCode and in magpie.
Provider id: commandcode-plan.
Signing in
An account is a Command Code API key. There are three ways to get one:
- Command Code (browser): the CLI's own sign-in. Studio asks you to
approve a key for this machine, then posts it to a callback on
127.0.0.1. The plugin checks the key with/alpha/whoamiand reads the plan. - Command Code CLI's sign-in: takes the account
commandcode loginsigned in to, from~/.commandcode/auth.json. The file is only read, never changed. - API key: paste a key from commandcode.ai/settings/keys.
The key is kept where OpenCode keeps sign-ins (auth.json; in magpie,
plugin-auth.json) as { "type": "api", "key", "metadata": { "email": <user>, "plan" } }.
Keys don't expire, so there is nothing to refresh.
Requests
- Every plan but Go uses the Provider API at
https://api.commandcode.ai/provider/v1. Every request carries the key as bothAuthorization: Bearerandx-api-key.- Claude models speak Anthropic's Messages API.
- The other models speak chat completions.
- Go has no Provider API access. Its key is only accepted where the CLI
asks,
POST /alpha/generate, in the CLI's own format (command-code 1.72.2 and its headers). The plugin'sfetchhandles this:- It turns OpenCode's chat completion into that format.
- It turns the line-by-line reply back into a chat completion, streamed or not.
- Failures keep their statuses: a model the plan lacks is a 403, running out of credits is a 402, and a usage-window limit is a 429.
- A reply that stops before its finish line is a 502, unless it was
streamed and had already said something. Then it ends cut short, with
a note saying so, and
[DONE](#91).
The plan is read from /alpha/billing/subscriptions. It is cached for 10
minutes; after a failed read, the plugin tries again after 1 minute.
When the plan isn't known yet and the Provider API refuses the key with
"Your Go plan doesn't include API access", the key is taken as Go's from
then on (and saved so with it), and a chat completion is sent again to
/alpha/generate.
Models
The config hook declares the default list:
| Model | Context window |
|---|---|
| Claude Sonnet 5 | 1M |
| Claude Opus 5.5 | 1M |
| GPT-6 Sol | 1.05M |
| DeepSeek V4 Pro | 1M |
| DeepSeek V4 Flash | 1M |
| Kimi K3 | 1M |
| GLM-5.3 | 1M |
| MiniMax M3 | 1M |
Once signed in, the provider.models hook replaces the default list with
the account's own:
Command Code's /models list is the same for every plan. A plan's list is
that list less the models the plan may not use, as the CLI's own table
(command-code 1.79.2) has it:
- Go and GOAT may not use the premium models (Claude Sonnet 5 and Opus, GPT-6 Sol, GPT-5.6 Terra, …). Go is also blocked from GOAT's own (Claude Sonnet 5.5 and Haiku 5.5, GPT-5.6 Sol, Grok 4.6 and 4.7, …).
- Pro may not use Claude Opus and Fable, GPT-6 Astra, GPT-6.1 Sol and Fugu Ultra; Provider may not use GPT-6.1 Sol.
- Max, Ultra and Teams Pro may use every model.
An account with bought or free credits may use every model, and so may one
whose plan can't be read: then the whole list is shown. A model the plan
doesn't have is still refused by Command Code (403 MODEL_NOT_IN_PLAN), and
that refusal reaches the agent.
-
Every plan but Go: the Provider API's
/modelslist. Each model'ssupported_endpointspicks the API it speaks. -
Go: the same
/modelslist, asked without the key (it answers without one, and Go's key has no Provider API). That is 56 models as of 2026-10-13. When the list can't be had, the CLI's own Go table (57 models) stands in.The Go models carry their reasoning levels, and a requested level is fitted to the nearest one the model has.
The /models list doesn't say which models take images. A model is marked
as taking them when it is a Claude model, or when the default list or the
CLI's table says so. For any other model the plugin says nothing either
way, and magpie answers from models.dev, as its built-in did.
Not included
- Usage and quota (
/alpha/billing/credits, the 5-hour and weekly windows). - Switching between several accounts. OpenCode keeps one sign-in per provider.