GLM-OCR vs TrOCR
Pick GLM-OCR when you need to turn whole pages or PDFs into Markdown or JSON, either through a cheap API or self-hosted. Pick TrOCR when you already have cropped single text-line images, mostly English handwriting or receipt lines, and want a recognizer you can fine-tune. The main split is scope: GLM-OCR reads pages with layout, TrOCR reads one line at a time.
GLM-OCRzai/glm-ocr | TrOCRmicrosoft/trocr | |
|---|---|---|
| Type | Open source | Open source |
| Price | 6 credits / page | 1 credit / page |
| Per 1,000 pages | $6.00 | $1.00 |
| Typical speed | 1.3 s / page | 1.2 s / page |
| Best for | Low-cost general documents | Handwritten text lines |
| Inputs | PDF, images | images |
| Languages | 100+ languages | English |
| Max pages per request | 500 | 100 |
| Tables | ✓ Yes | No |
| Handwriting | No | ✓ Yes |
| Math | ✓ Yes | No |
| Bounding boxes | ✓ Yes | No |
| Confidence | ✓ Yes | No |
| Forms | No | No |
| Multilingual | ✓ Yes | No |
| On OCRRouter | Available | Available |
Prices are what you pay on OCRRouter. Speed is the provider's typical figure, not a benchmark we ran.
Which to choose
Choose GLM-OCR if
- It handles full pages and PDFs, with layout analysis and Markdown, JSON or plain text output.
- The Z.ai API costs $0.03 per million tokens for input and output, and the weights are MIT licensed for self-hosting.
- It can extract fields into a user-defined JSON schema, which suits forms.
Choose TrOCR if
- It scores 2.89 character error rate on the IAM handwriting set with the large model, per the paper.
- It has separate checkpoints fine-tuned for handwritten (IAM), printed (SROIE) and scene text.
- It loads in a few lines with Hugging Face transformers, so it is easy to fine-tune on your own line images.
Key differences
| GLM-OCR | TrOCR | |
|---|---|---|
| Input it reads | Full pages and PDFs, with layout analysis (PP-DocLayout-V3) | Single text-line images only; you need a separate line detector |
| Output formats | Markdown, JSON, plain text | Plain text |
| How you run it | Z.ai API, or self-host with vLLM, SGLang, Ollama or transformers | Locally through Hugging Face transformers |
| Price | API: $0.03 per million tokens for input and output. Self-hosted: free, you pay for compute | Free, self-hosted, you pay for compute |
| Licence | MIT (weights); SDK repo and bundled PP-DocLayoutV3 are Apache-2.0 | MIT (microsoft/unilm repository) |
| Model size | 0.9B parameters | Base 334M, large 558M |
| Known failures | Repeated output without a stop sequence (issue #220), dropped table footer rows (issue #240), lost comma decimals in cropped tables (issue #241), no aarch64 Linux support (issue #227), 29.6 mean on ParseBench | No layout, table or page-level output; English-focused checkpoints; slow versus CRNN recognizers on CPU |
Sources
- Hugging Face model card
- Z.ai GLM-OCR docs and pricing
- Issue #240 missing table rows
- TrOCR paper (arXiv 2109.10282)
- trocr-large-handwritten model card
- microsoft/unilm repository
What each one is
TrOCR
Transformer text recognition model. Reads single text lines, including handwriting.
TrOCR detailsTry both on your own file
Run the file once with each model and compare the output.
PDF, PNG, JPG, WebP, HEIC. Up to 20 MB each, 10 files.No file?
Use one, fall back to the other
{"model": "zai/glm-ocr","fallbacks": ["microsoft/trocr"],"file_url": "https://example.com/document.pdf"}Questions
More comparisons
GLM-OCR vs olmOCRGLM-OCR vs KrakenUnlimited OCR vs TrOCRPaddleOCR-VL vs TrOCRReducto Parse vs TrOCRGLM-OCR vs PaddleOCR (PP-OCR)GLM-OCR vs RolmOCRDeepSeek-OCR vs TrOCR
GLM-OCR alternativesTrOCR alternativesBest OCR models in 2026