OCRRouter

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-ocrTrOCRmicrosoft/trocr
TypeOpen sourceOpen source
Price6 credits / page1 credit / page
Per 1,000 pages$6.00$1.00
Typical speed1.3 s / page1.2 s / page
Best forLow-cost general documentsHandwritten text lines
InputsPDF, imagesimages
Languages100+ languagesEnglish
Max pages per request500100
Tables✓ YesNo
HandwritingNo✓ Yes
Math✓ YesNo
Bounding boxes✓ YesNo
Confidence✓ YesNo
FormsNoNo
Multilingual✓ YesNo
On OCRRouterAvailableAvailable

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-OCRTrOCR
Input it readsFull pages and PDFs, with layout analysis (PP-DocLayout-V3)Single text-line images only; you need a separate line detector
Output formatsMarkdown, JSON, plain textPlain text
How you run itZ.ai API, or self-host with vLLM, SGLang, Ollama or transformersLocally through Hugging Face transformers
PriceAPI: $0.03 per million tokens for input and output. Self-hosted: free, you pay for computeFree, self-hosted, you pay for compute
LicenceMIT (weights); SDK repo and bundled PP-DocLayoutV3 are Apache-2.0MIT (microsoft/unilm repository)
Model size0.9B parametersBase 334M, large 558M
Known failuresRepeated 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 ParseBenchNo layout, table or page-level output; English-focused checkpoints; slow versus CRNN recognizers on CPU

Sources

What each one is

GLM-OCR

Small open-source OCR model from Z.ai with layout regions. MIT licensed.

GLM-OCR details

TrOCR

Transformer text recognition model. Reads single text lines, including handwriting.

TrOCR details

Try 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 alternativesTrOCR alternativesBest OCR models in 2026