GLM-OCR is a multimodal OCR model for complex document understanding, built on the GLM-V encoder-decoder architecture by Zhipu AI. The model combines a 0.4B-parameter CogViT visual encoder pre-trained on large-scale image-text data, a lightweight cross-modal connector with efficient token downsampling, and a 0.5B-parameter GLM language decoder, totaling 0.9B parameters. To address the inefficiency of standard autoregressive decoding in deterministic OCR tasks, GLM-OCR introduces a Multi-Token Prediction (MTP) mechanism that predicts multiple tokens per step, significantly improving decoding throughput while keeping memory overhead low through shared parameters. Training proceeds through four stages: visual encoder pretraining with MIM, CLIP, and distillation objectives; vision-language pretraining on document parsing, grounding, and VQA data; supervised fine-tuning on curated OCR datasets covering text, formula, table, and key information extraction; and full-task reinforcement learning to improve accuracy and structural consistency.
At the system level, GLM-OCR adopts a two-stage pipeline in which PP-DocLayout-V3 first performs layout analysis, followed by parallel region-level recognition. This design enables robust handling of diverse document layouts including tables, formulas, and multi-column text. The model supports document parsing and targeted recognition tasks, producing structured outputs in Markdown, JSON, and LaTeX formats across more than 100 languages. On the OmniDocBench V1.5 benchmark, GLM-OCR scores 94.62, and achieves 94.0 on OCRBench and 96.5 on UniMERNet for formula recognition.
Drag and drop an image here, or click to browse
OCR will run automatically
GLM-OCR has not yet been evaluated on the current benchmark. The results below are from the legacy version of Vision Evals, our previous benchmark. See the current Vision Evals
| Category | Passed | Score |
|---|---|---|
| Handwritten Math | 10 / 10 | 100% |
| Text Recognition | 27 / 30 | 90% |
| License Plate Recognition | 27 / 30 | 90% |
| Focused Scene OCR | 87 / 99 | 87.9% |
| VQA & Extraction | 49 / 60 | 81.7% |
Scores based on a single evaluation run · Methodology
View all legacy Vision Evals results →Estimated cost per task vs. OCR score, for this model and others ranked near it. Upper-left is the sweet spot (high quality, low cost). Based on Vision Evals (legacy) results.
10 of 11 models plotted · 1 not yet evaluated
| Model | Score | Median tokens | Est. cost / task | Compare |
|---|---|---|---|---|
| Gemini 3 Flash | 93.0% | 1.3K | $0.0010 | Compare |
| Gemini 3.5 Flash | 90.4% | 1.3K | $0.0034 | Compare |
| Gemini 3.1 Flash-Lite | 90.0% | 1.1K | $0.0003 | Compare |
| Gemini 3.1 Pro | 89.5% | 1.1K | $0.0024 | Compare |
| Claude Fable 5 | 89.5% | 782 | $0.014 | Compare |
| GLM-OCR(this model) | 87.3% | — | — | — |
| Claude Opus 4.8 | 87.3% | 670 | $0.0049 | Compare |
| Claude Opus 4.7 | 86.9% | 1.1K | $0.0069 | Compare |
| Qwen3.5 27B | 85.6% | 273 | $0.0002 | Compare |
| Gemma 4 31B | 84.7% | 423 | $0.0001 | Compare |
| Claude Sonnet 5 | 83.8% | 725 | $0.0019 | Compare |
Other models worth comparing for similar use cases.
GLM-OCR runs as a hosted REST endpoint through Roboflow Workflows. Pick a task, then hand the prompt to your coding agent or copy the code. Forking the workflow into a free Roboflow workspace replaces the your-workspace and YOUR_API_KEY placeholders with your own.
Add the Roboflow MCP server
claude mcp add --transport http roboflow https://mcp.roboflow.com/mcp
Run /mcp and authorize Roboflow in your browser when the OAuth flow opens.
Start a new Claude Code session so the MCP loads, then paste the prompt below (it works the same in any agent).
Fork this workflow to your Roboflow workspace to use it.
Integrate the Roboflow "GLM-OCR" workflow into my app.
- Endpoint: POST https://serverless.roboflow.com/<your-workspace>/workflows/playground-glm-ocr-ocr
- Auth: send my Roboflow API key as `api_key` in the request body, read from the ROBOFLOW_API_KEY env var (never hardcode).
- Body: { "api_key": ..., "inputs": { `image`: { type: "url" | "base64", value } } }.
With the Roboflow MCP connected, call `workflows_get` on "playground-glm-ocr-ocr" to read the exact input schema (the source of truth), then `workflows_run` on a sample image to confirm the output shape before writing code (the MCP is authenticated, so this needs no key). Without the MCP, use the contract above.
Before running the app, set up these keys so it does not error at runtime:
- `ROBOFLOW_API_KEY` (sent as `api_key`) from https://app.roboflow.com/settings/api
Create a .gitignore'd .env with these variables, using placeholder values for any I haven't given you. Then pause and tell me directly, in your reply: the full path to the .env file, exactly which keys I need to paste in, and the link to get each one. Wait for me to confirm I've added them before you run anything. Do not run the app until I confirm.
Then add the integration to my codebase: match my project's language, framework, and conventions; read every key from environment variables (never hardcode); add basic error handling; and include a small runnable example. If you can't tell what language my project uses, ask me.pip install inference-sdkFork this workflow to your Roboflow workspace to use it.
# 1. Import the library
from inference_sdk import InferenceHTTPClient
# 2. Connect to your workflow
client = InferenceHTTPClient(
api_url="https://serverless.roboflow.com",
api_key="YOUR_API_KEY"
)
# 3. Run your workflow on an image
result = client.run_workflow(
workspace_name="your-workspace",
workflow_id="playground-glm-ocr-ocr",
images={
"image": "YOUR_IMAGE.jpg" # Path to your image file
},
use_cache=True # cache workflow definition for 15 minutes
)
# 4. Get your results
print(result)Fork this workflow to your Roboflow workspace to use it.
const response = await fetch('https://serverless.roboflow.com/your-workspace/workflows/playground-glm-ocr-ocr', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
api_key: 'YOUR_API_KEY',
inputs: {
"image": {"type": "url", "value": "IMAGE_URL"}
}
})
});
const result = await response.json();
console.log(result);Fork this workflow to your Roboflow workspace to use it.
curl --location 'https://serverless.roboflow.com/your-workspace/workflows/playground-glm-ocr-ocr' \
--header 'Content-Type: application/json' \
--data '{
"api_key": "YOUR_API_KEY",
"inputs": {
"image": {"type": "url", "value": "IMAGE_URL"}
}
}'License terms and commercial-use guidance for GLM-OCR.
This model is released under the MIT License, a short and permissive open-source license that allows commercial use, modification, and redistribution.
Yes. Under the terms of the MIT license, you can freely use this model for commercial purposes. You must retain the copyright notice and license text when redistributing.
License information is provided as a guide and is not legal advice.
Yes. GLM-OCR accepts image input, and on Roboflow's previous vision benchmark it scored 87.3% on OCR. You can test it on your own image in the demo above.
GLM-OCR has not yet been evaluated on Roboflow's current Vision Evals. The results on this page are from the previous benchmark.
Yes. The demo on this page runs GLM-OCR in the free Roboflow Playground: upload an image and see results in seconds. A free account unlocks unlimited runs.