How bhimrazy/receipt-ocr works
Receipt OCR Engine offers two paths: a structured-data package that sends receipt images and a requested schema to an OpenAI-compatible vision model, then parses its response; and a Tesseract path that detects and rectifies the receipt before returning raw text. Users can start either path through a CLI or HTTP API. The graph follows sampled calls; the README documents additional LLM-compatible providers, but the provider implementation is OpenAI-compatible. The production API is represented by its sampled server entry point.
Main entry points: processors.py Receipt processor · providers.py LLM provider · server.py Structured API · utils.py Receipt image OCR
Components 15
Structured Extraction
- Receipt processor
src/receipt_ocr/processors.py - LLM provider
src/receipt_ocr/providers.py - Extraction prompts
src/receipt_ocr/prompts.py - Image encoding
src/receipt_ocr/utils.py - Response parser
src/receipt_ocr/parsers.py - Structured receipt data
Raw OCR
- Receipt image OCR
src/tesseract_ocr/utils.py - Raw receipt text
User Interfaces
- Receipt CLI
src/receipt_ocr/cli.py - Structured API
app/server.py - Tesseract CLI
src/tesseract_ocr/main.py - Tesseract API
src/tesseract_ocr/app.py
External Services
- OpenAI-compatible LLM
- Tesseract engine
Other components
- Receipt user
Connections 23
- Receipt user → Receipt CLI: runs
- Receipt user → Structured API: uploads image
- Receipt CLI → Receipt processor: processes receipt
- Structured API → Receipt processor: processes receipt
- Receipt processor → LLM provider: requests extraction
- LLM provider → Image encoding: encodes image
- LLM provider → Extraction prompts: uses prompts
- LLM provider → OpenAI-compatible LLM: sends image and schema
- OpenAI-compatible LLM → LLM provider: returns completion
- LLM provider → Receipt processor: returns completion
- Receipt processor → Response parser: parses response
- Response parser → Structured receipt data: produces
- Receipt processor → Receipt CLI: returns data
- Receipt processor → Structured API: returns data
- Structured API → Receipt user: responds with JSON
- Receipt user → Tesseract CLI: runs
- Receipt user → Tesseract API: uploads image
- Tesseract CLI → Tesseract engine: recognizes text
- Tesseract CLI → Raw receipt text: prints
- Tesseract API → Receipt image OCR: passes image bytes
- Receipt image OCR → Tesseract engine: recognizes text
- Receipt image OCR → Raw receipt text: returns
- Tesseract API → Receipt user: responds with text