Invoice & Receipt Extraction Agent
An AI invoice and receipt extraction agent that reads PDFs, receipt photos and scanned documents, pulls vendor, invoice number, dates, currency, subtotal, tax, total, category and line items into CSV, checks that the maths adds up, catches duplicates, and flags anything doubtful for review.
Who it's for
Freelancers, small businesses and bookkeepers who still type invoices and receipts into spreadsheets.
What goes in
- A folder of PDFs, PNG/JPG photos or text receipts
- An LLM API key (a vision model for photos and scans)
- poppler-utils for PDFs
What comes out
- invoices.csv: one checked row per document
- line_items.csv
- needs_review flag with the reason
- Duplicate warnings
Setup in 4 steps
- Run the offline tests and install poppler-utils.
- Add your LLM key (and a vision model for photos).
- Dry-run on the samples, then run on your invoice folder.
- Review flagged rows, then import the CSV into your accounting tool.
Tool stack
Cost per run
Estimate, not yet measured: about $0.0005 per text PDF on a small model; photos and scans use a vision model and cost more per page. The script prints real token usage.
What's included
- n8n workflow JSON (Gmail PDF attachment → Google Sheet)
- Python code version (stdlib only, PDF + vision) + AGENTS.md
- README setup guide
- Offline sample data + tests
- Honest cost notes
- Changelog
FAQ
Can it read photos of paper receipts?
Yes. Photos and scanned PDFs are sent to a vision-capable model that you choose (any OpenAI-compatible API or Anthropic). Text PDFs use a cheaper text model.
How does it catch mistakes?
It checks subtotal plus tax and tip against the total, line items against the subtotal, quantity times price per line, valid ISO dates and currency codes. Anything off is marked needs_review with the reason.
Will it process the same invoice twice?
No. Files are tracked by SHA-256 hash, and a second document with the same vendor and invoice number is flagged as a possible duplicate.
Does it connect to QuickBooks or Xero?
It outputs clean CSVs that accounting tools can import. A direct integration isn't included.