Skip to main content

OcrRoute

OcrRoute is an OCR gateway for multi-engine text extraction: one HTTP endpoint in front of local and cloud OCR engines, with routing, load balancing, retries and fallbacks - plus quotas, caching, cost tracking and observability for reliable, cost-aware document understanding. It imports the given AioOCR engine library unchanged (55 OCRPlugin classes: Tesseract, RapidOCR, PaddleOCR, Surya, GOT-OCR, DeepSeek-OCR, Nougat, OCR.Space, Google Vision, Mistral OCR, Gemini/Claude/OpenAI-style VLM OCR, …) in a FastAPI gateway with a web control panel, a desktop app (ManyQt: PyQt5 / PyQt6 / PySide2 / PySide6) and a CLI. Persistence is a single SQLite file.

pip install "ocrroute[local,desktop]"   # from PyPI: core + Tesseract/OpenCV extras + the desktop app
# or, from a clone:
pip install -e ".[local,desktop,dev]"   # core + Tesseract/OpenCV extras + ManyQt + PyQt5 + tests
ocrroute setup                          # admin user, first provider, default route, API key
ocrroute serve                          # API  http://127.0.0.1:20256/v1/docs
                                        # panel http://127.0.0.1:20256/panel/
ocrroute ocr scan.png                   # zero-config OCR through the built-in auto route
ocrroute desktop                        # PyQt5 app (embedded server or remote)
curl -X POST http://127.0.0.1:20256/v1/ocr \
  -H "Authorization: Bearer ocrr_…" \
  -F file=@invoice.pdf \
  -F 'json={"route":"invoices","language":"en","pages":"1-3","output":["json","text","pdf"]}'

The response keeps the engine library's unified result verbatim under result and adds gateway metadata beside it (routing.attempts, routing.explain, usage, artifacts). See docs/API.md.

Screenshots:

Playground: run any engine or route on an image or PDF and inspect the result as text, lines, JSON, routing or ready-to-use code, with the recognised words drawn over the input.

OcrRoute Playground: OCR.Space result with word boxes over the input and the JSON result

Engines: every detected OCR engine, cloud and local, with availability, capabilities, pricing model, per-engine options, one-click provider creation and a probe button.

OcrRoute Engines page: cards for each detected engine with availability, capabilities and actions

What you get:

