npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ghoulm370/pi-zai-vision

v0.1.2

Published

Pi extension: Z.AI GLM-4.6V vision tools — image analysis, OCR, error diagnosis, diagram reading, UI diff, UI-to-code, video analysis

Readme

pi-zai-vision

Pi extension: Z.AI GLM-4.6V vision tools — native pi integration of the official Z.AI vision MCP server capabilities.

Tools

General Vision

| Tool | Description | |------|-------------| | image_analysis | General-purpose image analysis — describe, identify, extract, answer |

Specialized Image Tools

| Tool | Description | |------|-------------| | extract_text_from_screenshot | OCR text extraction with formatting preservation | | diagnose_error_screenshot | Error diagnosis with root cause analysis and fix guidance | | understand_technical_diagram | Architecture/UML/flowchart/ER diagram interpretation | | analyze_data_visualization | Chart/graph/dashboard analysis — trends, anomalies, recommendations | | ui_diff_check | Compare two UI screenshots — visual regression testing | | ui_to_artifact | UI screenshot → code (HTML/CSS), spec, prompt, or description |

Video

| Tool | Description | |------|-------------| | video_analysis | Video content analysis — scenes, actions, events (MP4/MOV/M4V/AVI/WebM/WMV)

Prerequisites

  • A Zhipu / Z.AI API key with GLM-4.6V access
  • Pi installed (npm install -g @ghoulm370/pi-web)

Quick Start

1. Install

# From local path (development)
pi install /path/to/pi-zai-vision

# From npm (once published)
pi install npm:@ghoulm370/pi-zai-vision

2. Configure

方式一:配置文件(推荐,~/.pi/agent/pi-zai-vision.json

{
  "apiKey": "your-api-key",
  "mode": "ZAI"
}

方式二:环境变量(优先级更高)

export Z_AI_API_KEY="your-api-key"
export Z_AI_MODE="ZAI"       # ZHIPU | ZHIPU_CODING | ZAI | ZAI_CODING

优先级:环境变量 > 配置文件 > 默认值

| 配置项 | 环境变量 | 配置文件 key | 默认值 | |--------|----------|-------------|--------| | API Key | Z_AI_API_KEY | apiKey | (required) | | 平台 | Z_AI_MODE | mode | ZAI | | 模型 | Z_AI_MODEL | model | glm-4.6v | | Thinking | Z_AI_THINKING | thinking | true | | 超时(秒) | Z_AI_TIMEOUT | timeoutSecs | 300 | | 图片上限(MB) | Z_AI_MAX_IMAGE_SIZE_MB | maxImageSizeMB | 5 | | 视频上限(MB) | Z_AI_MAX_VIDEO_SIZE_MB | maxVideoSizeMB | 8 |

3. Use

pi

Then in your pi session:

> Describe this screenshot: image_analysis(imagePath="error.png", prompt="What's wrong?")

> Extract the code from this screenshot: extract_text_from_screenshot(imagePath="code.png", programmingLanguage="typescript")

> Diagnose this error: diagnose_error_screenshot(imagePath="stacktrace.png", context="Running cargo build")

Platform Endpoints

Coding Plan(编码套餐)用户:智谱用 ZHIPU_CODING,Z.AI 用 ZAI_CODING。 Coding Plan 支持的 OpenAI Chat Completion 端点见 官方文档

| Mode | Endpoint | 适用 | |------|----------|------| | ZHIPU | https://open.bigmodel.cn/api/paas/v4/ | 智谱(标准 / 按量计费) | | ZHIPU_CODING | https://open.bigmodel.cn/api/coding/paas/v4/ | 智谱 Coding Plan | | ZAI | https://api.z.ai/api/paas/v4/ | Z.AI(标准 / 按量计费) | | ZAI_CODING | https://api.z.ai/api/coding/paas/v4/ | Z.AI Coding Plan |

Architecture

This package ports the official @z_ai/mcp-server vision tools into pi-native custom tools using pi.registerTool(). System prompts are sourced directly from the official MCP server (verified via glm-vision-rs).

Unlike an MCP server (which requires a separate npx process and MCP protocol), pi-native tools:

  • Appear in pi's system prompt and tool list automatically
  • Support pi's native cancellation signals
  • Work in all pi modes: TUI, RPC, print
  • Show streaming progress via onUpdate

Development

# Test with pi
pi -e ./extensions/index.ts

# From a local path
pi install ./pi-zai-vision

License

MIT