pi-zro-provider
v1.3.28
Published
Zro provider extension for pi - GLM-5.2, GLM-5.3 Flash, Kimi K3, DeepSeek V4 Flash & DeepSeek V4.1 Flash through the Zro inference endpoint
Maintainers
Readme
✨ pi-zro-provider
3+ models through Zro
GLM-5.2, Kimi K3, and DeepSeek V4 / V4.1 Flash — run through the Zro inference endpoint with pi.
Features
- 6+ AI Models — GLM-5.2 (default), Kimi K3, DeepSeek V4 Flash, and DeepSeek V4.1 Flash, straight from Zro's production catalog
- Native reasoning effort — every model ships an endpoint-verified
piLevel→ level-id map (glm-5.2,glm-5.3-flash,deepseek-v4-flash-0731: fulloff–maxladder;deepseek-v4.1-flash:low/high/max— catalog has nonone, andxhigh/maxboth sendmax;kimi-k3:low/high/max— the proxy rejectsmediumthere), so/thinking lowetc. maps exactly to what the Zro proxy accepts. Quirks:glm-5.3-flashsilently disables thinking atlow, sominimal/lowmap tominimal;glm-5.3mirrors flash's full ladder — Z.ai officially removednonefor the 5.3 family, but the proxy accepts it and streams cleanly (occasionally a short chain-of-thought preamble surfaces incontentbefore the answer), andxhigh/maxboth sendmax - OpenAI-compatible API at
https://zro.moonmath.ai/v1 - Official catalog sync from Zro's
/api/cli/modelsendpoint — same onezro modelsuses - Quiet live model sync — the catalog refreshes in the background, at most hourly and by one pi process at a time (details)
- Zro login reuse — if you've run
zro login, the extension picks up~/.config/zro/credentials.jsonautomatically (no duplicated keys) - Footer status widget — session spend/requests and account plan / available spend / usage packs / 30-day activity at a glance
Available Models
| Model | Type | Context | Max Tokens | Input Cost | Output Cost | |-------|------|---------|------------|------------|-------------| | Auto | Text | 1.0M | 131K | — | — | | DeepSeek V4.1 Flash | Text + Image | 1.0M | 384K | $0.14 | $0.28 | | Dolly 1 Security | Text | 1.0M | 64K | — | — | | GLM-5.3 | Text | 1.0M | 131K | $1.40 | $4.40 | | GLM-5.3 Flash | Text + Image | 1.0M | 64K | $0.15 | $0.50 | | Kimi K3 | Text + Image | 1.0M | 131K | $2.50 | $12.00 | Costs are per million tokens. Billing is metered by your Zro plan and usage packs — see zro.moonmath.ai for pricing.
Installation
Option 1: Using pi install (Recommended)
Install from npm:
pi install npm:pi-zro-providerOr directly from GitHub:
pi install https://github.com/monotykamary/pi-zro-providerThen make sure you're logged in (or set a key) and run pi:
# Recommended: reuse your zro CLI login
zro login
# Or set as environment variable
export ZRO_API_KEY=your-api-key-here
piGet your API key from zro.moonmath.ai.
Option 2: Manual Clone
Clone this repository:
git clone https://github.com/monotykamary/pi-zro-provider.git cd pi-zro-providerMake sure you have a Zro credential (any of the Authentication options).
Run pi with the extension:
pi -e /path/to/pi-zro-provider
Usage
After loading the extension, select a model with:
/model zro glm-5.2Or start pi directly with a Zro model:
pi --provider zro --model glm-5.2Reasoning Effort
All Zro models are reasoning models. Control thinking depth with /thinking or the CLI:
pi --provider zro --model glm-5.2 --thinking xhighThe available levels are model-specific and come straight from Zro's catalog:
| Model | pi levels | Sent as reasoning_effort |
|-------|-----------|----------------------------|
| glm-5.2 | off, high, max | none, high, max |
| glm-5.3 | off, minimal, low, medium, high, xhigh, max | none, minimal, minimal, medium, high, max, max |
| kimi-k3 | low, high, max | low, high, max |
| deepseek-v4-flash-0731 | off, low, high, max | none, low, high, max |
| deepseek-v4.1-flash | low, high, xhigh, max | low, high, max, max |
Levels map one-to-one through thinkingLevelMap, so off sends Zro's none token instead of silently dropping the field.
Footer Status
A Neuralwatt-style status line sits below the editor. It appears after the
session's first Zro turn completes (never before — no half-empty line on
fresh sessions or other providers), refreshes its balance when the agent run
fully settles, and makes no status-related API calls in sessions that never
use Zro. The account prefetch at session start runs only in interactive
sessions (not pi -p or child agents) and is shared across pi processes: one
fetches /api/cli/status and writes ~/.pi/agent/cache/zro-account.json, and
sessions starting within the next 60 seconds render from that file instead:
⚡ $0.42 · 7 req Pro ◆ $12.34 avail · $2.50 pack · 1.2k req/30d
└─ session spend+requests ─┘ └─ plan · available spend · packs · activity ──┘The left side tracks what this session has done — request count, the spend
Zro attaches to a response when it reports one, and elapsed time (raw token
totals stay in pi's own footer, which can't show
Zro cost since its catalog carries no pricing). The right
side shows your plan name, total available spend, usage-pack balance, and
30-day request/token activity from Zro's /api/cli/status endpoint — the
same account view zro status prints — plus a request-rate atom from
response headers when present. The right side compresses progressively as
the terminal narrows, and turns to a warning color at/below the
lowBalanceUsd threshold.
Configuration
Edit ~/.pi/agent/extensions/zro.json or run /zro-status:
| Setting | Values | Default |
|---------|--------|---------|
| session | widget | statusbar | off | widget |
| account | widget | statusbar | off | widget |
| hideOnOtherProvider | true | false | true |
| lowBalanceUsd | number | null | 10 |
| glyphs | auto | unicode | ascii | auto |
Non-interactive toggles:
/zro-status session widget|statusbar|off
/zro-status account widget|statusbar|off
/zro-status hide true|false
/zro-status lowBalance 25|off
/zro-status glyphs auto|unicode|ascii
/zro-status refresh
/zro-status resetglyphs: "auto" swaps the emoji footer glyphs (bolt, gem, warn, separator) for ASCII equivalents on
legacy terminals (mintty/Cygwin), whose cell-width tables can disagree with the
extension's width math. On those terminals a full-width widget line can wrap
physically, which desynchronizes pi's renderer and leaves stale rows behind.
The widget also never paints the terminal's last column, and clamps an explicit
unicode choice to ASCII on legacy terminals; the statusbar is not edge-padded
and always honors the exact choice.
Authentication
The Zro API key can be configured in multiple ways (resolved in this order):
auth.json(recommended) — Add to~/.pi/agent/auth.json:
The{ "zro": { "type": "api_key", "key": "your-api-key" } }keyfield supports literal values, env var names, and shell commands (prefix with!). See pi's auth file docs for details.- Environment variable — Set
ZRO_API_KEY zro loginreuse — If you've already runzro login, the extension reads~/.config/zro/credentials.json(XDG_CONFIG_HOMEaware) automatically. No extra configuration needed.- Runtime override — Use the
--api-keyCLI flag
Get your API key from zro.moonmath.ai.
Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| ZRO_API_KEY | No | Your Zro API key (env var fallback) |
| ZRO_ENDPOINT_ROOT | No | Override the endpoint root (default https://zro.moonmath.ai) |
| ZRO_AUTH_URL | No | Override the authentication/API host (used by zro login; the extension resolves catalog/status from it too) |
| PI_PROVIDER_SYNC_TTL_MS | No | Model sync freshness window in ms (default 3600000; 0 = revalidate every session start) |
Configuration
Add to your pi configuration for automatic loading:
{
"extensions": [
"/path/to/pi-zro-provider"
]
}Catalog and Compat Settings
Model metadata matches the transform Zro's own pi adapter applies to its
/api/cli/models catalog:
- canonical ids, display names, context windows, and output caps
thinkingLevelMapbuilt from each model's published reasoning levels (piLevel→ provider level id)compat.supportsReasoningEffort: trueandmaxTokensField: "max_tokens"(plainopenai-completions, no customthinkingFormat)supportsDeveloperRole: false- all text-only inputs
patch.json is reserved only for a verified provider regression and is
currently empty.
Patch Overrides
patch.json is applied on top of models.json only for verified endpoint
corrections. It is currently empty because every live field comes from Zro's
canonical model catalog.
Model sync
Startup never waits on the network. pi starts with the cached catalog (~/.pi/agent/cache/zro-models.json,
falling back to the bundled models.json) and revalidates against /api/cli/models in the background — only when:
- a Zro API key is configured (auth.json,
ZRO_API_KEY, or azro login; no key, no request), - the cache is older than 1 hour, missing, or was fetched with a different API key (so a new
zro loginrefreshes it right away), and - no other pi process is already refreshing it (a
zro-models.lockfile next to the cache).
So /new, /reload, pi -p and fan-out child agents share one cache instead of each calling the API; a
session that skips the fetch still picks up a cache another process refreshed. A failed refresh is retried after
5 minutes at the earliest. PI_PROVIDER_SYNC_TTL_MS changes the window (0 revalidates on every session start).
Only a hash fingerprint of the key is stored (zro-models.sync.json), never the key itself.
The footer's startup account prefetch follows the same rules with its own 60-second window
(zro-account.json, see Footer Status); balance polls after each agent run are unchanged.
Updating Models
Run the update script to fetch the latest models from the Zro catalog:
node scripts/update-models.js # uses zro login credentials
# or
ZRO_API_KEY=your-api-key node scripts/update-models.jsThis will:
- Fetch models from
https://zro.moonmath.ai/api/cli/models - Regenerate
models.jsonas pure metadata from the live catalog - Apply overrides from
patch.jsononly when building the README - Remove custom models now available upstream from
custom-models.json - Reconcile delisted models through the 14-day
deprecated-models.jsongrace layer - Update
models.jsonand the README model table
License
MIT
