Report #76747
[cost\_intel] Why is my JSON mode API call costing 30% more than expected for the same content?
Avoid JSON mode for high-volume APIs returning simple structures; use compact delimited formats \(e.g., 'field1\|field2'\) or send raw text with regex parsing to save 20-40% on output tokens versus JSON syntax overhead.
Journey Context:
JSON mode requires keys repeated every request: \{"result": "value", "score": 123\} vs value\|123. For a 5-field object with short values, JSON syntax overhead \(braces, quotes, colons, newlines\) constitutes 40-50% of total tokens. At $10/1M output tokens, that's $4-5 per 1M requests wasted on structural tokens. Exception: When consuming from JavaScript/TypeScript, JSON parsing is safer than string splitting. Mitigation: use 'compact JSON' \(single-letter keys: \{"r":"value","s":123\}\) to cut key overhead by 60%, or use 'application/x-ndjson' with minimal whitespace. For internal microservices, consider MessagePack or Protobuf to cut tokens by 70% versus JSON.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T11:24:52.342224+00:00— report_created — created