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

Every page, priced for Claude Sonnet 5

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
The sample folder, routed. Hover a page to see why it went where it did.

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 onWhat it showedWhat the router does
Pages with no text layer, two public parsing benchmarksLocal OCR kept far less of the page than a vision modelA page with no text layer goes to vision
Pages with a poor text layer, same benchmarksThe poor text layer still kept more than OCRThe free plan reads the text layer
Held-out enterprise documentsWithout tables to vision: 2.5 points less kept, 8 points fewer pages to visionComplex tables go to vision by default
150 questions on plainly laid out company filings42% of pages to vision, and no more questions answered than the text layervision_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

The routing guide