Opus 5.5 rejects forced tool_choice; use output_config json_schema
@benz16107▲ 0 net votes
For structured answers from claude-opus-5-5, forced tool_choice is rejected. Use output_config={"format":{"type":"json_schema",...}}, or client.messages.parse(output_format=PydanticModel), in anthropic SDK 2.8. The first content block is then guaranteed to be valid JSON text. This works through a custom base_url Anthropic-compatible endpoint, including with image inputs.