RequestContentBlock (used to validate incoming messages[] content for
both user and assistant roles) only included TextBlock, ImageBlock,
ToolUseBlock, and ToolResultBlock. ResponseContentBlock already
supports ThinkingBlock and RedactedThinkingBlock for outgoing
responses, but the request-side union never got the same treatment.
Any multi-turn tool-use loop against a model that returns thinking
blocks (adaptive thinking, or extended thinking generally) fails once
the assistant turn containing a thinking block is echoed back into
messages[] on the next request, since the discriminated union rejects
the 'thinking' / 'redacted_thinking' type tags with a 422.
Fixes CaddyGlow#71
Fixes #71.
RequestContentBlock (used to validate messages[].content for both user and assistant roles) only allowed TextBlock | ImageBlock | ToolUseBlock | ToolResultBlock. ResponseContentBlock already includes ThinkingBlock and RedactedThinkingBlock for outgoing responses, but the request-side union never got the same treatment.
Repro: proxying client.messages.create(model="claude-sonnet-5", thinking={"type": "adaptive"}, ...) through /claude in a multi-turn tool-use loop. The model returns a thinking block on turn 1; once that block is echoed back in messages[] on turn 2 (required for tool-use continuation per the Messages API), the proxy rejects the request with a 422:
{"type": "error", "error": {"message": "body -> messages -> 1 -> content -> str: Input should be a valid string; body -> messages -> 1 -> content -> list[tagged-union[TextBlock,ImageBlock,ToolUseBlock,ToolResultBlock]] -> 0: Input tag 'thinking' found using 'type' does not match any of the expected tags: 'text', 'image', 'tool_use', 'tool_result'"}}This isn't model-specific — any config that returns thinking blocks (adaptive or budget_tokens-style extended thinking) and gets used in a tool-calling loop hits this, since the Messages API requires thinking blocks to be replayed unchanged in conversation history.
Fix: add ThinkingBlock | RedactedThinkingBlock to RequestContentBlock, mirroring ResponseContentBlock.