AI & LLM
Anthropic Claude Messages Response JSON Example
A JSON example of an Anthropic Claude Messages API response — includes content blocks, stop_reason, and input/output token usage. Copy-ready for building apps on Claude.
Field Reference
idrequiredstringUnique message identifier, prefixed with msg_typerequiredstringObject type — always 'message' for a Messages responserolerequiredstringAlways 'assistant' for a response messagecontentrequiredarray<object>Ordered content blocks; each has a type such as 'text' or 'tool_use'stop_reasonrequiredstringWhy Claude stopped: end_turn, max_tokens, stop_sequence, or tool_useusage.input_tokensrequiredintegerTokens counted for the prompt (messages + system)usage.output_tokensrequiredintegerTokens generated in the responseVariants
Request bodyThe body you POST to /v1/messages.
Tool use responseClaude returns a tool_use block when it wants to call one of your tools.
Common Use Cases
- →Parsing Claude's response content blocks in a chat application
- →Detecting tool_use blocks to run agentic tool-calling loops
- →Tracking input/output and cache token usage for cost analysis
anthropicclaudellmmessages apiai api
Validate or format this JSON
One click loads this exact example into the tool — no copy-paste needed. Format it, validate it, explore the tree, or generate TypeScript types instantly.
Frequently Asked Questions
Related JSON Examples
AI & LLMOpenAI Chat Completion ResponseOpenAI Chat Completions API response with choices, message, finish_reason, and usage.AI & LLMLLM Tool / Function CallFunction-calling JSON: a tool definition plus the model's tool_call with arguments.AI & LLMChat Conversation HistoryOrdered messages array with system, user, and assistant roles for LLM chats.