---
title: "Do you still need invoice OCR? I tested 4 AI models"
description: "Four AI models read 30 fictional invoices, clean and scanned, without OCR. On scans, errors sat in VAT IDs and invoice numbers; totals checks caught 3 of 63."
url: "https://madsalt.tech/blog/invoice-data-extraction-with-ai/"
author: "Denys Zaichenko"
author_url: "https://madsalt.tech/about/"
language: "en"
published: 2026-10-18
updated: 2026-10-22
---

# Do you still need invoice OCR? I tested 4 AI models

TL;DR

On clean digital invoices, three of the four models I tested read all nine fields right on 30 of 30. On simulated scans of the same invoices the best managed 22 of 30. The errors were almost never in the amounts. They were in VAT IDs and invoice numbers, and the usual safety net, checking that net plus VAT equals the total, flagged only 3 of the 63 wrong invoices. Two simple rules on the VAT IDs caught 31 of the 32 wrong invoices from the three best models. The cheapest model cost USD 0.43 per 1,000 invoices, but on scans it did not match the model 17 times its price: 14 of 30 against 22. Gemini 3.8 Flash matched Sonnet's 22 at about half its price.

I re-ran this test on 22 October 2026 on a new set of fictional invoices. All numbers in this article are from the re-run.

I'm Denys, a full-stack and AI engineer. I built an [invoice extraction prototype](https://madsalt.tech/work/invoice-extraction/) earlier this year: a web app and an API that turn PDF invoices into fields, with unsure fields flagged for a person. It runs on sample data, with no model behind it. So before writing about invoice data extraction, I ran a real test: 30 fictional Czech, German and Portuguese supplier invoices, four models, 240 calls, USD 0.76 of billed usage.

## What does AI get right and wrong on invoices?

Each model read every invoice twice: as a clean render, the way a PDF from accounting software looks, and as a simulated scan, grey, slightly rotated, blurred and compressed. An invoice counts as right only when all nine fields match: invoice number, issue date, due date, supplier VAT ID, buyer VAT ID, currency, net total, VAT total and gross total.

| Model             | Clean, all 9 fields right | Scan, all 9 fields right | USD per 1,000 invoices | Median seconds per invoice |
| ----------------- | ------------------------- | ------------------------ | ---------------------- | -------------------------- |
| Claude Haiku 5.5  | 30 of 30                  | 14 of 30                 | 0.43                   | 6.13                       |
| Claude Sonnet 5.5 | 30 of 30                  | 22 of 30                 | 7.18                   | 8.50                       |
| Gemini 3.8 Flash  | 30 of 30                  | 22 of 30                 | 3.51                   | 8.43                       |
| GPT-5.6 Luna      | 29 of 30                  | 0 of 30                  | 1.52                   | 10.85                      |

