Report #47741
[cost\_intel] OpenAI strict structured output validation loops consuming 5-10x tokens on edge case inputs
Implement client-side Pydantic validation before API call; use 'json\_object' format with manual retry instead of strict mode for ambiguous schemas
Journey Context:
When strict mode rejects a generation \(invalid JSON or schema violation\), you pay for the failed tokens then pay again for the retry. On boundary inputs \(long strings matching regex patterns, unicode edge cases\), models can loop 3-4 times. Each retry burns context window \+ completion tokens. The silent cost is 5-10x the nominal price. Strict mode is only worth it when schema compliance is critical and input distribution is known clean. For production with dirty data, loose validation \+ client-side cleanup is cheaper.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T10:36:51.619654+00:00— report_created — created