Official skill for recognizing handwritten text from images using ZhiPu GLM-OCR API. Supports various handwriting styles, languages, and mixed handwritten/printed content. Use this skill when the user wants to read handwritten notes, convert handwriting to text, or OCR handwritten documents.
Recognize handwritten text from images and PDFs using the ZhiPu GLM-OCR layout parsing API.
| Resource | Link |
|---|---|
| Get API Key | 智谱开放平台 API Keys |
| API Docs | Layout Parsing / 版面解析 |
脚本通过 ZHIPU_API_KEY 环境变量获取密钥,可与其他智谱技能复用同一个 key。
This script reads the key from the ZHIPU_API_KEY environment variable. Reusing the same key across Zhipu skills is optional.
Get Key / 获取 Key: Visit 智谱开放平台 API Keys to create or copy your key.
Setup options / 配置方式(任选一种):
Global config (recommended) / 全局配置(推荐): Set once in openclaw.json under env.vars, all Zhipu skills will share it:
{
"env": {
"vars": {
"ZHIPU_API_KEY": "你的密钥"
}
}
}
Skill-level config / Skill 级别配置: Set for this skill only in openclaw.json:
{
"skills": {
"entries": {
"glmocr-handwriting": {
"env": {
"ZHIPU_API_KEY": "你的密钥"
}
}
}
}
}
Shell environment variable / Shell 环境变量: Add to ~/.zshrc:
export ZHIPU_API_KEY="你的密钥"
💡 如果你已为其他智谱 skill(如
glmocr、glmv-caption、glm-image-generation)配置过 key,它们共享同一个ZHIPU_API_KEY,无需重复配置。
ZHIPU_API_KEY (required / 必需)GLM_OCR_TIMEOUT (optional timeout seconds / 可选超时秒数)https://open.bigmodel.cn/api/paas/v4/layout_parsing--include-raw only when needed for debugging.⛔ MANDATORY RESTRICTIONS / 强制限制 ⛔
python scripts/glm_ocr_cli.pyAfter running the script, present the OCR result clearly and safely.
text) in full--include-raw)python scripts/glm_ocr_cli.py --file-url "https://example.com/handwriting.jpg"
python scripts/glm_ocr_cli.py --file /path/to/notes.png
python scripts/glm_ocr_cli.py --file notes.png --output result.json --pretty
python scripts/glm_ocr_cli.py --file notes.png --output result.json --include-raw
python {baseDir}/scripts/glm_ocr_cli.py (--file-url URL | --file PATH) [--output FILE] [--pretty] [--include-raw]
| Parameter | Required | Description |
|---|---|---|
--file-url | One of | URL to image/PDF |
--file | One of | Local file path to image/PDF |
--output, -o | No | Save result JSON to file |
--pretty | No | Pretty-print JSON output |
--include-raw | No | Include raw upstream API response in result field (debug only) |
{
"ok": true,
"text": "Recognized handwritten text in Markdown...",
"layout_details": [...],
"result": null,
"error": null,
"source": "/path/to/file",
"source_type": "file",
"raw_result_included": false
}
Key fields:
ok — whether recognition succeededtext — extracted text in Markdown (use this for display)layout_details — layout analysis detailserror — error details on failureAPI key not configured:
ZHIPU_API_KEY not configured. Get your API key at: https://bigmodel.cn/usercenter/proj-mgmt/apikeys
→ Show exact error to user, guide them to configure
Authentication failed (401/403): API key invalid/expired → reconfigure
Rate limit (429): Quota exhausted → inform user to wait
File not found: Local file missing → check path