Roboflow
Z.ai

Z.ai: GLM-OCR

GLM-OCR Overview

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.

GLM-OCR Interactive Demo

Results appear here. Add an image or pick an example to run GLM-OCR.

GLM-OCR Details & Performance

Details

Resources

Vision Tasks

OCRDocument Question AnsweringVisual Question AnsweringVision LanguageChart Question Answering

Features

Multimodal VisionLLMs with Vision Capabilities

Usage

Past 30 Days

Performance

Avg. Latency

GLM-OCR Vision Evals

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

HighestLowest
This model#8 of 5887.34% pass rate · better than 84%
Score87.34%pass rate across 229 tasks
Speed1.00savg response per task
Costpricing unavailable
Tokenstokens unavailable
Score key:≥75%40–74%<40%
CategoryPassedScore
Handwritten Math10 / 10
100%
Text Recognition27 / 30
90%
License Plate Recognition27 / 30
90%
Focused Scene OCR87 / 99
87.9%
VQA & Extraction49 / 60
81.7%

Scores based on a single evaluation run · Methodology

View all legacy Vision Evals results →

Price vs. performance

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

ModelScoreMedian tokensEst. cost / taskCompare
GoogleGemini 3 Flash93.0%1.3K$0.0010Compare
GoogleGemini 3.5 Flash90.4%1.3K$0.0034Compare
GoogleGemini 3.1 Flash-Lite90.0%1.1K$0.0003Compare
GoogleGemini 3.1 Pro89.5%1.1K$0.0024Compare
AnthropicClaude Fable 589.5%782$0.014Compare
Z.aiGLM-OCR(this model)87.3%
AnthropicClaude Opus 4.887.3%670$0.0049Compare
AnthropicClaude Opus 4.786.9%1.1K$0.0069Compare
QwenQwen3.5-27B85.6%273$0.0002Compare
GoogleGemma 4 31B84.7%423$0.0001Compare
AnthropicClaude Sonnet 583.8%725$0.0019Compare

Alternatives to GLM-OCR

Other models worth comparing for similar use cases.

