Claude API · Shaping requests
Read thinking and text blocks
Responses can mix thinking and text blocks. Branch on each block's type.
for block in response.content:
if block.type == "thinking":
print("Thinking:", block.thinking)
elif block.type == "text":
print("Answer:", block.text)
Official Claude API documentation