Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Surya OCR

$ surya_ocr Official Low Risk
Datalab · AI & Media · Apache-2.0 · macos / linux / windows

Surya OCR (surya_ocr, from surya-ocr by Datalab) performs multilingual document OCR, reading-order/layout detection, and table recognition across 90+ languages. Uniquely among deep-learning OCR CLIs, it provides --stdout to stream JSON directly to stdout alongside --page_range, --block_mode, and --keep_server.

FCRS-1.0 Score
81 /100
Good
Medium Confidence
Zero-Friction Install
pip install surya-ocr
CLI vs MCP Decision CLI Preferred vs MCP

surya_ocr --stdout streams OCR JSON directly from local PDFs/images over local GPU/CPU without uploading sensitive images to MCP tools.

Agent-Readiness Checklist

✓ JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 21 / 25

Provides --stdout for direct JSON streaming, --page_range bounding, and --keep_server to avoid repeated cold starts.

  • --stdout streams JSON directly to stdout for shell/agent pipelines
  • --page_range bounds PDF page processing
Trust & Safety 19 / 25

100% local execution with read-only --stdout mode, though model weights carry a $5M commercial revenue/funding threshold under OpenRAIL-M.

  • Zero remote uploads; read-only --stdout mode
  • Modified OpenRAIL-M license threshold on model weights
Setup & Portability 10 / 15

Installable via pip install surya-ocr, though heavy PyTorch and VLM weight downloads are required.

  • Heavy PyTorch + local model weight footprint
Utility & Efficiency 14 / 15

Covers 90+ language OCR, block mode layout detection, and persistent local server reuse (--keep_server).

  • Supports --stdout, --block_mode, --recursive, and --keep_server
Maintenance & Lineage 8 / 10

Official Datalab repository (datalab-to/surya) with active releases.

  • Official datalab-to/surya repository
Docs & Verifiability 9 / 10

Clear README CLI documentation covering every flag including --stdout and --keep_server.

  • Documented CLI flags in upstream repository README

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

Runs completely locally without API keys; caches model weights under local Hugging Face / Datalab cache directories.

Side Effects
Read-Only Local Write
Cost & Quotas

Apache-2.0 code; model weights use Modified AI Pubs OpenRAIL-M (free under $5M revenue/funding).

Copyable Guardrail for CLAUDE.md / AGENTS.md
# Surya OCR CLI (surya_ocr) Agent Rules
- Prefer `--stdout` with `--page_range <range>` on large PDFs to get bounded JSON without disk clutter.
- Omit `--keep_server` unless running multiple sequential `surya_*` commands that need a warm VLM backend.
- Verify commercial eligibility under Datalab's OpenRAIL-M model weight license ($5M revenue/funding cap).

Agent-Ready Command Recipes

Safe Read-Only Queries

Stream OCR JSON for specific PDF pages to stdout
surya_ocr doc.pdf --page_range 0-2 --stdout

Runs OCR on pages 0 to 2 and streams structured JSON directly to stdout without writing disk files.

Controlled Writes & Previews

Run full OCR and save results.json to an output folder
surya_ocr doc.pdf --output_dir ./surya_res

Processes the full document and saves results.json under ./surya_res.

Strengths for Agents

  • + --stdout streams clean OCR JSON directly to stdout without writing intermediate files.
  • + --page_range and --keep_server make iterative agent document inspection fast and bounded.

Caveats & Pitfalls

  • ! Model weights use Modified AI Pubs OpenRAIL-M (commercial license needed above $5M funding/revenue).
  • ! First run downloads multi-GB weights and requires PyTorch.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI