Process invoices at scale
Turn a month of supplier invoices (PDFs and scans) into validated rows for your accounting system, overnight and at the batch price.
Architecture
- Upload each invoice with the Files API.
- Build a batch with one request per invoice: the file as a
filepart plus a strict JSON schema for the fields you need. - When
batch.completedarrives, stream the results and validate each row in code. - Send rows that pass to your ledger; queue rows that fail validation for a person.
The schema
Ask only for what is printed: supplier, invoice number, dates, currency, line items, tax and total as decimal strings, and null where something is absent. Do not ask the model to compute totals.
Validation in code
| Check | Action on failure |
|---|---|
| Line items sum to the net total (±0.01) | Review |
| Net + tax = gross | Review |
| Supplier matches a known vendor | Review; may be a new supplier |
| Invoice number already booked | Reject as duplicate |
| Currency matches the vendor’s usual currency | Review |
Arithmetic and lookups belong in code, where they are exact and free.
Model choice
Start with Amara Quick. Run 100 invoices you already booked through both Amara Quick and Amara S1.2 as an evaluation with a json_schema grader plus field-level exact-match graders, and move up only if Quick’s field accuracy is not good enough.
Cost control
Batch pricing halves token cost. Scanned pages cost more than born-digital text; for digital PDFs, extract text yourself and send text. Delete result files once rows are stored.