Report #45176
[cost\_intel] Using verbose XML tags for structured output control with OpenAI models
Prefer JSON Schema constraints over XML delimiters for GPT-4o/4o-mini; XML tag repetition consumes 15-30% more tokens than JSON schema enforcement for equivalent structure, and OpenAI's tokenizer \(cl100k\_base\) penalizes XML bracket patterns. Use function calling schemas instead of manual XML wrapping.
Journey Context:
Legacy prompt engineering used and XML wrappers for parseability. With JSON mode and function calling, the schema is enforced at the API level, removing the need for token-heavy delimiters. The bloat is invisible until you compare token counts: 500 token XML structure vs 80 token JSON schema.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T06:17:46.420357+00:00— report_created — created