How getomni-ai/zerox works
Zerox is a document-to-Markdown OCR SDK with Node.js and Python implementations. The principal workflow accepts a document, prepares page images, sends pages to vision models, and aggregates Markdown; Node also supports structured extraction. The graph separates orchestration, document processing, model integrations, and Python’s page-processing layer. Relationships for the sampled paths are grounded in source excerpts or the README; some broader capabilities are documented but their implementation details were not sampled.
Main entry points: src/index.ts OCR orchestration · models/index.ts Provider selection · modellitellm.py LiteLLM adapter · zerox.py OCR orchestration
Components 23
Node SDK
- OCR orchestration
node-zerox/src/index.ts
Node Processing
- File preparation
node-zerox/src/utils/file.ts - Image cleanup
node-zerox/src/utils/image.ts - Shared helpers
node-zerox/src/utils/common.ts - Orientation workers
node-zerox/src/utils/tesseract.ts
Node Models
- Model utilities
node-zerox/src/utils/model.ts - Provider selection
node-zerox/src/models/index.ts - OpenAI adapter
node-zerox/src/models/openAI.ts - Azure adapter
node-zerox/src/models/azure.ts - Bedrock adapter
node-zerox/src/models/bedrock.ts - Google adapter
node-zerox/src/models/google.ts
Python SDK
- OCR orchestration
py_zerox/pyzerox/core/zerox.py - LiteLLM adapter
py_zerox/pyzerox/models/modellitellm.py - Messages and prompts
py_zerox/pyzerox/constants/messages.py - Model prompts
py_zerox/pyzerox/constants/prompts.py - Domain exceptions
py_zerox/pyzerox/errors/exceptions.py
Python Processing
- PDF conversion
py_zerox/pyzerox/processor/pdf.py - Image utilities
py_zerox/pyzerox/processor/image.py - Markdown formatting
py_zerox/pyzerox/processor/text.py
Other components
- SDK caller
- Vision model APIs
- Python SDK caller
- LiteLLM services
Connections 27
- SDK caller → OCR orchestration: submits document
- OCR orchestration → File preparation: prepares input
node-zerox/src/index.ts - OCR orchestration → Image cleanup: cleans images
node-zerox/src/index.ts - OCR orchestration → Orientation workers: manages workers
node-zerox/src/index.ts - OCR orchestration → Provider selection: creates model
node-zerox/src/index.ts - Provider selection → Model utilities: validates parameters
node-zerox/src/models/index.ts - Provider selection → OpenAI adapter: selects provider
node-zerox/src/models/index.ts - Provider selection → Azure adapter: selects provider
node-zerox/src/models/index.ts - Provider selection → Bedrock adapter: selects provider
node-zerox/src/models/index.ts - Provider selection → Google adapter: selects provider
node-zerox/src/models/index.ts - OpenAI adapter → Vision model APIs: requests completion
- Azure adapter → Vision model APIs: requests completion
- Bedrock adapter → Vision model APIs: requests completion
- Google adapter → Vision model APIs: requests completion
- OCR orchestration → SDK caller: returns Markdown
- Python SDK caller → OCR orchestration: submits document
- OCR orchestration → LiteLLM adapter: initializes model
py_zerox/pyzerox/core/zerox.py - OCR orchestration → PDF conversion: converts and processes pages
py_zerox/pyzerox/core/zerox.py - PDF conversion → Image utilities: saves page images
py_zerox/pyzerox/processor/pdf.py - PDF conversion → Markdown formatting: formats Markdown
py_zerox/pyzerox/processor/pdf.py - PDF conversion → LiteLLM adapter: requests page completion
py_zerox/pyzerox/processor/pdf.py - LiteLLM adapter → Image utilities: encodes images
py_zerox/pyzerox/models/modellitellm.py - LiteLLM adapter → LiteLLM services: calls completion API
py_zerox/pyzerox/models/modellitellm.py - LiteLLM adapter → Model prompts: uses defaults
py_zerox/pyzerox/models/modellitellm.py - LiteLLM adapter → Messages and prompts: formats errors
py_zerox/pyzerox/models/modellitellm.py - OCR orchestration → Domain exceptions: raises domain errors
py_zerox/pyzerox/core/zerox.py - OCR orchestration → Python SDK caller: returns Markdown