Area Highlights
Routing Built-in auto/* catalog (balanced, fast, accurate, cheapest, free, private, handwriting, tables, pdf, multilingual, consensus, best-of-two) plus named Routes (fallback chains) with 18 strategies: priority, round-robin, weighted, fill-first, least-used, least-latency, P2C, random, cost-optimised, local-first, quality-first, language-aware, ensemble-vote, auto (explainable).
Reliability Bounded retries, per-provider circuit breaker with escalating cooldown, deadlines, credential rotation on auth/quota errors, terminal-error short-circuit, degraded partial results.
Control Providers, encrypted credentials (Fernet), client API keys with scopes/RPM/RPD/budgets, panel users with roles (admin / operator / viewer), runtime settings, audit log, graceful restart / shutdown.
Cost & quotas Per-engine price table, per-run cost estimate, monthly budgets per provider and per key, sliding-window limits.
Cache & dedupe Result cache keyed by input hash + target + options, idempotency keys, in-flight single-flight.
Inputs / outputs Path, URL (SSRF-guarded), base64, upload, PDF page ranges; exports: json, text, md, hOCR, ALTO, csv, xlsx, docx, searchable PDF, overlay PNG.
Observability Runs & attempts in SQLite, live SSE feed, Prometheus /metrics, doctor diagnostics with copyable system report.
UIs Web control panel (12 pages, Bootstrap 5 + Bootstrap Icons vendored for offline use, mobile-first with an offcanvas sidebar) · PyQt5 desktop (10 pages, embedded/remote, region capture, overlay viewer, tray) · Typer CLI. Both UIs: light / dark / system themes, English · Français · Español · Deutsch · Italiano · Português · Русский · 中文 · العربية (RTL), onboarding checklist, humanised times.
Endpoints Active endpoints with copy, all LAN URLs, tunnels (Cloudflare / Tailscale / ngrok) with install / enable / disable, public URL, global OCR prompt, server restart / shutdown.
Auto-detection Every OCRPlugin in AioOCR is discovered by the library's own discovery, seeded as a provider, and re-detected live when modules are added or dependencies installed (file watcher + periodic rescan).
Tools Reserved, intentionally empty extension point (/v1/tools, ocrroute/tools, empty-state pages). See docs/TOOLS.md.

Several servers:

Run one leader and any number of followers: followers mirror the leader's providers, credentials, routes, API keys and users. Set it up from the web panel (System > Cluster sync) or with .env; see docs/CLUSTER.md.

Editions and more engines:

The stand-alone executables come in two editions:

Edition Files Engines Unpacked size
Lean ocrroute-server-*, ocrroute-desktop-* 49 of 56: every engine without a deep-learning framework (Tesseract, RapidOCR, Mistral OCR, all cloud engines) ~150 MB
Full ocrroute-server-full-*, ocrroute-desktop-full-* Lean + EasyOCR and Surya (PyTorch, CPU) + PaddleOCR (PaddlePaddle) ~1.7 GB

On Intel Macs the Full edition includes PaddleOCR but not EasyOCR or Surya: PyTorch publishes no Intel-Mac build newer than 2.2, which predates NumPy 2. EasyOCR, Surya and PaddleOCR download their model weights on first use.

Surya is bundled as 0.17.1, the last release that runs OCR entirely in PyTorch; Surya 2 (0.20+) needs a vLLM or llama.cpp server (pip install "ocrroute[surya2]"). Surya's code is Apache-2.0, but its model weights use a modified AI Pubs Open Rail-M license: free for research, personal use and startups under $5M in funding or revenue; other commercial use needs a license from Datalab.

The remaining deep-learning engines (Calamari, keras-ocr, GLM, olmOCR) install on demand in a pip installation: click Install in the Engines page, run ocrroute engines install SuryaOcr, or pip install "ocrroute[surya]". See docs/ENGINES.md.

Documentation:

docs/ARCHITECTURE.md · docs/ROUTING.md · docs/API.md · docs/ENGINES.md · docs/DEPLOYMENT.md · docs/SECURITY.md · docs/TOOLS.md · docs/DECISIONS.md · docs/CHANGELOG.md

Independence note:

Design patterns for gateway routing (fallback chains, balancing strategies, key management, dashboards) are widely used in the ecosystem; OcrRoute applies them to OCR. OcrRoute is an independent Python project with its own namespace (ocrroute, ~/.ocrroute, OCRROUTE_*), its own default port (20256; it refuses to bind 20128), and no chat/completions, LLM proxying or agent-protocol surface. It is not a fork, plugin or companion of any other gateway.

Desktop app and Qt:

The desktop app is written against ManyQt, one API over PyQt4/5/6 and PySide/2/6. The executables ship PyQt5; from source, pip install "ocrroute[desktop]" installs ManyQt with PyQt5, and any other installed binding works too (QT_API=pyqt6, QT_API=pyside6...). ManyQt is GPL-3.0, like PyQt5.

Support the project:

OcrRoute is free and open source. If it saves you time or money, you can support its development:

Support on ba9chich Support on Ko-fi

Stars, bug reports and pull requests help too. Thank you!

Third-party assets:

ocrroute/assets/fonts/DejaVuSans.ttf is DejaVu Sans (Bitstream Vera license; see LICENSE-DejaVu.txt next to it), used by PaddleOCR for visualisations.

License:

MIT - see LICENSE.

Metadata

Release files for ocrroute 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ocrroute 0.8.0
File Size Uploaded Provenance
ocrroute-0.8.0.tar.gz 1.5 MB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ocrroute 0.8.0
File Interpreter ABI Platform
ocrroute-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 3.1 MB

Release files / ocrroute-0.8.0.tar.gz

Download URL ocrroute-0.8.0.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
2fe79fb22827e07a235a0abc95454dbee2b40302b3f9e5c4c5aa484a6f4a1c7f
BLAKE2b-256 checksum
How to use checksums
f59d271e5e67949c0bac101c939b3cf7593b1d3bfab33ea4f065ae8e6434dedb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release files / ocrroute-0.8.0-py3-none-any.whl

Download URL ocrroute-0.8.0-py3-none-any.whl
Size 1.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
d0fc69cd08c422baabc9a30e66981d377789532047b7e1585f39e3012df7d43b
BLAKE2b-256 checksum
How to use checksums
9a9f6af3a6c9ad200e22ea5e3c4cc887cff2fa2e22b1822de5b454f829d9547c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Security for ocrroute 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ocrroute-0.8.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page