glmocr-sdk

glmocr-sdk is a skill for Claude Code, Codex from zai-org/GLM-skills. It costs 174 tokens per session (2,783 once invoked), scanned A, original, Apache-2.0.

A Python SDK and command-line tool for extracting text and structured content from images, PDFs, and scanned documents using GLM-OCR.

In plain words
What is it for?
Use it to parse documents, print Markdown or dictionary results, process folders of scans, and extract text, tables, formulas, or other structured data. It requires a ZHIPU_API_KEY.
Why use it?
It gives code and terminal workflows for document parsing without requiring a GPU or configuration files.

Skill for Claude CodeCodex

Which agent this was written for is unclear — built for openclaw. Also seen: built for openclaw.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is glmocr parse ./scans/ --output ./output/ --stdout.

Good fit Use it to parse documents, print Markdown or dictionary results, process folders of scans, and extract text, tables, formulas, or other structured data. It requires a ZHIPU_API_KEY.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/zai-org/GLM-skills
agentmods
npx agentmods add skills/zai-org/glm-skills/glmocr-sdk

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for glmocr-sdk

README.md
[![agentmods](https://agentmods.dev/badge/skills/zai-org/glm-skills/glmocr-sdk/github.svg)](https://agentmods.dev/skills/zai-org/glm-skills/glmocr-sdk)
Your own site
<a href="https://agentmods.dev/skills/zai-org/glm-skills/glmocr-sdk"><img src="https://agentmods.dev/badge/skills/zai-org/glm-skills/glmocr-sdk/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for glmocr-sdk

Your own site · 80×15
<a href="https://agentmods.dev/skills/zai-org/glm-skills/glmocr-sdk"><img src="https://agentmods.dev/badge/skills/zai-org/glm-skills/glmocr-sdk.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 174 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,783 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00174 $0.02783
Opus 5 $0.00087 $0.01392
Sonnet 5 $0.00035 $0.00557
Haiku 4.5 $0.00017 $0.00278

Measured 9d ago against content hash 22cd58294841, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

glmocr-sdk scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/glmocr-sdk/SKILL.md · 349 lines

How it starts

The opening of the file, as written. The whole thing — 349 lines — stays where its author put it; the contents beside it link to each section on GitHub.

OpenClaw Skill: glmocr

Parses documents (images, PDFs, scans) via the GLM-OCR SDK.

📌 On-demand: This skill requires only ZHIPU_API_KEY in the environment. No YAML config files or GPU needed.

⚡ Quick Start

# Install
pip install glmocr

# Set API key (once)
export ZHIPU_API_KEY=sk-xxx
# or add to .env file in working directory:
echo "ZHIPU_API_KEY=sk-xxx" >> .env
# One-liner
import glmocr
result = glmocr.parse("document.pdf")
print(result.markdown_result)
print(result.to_dict())
# CLI — pass API key directly (no env setup needed)
glmocr parse image.png --api-key sk-xxx

# Or load from a specific .env file
glmocr parse image.png --env-file /path/to/.env

# Or rely on env var / auto-discovered .env (set once, then omit)
glmocr parse image.png
glmocr parse ./scans/ --output ./output/ --stdout

Configuration Priority

Constructor kwargs  >  os.environ  >  .env file  >  config.yaml  >  built-in defaults

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)

import glmocr

# Single file → PipelineResult
result = glmocr.parse("invoice.png")

# Multiple files → list[PipelineResult]
results = glmocr.parse(["page1.png", "page2.png", "report.pdf"])

Class-based (multiple calls / resource reuse)

from glmocr import GlmOcr

parser = GlmOcr(api_key="sk-xxx")   # mode auto-set to "maas"
parser = GlmOcr(mode="maas")        # reads ZHIPU_API_KEY from env

# Always use as context manager or call .close()
with GlmOcr(api_key="sk-xxx") as parser:
    result = parser.parse("document.png")
    print(result.markdown_result)

parser.close()   # if not using `with`

Read the full file on GitHub · 349 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 349 lines · 174 tokens per session scan A 22cd58294841

Subscribe to this mod's changes

glmocr-sdk is a skill published in the GitHub repository zai-org/GLM-skills (474 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 174 tokens to every session and 2,783 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.