Report #86823
[cost\_intel] Complex JSON schemas in structured output mode silently inflating output token costs
Minimize schema complexity. Remove optional fields the model will usually null-fill, flatten nested objects where possible, and use short field names. For simple extractions \(3-5 fields\), consider free-text output with regex post-processing instead of structured output mode.
Journey Context:
Structured output modes require the model to generate valid JSON conforming to your schema. A schema with 20 fields \(many optional\) causes the model to generate JSON with numerous null/empty values, bloating output tokens 2-4x beyond the actual information content. At output token prices \(typically 3-5x input prices\), this is disproportionately expensive. Example: extracting name, date, and amount from a receipt takes ~30 tokens as plain text but ~120 tokens as a fully-specified JSON object with schema-mandated wrapper fields, type indicators, and null optionals. At GPT-4o output pricing \($10/M\), processing 1M receipts costs $1,200 for verbose JSON vs $300 for plain text — a $900 difference from schema verbosity alone. Short field names \("amt" vs "transaction\_amount"\) save another 15-20%.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T04:19:24.161993+00:00— report_created — created