pi-zcode

ZCode / Z.AI model provider for Pi Coding Agent

Packages

Package details

extension

Install pi-zcode from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-zcode
Package
pi-zcode
Version
0.1.4
Published
Sep 2, 2026
Downloads
658/mo · 79/wk
Author
undefined-project
License
MIT
Types
extension
Size
196.9 KB
Dependencies
2 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-zcode


Overview

pi-zcode is a lightweight, zero-dependency standalone provider extension that connects the Pi Coding Agent directly to ZCode, Z.AI, and BigModel cloud services. It brings GLM-5.3, GLM-5.3-Flash, and GLM-5.x reasoning models directly into your terminal coding workflow with zero external CLI or desktop application dependencies.


Features

  • Pure Standalone: Connects directly via upstream HTTP/SSE APIs. No local ZCode desktop client, CLI daemon, or proxy processes required.
  • Auto Plan Detection: Automatically identifies account entitlements (Start Plan and Individual Plan) and dynamically registers providers (zcode, zcode-start-plan, zcode-individual-plan).
  • Dynamic Model Discovery: Queries models live from upstream APIs instead of relying on hardcoded lists.
  • In-Process Headless CAPTCHA Solver: Integrates an in-memory DOM simulation (happy-dom) solving Aliyun CAPTCHA challenges in under 1 second in the background. Completely automated with zero browser popups or workflow interruptions.
  • Full Reasoning & Tool Support: Native streaming of thinking content (reasoning_content / Anthropic thinking blocks) and structured tool calls.
  • Quota & Diagnostics: Real-time quota inspection via /zcode.usage and connection diagnostics via /zcode.doctor.

Quick Start

  1. Install the extension in Pi:

    pi install npm:pi-zcode
    

    Or install from local source:

    pi install /path/to/pi-zcode
    
  2. Authenticate with your ZCode account:

    /login zcode
    

    Select your preferred OAuth provider (BigModel for China mainland or Z.ai for Global).

  3. Select a model: Use Pi's native model picker:

    /model zcode/glm-5.3-flash
    

    or flagship reasoning model:

    /model zcode/glm-5.3
    

Commands

Command Description
/login zcode Log in via Z.ai or BigModel browser OAuth flow.
/model Pi native model selector showing all entitled ZCode models.
/zcode.usage View detected plan tier, daily balance, and quota reset timestamps.
/zcode.doctor Show diagnostic stats (latency, request IDs, endpoint, error history).

Configuration & Environment Variables

Variable Description Default
PI_ZCODE_DEVICE_ID Override persistent device MID Stored in ~/.pi/zcode/device.json
PI_ZCODE_BASE_URL Override PaaS API endpoint Auto-resolved
CAPTCHA_DEBUG Enable verbose CAPTCHA solver logs false

License

MIT