OCRRouter

Tesseract API docs

How OCRRouter calls Tesseract, what the upstream returns field by field, and how that becomes Markdown and JSON blocks.

Overview

Tesseract is the open-source OCR engine. OCRRouter runs the tesseract binary on its own server, so nothing leaves the machine.

Output is plain text per page. Tesseract can also write hOCR, TSV, ALTO, PAGE and PDF, but OCRRouter only reads the plain text.

Price and limits

Model ID
tesseract/tesseract
Price
Free
Max pages per request
500
Inputs
PDF (rendered to PNG at 200 DPI); Images that Tesseract's image library can read
Languages
100+ languages with installed traineddata; OCRRouter uses the TESSERACT_LANGS setting, default English
Positions (bbox)
No, text only
License
Apache-2.0
  • Up to 500 pages per document in OCRRouter
  • Self-hosted only
  • No tables, formulas or headings: text only

You pay only for pages that succeed. A failed attempt that falls back to another model is not charged. See pricing.

How OCRRouter calls it

Binary
tesseract <image> stdout -l <langs>, run once per page image
PDF rendering
pdftoppm -r 200 -png (poppler), one PNG per page
Languages
TESSERACT_LANGS, default eng
Availability
Self-hosted servers with tesseract and pdftoppm installed; off on Cloudflare Workers or when TESSERACT_ENABLED=0

Options

What OCRRouter sets on the upstream call. You choose the model, format and pages in your request; vendor-specific options are not passed through.

-l
TESSERACT_LANGS, default eng
outputbase
stdout, so text goes to standard output
--psm, --oem, --dpi
Not set: defaults apply (psm 3, oem 3, DPI from image metadata)
PDF resolution
200 DPI via pdftoppm
Client options
Clients cannot pass Tesseract options through OCRRouter

Raw response fields

Every field the upstream documents, with its type and meaning taken from the vendor's own reference. Fields marked "read by OCRRouter" are the ones our connector uses; the rest are listed so you know what the engine produces.

Tesseract txt output (what OCRRouter uses)

With outputbase stdout and no config file, Tesseract writes recognized text to standard output. Pages end with a form feed character.

Source: tesseract(1) manual, retrieved 2026-11-19

stdouttext, read by OCRRouter
Recognized text in reading order, lines separated by newlines, blocks by blank lines.Example: "Invoice 1042\nDate: 2026-11-02\n\f"

Illustrative text; plain text has no fixed schema, shown as JSON for readability.

{"stdout": "Invoice 1042\nDate: 2026-11-02\n\nTotal  $120.00\n\f"}

Tesseract TSV output (not used)

With the tsv config file, Tesseract writes a header row, then one row per page, block, paragraph, line and word. Columns and their order are from GetTSVText in src/api/baseapi.cpp and the header in src/api/renderer.cpp. OCRRouter does not request this mode.

Source: tesseract src/api/baseapi.cpp (GetTSVText), retrieved 2026-11-19

levelinteger
Row level: 1 page, 2 block, 3 paragraph, 4 line, 5 word.Example: 5
page_numinteger
Page number, from 1.Example: 1
block_numinteger
Block number within the page.Example: 1
par_numinteger
Paragraph number within the block.Example: 1
line_numinteger
Line number within the paragraph.Example: 1
word_numinteger
Word number within the line.Example: 1
leftinteger
Left edge of the box in pixels.Example: 36
topinteger
Top edge of the box in pixels.Example: 92
widthinteger
Box width in pixels.Example: 121
heightinteger
Box height in pixels.Example: 25
confnumber
Word confidence 0 to 100 (RIL_WORD confidence); -1 on page, block, paragraph and line rows.Example: 96.1
textstring
Recognized word; empty on non-word rows.Example: "Invoice"

One TSV word row shown as JSON; values illustrative.

[{"level": 5,"page_num": 1,"block_num": 1,"par_num": 1,"line_num": 1,"word_num": 1,"left": 36,"top": 92,"width": 121,"height": 25,"conf": 96.1,"text": "Invoice"}]

How it maps to OCRRouter output

PDF pages
Rendered by pdftoppm, sorted by page number, one Tesseract run each
stdout
pages[]: form feeds removed and whitespace trimmed; plain text, no Markdown structure
hOCR, TSV, ALTO
Not requested, so no layout, bbox or confidence in OCRRouter output

The unified output is described in Response format.

Example request

curl https://api.ocrrouter.ai/v1/ocr \
  -H "Authorization: Bearer $OCRROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tesseract/tesseract",
    "file_url": "https://example.com/invoice.pdf",
    "format": "json"
  }'

Sources

Vendor documentation read on 2026-11-19.