Official skill for recognizing and extracting tables from images and PDFs into Markdown format using ZhiPu GLM-OCR API. Supports complex tables, merged cells, and multi-page documents. Use this skill when the user wants to extract tables, recognize spreadsheets, or convert table images to editable format.
Extract tables from images and PDFs and convert them to Markdown format 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-table": {
"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 fulllayout_details contains table-related entries, you may highlight them--include-raw)python scripts/glm_ocr_cli.py --file-url "https://example.com/table.png"
python scripts/glm_ocr_cli.py --file /path/to/table.png
python scripts/glm_ocr_cli.py --file table.png --output result.json --pretty
python scripts/glm_ocr_cli.py --file table.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": "| Column 1 | Column 2 |\n|----------|----------|\n| Data | Data |",
"layout_details": [...],
"result": null,
"error": null,
"source": "/path/to/file",
"source_type": "file",
"raw_result_included": false
}
Key fields:
ok — whether extraction 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