Before you pay an invoice, get a second opinion.
Upload a PDF invoice, or a whole batch, and find out in seconds whether the line totals, tax and grand total actually add up, with the evidence to prove it. Then ask questions about what it found.
Try it live → invoiceinspect.app · Portfolio case study · Request source access
This is a showcase repository. The full source code lives in a private repository. The product is live and free to use with no signup, and I'm happy to give access to the source on request: email me.
InvoiceInspect is an invoice validator for finance teams, accounts payable, freelancers and business owners. It reads a vendor invoice, rebuilds every number from scratch and flags anything that doesn't reconcile before money leaves the account.
- Line items: quantity × unit price checked against every line total.
- Subtotal and grand total: line sums, discounts, shipping and tax reconciled against the printed totals.
- VAT / GST / sales tax: rates compared with the tax amounts actually charged, and tax IDs checked for presence.
- Duplicate charges: repeated line items and double-billed amounts surfaced for review.
- Missing fields: invoice number, dates and other required details called out.
- Evidence, not just a verdict: each finding shows Expected vs Invoice says vs Difference, tied back to the page it came from.
- Bulk upload: check many invoices in one go. You land on the results page straight away and each review appears the moment it is ready, so you never wait for the whole batch.
- Ask about an invoice: a built-in assistant answers questions about the invoice in front of you and its findings, and nothing else.
The core idea is simple: money math should never be guessed by a language model.
| Layer | Job | Approach |
|---|---|---|
| Extraction | Turn a PDF into structured fields | Two independent readers: native text + OCR (smalot/pdfparser, Ghostscript, Tesseract) and an AI vision model that reads the rendered pages and quotes what it sees |
| Verification | Decide if the numbers are right | Deterministic rules engine: plain arithmetic, no AI in the verdict |
| Reasoning | Explain findings in plain English | LLM layer that explains and double-checks, but never overrides the math |
| Review | Handle unreadable numbers | When a value can't be read with confidence, the user picks the correct one and the checks re-run |
| Assistant | Answer questions about one invoice | A small, low-cost model that sees only the extracted fields and findings, must stay on topic, and cannot invent figures |
- Rules-based verification engine with independent rules for line totals, subtotals, grand total, tax, expected rates, required fields and duplicate charges.
- Dual-path PDF reading: native text extraction for digital PDFs, Ghostscript + Tesseract OCR for scans, with a visible scan reading quality indicator.
- AI vision extraction: a vision model reads the page images and must quote the exact printed text for every value. It never calculates or infers. Its instruction defines what each value is (for example that a deposit is not a discount and that carried-forward rows are not line items), and its answers are tidied (a printed "kr" becomes SEK, a discount is a positive amount).
- Cross-checking: the AI read and the rules-based read are compared field by field, so a misread on either side is caught instead of trusted.
- Downloadable PDF report of the results for sharing with a vendor or an approver.
- Evaluation harness with published results: invoice generators and a scorer measure extraction and finding accuracy against known answers, for five extractors including a model-based one. The test invoices, answer keys, raw results and every test report are public, including the weak results (see Accuracy and testing).
- Provider-agnostic AI layer with fallback between providers.
- Bulk upload with live results: pick many PDFs, limited to the checks your plan has left (each invoice is one check). Invoices are checked one at a time and each review is shown as soon as it finishes, in a tidy list-and-review layout that works on a phone. You can stop the rest, retry one that failed, or correct a value and re-check one invoice in place. See Bulk upload and results.
- Invoice assistant: suggested questions written from the invoice's own findings (for example Why does line 2 not add up?), answers grounded in the extracted data only, a fixed refusal for anything off topic, and limits per plan with a spam check. See Invoice assistant.
- Plans and limits: guest, free and paid tiers with per-day and per-minute limits, file-size and page caps, and a number of assistant questions per invoice, all editable in the admin without a release. The upload box always shows how many checks are left today.
- Accounts and admin: signup, login, email verification, password reset, feedback that earns extra checks, and an admin dashboard for users, usage analytics, plans and limits, AI provider and model settings (including the assistant's model), billing, SMTP settings and email logs.
- Runs on PostgreSQL or MySQL: a built-in tool copies the data from one database to the other, so moving hosts does not mean starting over.
- Content and SEO: blog system with Markdown rendering, guides, tax-specific landing pages (VAT, GST), sitemap and structured data.
Accuracy is measured, not claimed. An evaluation harness runs the checker on fictitious invoices whose correct values are known, including mistakes planted on purpose, and scores what it finds. The invoices, answer keys, raw results and every report are public, including the weak results.
| Finding | Evidence |
|---|---|
| The checking rules are correct. | With perfect input, the rule engine found every planted mistake with no false alarms. |
| Reading is the hard part. | On 30 independent invoices the rules extractor read 84.5% of fields correctly before fixes and 98.1% after (fixed on the same set, so not a fresh measure). |
| A vision model covers layouts nobody wrote rules for. | On 30 unseen invoices: rules 62.0%, vision 99.4%, with 26 of 26 planted mistakes found. |
| Fixes generalize, with caveats. | General fixes took the 50-invoice set from 92.2% to 99.9%. The ten invoices kept aside, which the fixes were not built on, went from 64.9% to 100%. |
Full detail is in Accuracy and testing: all eight reports, the test invoice sets, the five extractors and what the results show. Browse them live on the Harness Reports page.
Free-tier uploads are processed in memory and never stored. There is no file persistence in the free flow, and no signup is needed to check an invoice. Keeping files is never the default. Bulk uploads pass between pages inside the visitor's own browser and reach the server one file at a time, and the assistant only ever sees extracted text, never the PDF. See Privacy by design and the Security page.
| Area | Tools |
|---|---|
| Application | Laravel 13 on PHP 8.3+, Filament admin panel |
| PDF and OCR | smalot/pdfparser, Ghostscript, Tesseract |
| AI | Anthropic Claude and OpenRouter behind one provider interface with fallback |
| Frontend | Blade, Tailwind CSS 4, Vite |
| Database | PostgreSQL or MySQL |
| Spam protection | Cloudflare Turnstile on the assistant and the feedback form |
| Quality | PHPUnit, Laravel Pint, a custom evaluation harness |
The full stack, PDF and OCR toolchain and library list are in Tech stack and main libraries.
Reading an invoice and judging it are separate jobs. Two independent readers turn the PDF into fields, a cross-check compares them, and a deterministic rules engine decides the verdict. A language model never overrides the math.
PDF upload ─► text layer + OCR ──┐
(one or many) └─► AI vision read ────┴─► cross-check ─► deterministic rules ─► findings ─► results page / PDF report
│
└─► invoice assistant (grounded in the findings)
The full pipeline diagram and layer breakdown are in Architecture.
| Page | Covers |
|---|---|
| Accuracy and testing | Evaluation harness, test reports, invoice sets, extractors, results |
| Bulk upload and results | Checking many invoices, the live results page and how limits are respected |
| Invoice assistant | The chat about one invoice: grounding, scope rules, limits and spam protection |
| Privacy by design | What is stored, what is not, and how the AI read works |
| Tech stack and main libraries | Stack, PDF and OCR toolchain, libraries |
| Architecture | Pipeline, layers, bulk flow and the assistant |
- Live app: invoiceinspect.app
- Case study and details: aliyanfaisal.com/products/invoiceinspect
- Source access: aliyanbarcha15@gmail.com
Built by Aliyan Faisal, a full-stack developer who builds products end to end, from the rules engine to the deployment pipeline. More of my work is on my portfolio.
Interested in the code, a similar build, or working together? Reach out at aliyanbarcha15@gmail.com.
© Aliyan Faisal. All rights reserved. This repository contains documentation and screenshots only.