Skip to content

AnthropicMessagesResponse

The response body from the Anthropic Messages API.

---
title: AnthropicMessagesResponse
config:
  look: handDrawn
  theme: colorful
  class:
    hideEmptyMembersBox: true
---
classDiagram
    class AnthropicMessagesResponse {
        +string id
        +string type
        +string role
        +unknown[] content
        +string model
        +string stop_reason
        +AnthropicUsage usage
    }
    class AnthropicUsage {
        +int32 input_tokens
        +int32 output_tokens
    }
    AnthropicMessagesResponse *-- AnthropicUsage
id: msg_01XFDUDYJgAACzvnptvVoYEL
model: claude-sonnet-4-20250514
stop_reason: end_turn
NameTypeDescription
idstringUnique response identifier
typestringObject type (always ‘message’)
rolestringThe role of the response (always ‘assistant’)
contentunknown[]Array of content blocks in the response (AnthropicTextBlock
modelstringThe model that generated the response
stop_reasonstringThe reason generation stopped (‘end_turn’, ‘max_tokens’, ‘stop_sequence’, ‘tool_use’)
usageAnthropicUsageToken usage statistics

The following types are composed within AnthropicMessagesResponse: