zai-org

GLM-OCR: Recognize Text and Structure in Documents

GLM-OCR is a multimodal OCR model and SDK for extracting text and layout from complex documents. Use it through a hosted API or deploy the pipeline with supported inference servers for local control.

PythonApache-2.0OCRComputer VisionAI
Stars
7.5k
Forks
669
Stars, last 16 days
+43

Our take

Health score

35/100

How it is scored
Activity
38
Community
61
Issues
21
Pull requests
21

+43 stars in the last 16 days

Overview

GLM-OCR turns document images and PDFs into recognized text and structured results, including Markdown and JSON layout details. It is designed for documents where reading order and structure matter, such as tables, formulas, and mixed-content pages, rather than just extracting plain text.

The project combines a compact vision-language model with layout analysis and parallel region recognition. It suits developers building document-processing workflows who want a ready-to-use SDK and a choice between a hosted API and self-hosted inference.

Key Features

  • Processes images and PDFs through a CLI or Python SDK.
  • Returns Markdown and JSON layout details for downstream use.
  • Uses layout detection and parallel recognition to handle structured pages.
  • Supports hosted MaaS access without a local GPU.
  • Offers self-hosted deployment options with vLLM and SGLang, plus guides for Ollama and Apple Silicon.
  • Provides a Flask service and modular components for custom pipelines.

Use Cases

  • Automate invoice, form, or report ingestion when applications need both extracted text and document structure.
  • Convert scanned tables, formula-heavy pages, or code documents for search and further processing.
  • Build document-processing services where a hosted API is preferable to managing GPU infrastructure.
  • Deploy OCR behind an internal service when teams need control over inference and their processing pipeline.

Getting Started

For hosted API use, install the SDK:

pip install glmocr

Configure an API key to use MaaS, or install the self-hosted extra for a local pipeline. See the README for deployment, configuration, and usage details.

Alternatives

  • PaddleOCR: PaddleOCR is a broad OCR and document AI toolkit with multilingual pipelines, while GLM-OCR centers on a multimodal model and its SDK.
  • Marker: Marker converts documents into Markdown, JSON, or HTML, while GLM-OCR provides OCR extraction through a model and SDK.
  • Docling: Docling parses many document formats into a unified representation, while GLM-OCR focuses on multimodal OCR and layout extraction.
  • Docling: Docling parses many document formats into a unified representation, while GLM-OCR focuses on multimodal OCR and layout extraction.
ProjectLanguageLicenseStarsStatus
GLM-OCRPythonApache-2.07.5kNot checked yet
PaddleOCRPythonApache-2.090.6kActive
markerPythonApache-2.040.2kActive
doclingPythonMIT68.3kActive
doclingPythonMIT68.7kActive

Considerations

  • Self-hosted inference requires deploying a compatible model service, and GPU memory and context settings may need adjustment for large images or PDFs.
  • The hosted API avoids local GPU requirements but depends on external API access and credentials.
  • The repository code is Apache-2.0, while the README states that the model is MIT-licensed and the integrated PP-DocLayoutV3 component is Apache-2.0. Review the applicable licenses for your use.
  • Performance claims and benchmark results are reported by the project; validate accuracy on your own document types before production use.

Found this useful?

Share it with someone who would like GLM-OCR.

Comparisons