Skip to content
 
 

Repository files navigation

pi-commandcode-provider-deepseek

CI Memory benchmark

A pi provider for the Command Code Provider API, narrowed down to the DeepSeek models.

Unofficial. This is a community integration, not affiliated with or endorsed by Command Code. You need your own Command Code account and a plan with Provider API access.

What this fork changes

Forked from patlux/pi-commandcode-provider. Transport, authentication, and caching stay the same; the model surface does not:

Area Behavior here
Registered models Only deepseek/deepseek-v4-flash and deepseek/deepseek-v4.1-flash out of the box
Image input deepseek/deepseek-v4.1-flash only; deepseek/deepseek-v4-flash is text-only
Pricing Peak/off-peak selected by the request's UTC completion time; the picker shows the off-peak rate
Model picker New /commandcode-models checkbox UI; the choice is saved and restored

Everything not listed above follows the upstream extension.

Quick start

Install from a checkout:

git clone https://github.com/newCman1/pi-commandcode-provider-deepseek
pi install /path/to/pi-commandcode-provider-deepseek

Reload pi and sign in with /login (Use a subscription → Command Code). Then pick a model with /model, or pin one in ~/.pi/agent/settings.json:

{
  "defaultProvider": "commandcode",
  "defaultModel": "deepseek/deepseek-v4-flash"
}

pi has no built-in default for third-party providers, so without one of these steps login ends with no default model is configured.

Choosing models

The extension reads the whole Command Code catalog but registers only the two DeepSeek models by default. Run:

/commandcode-models

to open a checkbox list: space toggles, a selects all, n clears, enter confirms, esc cancels. Confirmed models appear in /model immediately. The selection lives in <agent-dir>/commandcode-models-selected.json and is re-applied on the next start.

Arguments work too, for hosts without a TUI:

/commandcode-models all
/commandcode-models default
/commandcode-models status
/commandcode-models deepseek/deepseek-v4.1-flash,gpt-5.5

default brings back just the two DeepSeek models.

Peak and off-peak pricing

Both DeepSeek models are half price for 17 hours a day. The model picker always shows the off-peak rate; the cost of a request is computed from the rate that applies at its UTC completion time.

Input Output Cache read
Off-peak (per 1M tokens) $0.15 $0.60 $0.003
Peak (per 1M tokens) $0.30 $1.20 $0.006

Peak runs on weekdays from 01:00-04:00 and 06:00-10:00 UTC. Every other hour, and the entire weekend, is off-peak.

Prices come from the Command Code pricing page, which stays authoritative for what you are actually billed. A model with no price entry is shown as zero cost in pi, which is a display default and not a promise that the request is free.

Image input

deepseek/deepseek-v4.1-flash is marked vision-capable, so pi forwards image blocks from user messages and tool results using the normal OpenAI or Anthropic message schema. deepseek/deepseek-v4-flash and any unrecognized model stay text-only, and image content is rejected before a request is sent.

Model discovery and offline behavior

The catalog is fetched from:

https://api.commandcode.ai/provider/v1/models

The last good response is cached at <agent-dir>/commandcode-models.json (for pi, ~/.pi/agent/commandcode-models.json). If the endpoint is unreachable, the cached catalog is used; on a cold offline start there are simply no Command Code models until a refresh succeeds.

Three commands are available without restarting pi:

  • /commandcode-refresh — re-fetch the catalog. Concurrent refreshes are merged, and a failure keeps the previous catalog.
  • /commandcode-status — show redacted discovery details: source, model count, timestamps, cache path, endpoint, warning.
  • /commandcode-models — open the model picker (see above).

COMMANDCODE_ZDR=1 adds Command Code's x-cmd-zdr: 1 zero-data-retention header.

Configuration

Credentials are read from /login, then from these locations in order:

  • COMMANDCODE_API_KEY
  • ~/.commandcode/auth.json
  • ~/.pi/agent/auth.json
  • ~/.omp/agent/auth.json

The auth files accept a plain { "apiKey": "user_..." }, a { "command-code": { "type": "api", "key": "user_..." } } entry, or { "commandcode": "user_..." }.

For tests, local mocks, and compatible endpoints:

Variable Purpose
COMMANDCODE_API_BASE Provider API base URL
COMMANDCODE_MODELS_URL Catalog URL
COMMANDCODE_MODELS_CACHE Catalog cache path
COMMANDCODE_MODELS_SELECTION Saved model selection path
COMMANDCODE_MODELS_TIMEOUT_MS Discovery timeout; defaults to 10s

Transports

The provider keeps a single entry and picks the transport the account supports. Provider API accounts use POST /provider/v1/chat/completions (and POST /provider/v1/messages for Claude models); Go-plan accounts fall back to POST /alpha/generate only after the Provider API answers 403 upgrade_required. The choice is kept for the current process and re-evaluated when the credential changes.

Reasoning levels are exposed only for models whose Command Code effort support is known. The two DeepSeek models accept high and max; the selected level is forwarded as reasoning_effort.

Oh My Pi

The same checkout works in Oh My Pi:

omp plugin install /path/to/pi-commandcode-provider-deepseek

Restart OMP or run /reload, then /login → Use a subscription → Command Code. OMP exposes the same /commandcode-models checkbox picker.

Development

npm test          # typecheck + unit tests + host smoke tests
npm run test:unit # typecheck + unit tests only

npm run pi:isolated     # throwaway pi with this checkout and no stored credentials
npm run pi:authenticated # this checkout with your existing credentials

Both pi:* scripts pass extra arguments through after --.

Live transport tests need separate Go-plan and Provider-API keys, supplied through protected files so they stay out of shell history:

COMMANDCODE_E2E_GO_API_KEY_FILE=/path/to/go-key npm run test:e2e:live:go
COMMANDCODE_E2E_PROVIDER_API_KEY_FILE=/path/to/provider-key npm run test:e2e:live:provider

Each profile uses an isolated agent directory and checks the transport through /commandcode-status (generate for Go, provider for Provider API). Override the model under test with COMMANDCODE_E2E_GO_MODEL / COMMANDCODE_E2E_PROVIDER_MODEL.

See CONTRIBUTING.md for local setup and RELEASE.md for releases.

License

MIT

About

pi custom provider for the Command Code API — 18 models including Claude, GPT, DeepSeek, Kimi, GLM, MiniMax, and Qwen

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages