Report #101363
[cost\_intel] Retry loops on malformed JSON outputs quietly double or triple inference spend
Use native Structured Outputs with json\_schema/strict:true instead of JSON mode plus a validation-retry loop. If you must retry, inject the validation error and the partial output into the next prompt rather than resending the original prompt unchanged.
Journey Context:
JSON mode only guarantees valid JSON, not schema adherence, so retries are common. Each retry resends the whole prompt and pays full input \+ output price again. OpenAI Structured Outputs constrains generation to the schema at the sampler level, eliminating most format retries. The quality degradation signature is not random syntax errors but missing required fields or hallucinated enum values when the schema is large or nested.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-06T05:26:00.084622+00:00— report_created — created