z-ai-tools
npx skills add https://github.com/briansunter/z-cli --skill z-ai-tools
Agent 安装分布
Skill 文档
Z.AI Tools
Unified CLI and MCP tools for image generation, vision, OCR, web search, web reading, and GitHub code research via @briansunter/z-cli.
Setup
npx -y @briansunter/z-cli --help
Set API key in ~/.dotfiles/local/.env:
export Z_AI_API_KEY="your-api-key"
Tools
generate_image
Generate images from text prompts. Auto-downloads to current directory.
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt |
string | Yes | Text description (max 4000 chars) |
quality |
enum | No | hd (default) or standard |
size |
string | No | Dimensions (default: 1280x1280) |
outputPath |
string | No | Save directory |
filename |
string | No | Custom filename |
Sizes: 1280x1280, 1568x1056, 1056x1568, 1472x1088, 1088x1472, 1728x960, 960x1728. Custom: 1024-2048px, divisible by 32.
layout_parsing
Extract text, tables, and structured content from images and PDFs (OCR).
| Parameter | Type | Required | Description |
|---|---|---|---|
file |
string | Yes | URL or local file path |
model |
string | No | Model (default: glm-ocr) |
Supports JPG, PNG (max 10MB), PDFs (max 50MB, 100 pages).
vision
Analyze images using Z.AI vision model (glm-4.6v). Supports local files and URLs.
| Parameter | Type | Required | Description |
|---|---|---|---|
image |
string | Yes | URL or local file path |
prompt |
string | Yes | Question or instruction about the image |
model |
string | No | Vision model (default: glm-4.6v) |
thinking |
boolean | No | Enable reasoning mode |
maxTokens |
number | No | Maximum tokens in response |
Supports JPG, PNG, GIF, WebP, BMP. Local files are base64-encoded automatically.
web_search
Search the web with results optimized for LLM consumption.
| Parameter | Type | Required | Description |
|---|---|---|---|
query |
string | Yes | Search query |
count |
number | No | Results count (1-50, default: 10) |
domainFilter |
string | No | Limit to domain |
recencyFilter |
string | No | oneDay, oneWeek, oneMonth, oneYear, noLimit |
web_reader
Read and parse web pages to markdown or plain text.
| Parameter | Type | Required | Description |
|---|---|---|---|
url |
string | Yes | URL to read |
format |
string | No | markdown (default) or text |
noCache |
boolean | No | Disable caching |
retainImages |
boolean | No | Keep images (default: true) |
withImagesSummary |
boolean | No | Include image summary |
withLinksSummary |
boolean | No | Include links summary |
search_doc
Search documentation and code within a GitHub repository.
| Parameter | Type | Required | Description |
|---|---|---|---|
repo |
string | Yes | GitHub repo (owner/repo) |
query |
string | Yes | Search query |
language |
string | No | en or zh |
get_repo_structure
View GitHub repository directory structure.
| Parameter | Type | Required | Description |
|---|---|---|---|
repo |
string | Yes | GitHub repo (owner/repo) |
path |
string | No | Subdirectory path |
read_file
Read a file from a GitHub repository.
| Parameter | Type | Required | Description |
|---|---|---|---|
repo |
string | Yes | GitHub repo (owner/repo) |
file_path |
string | Yes | Path to file |
CLI Usage
# Image generation
npx -y @briansunter/z-cli image "A sunset over mountains" --quality hd --size 1568x1056
# OCR
npx -y @briansunter/z-cli ocr ./document.pdf
npx -y @briansunter/z-cli ocr https://example.com/image.png
# Vision - analyze images
npx -y @briansunter/z-cli vision ./photo.png "Describe this image"
npx -y @briansunter/z-cli vision https://example.com/image.jpg "What objects are here?" --thinking
# Web search
npx -y @briansunter/z-cli search "Claude Code MCP server" --count 5
npx -y @briansunter/z-cli search "bun runtime" --recency oneWeek
# Web reader
npx -y @briansunter/z-cli read https://bun.com
npx -y @briansunter/z-cli read https://docs.anthropic.com --format text --no-images
# Code research
npx -y @briansunter/z-cli zread search facebook/react "hooks"
npx -y @briansunter/z-cli zread structure vercel/next.js
npx -y @briansunter/z-cli zread read vercel/next.js package.json
MCP Server
Single unified server exposes all 8 tools:
{
"z-ai": {
"command": "bunx",
"args": ["@briansunter/z-cli", "mcp"],
"env": { "Z_AI_API_KEY": "${Z_AI_API_KEY}" }
}
}
Subset modes: mcp image, mcp ocr, mcp vision, mcp web, mcp search, mcp reader, mcp zread.