Sujahath Siddeek
All work

TeardownOct 2026Solo project

Energy Bill Extractor

Upload an electricity bill as a PDF or a phone photo and get checked JSON back. The vision model only reads. Plain code does the maths.

Energy Bill Extractor: a phone photo of a synthetic bill on the left, the extracted and checked fields on the right.
A phone photo of a synthetic bill, read into fields. The MPAN check digit and every sum are verified by code.
field accuracy on damaged phone photos
97.5%
bills with a planted error caught
36/36
per bill, about 2.6 s each
$0.013

Plant an error

These are the fields a model read from one of the project's synthetic bills. Edit any value, or plant one of the errors from the evaluation, and the checks re-run in your browser, including the real MPAN check-digit algorithm.

Tidewell Energy

Synthetic sample. What the model read, field by field.

model output, editable
Account
Usage
Charges

Plant an error from the evaluation:

All checks passed

8/8
  • Passed: MPAN check digitCheck digit is valid.
  • Passed: Billing period matches its dates31 days.
  • Passed: Meter readings match usage25098 − 24725 = 373 kWh.
  • Passed: Energy charge = usage × unit rate£88.70.
  • Passed: Standing charge = days × daily rate£16.54.
  • Passed: Charges add up£105.24 before VAT.
  • Passed: VAT is 5% of the subtotal£5.26.
  • Passed: Total = subtotal + VAT£110.50.
{
  "needs_review": false,
  "flagged_fields": [],
  "checks_passed": "8/8"
}

8 of the project's 11 checks, running in your browser.

The problem

Switching energy supplier means copying a supply number, tariff, unit rates and usage off an old bill. A model can read the bill, but one misread digit quietly mis-prices a customer.

How I built it

The model copies each field exactly as printed, or null if it isn't there. It never does arithmetic.

Code does the rest: unit conversion, reconciling charges, meter readings and totals, and the MPAN check digit. Eleven checks in all. Any failure sets needs_review and names the fields a person should look at.

A strict Pydantic schema with one repair attempt, retries with backoff, and input guards. The file type comes from its bytes, damaged PDFs and decompression bombs are rejected, and bill contents never reach the logs.

The model provider is one environment variable: Claude, any OpenAI-compatible API, or a local model through Ollama.

What happened

  • Claude Sonnet 5.5: 100% field accuracy on clean PDFs, scans and photos, and 97.5% across 96 photos from clean to severely damaged. About 2.6 s and $0.013 per bill.
  • Haiku 5.5 caught 36 of 36 bills with a planted error, at about $0.0008 per bill.
  • A local Qwen2.5-VL 3B reached 88.4% at no cost, which shows where the line is.
  • What the checks miss: a misread name or an omitted optional field. 67% of the models' own errors were flagged, with no false alarms.
  • More than 200 tests that run without a network. Evaluated on synthetic bills only, because real bills are personal data.

Architecture

PDF or photoPreprocesssniff, rotateVision modelreads onlySchemaPydantic11 checkscode does mathsJSONneeds_reviewrepair once
A bill with swapped meter readings, flagged for review with the affected fields highlighted.
A planted error: swapped meter readings are flagged and the fields are highlighted.
  • Python
  • FastAPI
  • Pydantic
  • Vision LLMs
  • Ollama
  • Docker
  • GitHub Actions

Next teardown

evalX

pytest for AI behaviour