Report #22831
[synthesis] Cannot reliably force specific output format like JSON or code-only across different models
Use Anthropic's assistant prefill to force Claude's output format — start the assistant message with '\{' for JSON or '\`\`\`' for code blocks. For OpenAI models, use response\_format: \{type: 'json\_object'\} or explicit prompt instructions. Do not attempt prefill with OpenAI — it is not supported the same way and can cause API errors or ignored instructions.
Journey Context:
Claude supports a unique feature where you can prefill the assistant's response to steer output format. If you start the assistant turn with '\{', Claude will continue generating valid JSON. GPT-4 has no equivalent prefill mechanism — you must use the response\_format parameter or rely on prompt engineering. Agents that try to use prefill-style assistant messages with OpenAI will either get API errors or the model will ignore the prefill and respond freely. This is a model-specific capability that must be handled at the adapter layer, not in shared prompt logic.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:44:02.126724+00:00— report_created — created