- Add scripts/extract-models.ts to parse command-code npm dist file - Generate models.json (21 models, 15 pricing entries) with contextWindow and maxOutputTokens pre-filled; no nulls or hardcoded fallbacks in index.ts - Rewrite index.ts to load model list and costs from models.json - Cap gateway model maxOutputTokens at 65536 (API limit for Baseten/Vercel) - Add 'Update models' section to README documenting the generation flow - Add npm run extract-models script
3.8 KiB
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 offer: Command Code offers 4× usage of DeepSeek V4 (Pro and Flash) at no extra cost.
Models
18 models across premium and open-source providers:
| Category | Models |
|---|---|
| Anthropic | Claude Opus 4.7, Claude Opus 4.6, Claude Sonnet 4.6, Claude Haiku 4.5 |
| OpenAI | GPT-5.5, GPT-5.4, GPT-5.3 Codex, GPT-5.4 Mini |
| Open-source | DeepSeek V4, DeepSeek V4 Pro, DeepSeek V4 Flash, Kimi K2.6, Kimi K2.5, GLM-5.1, GLM-5, MiniMax M2.7, MiniMax M2.5, Qwen 3.6 Max, Qwen 3.6 Plus |
Install
pi install npm:pi-commandcode-provider
Or shorthand:
pi install pi-commandcode-provider
Then reload pi:
/reload
Setup
Set your Command Code API key using one of these methods:
1. Browser login (recommended)
In pi, run:
/login
Then 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_..."
}
Or use pi's auth file at ~/.pi/agent/auth.json:
{
"commandcode": "user_..."
}
Usage
After installing and setting your API key, select a Command Code model in pi:
/model deepseek/deepseek-v4-flash
Any query will then use the Command Code API. You can list available models:
pi -e index.ts --list-models
Or within pi:
/models
Update models
The model list (models.json) is extracted from the command-code npm package's dist file. When Command Code releases a new version with updated models, regenerate it:
npm run extract-models
This runs scripts/extract-models.ts, which:
- Downloads the latest
command-codetarball from npm (npm pack command-code) - Parses the minified
dist/index.mjsto extract provider definitions, model metadata, and pricing - Fills in
contextWindowandmaxOutputTokenswith sensible defaults where the CLI omits them - Writes the result to
models.json
To use a specific version or local dist file:
npx tsx scripts/extract-models.ts /path/to/command-code/dist/index.mjs
models.json is committed to the repo and included in the npm package.
Publish
npm login
npm publish --access public
License
MIT