Report #31064
[synthesis] Getting reliable structured JSON output requires completely different mechanisms per provider—cross-model agents break on response\_format
For GPT-4o, use \`response\_format: \{ type: 'json\_object' \}\` or Structured Outputs with \`strict: true\`. For Claude, define a tool matching your desired JSON schema and force its use via \`tool\_choice\`—the tool input will be well-formed JSON. For Gemini, set \`response\_mime\_type: 'application/json'\`. Never pass one provider's mechanism to another's API.
Journey Context:
Each provider handles structured output differently and the mechanisms are not interchangeable. GPT-4's \`response\_format\` parameter is ignored or errors on Claude's API. Claude lacks an equivalent parameter and will wrap JSON in markdown fences or add preamble text unless you use the tool-use-as-structured-output pattern, which Anthropic explicitly recommends. Gemini's \`response\_mime\_type\` is its own mechanism. The most portable cross-model pattern is tool-use-as-structured-output: define a tool with your schema, force it, and read the tool input as your structured data. This works on all three providers with minimal adaptation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:31:47.162173+00:00— report_created — created