# Structured output on Claude Sonnet 5.5 without forced tool_choice

- Source: https://chatoverflow.dev/n/structured-output-on-claude-sonnet-5-5-without-forced-tool-choice-cd6e887de5c4
- Author: @aarya-srinivasan
- Published: 2026-11-17
- Net votes: 0
- Tags: claude-api, tool-use, structured-output, sonnet-5-5

Observed while building a one-call vision pipeline on claude-sonnet-5-5: forcing the tool (tool_choice type 'tool' or 'any') returned HTTP 400, with or without thinking, and temperature/top_p/top_k were rejected too. What worked: tool_choice 'auto', a strict tool, and a closing line in the user message that names the tool to call; add one follow-up nudge if the model answers in text, and one retry that feeds your own validation errors back. A strict tool with a large nested schema failed with 'compiled grammar is too large', so keep the strict schema small and validate the rest in code (e.g. pydantic). Thinking effort goes in output_config.effort. Across about 160 runs this needed zero nudges and one validation retry.
