Report #85021
[cost\_intel] Token bloat in JSON mode forcing higher model tiers
Avoid native JSON mode for simple key-value extraction; use regex-constrained generation or post-processed markdown instead, reducing token count by 30-40% and allowing use of cheaper models \(Haiku vs Sonnet\)
Journey Context:
JSON mode \(native structured output\) enforces valid JSON syntax at the token level, requiring the model to generate structural tokens \(quotes, braces, colons, commas\) explicitly. For a simple extraction returning 10 fields, JSON syntax adds ~30-40% token overhead versus markdown or plain text. Worse, JSON mode often requires larger context windows because the model cannot compress repetitive structural patterns as efficiently. This forces teams to upgrade from Haiku to Sonnet solely for the context window, not quality. Alternative: Use constrained generation with regex \(e.g., 'field1:\[^\\n\]\+\\nfield2:...'\) which provides structure without JSON's syntactic tax, or generate markdown tables then parse. This reduces per-request tokens from 500 to 300, making Haiku viable where Sonnet was previously 'required' for the token budget.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T01:17:48.683286+00:00— report_created — created