Shop receipts turned into JSON by a remote vision model
Receipt OCR is a Python library, with a receipt-ocr command, that turns a photo of a receipt into JSON: merchant name and address, date, time, total and line items. The reading doesn't happen on your machine. The package scales the image down to 1080 pixels on its longest side, encodes it as PNG and sends it to a vision model through OpenAI's Chat Completions API, with the expected schema written into the prompt.
The repository also holds a second, separate module. It finds the receipt's edges with OpenCV, straightens the image and runs Tesseract on it, which returns raw text. The two never chain: the LLM gets the image, not Tesseract's output. Tesseract.js brings the same Tesseract engine to the browser and Node.js, with no server involved.
The comparison of open source OCR tools places Receipt OCR among OCR engines, vision models and document converters.
Your own schema on top of the openai SDK
- JSON in three commands:
pip install receipt-ocr, setOPENAI_API_KEY, thenreceipt-ocr receipt.jpg. - Bring your own schema: a JSON file through
--schema_path, or a dict in Python. Since v0.3.1,json_schemamode asks the model for output that matches a strict JSON Schema. - One SDK, several providers: the package is built on the
openaiSDK, andOPENAI_BASE_URLpoints it elsewhere. The README has settings for Gemini and Groq. The default model isgpt-4.1. - FastAPI service:
docker compose -f app/docker-compose.yml upstarts an API on port 8000 withPOST /ocr/(images up to 5 MB, optional schema). - A small codebase: nine Python files and three pinned dependencies; the whole system prompt sits in
prompts.py.
API key required, schema not enforced by default
An API key and a model that reads images are required. The LLM module has no local mode, and the README reminds you the key needs credits. The code accepts any OpenAI-compatible endpoint, but the docs only cover three hosted services, OpenAI, Gemini and Groq, so every receipt goes to whichever provider is configured. Unstract also extracts JSON with an LLM and can use a local model through Ollama, but it runs PostgreSQL, Redis and RabbitMQ and asks for at least 8 GB of RAM.
The JSON isn't checked by default. In that mode the schema is only an instruction in the prompt. json_schema mode is reachable from Python alone: neither the CLI nor the web service exposes it. A response that isn't valid JSON doesn't raise; the library returns an {"error": ...} object instead. Nothing checks that the line items add up to the total.
The web service is a starting point. The README calls it "production-ready", yet POST /ocr/ has no authentication, handles one image per request and rejects anything that isn't an image, PDFs included. No Docker image is published (pull request #52 has been waiting since May 2026). In issue #29, open since November 2025, a user reports about 22 seconds per request.
The Tesseract module doesn't ship with the package. pip install receipt-ocr installs the LLM module only. Using the Tesseract module means cloning the repository and installing Tesseract and OpenCV. That module fails when it can't find a four-cornered outline, and issue #4, still open, reports that the perspective correction sometimes mangles the text. No language is passed to Tesseract, so it falls back to English.
One maintainer, and a v0.4.0 with no new features. Released on October 6, 2026, almost a year after v0.3.1, v0.4.0 brings tests, CI work and dependency updates, and drops Python 3.9. Bhimraj Yadav authored 66 of the 86 commits; the rest come from Dependabot and pre-commit.ci. The PyPI package lists itself as "Beta".
