pi-commandcode-provider
v0.4.2
Published
pi custom provider for Command Code API (commandcode.ai)
Maintainers
Readme
pi-commandcode-provider
A pi custom provider that connects pi to the Command Code API.
Disclaimer: This is an unofficial, community-maintained package. I am not affiliated with, endorsed by, or connected to Command Code in any way. This provider simply forwards requests to the public Command Code API using your own API key.
Note: This package only provides a model provider. It does not include an API key. You must bring your own Command Code API key or subscription.
💰 Current offers: Command Code offers 4× usage of DeepSeek V4 Pro and 2× usage of Qwen 3.7 Max.
Models
Models are fetched live from Command Code's Provider API at startup, so new models like Qwen 3.7 Max show up without a package release.
You can list the current Command Code models with:
pi -e index.ts --list-modelsInstall
pi install npm:pi-commandcode-providerOr shorthand:
pi install pi-commandcode-providerThen reload pi:
/reloadOh My Pi
omp plugin install pi-commandcode-providerThen restart OMP or run:
/reloadSetup
Set your Command Code API key using one of these methods:
1. Browser login (recommended)
In pi, run:
/loginThen select Command Code from the provider list.
This opens Command Code in your browser and stores the returned API key in pi's auth file. If the browser shows "Copy your API key" because automatic transfer failed, copy that key and paste it into the pi terminal prompt.
Note:
/login commandcodeis not supported by pi currently; use interactive/loginand select Command Code.
2. Environment variable
export COMMANDCODE_API_KEY="user_..."3. Auth file
Create ~/.commandcode/auth.json:
{
"apiKey": "user_..."
}The official Command Code CLI auth shape is also supported:
{
"command-code": {
"type": "api",
"key": "user_..."
}
}Or use a pi/OMP auth file at ~/.pi/agent/auth.json or ~/.omp/agent/auth.json:
{
"commandcode": "user_..."
}Usage
After installing and setting your API key, select a Command Code model in pi:
/model deepseek/deepseek-v4-flashAny query will then use the Command Code API. You can list available models:
pi -e index.ts --list-models # or /models within pi
omp -e index.ts --list-modelsIn OMP, use the provider-qualified model name:
omp -p "hello" --model commandcode/deepseek/deepseek-v4-flashOMP currently resolves --provider commandcode --model ... before extension providers are loaded, so prefer --model commandcode/<model-id>.
Model discovery
On startup, the provider fetches:
https://api.commandcode.ai/provider/v1/modelsFor tests or local mocks, override it with COMMANDCODE_MODELS_URL.
Pricing
Command Code does not yet expose model pricing through its Provider API. The provider ships a static cost table (MODEL_COSTS in index.ts) for known models so that pi can display per-model pricing.
- Models present in
MODEL_COSTSshow their real per-million-token rates (including promotional deals like the DeepSeek V4 Pro 4× discount and Qwen 3.7 Max 2× discount). - Models not in the table fall back to zero cost. When the Provider API adds a
costfield, the static table can be removed.
To add or update a price, edit the MODEL_COSTS record in index.ts and update the corresponding test in tests/test-pricing.ts.
Contributing
See CONTRIBUTING.md for development setup, PR expectations, and commit message rules.
Release
See RELEASE.md for the prerelease, npm smoke-test, stable publish, git tag, and GitHub follow-up checklist.
License
MIT