![Scanned invoices read with all 9 fields right. Out of 30 simulated scans per model. Same prompt, temperature 0. Claude Haiku 5.5: 14; Claude Sonnet 5.5: 22; Gemini 3.8 Flash: 22; GPT-5.6 Luna: 0.](https://madsalt.tech/charts/en/invoice-data-extraction-with-ai.svg)

*My test, 22 October 2026: 30 fictional Czech, German and Portuguese invoices, simulated scans, via OpenRouter.*

Cost is what [OpenRouter](https://openrouter.ai/models) billed for each call, not a price-list estimate. On clean invoices, Claude Haiku 5.5 and Claude Sonnet 5.5 were equally right, 30 of 30. On scans Sonnet read 22 right against Haiku's 14, and cost about 17 times more.

## Do you still need OCR to extract invoice data?

Not as a separate step, in this test. All four models received the page as an image and returned the nine fields directly, with no OCR layer in between. What changes the result is the quality of the page. A clean PDF from accounting software has a text layer, and a scan does not: it is only pixels. The "simulated scan" column in the table above is exactly the OCR-quality question, and it is where the models differ: the best read 22 of 30 scanned invoices right, and the weakest read none.

I did not test classic OCR engines or template-based tools, so I can't say how they would score on the same 30 invoices. What the test shows is where the risk sits when a model reads a scan: in VAT IDs and invoice numbers, which the checks below catch.

## How was the test set up?

I generated the invoices with a script, so every true value is known to the cent. The invoices are fictional: company names carry Vzor, Muster, Beispiel or Exemplo, and every invoice has a footer in the local language reading "SAMPLE - fictitious invoice / no real company". Each one carries the traps a real accounts payable clerk meets in that country:

- **Local number formats.** `175 011,84 Kč` in Czech, `10.465,61 €` in German, and both `1 234,56` and `1.234,56` on Portuguese invoices.
- **A second identifier next to the invoice number.** The Czech variable symbol, the German customer number, the Portuguese ATCUD code.
- **A second date.** The Czech date of taxable supply and the German service date sit next to the issue date.
- **Two VAT IDs on one page**, plus a German tax number (Steuernummer) that looks like a VAT ID and is not one.
- **Hard cases.** Mixed VAT rates, an invoice without VAT, a reverse-charge invoice, a credit note with negative amounts and a nine-line invoice in each country.

Every VAT ID has a valid check digit, verified with the [python-stdnum](https://arthurdejong.org/python-stdnum/) library, and none of them is registered: I looked up each of the 33 IDs used (30 supplier IDs and one buyer ID per country) in the EU's VIES service, and it answered "not valid" for all of them. The 11 Czech company numbers behind the Czech IDs were also looked up in the Czech business register, ARES, and not found. All four models got the same prompt, at temperature 0, one call per image.

![How the test was run. Same prompt and settings for every model. 30 invoices from Czechia, Germany and Portugal: Script → 30 invoices → Clean + scan → 4 models → Score.](https://madsalt.tech/charts/en/invoice-data-extraction-with-ai-test.svg)

*My test, 22 October 2026. 30 invoices × 2 versions × 4 models = 240 calls.*

![The top of a Czech test invoice, number FV-2026-0738, with its SAMPLE footer. Above: the clean render, sharp and easy to read. Below: the simulated scan of the same invoice, grey, blurred and rotated, where the 3 in the invoice number is hard to tell from a 5.](https://madsalt.tech/blog/invoice-data-extraction-with-ai/clean-vs-scan.webp)

*Test invoice cz09, clean and as a simulated scan. Claude Haiku 5.5 read the scanned number as FV-2026-0758.*

## Why did the totals check catch almost nothing?

Checking that net plus VAT equals the gross total is the first rule most extraction pipelines add, and the one my prototype uses. In this test it flagged 3 of the 63 wrong invoices across the four models: one Gemini 3.8 Flash scan (cz06, gross total wrong), one GPT-5.6 Luna scan (cz08, where the issue date, buyer ID, net and VAT were wrong) and one Luna clean invoice (pt02, net total wrong).

The reason is where the errors were. Claude Haiku 5.5, Claude Sonnet 5.5 and Gemini 3.8 Flash made 32 wrong extractions between them, and only two had a wrong amount: the Gemini scan above, and a Haiku scan (cz09) where the net and VAT totals were slightly off but net plus VAT still equalled gross, so the check stayed silent. The rest misread a digit in a VAT ID, or in an invoice number such as FV-2026-0738 read as FV-2026-0758. GPT-5.6 Luna did get amounts wrong on 7 invoices, and on 5 of them its net, VAT and gross still added up. A model reads a total that is consistent with the rest of what it read, so an arithmetic check passes over most of its mistakes.

## Which checks catch the errors?

Two rules on the VAT IDs, both a few lines of code:

1. **The check digit.** A VAT ID ends in a check digit computed from the other digits: modulo 11 for the Czech company number behind a DIČ and for the Portuguese NIF, ISO 7064 for the German USt-IdNr. Libraries such as [python-stdnum](https://arthurdejong.org/python-stdnum/) implement all three. A misread digit almost always breaks it.
2. **Your own VAT ID.** On an incoming invoice, the buyer is you. Any buyer VAT ID that is not yours is wrong, or the invoice was not meant for you.

![32 wrong invoices, by what caught them. Claude Haiku 5.5, Claude Sonnet 5.5 and Gemini 3.8 Flash, 180 extractions. Caught by two rules on the VAT IDs: 31; Caught only by the model's own unsure flag: 0; Not caught by the rules or the flag: 1.](https://madsalt.tech/charts/en/invoice-data-extraction-with-ai-checks.svg)

*My test, 22 October 2026. Rules: VAT ID check digit and our own VAT ID. Flag: a field the model listed as unsure. The one case caught by neither was flagged by the totals check.*

The one left, the Gemini scan cz06, had a wrong gross total. No VAT ID rule can see that, and Gemini never lists unsure fields, so only the totals check caught it. I asked each model to list the fields it was unsure about:

| Model             | Wrong invoices | Caught by the two rules | Caught only by its unsure flag | Not caught | Right invoices it still flagged |
| ----------------- | -------------- | ----------------------- | ------------------------------ | ---------- | ------------------------------- |
| Claude Haiku 5.5  | 16             | 16                      | 0                              | 0          | 13 of 44                        |
| Claude Sonnet 5.5 | 8              | 8                       | 0                              | 0          | 19 of 52                        |
| Gemini 3.8 Flash  | 8              | 7                       | 0                              | 1          | 0 of 52                         |
| GPT-5.6 Luna      | 31             | 30                      | 0                              | 1          | 0 of 29                         |

Gemini 3.8 Flash never listed a field as unsure, so for it the checks are all you have; here the two rules caught 7 of its 8 wrong invoices and the totals check the eighth. The Claude models flagged too much rather than too little: Haiku flagged 13 of its 44 correct invoices (30%) and Sonnet 19 of 52 (37%), all of them scans; neither flagged a single clean invoice. That is the trade you want in accounts payable, where a clerk's glance costs less than a wrong payment.

Two more things showed up. GPT-5.6 Luna's errors were not limited to IDs: of its 31 wrong invoices, 30 were scans, 20 had a wrong invoice number, 13 a wrong issue date and 15 a wrong due date, and 15 amount fields were wrong on 7 invoices. Its one invoice in the "not caught" column is a clean one, pt02, with a wrong net total: the two rules and its unsure flag missed it, the totals check did not. And a check digit cannot catch every misread, because some wrong numbers are valid too; in this run no wrong VAT ID passed both rules.

## Which model should you use for invoice extraction?

On this set the scan results were: Claude Sonnet 5.5 22 of 30 with 8 wrong invoices at USD 7.18 per 1,000; Gemini 3.8 Flash also 22 of 30 with 8 wrong invoices at USD 3.51, about half the price; Claude Haiku 5.5 14 of 30 with 16 wrong at USD 0.43. Gemini matched Sonnet on accuracy at about half the price, but it never lists unsure fields: its wrong invoices were caught by the two VAT ID rules (7) and the totals check (1), where Sonnet also flagged 19 of its 52 correct invoices. With the checks in place, none of Haiku's or Sonnet's wrong invoices stayed silent, so the cheapest model means more wrong invoices to correct (16 against 8), not more errors in the ledger. If you send each invoice to a model, the model is rarely the large cost; the [cost of an AI agent](https://madsalt.tech/blog/how-much-does-an-ai-agent-cost/) works the same way. GPT-5.6 Luna is not usable on scans in this test.

That ranking is one test on 30 invoices. Run your own invoices through two or three models before you pick one.

## Do you need a model at all?

Often not, and in some countries less every year. Before you send a picture of an invoice to a model, check whether the data is already in the file:

- **Portugal.** Every invoice from certified software must carry a QR code with both NIFs, the date, the invoice number, the ATCUD and the taxable base and VAT per rate ([Portaria n.º 195/2020](https://diariodarepublica.pt/dr/detalhe/portaria/195-2020-140210523), [AT QR code specification](https://info.portaldasfinancas.gov.pt/pt/apoio_ao_contribuinte/Negocios/Faturacao/Regras_mecanismos_comunicacao/Comunicacao_de_series_ATCUD/Codigo_barras_bidimensional/Documents/Especificacoes_Tecnicas_Codigo_QR.pdf)). Reading the QR code gives you most of the fields exactly.
- **Germany.** Since 1 January 2025 a plain PDF no longer counts as an e-invoice between German businesses. Paper and PDF invoices are allowed during a transition, which ends for all businesses at the end of 2027 ([Federal Ministry of Finance FAQ](https://www.bundesfinanzministerium.de/Content/DE/FAQ/e-rechnung.html)). XRechnung and ZUGFeRD invoices carry structured data you can read directly.
- **Czechia.** Many accounting tools embed an ISDOC data layer inside the PDF; Fakturoid has added it to all its PDF invoices since December 2022 ([Fakturoid](https://www.fakturoid.cz/podpora/faktury/isdoc)).

So the order that works is: read the data layer if there is one, send only the rest to a model, then run the checks. The model is the fallback, not the first step.

![Read the data first, send the rest to a model. Two routes for an incoming invoice. Invoice with a data layer (QR code, e-invoice XML): Invoice → Read data → Checks → Ledger; Plain PDF or scan: Invoice → AI model → Checks → Clerk → Ledger.](https://madsalt.tech/charts/en/invoice-data-extraction-with-ai-flow.svg)

*Checks: VAT ID check digit, your own VAT ID, fields the model marked as unsure. Data layer: QR code in Portugal, XRechnung or ZUGFeRD in Germany, ISDOC in Czechia.*

## How do the fields get into Excel or your accounting system?

The [archive](https://madsalt.tech/blog/invoice-data-extraction-with-ai/invoice-extraction-test.zip) linked below already ships a CSV with every result, one row per extraction, so the output opens in Excel as it is. My [invoice extraction prototype](https://madsalt.tech/work/invoice-extraction/) works the same way at the app level: it exports the approved fields, and it exposes one API call that takes a PDF and returns the fields as JSON for each invoice.

From there, a CSV or XLSX file can be imported into an accounting system that accepts file imports, or the JSON can be passed on by a small script. The prototype runs on sample data, and I have not connected it to any specific accounting product. For a PDF-to-Excel run that includes line items and a two-sheet workbook, see [PDF invoice to Excel: when you need AI and when you don't](https://madsalt.tech/blog/pdf-invoice-to-excel/).

If you are still working out which part of your company is worth automating, I help you choose it and then build it: see [AI consultant for small business](https://madsalt.tech/services/ai-consultant-small-business/). Customer messages are the other common first job for AI in a small firm: [what a WhatsApp AI chatbot costs per reply](https://madsalt.tech/blog/whatsapp-ai-chatbot-for-business/), with Meta's fee counted.

## What does this test not prove?

- **The invoices are fictional.** One layout per country, generated by a script, with sample company names. Real supplier invoices vary far more.
- **The scans are simulated.** Blur, rotation, noise and JPEG compression on a clean render, not paper through a scanner or a phone photo.
- **One call per invoice, one set of 30.** Results vary between sets a lot. This article first ran on another set of 30 invoices, where the scan results for Haiku, Sonnet and Gemini were 22, 22 and 17 of 30; on this set they are 14, 22 and 22. Each country has one buyer VAT ID repeated on 10 invoices, so one misread string can break up to 10 invoices at once.
- **Prices change.** The costs are what OpenRouter billed on 22 October 2026.
- **Nine fields only.** No line items, IBANs or payment terms.

## How to repeat it on your own invoices

1. Pick 30 to 50 real invoices, including the worst scans you receive. Write down the true values by hand.
2. Use one prompt and a fixed output schema with a list of unsure fields, at temperature 0.
3. Run two or three models and record the billed cost per call, not the list price.
4. Score whole invoices, not single fields: one wrong digit in a VAT ID is a wrong invoice.
5. Add the check-digit rule and the own-VAT-ID rule, and measure what they catch.
6. Read the data layer first wherever your suppliers' software provides one.

The scripts, the generated invoices and every result are in [one archive](https://madsalt.tech/blog/invoice-data-extraction-with-ai/invoice-extraction-test.zip): the generator, the runner, the scorer and a CSV with all 240 extractions. If you want this built into your accounts payable process, it is part of [workflow automation](https://madsalt.tech/services/workflow-automation/).

If you want extraction like this added to an accounts payable process you already run, I do that under [AI integration for existing products](https://madsalt.tech/services/ai-integration/).

See also: [Document management software for small business: 8 priced](https://madsalt.tech/blog/document-management-software-for-small-business/).

## My similar case

I built a service that turns a property certificate that took 2–3 weeks and cost EUR 200–300 into one that takes 2–3 minutes and costs EUR 99, with scripts and vision AI. The build is in the [property document automation case](https://madsalt.tech/work/property-document-automation/).

Extracting invoice data by hand or with a tool you don't trust? Write to me and we'll work out the best option for you.

Still typing invoice data by hand?

Tell me what you have now and what you need. I'll reply with the option I'd pick.

[Write to me](https://madsalt.tech/#contact)
