zai-org/glm-skills/glmocr-sdk
Claude Code and agent skill by zai-org/glm-skills
- community
- ext:[{"type":"config","description":"Configuration overrides"}]
Checking that the SKILL.md file is still in the repository.
Trigger when: (1) User wants to extract text, tables, formulas, or structured data from images/PDFs/scanned documents, (2) User mentions "OCR", "文字识别", "文档解析", (3) User has a document (screenshot, scanned page, invoice, paper, whiteboard photo) and needs its content in structured form, (4) User asks to parse, digitize, or extract content from a visual document. Invokes the GLM-OCR SDK (pip install glmocr) to parse documents via Zhipu's cloud API. No GPU required. Returns structured JSON (regions with labels + bounding boxes) and Markdown. Agent can operate entirely via CLI — no YAML files needed. NOT for: real-time camera feeds, audio transcription, or non-document images (photos, illustrations).
Install
npx vskill@latest install zai-org/glm-skills/glmocr-sdkSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as zai-org/glm-skills/glmocr-sdk.
OpenClaw Skill: glmocr
Parses documents (images, PDFs, scans) via the GLM-OCR SDK.
📌 On-demand: This skill requires onlyZHIPU_API_KEYin the environment. No YAML config files or GPU needed.
⚡ Quick Start
Configuration Priority
Agents override everything via constructor kwargs or env vars — no YAML editing needed.
Key Environment Variables
| Variable | Description | Example | |
|---|---|---|---|
ZHIPU_API_KEY | API key (required for MaaS) | sk-abc123 | |
GLMOCR_MODEL | Model name | glm-ocr | |
GLMOCR_TIMEOUT | Request timeout (seconds) | 600 | |
GLMOCR_ENABLE_LAYOUT | Layout detection on/off | true | |
GLMOCR_LOG_LEVEL | DEBUG / INFO / WARNING / ERROR | INFO |
Python API
Convenience function (single call)
Class-based (multiple calls / resource reuse)
Constructor Parameters
| Parameter | Type | Description | |
|---|---|---|---|
api_key | str | API key. Providing this auto-enables MaaS mode. | |
api_url | str | Override MaaS endpoint URL | |
model | str | Model name override | |
timeout | int | Request timeout in seconds (default: 600) | |
enable_layout | bool | Enable layout detection | |
log_level | str | Logging level |
Working with PipelineResult
Fields
json_result structure
List of pages → list of regions per page:
Bounding boxes (bbox_2d): [x1, y1, x2, y2] normalised to 0–1000 scale.
Region labels: title, text, table, figure, formula, header, footer, page_number, reference, seal
Serialization
Error Handling
The SDK does not raise on MaaS errors — check to_dict() for an "error" key:
CLI Reference
Agent-preferred interface: use the CLI for most operations. SetZHIPU_API_KEYin env once, then invoke as needed.
Supported input formats: .jpg, .jpeg, .png, .bmp, .gif, .webp, .pdf
Basic usage
Read results in the terminal (agent-friendly)
Save control
Batch processing
Debugging
Full flag reference
| Flag | Default | Description | |
|---|---|---|---|
--api-key / -k | env var | API key for MaaS mode (overrides ZHIPU_API_KEY) | |
--mode | maas | maas (cloud, default) or selfhosted (local GPU) | |
--env-file | auto | Path to .env file (default: auto-discover from cwd) | |
--output / -o | ./output | Output directory | |
--stdout | off | Print JSON + Markdown to stdout | |
--no-save | off | Skip writing files (use with --stdout) | |
--json-only | off | stdout JSON only, no Markdown | |
--no-layout-vis | off | Skip layout visualization images | |
--config / -c | none | Path to YAML config override | |
--log-level | INFO | DEBUG / INFO / WARNING / ERROR |
Typical Agent Workflow
Filter by label
Multi-page PDF → iterate pages
Programmatic config (no env vars)
Output Directory Layout
After result.save(output_dir):
Common Pitfalls
- `ZHIPU_API_KEY` not set: SDK defaults to MaaS mode. Without a key,
parse()will fail with a clear error message and quick-fix instructions. Set viaexport ZHIPU_API_KEY=sk-xxx, add to a.envfile, or pass--api-key sk-xxxto the CLI. - Large PDFs: Default timeout is 600s. For very long documents increase with
timeout=1200. - `result.json_result` is a string: Happens when the model returns malformed JSON. The SDK preserves the raw string — parse or log it manually.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/glmocr-sdk/SKILL.md
Popularity
- Repository stars
- 357
- Repository forks
- 26
- 7-day trend score
- 29
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 28 Apr 2026, 7 months ago.
Extension points
configConfiguration overrides
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/zai-org/glm-skills/glmocr-sdk)