← Catalog

@arhen/pi-add-commandcode

pi extension: Command Code Provider API (models, ZDR).

Extension

Install

Install with PiG

pig install npm:@arhen/pi-add-commandcode

Install with Pi

pi install npm:@arhen/pi-add-commandcode
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./src/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.0.4 (README.md). PiG does not review it.

@arhen/pi-add-commandcode

npm version license

Install

Requires the pi coding agent — install it first: npm install -g @earendil-works/pi-coding-agent.

pi install npm:@arhen/pi-add-commandcode

Command Code Provider API for pi — 58 models on one key, live catalog, dual-endpoint routing, Zero Data Retention toggle.

  • Login: /login → "Command Code" → API key (or COMMANDCODE_API_KEY)
  • /commandcode — status: key, model count, ZDR state
  • /commandcode zdr [on|off] — Zero Data Retention (persisted across sessions)

Endpoint routing

The API is two endpoints on one base, and using the wrong one is a hard 400:

ModelsEndpointpi API
claude-* (7)/provider/v1/messagesanthropic-messages
everything else (51)/provider/v1/chat/completionsopenai-completions

Routing is per model, so /model just works — pick any id and the right shape is sent.

Models are fetched in the extension factory, which pi awaits before startup finishes, so the catalog is ready for interactive startup and /model. Fetching in session_start instead leaves the provider empty on first paint.

Model metadata

GET /provider/v1/models returns only id, name, and context_length — no pricing, no capability flags. So metadata comes from two sources:

  • Claude ids reuse pi's built-in ANTHROPIC_MODELS entry. Rates are identical to the Command Code docs, and it carries forceAdaptiveThinking and supportsTemperature, which Opus 4.7+/Sonnet 4.6 need to think correctly.
  • Everything else reads the CATALOG table in src/index.ts, transcribed from pricing & limits.
npx tsx src/index.test.ts   # hits the live public /models endpoint

The test asserts every live model resolves to exactly one source, that Claude ids route to Messages with a /v1-less baseUrl, and that an offline refresh preserves the catalog rather than emptying it. Run it after Command Code adds models: a model in neither source still registers, but bills as free and claims reasoning: true, so the test fails rather than letting that ship.

Zero Data Retention

/commandcode zdr on sends x-cmd-zdr: 1 on every request, so it routes only through ZDR-capable upstreams. Per the docs there is no silent fallback: a model with no ZDR upstream fails with 422 cmd_zdr_no_providers instead of quietly using a non-ZDR route. ZDR may also change which upstream serves you, so cost can differ.

Notes

  • Reasoning effort accepts low|medium|high|xhigh|max. There is no none, so thinking-off is marked unsupported and pi omits the field.
  • Token usage arrives at the end of every stream with no opt-in, so pi's built-in cost footer works as-is.
  • Claude ids register on any plan but return 403 MODEL_NOT_IN_PLAN unless your plan covers them.
  • Long-context pricing tiers (8 models bill ~2× past a threshold) are not modelled — CATALOG holds the standard tier, so cost reads low on very large contexts.

License

MIT.