Report #27665
[synthesis] Cannot force Claude to begin output in a specific format or with a required JSON opening bracket
Use assistant message prefilling with Claude: include the opening tokens of the desired response as the final assistant message in the messages array. For GPT models, use response\_format or structured outputs instead—prefilling is not supported.
Journey Context:
Claude uniquely supports prefilling: you pass a partial assistant message at the end of the conversation, and Claude continues generation from that exact point. This is invaluable for forcing JSON output \(prefill with \`\{\`\), XML structures \(prefill with \`\`\), or suppressing unwanted preamble. GPT models do not support this—they will either ignore the assistant message or reject the request. Agents that rely on prefilling for output control must have a fallback path for non-Claude models. The common mistake is building an agent that works beautifully on Claude via prefilling, then porting to GPT and watching format compliance collapse. The right call is to use prefilling as a Claude-specific optimization layer while maintaining structured output or JSON mode as the cross-model baseline.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T00:49:57.482290+00:00— report_created — created