This page contains reference documentation for Messages. See the docs for conceptual guides, tutorials, and examples on using Messages.
Message from an AI.
Message chunk from an AI (yielded when streaming).
Message from the user.
Message for priming AI behavior.
Message for passing the result of executing a tool back to a model.
Represents an AI's request to call a tool.
Allowance for errors made by LLM.
A chunk of a tool call (yielded when streaming).
Tool call that is executed server-side.
A chunk of a server-side tool call (yielded when streaming).
Result of a server-side tool call.
Text output from a LLM.
Annotation for citing data from a document.
Provider-specific annotation format.
Reasoning output from a LLM.
Image data.
Video data.
Audio data.
Plaintext data (e.g., from a .txt or .md document).
File data that doesn't fit into other multimodal block types.
Provider-specific content data.
Usage metadata for a message, such as token counts.
Breakdown of input token counts.
Breakdown of output token counts.