Google
Gemini 3.1 Flash-Lite
Gemini 3.1 Flash-Lite is a natively multimodal reasoning model from Google DeepMind in the Gemini 3 series, based on the Gemini 3 Pro architecture. It processes text, image, video, audio, and PDF inputs within a 1 million token context window and produces text output up to 64K tokens. The model targets high-volume, latency-sensitive workloads and supports visual question answering, image and document data extraction, content moderation, classification, translation, automated speech recognition, and agentic data pipelines. It exposes configurable thinking levels of minimal, low, medium, and high, which set the depth of internal reasoning applied per request and let developers balance response quality against cost and latency.On benchmarks reported at launch, Gemini 3.1 Flash-Lite scores 86.9% on GPQA Diamond and 76.8% on the MMMU Pro multimodal benchmark, and reaches an Elo score of 1432 on the Arena.ai leaderboard. According to Artificial Analysis benchmarks, it produces a 2.5 times faster time to first answer token and a 45% increase in output speed relative to Gemini 2.5 Flash. It also shows improved instruction following, higher audio input quality for automated speech recognition tasks, and support for structured JSON output used in data extraction pipelines.
OpenAI
GPT-5.4 Nano
GPT-5.4 nano is a high-throughput model developed by OpenAI and released on March 17, 2026, as the efficiency-optimized entry in the GPT-5.4 family. Engineered for cost-sensitive production environments and latency-critical workloads, it features an expanded 400,000-token context window that enables the processing of large document batches or extensive logs in a single pass. The model is primarily optimized for text-heavy operations, serving as a premier engine for high-volume classification, data extraction, ranking, and the orchestration of lightweight sub-agents where speed and low per-token costs are the primary requirements.While it supports text and image inputs, GPT-5.4 nano is designed as a text-first worker rather than a specialized visual reasoning tool. In multi-model architectures, it is best utilized for structured text tasks and simple coding sub-tasks, leaving intensive vision reasoning and UI navigation to its sibling, GPT-5.4 mini. Compared to the previous GPT-5 nano, this version provides a significant leap in reliability for structured outputs and tool calling, making it a dependable and economical choice for developers building scalable, automated pipelines that require rapid execution at the edge of the GPT-5.4 ecosystem.
Anthropic
Claude Haiku 4.5
Claude Haiku 4.5 is Anthropic’s lightweight model in the Claude 4.5 series, released in October 2025 under a proprietary license. Designed for speed and cost efficiency, it delivers near-frontier performance while maintaining Anthropic’s AI Safety Level 2 standard. Haiku 4.5 supports both text and multimodal (text and image) inputs, integrates tool use and extended reasoning, and features a 200,000 token context window, making it adept at handling long or complex workflows. Though the parameter count remains undisclosed, it achieves about 73.3% on SWE-bench Verified, reflecting strong coding and reasoning ability. Haiku 4.5 is ideal for developers and researchers seeking rapid, cost-effective model calls for analysis, coding, or multimodal understanding.
Google
Gemini 2.5 Flash-Lite
Gemini 2.5 Flash-Lite, released for general availability on July 22, 2025, is the most cost-efficient model in the Gemini 2.5 family, designed for high-volume and latency-sensitive tasks. It is multimodal, supporting text, images, video, audio, and PDFs as inputs, with text as its primary output. The model handles up to 1 million input tokens and generates outputs up to 64K tokens, making it suitable for large-scale document or media processing at low cost. It is built on a Sparse Mixture-of-Experts architecture with native multimodal support, though exact parameter counts are undisclosed.Flash-Lite offers the lowest usage cost among Gemini 2.5 models. It introduces developer controls for “thinking mode,” allowing fine-tuning of reasoning depth vs. efficiency. It also integrates native tools such as code execution, search grounding, and URL context. While strong on translation, classification, coding, and general multimodal reasoning, it lacks support for image or audio generation in its stable release and is less capable than Gemini 2.5 Flash or Pro on complex reasoning-heavy workflows.
OpenAI
GPT-5 Nano
GPT-5 Nano, released by OpenAI on August 7, 2025, is the smallest and most cost-efficient model in the GPT-5 family. Like its larger counterparts, it is multimodal—accepting text and images, supporting tool use, structured outputs, and reasoning—but it is optimized for speed, low latency, and affordability. It features input and output token limits of roughly 272K and 128K tokens respectively, enabling large-context processing even at its compact scale. Its knowledge cutoff is around May 2024, slightly earlier than the full GPT-5 model.GPT-5 Nano is well-suited for high-volume or cost-sensitive deployments such as mobile apps, embedded AI systems, or rapid-response APIs. While it offers less depth on complex reasoning and coding tasks compared to GPT-5 Mini or Pro, it retains core multimodal and agentic capabilities, making it an attractive option where efficiency and scale matter more than maximum performance.
Surya
Surya is an OCR and document layout analysis toolkit developed by Vikram Paruchuri and distributed via Mindee, first released in January 2024 under the GPL-3.0 license. It supports text recognition across more than 90 languages, document layout detection, reading order prediction, table recognition, and equation detection, providing a comprehensive set of tools for extracting structured information from document images.Surya is designed to operate without cloud API dependencies, running fully on local hardware with support for CPU and GPU inference. It is commonly used for digitizing scanned documents, extracting text from PDFs with complex layouts, and building automated document processing pipelines.

Deploy GLM-OCR with an API

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. Deploying the workflow into a free Roboflow workspace replaces the your-workspace and YOUR_API_KEY placeholders with your own.

Connect your agent to Roboflow (once)

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).

Deploy 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/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 "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.
Installpip install inference-sdk

Deploy 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="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)

Deploy this workflow to your Roboflow workspace to use it.

const response = await fetch('https://serverless.roboflow.com/your-workspace/workflows/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);

Deploy this workflow to your Roboflow workspace to use it.

curl --location 'https://serverless.roboflow.com/your-workspace/workflows/glm-ocr-ocr' \
--header 'Content-Type: application/json' \
--data '{
  "api_key": "YOUR_API_KEY",
  "inputs": {
    "image": {"type": "url", "value": "IMAGE_URL"}
  }
}'

GLM-OCR License

MIT · Permissive license

GLM-OCR is released under MIT, a permissive license. The GLM-OCR license lets you use, modify, and sell work built on the model, with the copyright notice as the only real obligation and no requirement to open-source related code changes.

Commercial use
Permitted with no separate commercial license. No usage caps, revenue thresholds, or field-of-use limits apply to GLM-OCR.
Modification
Permitted. You can fine-tune or rewrite GLM-OCR and keep the result closed-source.
Redistribution
Permitted. Include the original copyright and permission notice in copies or substantial portions of the work.

MIT grants no explicit patent license and disclaims all warranties. If patent exposure is a concern for your deployment, review it with counsel before launch.

Read the full MIT license ↗

Do I need a commercial license for GLM-OCR?

No commercial license is needed for GLM-OCR: permissive terms let you keep related code private while deploying commercially.

Do not hesitate to reach out with questions for your commercial project — our team will help you start solving business problems on the first call. See Roboflow commercial licensing for the models included in each plan.

Talk to sales

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.

Frequently Asked Questions About GLM-OCR Vision

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.