In a standard Claude API response, where does the actual text content of Claude's response appear?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Claude's response text lives in response.content[0].text — the content is an array of content blocks, and for a simple text response, the first block is type='text'.
Full explanation below image
Full Explanation
The Anthropic Messages API response structure: the response object contains a 'content' array. Each element in the content array is a content block with a 'type' field. For text responses, content[0] is {'type': 'text', 'text': 'the actual response text'}. The response also includes 'id', 'model', 'stop_reason', 'stop_sequence', and 'usage' at the top level. This differs from OpenAI's structure (choices[0].message.content). Understanding this structure is fundamental for parsing Claude's responses. Option A (top-level 'text') is wrong. Option C uses OpenAI's API structure, not Anthropic's. Option D is invented.