Extract Invoice Line Items

ExtractionDifficulty: MEDIUM11 models comparedTotal cost: $0.018083

Prompt

Extract all line items from the following messy invoice text and return them as a JSON array. Each object should have: item_number, description, quantity, unit_price, and total. If a field is missing or unclear, use null. Be careful — some lines have typos, inconsistent formatting, and one line item has a calculation error that you should preserve as-is (extract what's written, not the corrected value).

---

INVOICE #INV-2094
Date: March 14, 2024
Bill To: Acme Corp

Line Items:
1. Widget Pro X   qty: 3   @$45.00 ea   Total: $135.00
2. Deluxe Mounting Bracket (set of 4) - 1 unit -- $22.50 -- $22.50
3. instalation service   2hrs   $85/hr   $170
4. Cable Harness Assembly   Qty 10 @ 12.99   Totl: $139.90
5.   Replacement Filter (HEPA)  x1   unit price: $18.00    $18.00
6. Calibration Fee         --         $200.00
7. Shipping & Handling                              $15.75
8. Extended Warranty - 2yr   1   $75.00   $175.00

Subtotal: $876.15
---

Expected Output

[{"item_number": 1, "description": "Widget Pro X", "quantity": 3, "unit_price": 45.00, "total": 135.00}, {"item_number": 2, "description": "Deluxe Mounting Bracket (set of 4)", "quantity": 1, "unit_price": 22.50, "total": 22.50}, {"item_number": 3, "description": "instalation service", "quantity": 2, "unit_price": 85.00, "total": 170.00}, {"item_number": 4, "description": "Cable Harness Assembly", "quantity": 10, "unit_price": 12.99, "total": 139.90}, {"item_number": 5, "description": "Replacement Filter (HEPA)", "quantity": 1, "unit_price": 18.00, "total": 18.00}, {"item_number": 6, "description": "Calibration Fee", "quantity": null, "unit_price": null, "total": 200.00}, {"item_number": 7, "description": "Shipping & Handling", "quantity": null, "unit_price": null, "total": 15.75}, {"item_number": 8, "description": "Extended Warranty - 2yr", "quantity": 1, "unit_price": 75.00, "total": 175.00}]

Model Responses

Claude Opus 4.6

Unrated
8,110ms949 tokens
```json [ { "item_number": 1, "description": "Widget Pro X", "quantity": 3, "unit_price": 45.00, "total": 135.00 }, { "item_number": 2, "description": "Deluxe Mounting Bracket (set of 4)", "quantity": 1, "unit_price": 22.50, "total": 22.50 }, { "item_number": 3, "description": "instalation service", "quantity": 2, "unit_price": 85.00, "total": 170.00 }, { "item_number": 4, "description": "Cable Harness Assembly", "quantity": 10, "unit_price": 12.99, "total": 139.90 }, { "item_number": 5, "description": "Replacement Filter (HEPA)", "quantity": 1, "unit_price": 18.00, "total": 18.00 }, { "item_number": 6, "description": "Calibration Fee", "quantity": null, "unit_price": null, "total": 200.00 }, { "item_number": 7, "description": "Shipping & Handling", "quantity": null, "unit_price": null, "total": 15.75 }, { "item_number": 8, "description": "Extended Warranty - 2yr", "quantity": 1, "unit_price": 75.00, "total": 175.00 } ] ``` **Notes:** - **Item 3** ("instalation service"): The typo in "instalation" is preserved as written. - **Item 4**: "Totl" is a typo for "Total"; the value $139.90 is extracted as-is (correct math would be $129.90 for 10 × $12.99). - **Item 8**: The total is listed as $175.00 despite qty 1 × $75.00 = $75.00 — this is the **calculation error** preserved as-is from the invoice. - **Items 6 & 7**: No explicit quantity or unit price was provided, so those fields are `null`.

GPT-4.1

Unrated
3,667ms677 tokens
```json [ { "item_number": 1, "description": "Widget Pro X", "quantity": 3, "unit_price": 45.00, "total": 135.00 }, { "item_number": 2, "description": "Deluxe Mounting Bracket (set of 4)", "quantity": 1, "unit_price": 22.50, "total": 22.50 }, { "item_number": 3, "description": "instalation service", "quantity": 2, "unit_price": 85.00, "total": 170.00 }, { "item_number": 4, "description": "Cable Harness Assembly", "quantity": 10, "unit_price": 12.99, "total": 139.90 }, { "item_number": 5, "description": "Replacement Filter (HEPA)", "quantity": 1, "unit_price": 18.00, "total": 18.00 }, { "item_number": 6, "description": "Calibration Fee", "quantity": null, "unit_price": null, "total": 200.00 }, { "item_number": 7, "description": "Shipping & Handling", "quantity": null, "unit_price": null, "total": 15.75 }, { "item_number": 8, "description": "Extended Warranty - 2yr", "quantity": 1, "unit_price": 75.00, "total": 175.00 } ] ```

GPT-4.1 Mini

Unrated
6,560ms677 tokens
```json [ { "item_number": 1, "description": "Widget Pro X", "quantity": 3, "unit_price": 45.00, "total": 135.00 }, { "item_number": 2, "description": "Deluxe Mounting Bracket (set of 4)", "quantity": 1, "unit_price": 22.50, "total": 22.50 }, { "item_number": 3, "description": "instalation service", "quantity": 2, "unit_price": 85.00, "total": 170.00 }, { "item_number": 4, "description": "Cable Harness Assembly", "quantity": 10, "unit_price": 12.99, "total": 139.90 }, { "item_number": 5, "description": "Replacement Filter (HEPA)", "quantity": 1, "unit_price": 18.00, "total": 18.00 }, { "item_number": 6, "description": "Calibration Fee", "quantity": null, "unit_price": null, "total": 200.00 }, { "item_number": 7, "description": "Shipping & Handling", "quantity": null, "unit_price": null, "total": 15.75 }, { "item_number": 8, "description": "Extended Warranty - 2yr", "quantity": 1, "unit_price": 75.00, "total": 175.00 } ] ```

GPT-4.1 Nano

Unrated
16,091ms673 tokens
[ { "item_number": 1, "description": "Widget Pro X", "quantity": 3, "unit_price": 45.00, "total": 135.00 }, { "item_number": 2, "description": "Deluxe Mounting Bracket (set of 4)", "quantity": 1, "unit_price": 22.50, "total": 22.50 }, { "item_number": 3, "description": "instalation service", "quantity": 2, "unit_price": 85.00, "total": 170.00 }, { "item_number": 4, "description": "Cable Harness Assembly", "quantity": 10, "unit_price": 12.99, "total": 139.90 }, { "item_number": 5, "description": "Replacement Filter (HEPA)", "quantity": 1, "unit_price": 18.00, "total": 18.00 }, { "item_number": 6, "description": "Calibration Fee", "quantity": null, "unit_price": null, "total": 200.00 }, { "item_number": 7, "description": "Shipping & Handling", "quantity": null, "unit_price": null, "total": 15.75 }, { "item_number": 8, "description": "Extended Warranty - 2yr", "quantity": 1, "unit_price": 75.00, "total": 175.00 } ]

o3

Unrated
15,289ms2434 tokens
```json [ { "item_number": 1, "description": "Widget Pro X", "quantity": 3, "unit_price": 45.00, "total": 135.00 }, { "item_number": 2, "description": "Deluxe Mounting Bracket (set of 4)", "quantity": 1, "unit_price": 22.50, "total": 22.50 }, { "item_number": 3, "description": "instalation service", "quantity": 2, "unit_price": 85.00, "total": 170.00 }, { "item_number": 4, "description": "Cable Harness Assembly", "quantity": 10, "unit_price": 12.99, "total": 139.90 // calculation error kept as-is }, { "item_number": 5, "description": "Replacement Filter (HEPA)", "quantity": 1, "unit_price": 18.00, "total": 18.00 }, { "item_number": 6, "description": "Calibration Fee", "quantity": 1, "unit_price": 200.00, "total": 200.00 }, { "item_number": 7, "description": "Shipping & Handling", "quantity": null, "unit_price": null, "total": 15.75 }, { "item_number": 8, "description": "Extended Warranty - 2yr", "quantity": 1, "unit_price": 75.00, "total": 175.00 } ] ```

o3 Mini

Unrated
21,058ms3435 tokens
[ { "item_number": 1, "description": "Widget Pro X", "quantity": 3, "unit_price": "$45.00", "total": "$135.00" }, { "item_number": 2, "description": "Deluxe Mounting Bracket (set of 4)", "quantity": 1, "unit_price": "$22.50", "total": "$22.50" }, { "item_number": 3, "description": "instalation service", "quantity": "2hrs", "unit_price": "$85/hr", "total": "$170" }, { "item_number": 4, "description": "Cable Harness Assembly", "quantity": 10, "unit_price": "12.99", "total": "$139.90" }, { "item_number": 5, "description": "Replacement Filter (HEPA)", "quantity": 1, "unit_price": "$18.00", "total": "$18.00" }, { "item_number": 6, "description": "Calibration Fee", "quantity": null, "unit_price": null, "total": "$200.00" }, { "item_number": 7, "description": "Shipping & Handling", "quantity": null, "unit_price": null, "total": "$15.75" }, { "item_number": 8, "description": "Extended Warranty - 2yr", "quantity": 1, "unit_price": "$75.00", "total": "$175.00" } ]

o4 Mini

Unrated
11,850ms1842 tokens
[ { "item_number": 1, "description": "Widget Pro X", "quantity": 3, "unit_price": 45.00, "total": 135.00 }, { "item_number": 2, "description": "Deluxe Mounting Bracket (set of 4)", "quantity": 1, "unit_price": 22.50, "total": 22.50 }, { "item_number": 3, "description": "instalation service", "quantity": 2, "unit_price": 85.00, "total": 170.00 }, { "item_number": 4, "description": "Cable Harness Assembly", "quantity": 10, "unit_price": 12.99, "total": 139.90 }, { "item_number": 5, "description": "Replacement Filter (HEPA)", "quantity": 1, "unit_price": 18.00, "total": 18.00 }, { "item_number": 6, "description": "Calibration Fee", "quantity": null, "unit_price": null, "total": 200.00 }, { "item_number": 7, "description": "Shipping & Handling", "quantity": null, "unit_price": null, "total": 15.75 }, { "item_number": 8, "description": "Extended Warranty - 2yr", "quantity": 1, "unit_price": 75.00, "total": 175.00 } ]

GPT-4o Mini

Partial
14,067ms686 tokens$0.000281
```json [ { "item_number": "1", "description": "Widget Pro X", "quantity": 3, "unit_price": 45.00, "total": 135.00 }, { "item_number": "2", "description": "Deluxe Mounting Bracket (set of 4)", "quantity": 1, "unit_price": 22.50, "total": 22.50 }, { "item_number": "3", "description": "instalation service", "quantity": 2, "unit_price": 85.00, "total": 170.00 }, { "item_number": "4", "description": "Cable Harness Assembly", "quantity": 10, "unit_price": 12.99, "total": "139.90" // Preserving the original calculation error }, { "item_number": "5", "description": "Replacement Filter (HEPA)", "quantity": 1, "unit_price": 18.00, "total": 18.00 }, { "item_number": "6", "description": "Calibration Fee", "quantity": null, "unit_price": null, "total": 200.00 }, { "item_number": "7", "description": "Shipping & Handling", "quantity": null, "unit_price": null, "total": 15.75 }, { "item_number": "8", "description": "Extended Warranty - 2yr", "quantity": 1, "unit_price": 75.00, "total": 175.00 } ] ```

Verdict note: number in json are string and should be numbers

1 community vote

Claude Haiku 4.5

Correct
4,933ms789 tokens$0.002653
```json [ { "item_number": 1, "description": "Widget Pro X", "quantity": 3, "unit_price": 45.00, "total": 135.00 }, { "item_number": 2, "description": "Deluxe Mounting Bracket (set of 4)", "quantity": 1, "unit_price": 22.50, "total": 22.50 }, { "item_number": 3, "description": "instalation service", "quantity": 2, "unit_price": 85.00, "total": 170.00 }, { "item_number": 4, "description": "Cable Harness Assembly", "quantity": 10, "unit_price": 12.99, "total": 139.90 }, { "item_number": 5, "description": "Replacement Filter (HEPA)", "quantity": 1, "unit_price": 18.00, "total": 18.00 }, { "item_number": 6, "description": "Calibration Fee", "quantity": null, "unit_price": null, "total": 200.00 }, { "item_number": 7, "description": "Shipping & Handling", "quantity": null, "unit_price": null, "total": 15.75 }, { "item_number": 8, "description": "Extended Warranty - 2yr", "quantity": 1, "unit_price": 75.00, "total": 175.00 } ] ```

1 community vote · 100% correct

GPT-4o

Correct
4,676ms677 tokens$0.004595
```json [ { "item_number": 1, "description": "Widget Pro X", "quantity": 3, "unit_price": 45.00, "total": 135.00 }, { "item_number": 2, "description": "Deluxe Mounting Bracket (set of 4)", "quantity": 1, "unit_price": 22.50, "total": 22.50 }, { "item_number": 3, "description": "instalation service", "quantity": 2, "unit_price": 85.00, "total": 170.00 }, { "item_number": 4, "description": "Cable Harness Assembly", "quantity": 10, "unit_price": 12.99, "total": 139.90 }, { "item_number": 5, "description": "Replacement Filter (HEPA)", "quantity": 1, "unit_price": 18.00, "total": 18.00 }, { "item_number": 6, "description": "Calibration Fee", "quantity": null, "unit_price": null, "total": 200.00 }, { "item_number": 7, "description": "Shipping & Handling", "quantity": null, "unit_price": null, "total": 15.75 }, { "item_number": 8, "description": "Extended Warranty - 2yr", "quantity": 1, "unit_price": 75.00, "total": 175.00 } ] ```

1 community vote · 100% correct

Claude Sonnet 4.6

Partial
9,032ms962 tokens$0.010554
```json [ { "item_number": 1, "description": "Widget Pro X", "quantity": 3, "unit_price": 45.00, "total": 135.00 }, { "item_number": 2, "description": "Deluxe Mounting Bracket (set of 4)", "quantity": 1, "unit_price": 22.50, "total": 22.50 }, { "item_number": 3, "description": "instalation service", "quantity": 2, "unit_price": 85.00, "total": 170.00 }, { "item_number": 4, "description": "Cable Harness Assembly", "quantity": 10, "unit_price": 12.99, "total": 139.90 }, { "item_number": 5, "description": "Replacement Filter (HEPA)", "quantity": 1, "unit_price": 18.00, "total": 18.00 }, { "item_number": 6, "description": "Calibration Fee", "quantity": null, "unit_price": null, "total": 200.00 }, { "item_number": 7, "description": "Shipping & Handling", "quantity": null, "unit_price": null, "total": 15.75 }, { "item_number": 8, "description": "Extended Warranty - 2yr", "quantity": 1, "unit_price": 75.00, "total": 175.00 } ] ``` **Notes:** - **Item 3:** Typo `"instalation"` preserved as written. - **Item 4:** `"Totl:"` typo preserved in source; the total `$139.90` is mathematically correct (10 × $12.99 = $129.90 would actually be the correct value — but `$139.90` is what's written on the invoice and is preserved as-is). - **Item 6 & 7:** No quantity or unit price was provided; fields set to `null`. - **Item 8:** This contains the deliberate calculation error — 1 unit × $75.00 should equal $75.00, but the invoice states **$175.00**, which is preserved exactly as written.

Verdict note: JSON is correct but additional info that was not requested.

1 community vote

Cost & Performance Comparison

ModelLatencyTokensCostVerdict
Claude Opus 4.68,110ms949
GPT-4.13,667ms677
GPT-4.1 Mini6,560ms677
GPT-4.1 Nano16,091ms673
o315,289ms2,434
o3 Mini21,058ms3,435
o4 Mini11,850ms1,842
GPT-4o Mini14,067ms686$0.000281Partial
Claude Haiku 4.54,933ms789$0.002653Correct
GPT-4o4,676ms677$0.004595Correct
Claude Sonnet 4.69,032ms962$0.010554Partial
Extract Invoice Line Items — Model Lab — AISpendGuard