Surya is a free, open-source OCR toolkit that reads text, page layout, reading order and tables from scanned pages, photos of documents and PDFs in more than 90 languages. Point surya_ocr at a file or a folder and you get a results.json with every block of text in reading order, its position on the page, tables as HTML and equations as LaTeX. surya_gui opens a local viewer in your browser where you drop in a PDF and see the boxes drawn on each page.
It earns its place because one small model, 689 million parameters, does layout, OCR and tables together, and it runs on your own machine: through vLLM in Docker on an NVIDIA GPU, or through llama.cpp on an ordinary CPU or an Apple Silicon Mac, with the server started for you on first use. Datalab, the company behind it, uses Surya inside Marker, its PDF-to-Markdown converter, and a --stdout flag plus a bundled agent skill make it easy to call from scripts and AI agents.
The code is Apache 2.0. The model weights use a modified OpenRAIL-M licence: free for research, personal use and companies under 5 million dollars in revenue or funding, with a paid licence above that. Datalab also sells a hosted API, with about 5,000 free pages a month for a work email, which the README promotes. Vik Paruchuri leads the project; it has about 21,600 stars and 19 contributors, and v0.24.0 came out on 13 November 2026.
- Repository: github.com/datalab-to/surya
- Licence: Apache-2.0 (Apache License 2.0)
- Language: Python. Stars: 21.6K. Forks: 1,574. Last push: Nov 13, 2026.
- Scan: safe, Nov 28, 2026, commit 2538880
Who it is for
Developers building document pipelines, researchers digitising papers and archives, and anyone who needs OCR in many languages without uploading files to a cloud service. You need Python 3.10 or newer and a terminal, plus Docker on an NVIDIA machine or llama.cpp everywhere else.
Getting started
1. Install the client (Python 3.10 or newer, ideally in a fresh virtual environment)
pip install surya-ocr2. On a Mac or a CPU-only machine, install the llama.cpp server the model runs on (NVIDIA users need Docker and the NVIDIA Container Toolkit instead)
brew install llama.cpp3. Read the first page of a PDF; results.json lands in results/surya/document/
surya_ocr document.pdf --page_range 04. Detect layout and reading order, or pull out tables as HTML
surya_layout document.pdf
surya_table document.pdf5. Open the local viewer in your browser
surya_gui --port 8000pip installs only a light client. The first run downloads the model weights from Hugging Face into your cache and, on NVIDIA, pulls the vllm/vllm-openai Docker image; both stay on disk until you delete them. Each command starts and stops the model server unless you add --keep_server. Our scan covers this repo's code, not the Docker image, llama.cpp or the model weights.
Safety scan
We cloned datalab-to/surya at commit 2538880 on Nov 28, 2026 and ran the checks described on the GitHub Tools page: credential patterns, decode-and-execute code, install-time scripts, committed binaries, risky CI workflows, every host the code talks to, known vulnerabilities in pinned dependencies, and project hygiene. A person read every hit. This is what we found.
- 0 secret hits and no committed binaries across 112 files and about 9,400 lines, almost all Python.
- 0 pattern hits. The scanner's odd host, evil.tld, appears twice in tests/test_spawn_and_inputs.py (lines 83 and 97) as fake script and iframe tags that check the HTML cleaner strips them. The datalab.to addresses are README and viewer links; the viewer page loads its fonts from Google Fonts and KaTeX from jsDelivr.
- No install hooks. On first use the client starts the model server for you: the vllm/vllm-openai:v0.25.1 Docker image with your Hugging Face cache mounted, or llama-server, both listening only on 127.0.0.1, and it downloads the datalab-to/surya-ocr-2.5 weights from Hugging Face. Nothing touches your shell profile or needs sudo.
- 180 known advisories (7 critical, 82 high) in uv.lock, the pinned development environment, which also carries Jupyter. The criticals are 4 in Pillow 10.4.0 image decoding, 1 each in anyio and certifi, and 1 in jupyter-server, a development-only tool. pip install surya-ocr ignores uv.lock and on 28 November 2026 resolved Pillow 13.0.0, anyio 4.16.0 and certifi 2026.11.20, all past the fixes; a fresh virtual environment makes sure an old Pillow is not kept.
- 4 workflows. cla.yml uses pull_request_target for the CLA Assistant bot and does not check out pull request code; tests, including a self-hosted GPU runner, run only on pushes to the repo, and a tag push publishes to PyPI with a token. None of the 4 third-party actions is pinned to a commit. Code and model licences are present; no security policy, Dependabot or CodeQL, and no OpenSSF Scorecard result.
What the scanner counted
| Check | Result |
|---|---|
| Secrets | None found. |
| Suspicious code | None found. |
| Install-time code | None: nothing runs at install beyond the package manager itself. |
| Committed binaries | None. |
| CI workflows | 4 workflows. 1 uses pull_request_target, none check out the pull request head. 4 of 4 third-party actions pinned to a tag rather than a commit. |
| Network hosts | 11 distinct hosts referenced from source; most often github.com, www.datalab.to, fonts.googleapis.com, cdn.jsdelivr.net. No URLs to bare IP addresses. |
| Known vulnerabilities | 180 advisories across 188 pinned packages: 7 critical, 82 high, 73 moderate, 18 low. uv.lock: 188 packages, 180 advisories. |
| Project hygiene | Has licence file. Missing security policy, automated dependency updates, CodeQL, contributing guide. |
| OpenSSF Scorecard | Not scored: the project is not in Scorecard's weekly index. |
The raw findings
Every hit the scanner wrote out, with a link to the exact line at the scanned commit. Secrets candidates are redacted.
Worst known vulnerabilities (24 of 180)
| Advisory | Severity | Package | Summary |
|---|---|---|---|
| GHSA-82r6-8w77-94w6 | critical | anyio@4.13.0 | AnyIO: TLSStream IDNA 2003 host name encoding enables potential TLS certificate spoofing |
| GHSA-6q48-6c7w-9gw2 | critical | certifi@2026.4.22 | certifi bundles emSign root CAs with compromised intermediate CA keys |
| GHSA-fcw5-x6j4-ccmp | critical | jupyter-server@2.18.2 | Jupyter Server: Stored XSS in `NbconvertFileHandler` / `NbconvertPostHandler` via missing `sandbox` CSP |
| GHSA-332p-7hrc-92wf | critical | pillow@10.4.0 | Pillow: Heap buffer overflow in _tiffWriteProc when saving TIFF to BytesIO |
| GHSA-5x8w-8jj5-q52h | critical | pillow@10.4.0 | Pillow: Heap buffer overflow in FlashPix (FPX) JPEG decoding leads to code execution |
| GHSA-8g5g-8vmr-9782 | critical | pillow@10.4.0 | Pillow: Heap buffer overflow in ImagingJpegDecode |
| GHSA-w889-685w-c8fh | critical | pillow@10.4.0 | Pillow: Argument Injection in Ghostscript call, potentially leading into RCE |
| GHSA-24c4-3p7v-29cm | high | aiohttp@3.13.5 | AIOHTTP: Base64 multipart parts bypass client_max_size |
| GHSA-28qf-cpwq-vmc2 | high | aiohttp@3.13.5 | AIOHTTP: Pure-Python parser request replay and buffer growth behind a declined upgrade |
| GHSA-2g87-pp6c-29x5 | high | aiohttp@3.13.5 | aiohttp: Multiple instances of excessive or unbounded memory/CPU use |
| GHSA-3rp8-rxj8-mvjw | high | aiohttp@3.13.5 | AIOHTTP: WebSocket max_msg_size bypass via integer overflow |
| GHSA-5rmc-48h2-hvcm | high | aiohttp@3.13.5 | AIOHTTP: WebSocket receive queue limits bypassed by small or compressed messages |
| GHSA-5wr8-gcqf-gqf3 | high | aiohttp@3.13.5 | aiohttp server lacks an initial request/header timeout |
| GHSA-9xw5-w5jj-pvcg | high | aiohttp@3.13.5 | AIOHTTP: File descriptor exhaustion in multipart requests |
| GHSA-cq5v-8q36-5273 | high | aiohttp@3.13.5 | AIOHTTP: Out-of-bounds heap read in C HTTP response parser error path (malformed chunked response) |
| GHSA-h4cc-hm5h-fmm9 | high | aiohttp@3.13.5 | AIOHTTP: Concatenated compressed streams cause excessive CPU use |
| GHSA-jm3w-gw2p-xjfj | high | aiohttp@3.13.5 | AIOHTTP: Event loop stall in add_domain() wildcard matching |
| GHSA-pw86-h8fm-j323 | high | aiohttp@3.13.5 | AIOHTTP: Unbounded buffering of data received during an upgrade request |
| GHSA-xgw8-8ccx-rmqh | high | aiohttp@3.13.5 | AIOHTTP: Too many URL-encoded form fields block the event loop |
| GHSA-v4x8-3wr5-3wq8 | high | filelock@3.29.0 | filelock ReadWriteLock: SQLite reopens the lock database by name, so a planted symlink or journal file makes the lock us… |
| GHSA-27vj-qcqg-25rc | high | fsspec@2026.2.0 | fsspec: Server-Side Template Injection in ReferenceFileSystem leads to Remote Code Execution |
| GHSA-c3mw-737p-c7g2 | high | jupyter-server@2.18.2 | Jupyter Server: 5xx request logging leaks token-bearing Referer header values |
| GHSA-6966-vjj6-99xv | high | jupyterlab@4.5.7 | JupyterLab: Cross-site scripting (XSS) in JupyterLab via notebook cells pasted from the system clipboard |
| GHSA-gx64-gj6p-pc4c | high | jupyterlab@4.5.7 | JupyterLab: Image viewer allows XSS when opening malicious image in new browser tab |
Workflows worth a look
- .github/workflows/cla.yml: pull_request_target
By the numbers
| Stars | 21.6K |
|---|---|
| Forks | 1,574 |
| Contributors | 19 |
| Commits | 1,026 |
| Open issues | 2 |
| Open pull requests | 0 |
| Releases | 89 |
| Latest release | v0.24.0 |
| Licence | Apache-2.0 |
| Main language | Python |
| Project age | 2 years |
| Last push | Nov 13, 2026 |
| Tracked files | 112 |
| Lines of code | 9,417 |
| Checkout size | 13 MB |
Lines by language: Python 8,007, Markdown 880, JSON 332, YAML 137, TOML 61.
Questions
Is Surya free?
Yes for most people. The code is Apache 2.0, and the weights are free for research, personal use and companies under 5 million dollars in revenue or funding; bigger companies need a commercial licence from Datalab. Datalab's hosted API is a separate paid service with a free monthly allowance.
Surya or Tesseract?
Surya for messy layouts, tables, math and many languages, since a modern vision model reads the whole page. Tesseract for clean printed text on modest hardware: it is tiny, runs on any CPU and is fully Apache 2.0, language data included.
Surya or Marker?
Both come from Datalab. Surya gives you OCR, layout and tables as JSON; Marker runs Surya underneath and turns whole documents into Markdown, HTML or chunks. Pick Marker if you want a finished document, Surya if you want the raw pieces.
Does Surya send my documents anywhere?
No. The model runs on your machine and its server listens only on 127.0.0.1. The network is used to download the model and the vLLM image, and the viewer loads fonts and KaTeX from CDNs; your files stay local unless you point it at another server.
What hardware do I need?
An NVIDIA GPU with Docker is fastest; the project's own tests run on a 16 GB T4. An Apple Silicon Mac or an ordinary CPU works through llama.cpp, more slowly, since the model is small at 689 million parameters.
This post is part of GitHub Tools, where every repository is cloned and scanned before it is written up. The scan is a snapshot of one commit on one day; the repository has moved on since, so check it before you install.
