The router
A folder is a mix of pages: some carry their text, some are scans, some are tables plain text scrambles. The router measures every page before anything is sent, picks the cheapest reader that loses nothing, and writes down why.
complydoc routing ./documents
- annual-report-2025.pdf
- employee-handbook.pdf
- master-services-agreement.pdf
- rechnungen-2026-de.pdf
- supplier-invoices-scanned.pdf
- vendor-due-diligence.pdf
- by the route each page needs
- $0.048
- every page from its text layer
- $0.036
- text layer, scans through local OCR
- $0.036
- every page as an image to a vision model
- $0.106
Every page, priced for Claude Sonnet 5
How each page is decided
With a vision model available, which is the default, a page goes to vision only when plain text would lose it. Without one, routing uses only what costs nothing.
With a vision model
- text
- A usable text layer, and nothing on the page that plain text loses
- vision
- No usable text layer, a layer that is not text, a table with merged or stacked header cells, or a page that is mostly picture
Without one
- text
- A text layer, whatever its state
- ocr
- No usable text layer: the page is read by local OCR
Where OCR will read a page poorly, a coarse scan or one read with low confidence, the plan says a vision model would read it better.
How the router is measured
Every rule was kept because it won on a benchmark, page by page, against the cheapest reader that loses nothing.
| Tested on | What it showed | What the router does |
|---|---|---|
| Pages with no text layer, two public parsing benchmarks | Local OCR kept far less of the page than a vision model | A page with no text layer goes to vision |
| Pages with a poor text layer, same benchmarks | The poor text layer still kept more than OCR | The free plan reads the text layer |
| Held-out enterprise documents | Without tables to vision: 2.5 points less kept, 8 points fewer pages to vision | Complex tables go to vision by default |
| 150 questions on plainly laid out company filings | 42% of pages to vision, and no more questions answered than the text layer | vision_for_tables: none is offered for corpora like it |
Every page carries the reason for its route, so a plan can be argued with. The routing guide
Every threshold is a setting
The rules live in readiness.yaml under routing. A plan is written to complydoc-routing.json, a manifest an ingestion job can read.
routing: vision: true min_characters: 40 min_text_coverage_pct: 30 picture_share_pct: 50 max_caption_chars: 500 max_control_char_pct: 2 min_wordlike_pct: 50 vision_for_tables: complex