pi-zenmux0.3.0
ZenMux provider extension for pi-mono
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
ZenMux Provider Extension for pi
Adds a zenmux provider to pi as a pi package, as requested in badlogic/pi-mono#1811.
ZenMux speaks both the OpenAI Chat Completions and the Anthropic Messages protocol for the same catalog, so this extension only supplies endpoints, model metadata, and catalog discovery: requests are converted and streamed by pi's built-in API implementations.
Features
- Registers provider
zenmux, API key env varZENMUX_API_KEY - Discovers the live catalog from
https://zenmux.ai/api/v1/modelsat startup and through pi'srefreshModels - Keeps the last good catalog as a snapshot, so offline startups still list models
- Routes
anthropic/*models tohttps://zenmux.ai/api/anthropic(anthropic-messages) and every other model tohttps://zenmux.ai/api/v1(openai-completions) - Registers chat models only: image, video, speech, transcription, embedding, and rerank models from the same catalog are skipped
- Maps tiered ZenMux pricing to pi's request-wide cost tiers, cache prices (5 minute, generic, 1 hour) to
cost.cacheWrite, and prompt-cache TTLs topromptCacheso pi can warm caches - Fills in output limits and prices from the
zenmuxprovider in models.dev for the catalog entries where ZenMux publishes none - Takes the output cap from ZenMux's own per-endpoint catalog (
/api/frontend/model/available/list), because models.dev reports the upstream vendor's limit, which differs on most models; the fetch is best-effort and falls back to models.dev, then to a built-in default
Install
pi install npm:pi-zenmux
pi install /absolute/path/to/pi-zenmux
Requires pi 0.87.1 or newer (@earendil-works/pi-coding-agent); the former @mariozechner/pi-coding-agent scope is deprecated.
Configure
export ZENMUX_API_KEY="sk-ai-v1-..."
Or store the key in ~/.pi/agent/auth.json:
{
"zenmux": {
"type": "api_key",
"key": "sk-ai-v1-..."
}
}
Use
pi --provider zenmux --model anthropic/claude-opus-5
pi --list-models zenmux
You can also start pi normally and switch with /model.
Optional endpoint override
export ZENMUX_BASE_URL="https://zenmux.ai"
The extension derives ${ZENMUX_BASE_URL}/api/v1, ${ZENMUX_BASE_URL}/api/anthropic, and the catalog URL ${ZENMUX_BASE_URL}/api/v1/models.
Related
ZenMux also publishes an OAuth PKCE plugin, @zenmux/pi-zenmux-oauth, which signs in through /login instead of an API key. Install only one of the two: both register the provider id zenmux.
Breaking changes in 0.3.0
- Requires pi
0.87.1+ and imports@earendil-works/pi-* - The retired custom
zenmux-routerAPI and itsstreamSimplerouter are gone; models now carry their ownapiandbaseUrl routeModel,asZenmuxRouterModels,streamSimpleZenmux, andZENMUX_ROUTER_APIare no longer exported; useroutingForfor the routing rule- Non-chat models are no longer registered
Publish
npm run check
npm login
npm publish --access public
Dev / Test
npm install
npm run typecheck
npm test