getomni-ai /zerox

OCR & Document Extraction using vision models

★ 12,254⑂ 841
TypeScriptCreated 2024-07-21getomni.ai/ocr-demo
12,254
stars
+1+1+-1
841
forks
–
watchers
–
prs
–
issues
–
releases
–
discussions

README

!Hero Image

 Zerox OCR


  


A dead simple way of OCR-ing a document for AI ingestion. Documents are meant to be a visual representation after all. With weird layouts, tables, charts, etc. The vision models just make sense!

The general logic:

- Pass in a file (PDF, DOCX, image, etc.)
- Convert that file into a series of images
- Pass each image to GPT and ask nicely for Markdown
- Aggregate the responses and return Markdown

Try out the hosted version here: 
Or visit our full documentation at: 

 Getting Started

Zerox is available as both a Node and Python package.

- Node README - npm package
- Python README - pip package

| Feature                   | Node.js                      | Python                     |
| ------------------------- | ---------------------------- | -------------------------- |
| PDF Processing            | ✓ (requires graphicsmagick)  | ✓ (requires poppler)       |
| Image Processing          | ✓                            | ✓                          |
| OpenAI Support            | ✓                            | ✓                          |
| Azure OpenAI Support      | ✓                            | ✓                          |
| AWS Bedrock Support       | ✓                            | ✓                          |
| Google Gemini Support     | ✓                            | ✓                          |
| Vertex AI Support         | ✗                            | ✓                          |
| Data Extraction           | ✓ (schema)                 | ✗                          |
| Per-page Extraction       | ✓ (extractPerPage)         | ✗                          |
| Custom System Prompts     | ✗                            | ✓ (custom_system_prompt) |
| Maintain Format Option    | ✓ (maintainFormat)         | ✓ (maintain_format)      |
| Async API                 | ✓                            | ✓                          |
| Error Handling Modes      | ✓ (errorMode)              | ✗                          |
| Concurrent Processing     | ✓ (concurrency)            | ✓ (concurrency)          |
| Temp Directory Management | ✓ (tempDir)                | ✓ (temp_dir)             |
| Page Selection            | ✓ (pagesToConvertAsImages) | ✓ (select_pages)         |
| Orientation Correction    | ✓ (correctOrientation)     | ✗                          |
| Edge Trimming             | ✓ (trimEdges)              | ✗                          |

 Node Zerox

(Node.js SDK - supports vision models from different providers like OpenAI, Azure OpenAI, Anthropic, AWS Bedrock, Google Gemini, etc.)

 Installation

sh
npm install zerox


Zerox uses graphicsmagick and ghostscript for the PDF = image processing step. These should be pulled automatically, but you may need to manually install.

On linux use:


sudo apt-get update
sudo apt-get install -y graphicsmagick


 Usage

With file URL

ts
import { zerox } from "zerox";

const result = await zerox({
  filePath: "https://omni-demo-data.s3.amazonaws.com/test/cs101.pdf",
  credentials

Snapshot: 2026-11-10T09:35:25Z · Data license Apache-2.0 · JSON