Use GPT-6.2 Structured Outputs to constrain the fields a successful response can return, then validate each value before it reaches an expense system. A receipt can fit the expected response shape even when the amount was read incorrectly. The useful workflow treats shape and factual accuracy as two checks. OpenAI’s Structured Outputs guide · Responses API reference
Design the smallest useful receipt record
Require four fields in your schema. Use merchant and currency as text, total_cents as an integer or null, and needs_review as a boolean. Add null to any other field the reviewer is allowed to leave blank. Tell the model to choose null for an unreadable field and to avoid inferring totals from an incomplete photo.
For a synthetic receipt with the printed line “Bright Corner Books USD 12.50,” an expected record is {"merchant":"Bright Corner Books","currency":"USD","total_cents":1250,"needs_review":false}. After parsing, compare the total with the highlighted receipt line or a separate reviewer’s entry. Keep the receipt image with the result so a correction is traceable.
A recipe that deliberately fails bad inputs
- Run a clear receipt, a crop with no total, and a receipt that displays a subtotal and a final amount. Write the expected values before running the model.
- Put missing totals and mismatched currencies into a review queue. Keep the returned record separate from anything exported to accounting.
- Handle refusals and incomplete responses explicitly. In OpenAI’s implementation, a completed response following the schema is a different outcome from a refusal or an interrupted request. Structured Outputs error handling
Make the last test a receipt you expect the model to send for review. An extraction flow that can stop on an unreadable amount is more useful than one that always supplies a number.
Separate the extracted fields from the payment decision
Take a fictional receipt with a subtotal of $18.00, tax of $1.44, and a grand total of $19.44. A result can meet the schema while assigning $18.00 to the grand total. Include a currency field and an integer for an amount in the currency's minor unit. For this U.S. dollar example, that lets the application compare 1800 plus 144 with 1944 without mixing text formatting and arithmetic. The schema can constrain the shape. The application has to enforce the arithmetic rule and send ambiguous cases to a person.
Add another example with two large amounts. A card slip can show the amount charged beside a blank tip line. Ask the model to locate the printed final amount and return a null when the document does not support a value. Write down whether the input contains a clearly marked total before scoring it. Insisting on a number every time creates a tempting opportunity for the model to fill a gap. Refer to the Structured Outputs guide for behavior such as refusals and supported schema constraints.
Handle incomplete responses before reading the fields
An application should look at the response status and the returned content before attempting to parse the record. A timed-out request or a refusal belongs in the operational queue, where the team can see why a record failed. A valid record with a missing currency belongs in the document queue. Mixing those two failures makes it hard to tell whether changing the prompt, improving the source scan, or fixing retry behavior will help.
Leave room for a human decision in the interface. Show the extracted amounts beside the original line items and make the current status obvious. If the reviewer edits a value, recalculate the total and retain the corrected value separately from the proposed one. Save enough information to reproduce the outcome later, with access appropriate to the document. Keep posting or paying a receipt as a distinct, verified step.
Sources
By VUZURAN. Hypothetical examples describe situations we made up. References to VUZURAN services describe our own work.
