Messages
Count tokens in a Message
ModelsExpand Collapse
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type Base64PDFSource struct{…}
type BashCodeExecutionOutputBlock struct{…}
type BashCodeExecutionOutputBlockParamResp struct{…}
type BashCodeExecutionResultBlock struct{…}
Content []BashCodeExecutionOutputBlock
type BashCodeExecutionResultBlockParamResp struct{…}
Content []BashCodeExecutionOutputBlockParamResp
type BashCodeExecutionToolResultBlock struct{…}
Content BashCodeExecutionToolResultBlockContentUnion
type BashCodeExecutionToolResultError struct{…}
ErrorCode BashCodeExecutionToolResultErrorCode
type BashCodeExecutionResultBlock struct{…}
Content []BashCodeExecutionOutputBlock
type BashCodeExecutionToolResultBlockParamResp struct{…}
Content BashCodeExecutionToolResultBlockParamContentUnionResp
type BashCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BashCodeExecutionToolResultErrorCode
type BashCodeExecutionResultBlockParamResp struct{…}
Content []BashCodeExecutionOutputBlockParamResp
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type BashCodeExecutionToolResultError struct{…}
ErrorCode BashCodeExecutionToolResultErrorCode
type BashCodeExecutionToolResultErrorCode string
type BashCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BashCodeExecutionToolResultErrorCode
type CacheControlEphemeral struct{…}
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type CacheCreation struct{…}
The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 5 minute cache entry.
type CitationCharLocation struct{…}
type CitationCharLocationParamResp struct{…}
type CitationContentBlockLocation struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationPageLocation struct{…}
type CitationPageLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationsConfig struct{…}
type CitationsConfigParamResp struct{…}
type CitationsDelta struct{…}
Citation CitationsDeltaCitationUnion
type CitationCharLocation struct{…}
type CitationPageLocation struct{…}
type CitationContentBlockLocation struct{…}
type CitationsWebSearchResultLocation struct{…}
type CitationsSearchResultLocation struct{…}
type CitationsSearchResultLocation struct{…}
type CitationsWebSearchResultLocation struct{…}
type CodeExecutionOutputBlock struct{…}
type CodeExecutionOutputBlockParamResp struct{…}
type CodeExecutionResultBlock struct{…}
Content []CodeExecutionOutputBlock
type CodeExecutionResultBlockParamResp struct{…}
Content []CodeExecutionOutputBlockParamResp
type CodeExecutionTool20250522 struct{…}
Name CodeExecutionName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type CodeExecutionTool20250825 struct{…}
Name CodeExecutionName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type CodeExecutionTool20260120 struct{…}Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
Name CodeExecutionName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type CodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type CodeExecutionToolResultError struct{…}
ErrorCode CodeExecutionToolResultErrorCode
type CodeExecutionResultBlock struct{…}
Content []CodeExecutionOutputBlock
type EncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []CodeExecutionOutputBlock
type CodeExecutionToolResultBlockContentUnion interface{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type CodeExecutionToolResultError struct{…}
ErrorCode CodeExecutionToolResultErrorCode
type CodeExecutionResultBlock struct{…}
Content []CodeExecutionOutputBlock
type EncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []CodeExecutionOutputBlock
type CodeExecutionToolResultBlockParamResp struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type CodeExecutionToolResultErrorParamResp struct{…}
ErrorCode CodeExecutionToolResultErrorCode
type CodeExecutionResultBlockParamResp struct{…}
Content []CodeExecutionOutputBlockParamResp
type EncryptedCodeExecutionResultBlockParamResp struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []CodeExecutionOutputBlockParamResp
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type CodeExecutionToolResultBlockParamContentUnionResp interface{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type CodeExecutionToolResultErrorParamResp struct{…}
ErrorCode CodeExecutionToolResultErrorCode
type CodeExecutionResultBlockParamResp struct{…}
Content []CodeExecutionOutputBlockParamResp
type EncryptedCodeExecutionResultBlockParamResp struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []CodeExecutionOutputBlockParamResp
type CodeExecutionToolResultError struct{…}
ErrorCode CodeExecutionToolResultErrorCode
type CodeExecutionToolResultErrorCode string
type CodeExecutionToolResultErrorParamResp struct{…}
ErrorCode CodeExecutionToolResultErrorCode
type Container struct{…}Information about the container used in the request (for the code execution tool)
Information about the container used in the request (for the code execution tool)
Identifier for the container used in this request
The time at which the container will expire.
type ContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
type ContainerUploadBlockParamResp struct{…}A content block that represents a file to be uploaded to the container
Files uploaded via this block will be available in the container's input directory.
A content block that represents a file to be uploaded to the container Files uploaded via this block will be available in the container's input directory.
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type ContentBlockUnion interface{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
type TextBlock struct{…}
Citations []TextCitationUnionCitations supporting the text block.
Citations supporting the text block.
The type of citation returned will depend on the type of document being cited. Citing a PDF results in page_location, plain text results in char_location, and content document results in content_block_location.
type CitationCharLocation struct{…}
type CitationPageLocation struct{…}
type CitationContentBlockLocation struct{…}
type CitationsWebSearchResultLocation struct{…}
type CitationsSearchResultLocation struct{…}
type ThinkingBlock struct{…}
type RedactedThinkingBlock struct{…}
type ToolUseBlock struct{…}
Caller ToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type ServerToolUseBlock struct{…}
Caller ServerToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Name ServerToolUseBlockName
type WebSearchToolResultBlock struct{…}
Caller WebSearchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type WebSearchToolResultError struct{…}
ErrorCode WebSearchToolResultErrorCode
type WebSearchToolResultBlockContentArray []WebSearchResultBlock
type WebFetchToolResultBlock struct{…}
Caller WebFetchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Content WebFetchToolResultBlockContentUnion
type WebFetchToolResultErrorBlock struct{…}
ErrorCode WebFetchToolResultErrorCode
type WebFetchBlock struct{…}
Content DocumentBlock
Citations CitationsConfigCitation configuration for the document
Citation configuration for the document
Source DocumentBlockSourceUnion
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
type CodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type CodeExecutionToolResultError struct{…}
ErrorCode CodeExecutionToolResultErrorCode
type CodeExecutionResultBlock struct{…}
Content []CodeExecutionOutputBlock
type EncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []CodeExecutionOutputBlock
type BashCodeExecutionToolResultBlock struct{…}
Content BashCodeExecutionToolResultBlockContentUnion
type BashCodeExecutionToolResultError struct{…}
ErrorCode BashCodeExecutionToolResultErrorCode
type BashCodeExecutionResultBlock struct{…}
Content []BashCodeExecutionOutputBlock
type TextEditorCodeExecutionToolResultBlock struct{…}
Content TextEditorCodeExecutionToolResultBlockContentUnion
type TextEditorCodeExecutionToolResultError struct{…}
type TextEditorCodeExecutionViewResultBlock struct{…}
FileType TextEditorCodeExecutionViewResultBlockFileType
type TextEditorCodeExecutionCreateResultBlock struct{…}
type TextEditorCodeExecutionStrReplaceResultBlock struct{…}
type ToolSearchToolResultBlock struct{…}
Content ToolSearchToolResultBlockContentUnion
type ToolSearchToolResultError struct{…}
ErrorCode ToolSearchToolResultErrorCode
type ToolSearchToolSearchResultBlock struct{…}
ToolReferences []ToolReferenceBlock
type ContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
type ContentBlockParamUnionResp interface{…}Regular text content.
Regular text content.
type TextBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type ImageBlockParamResp struct{…}
Source ImageBlockParamSourceUnionResp
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type URLImageSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type DocumentBlockParamResp struct{…}
Source DocumentBlockParamSourceUnionResp
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
type ContentBlockSource struct{…}
Content ContentBlockSourceContentUnion
type TextBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type ImageBlockParamResp struct{…}
Source ImageBlockParamSourceUnionResp
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type URLImageSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type URLPDFSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptional
type SearchResultBlockParamResp struct{…}
Content []TextBlockParamResp
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptional
type ThinkingBlockParamResp struct{…}
type RedactedThinkingBlockParamResp struct{…}
type ToolUseBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Caller ToolUseBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type ToolResultBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Content []ToolResultBlockParamContentUnionRespoptional
[]ToolResultBlockParamContentUnionResp
type TextBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type ImageBlockParamResp struct{…}
Source ImageBlockParamSourceUnionResp
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type URLImageSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type SearchResultBlockParamResp struct{…}
Content []TextBlockParamResp
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptional
type DocumentBlockParamResp struct{…}
Source DocumentBlockParamSourceUnionResp
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
type ContentBlockSource struct{…}
Content ContentBlockSourceContentUnion
type TextBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type ImageBlockParamResp struct{…}
Source ImageBlockParamSourceUnionResp
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type URLImageSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type URLPDFSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptional
type ToolReferenceBlockParamResp struct{…}Tool reference block that can be included in tool_result content.
Tool reference block that can be included in tool_result content.
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type ServerToolUseBlockParamResp struct{…}
Name ServerToolUseBlockParamName
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Caller ServerToolUseBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type WebSearchToolResultBlockParamResp struct{…}
type WebSearchToolRequestError struct{…}
ErrorCode WebSearchToolResultErrorCode
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Caller WebSearchToolResultBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type WebFetchToolResultBlockParamResp struct{…}
Content WebFetchToolResultBlockParamContentUnionResp
type WebFetchToolResultErrorBlockParamResp struct{…}
ErrorCode WebFetchToolResultErrorCode
type WebFetchBlockParamResp struct{…}
Content DocumentBlockParamResp
Source DocumentBlockParamSourceUnionResp
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
type ContentBlockSource struct{…}
Content ContentBlockSourceContentUnion
type TextBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type ImageBlockParamResp struct{…}
Source ImageBlockParamSourceUnionResp
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type URLImageSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type URLPDFSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptional
Fetched content URL
ISO 8601 timestamp when the content was retrieved
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Caller WebFetchToolResultBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type CodeExecutionToolResultBlockParamResp struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type CodeExecutionToolResultErrorParamResp struct{…}
ErrorCode CodeExecutionToolResultErrorCode
type CodeExecutionResultBlockParamResp struct{…}
Content []CodeExecutionOutputBlockParamResp
type EncryptedCodeExecutionResultBlockParamResp struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []CodeExecutionOutputBlockParamResp
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type BashCodeExecutionToolResultBlockParamResp struct{…}
Content BashCodeExecutionToolResultBlockParamContentUnionResp
type BashCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BashCodeExecutionToolResultErrorCode
type BashCodeExecutionResultBlockParamResp struct{…}
Content []BashCodeExecutionOutputBlockParamResp
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type TextEditorCodeExecutionToolResultBlockParamResp struct{…}
Content TextEditorCodeExecutionToolResultBlockParamContentUnionResp
type TextEditorCodeExecutionToolResultErrorParamResp struct{…}
type TextEditorCodeExecutionViewResultBlockParamResp struct{…}
FileType TextEditorCodeExecutionViewResultBlockParamFileType
type TextEditorCodeExecutionCreateResultBlockParamResp struct{…}
type TextEditorCodeExecutionStrReplaceResultBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type ToolSearchToolResultBlockParamResp struct{…}
Content ToolSearchToolResultBlockParamContentUnionResp
type ToolSearchToolResultErrorParamResp struct{…}
ErrorCode ToolSearchToolResultErrorCode
type ToolSearchToolSearchResultBlockParamResp struct{…}
ToolReferences []ToolReferenceBlockParamResp
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type ContainerUploadBlockParamResp struct{…}A content block that represents a file to be uploaded to the container
Files uploaded via this block will be available in the container's input directory.
A content block that represents a file to be uploaded to the container Files uploaded via this block will be available in the container's input directory.
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type ContentBlockSource struct{…}
Content ContentBlockSourceContentUnion
type TextBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type ImageBlockParamResp struct{…}
Source ImageBlockParamSourceUnionResp
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type URLImageSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type ContentBlockSourceContentItemUnion interface{…}
type TextBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type ImageBlockParamResp struct{…}
Source ImageBlockParamSourceUnionResp
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type URLImageSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type DocumentBlock struct{…}
Citations CitationsConfigCitation configuration for the document
Citation configuration for the document
Source DocumentBlockSourceUnion
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
The title of the document
type DocumentBlockParamResp struct{…}
Source DocumentBlockParamSourceUnionResp
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
type ContentBlockSource struct{…}
Content ContentBlockSourceContentUnion
type TextBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type ImageBlockParamResp struct{…}
Source ImageBlockParamSourceUnionResp
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type URLImageSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type URLPDFSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptional
type EncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []CodeExecutionOutputBlock
type EncryptedCodeExecutionResultBlockParamResp struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []CodeExecutionOutputBlockParamResp
type ImageBlockParamResp struct{…}
Source ImageBlockParamSourceUnionResp
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type URLImageSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type InputJSONDelta struct{…}
type JSONOutputFormat struct{…}
The JSON schema of the format
type MemoryTool20250818 struct{…}
Name MemoryName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type Message struct{…}
ID stringUnique object identifier.
Unique object identifier.
The format and length of IDs may change over time.
Container ContainerInformation about the container used in the request (for the code execution tool)
Information about the container used in the request (for the code execution tool)
Identifier for the container used in this request
The time at which the container will expire.
Content []ContentBlockUnionContent generated by the model.
Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
Example:
[{"type": "text", "text": "Hi, I'm Claude."}]
If the request input messages ended with an assistant turn, then the response content will continue directly from that last turn. You can use this to constrain the model's output.
For example, if the input messages were:
[
{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
{"role": "assistant", "content": "The best answer is ("}
]
Then the response content might be:
[{"type": "text", "text": "B)"}]
type TextBlock struct{…}
Citations []TextCitationUnionCitations supporting the text block.
Citations supporting the text block.
The type of citation returned will depend on the type of document being cited. Citing a PDF results in page_location, plain text results in char_location, and content document results in content_block_location.
type CitationCharLocation struct{…}
type CitationPageLocation struct{…}
type CitationContentBlockLocation struct{…}
type CitationsWebSearchResultLocation struct{…}
type CitationsSearchResultLocation struct{…}
type ThinkingBlock struct{…}
type RedactedThinkingBlock struct{…}
type ToolUseBlock struct{…}
Caller ToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type ServerToolUseBlock struct{…}
Caller ServerToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Name ServerToolUseBlockName
type WebSearchToolResultBlock struct{…}
Caller WebSearchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type WebSearchToolResultError struct{…}
ErrorCode WebSearchToolResultErrorCode
type WebSearchToolResultBlockContentArray []WebSearchResultBlock
type WebFetchToolResultBlock struct{…}
Caller WebFetchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Content WebFetchToolResultBlockContentUnion
type WebFetchToolResultErrorBlock struct{…}
ErrorCode WebFetchToolResultErrorCode
type WebFetchBlock struct{…}
Content DocumentBlock
Citations CitationsConfigCitation configuration for the document
Citation configuration for the document
Source DocumentBlockSourceUnion
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
type CodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type CodeExecutionToolResultError struct{…}
ErrorCode CodeExecutionToolResultErrorCode
type CodeExecutionResultBlock struct{…}
Content []CodeExecutionOutputBlock
type EncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []CodeExecutionOutputBlock
type BashCodeExecutionToolResultBlock struct{…}
Content BashCodeExecutionToolResultBlockContentUnion
type BashCodeExecutionToolResultError struct{…}
ErrorCode BashCodeExecutionToolResultErrorCode
type BashCodeExecutionResultBlock struct{…}
Content []BashCodeExecutionOutputBlock
type TextEditorCodeExecutionToolResultBlock struct{…}
Content TextEditorCodeExecutionToolResultBlockContentUnion
type TextEditorCodeExecutionToolResultError struct{…}
type TextEditorCodeExecutionViewResultBlock struct{…}
FileType TextEditorCodeExecutionViewResultBlockFileType
type TextEditorCodeExecutionCreateResultBlock struct{…}
type TextEditorCodeExecutionStrReplaceResultBlock struct{…}
type ToolSearchToolResultBlock struct{…}
Content ToolSearchToolResultBlockContentUnion
type ToolSearchToolResultError struct{…}
ErrorCode ToolSearchToolResultErrorCode
type ToolSearchToolSearchResultBlock struct{…}
ToolReferences []ToolReferenceBlock
type ContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
Model ModelThe model that will complete your prompt.
The model that will complete your prompt.
See models for additional details and options.
type Model stringThe model that will complete your prompt.
The model that will complete your prompt.
See models for additional details and options.
Most intelligent model for building agents and coding
Frontier intelligence at scale — built for coding, agents, and enterprise workflows
Premium model combining maximum intelligence with practical performance
Premium model combining maximum intelligence with practical performance
High-performance model with early extended thinking
High-performance model with early extended thinking
Fastest and most compact model for near-instant responsiveness
Our fastest model
Hybrid model, capable of near-instant responses and extended thinking
Hybrid model, capable of near-instant responses and extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
Our best model for real-world agents and coding
Our best model for real-world agents and coding
Our most capable model
Our most capable model
Our most capable model
Our most capable model
Excels at writing and complex tasks
Excels at writing and complex tasks
Our previous most fast and cost-effective
Role AssistantConversational role of the generated message.
Conversational role of the generated message.
This will always be "assistant".
StopReason StopReasonThe reason that we stopped.
The reason that we stopped.
This may be one the following values:
"end_turn": the model reached a natural stopping point"max_tokens": we exceeded the requestedmax_tokensor the model's maximum"stop_sequence": one of your provided customstop_sequenceswas generated"tool_use": the model invoked one or more tools"pause_turn": we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue."refusal": when streaming classifiers intervene to handle potential policy violations
In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
StopSequence stringWhich custom stop sequence was generated, if any.
Which custom stop sequence was generated, if any.
This value will be a non-null string if one of your custom stop sequences was generated.
Type MessageObject type.
Object type.
For Messages, this is always "message".
Usage UsageBilling and rate-limit usage.
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in usage will not match one-to-one with the exact visible content of an API request or response.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
CacheCreation CacheCreationBreakdown of cached tokens by TTL
Breakdown of cached tokens by TTL
The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the cache entry.
The number of input tokens read from the cache.
The geographic region where inference was performed for this request.
The number of input tokens which were used.
The number of output tokens which were used.
ServerToolUse ServerToolUsageThe number of server tool requests.
The number of server tool requests.
The number of web fetch tool requests.
The number of web search tool requests.
ServiceTier UsageServiceTierIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
type MessageCountTokensToolUnion interface{…}Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
type Tool struct{…}
InputSchema ToolInputSchemaJSON schema for this tool's input.
JSON schema for this tool's input.
This defines the shape of the input that your tool accepts and that the model will produce.
Name stringName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
Description stringoptionalDescription of what this tool does.
Description of what this tool does.
Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.
Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers.
When true, guarantees schema validation on tool names and inputs
type ToolBash20250124 struct{…}
Name BashName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type CodeExecutionTool20250522 struct{…}
Name CodeExecutionName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type CodeExecutionTool20250825 struct{…}
Name CodeExecutionName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type CodeExecutionTool20260120 struct{…}Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
Name CodeExecutionName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type MemoryTool20250818 struct{…}
Name MemoryName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type ToolTextEditor20250124 struct{…}
Name StrReplaceEditorName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type ToolTextEditor20250429 struct{…}
Name StrReplaceBasedEditToolName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type ToolTextEditor20250728 struct{…}
Name StrReplaceBasedEditToolName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.
When true, guarantees schema validation on tool names and inputs
type WebSearchTool20250305 struct{…}
Name WebSearchName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
If provided, only these domains will be included in results. Cannot be used alongside blocked_domains.
If provided, these domains will never appear in results. Cannot be used alongside allowed_domains.
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
Maximum number of times the tool can be used in the API request.
When true, guarantees schema validation on tool names and inputs
UserLocation UserLocationoptionalParameters for the user's location. Used to provide more relevant search results.
Parameters for the user's location. Used to provide more relevant search results.
The city of the user.
The two letter ISO country code of the user.
The region of the user.
The IANA timezone of the user.
type WebFetchTool20250910 struct{…}
Name WebFetchName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
List of domains to allow fetching from
List of domains to block fetching from
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptionalCitations configuration for fetched documents. Citations are disabled by default.
Citations configuration for fetched documents. Citations are disabled by default.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
Maximum number of times the tool can be used in the API request.
When true, guarantees schema validation on tool names and inputs
type WebSearchTool20260209 struct{…}
Name WebSearchName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
If provided, only these domains will be included in results. Cannot be used alongside blocked_domains.
If provided, these domains will never appear in results. Cannot be used alongside allowed_domains.
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
Maximum number of times the tool can be used in the API request.
When true, guarantees schema validation on tool names and inputs
UserLocation UserLocationoptionalParameters for the user's location. Used to provide more relevant search results.
Parameters for the user's location. Used to provide more relevant search results.
The city of the user.
The two letter ISO country code of the user.
The region of the user.
The IANA timezone of the user.
type WebFetchTool20260209 struct{…}
Name WebFetchName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
List of domains to allow fetching from
List of domains to block fetching from
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptionalCitations configuration for fetched documents. Citations are disabled by default.
Citations configuration for fetched documents. Citations are disabled by default.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
Maximum number of times the tool can be used in the API request.
When true, guarantees schema validation on tool names and inputs
type ToolSearchToolBm25_20251119 struct{…}
Name ToolSearchToolBm25Name of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Type ToolSearchToolBm25_20251119Type
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type ToolSearchToolRegex20251119 struct{…}
Name ToolSearchToolRegexName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Type ToolSearchToolRegex20251119Type
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type MessageDeltaUsage struct{…}
The cumulative number of input tokens used to create the cache entry.
The cumulative number of input tokens read from the cache.
The cumulative number of input tokens which were used.
The cumulative number of output tokens which were used.
ServerToolUse ServerToolUsageThe number of server tool requests.
The number of server tool requests.
The number of web fetch tool requests.
The number of web search tool requests.
type MessageParamResp struct{…}
Content []ContentBlockParamUnionResp
type TextBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type ImageBlockParamResp struct{…}
Source ImageBlockParamSourceUnionResp
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type URLImageSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type DocumentBlockParamResp struct{…}
Source DocumentBlockParamSourceUnionResp
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
type ContentBlockSource struct{…}
Content ContentBlockSourceContentUnion
type TextBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type ImageBlockParamResp struct{…}
Source ImageBlockParamSourceUnionResp
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type URLImageSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type URLPDFSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptional
type SearchResultBlockParamResp struct{…}
Content []TextBlockParamResp
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptional
type ThinkingBlockParamResp struct{…}
type RedactedThinkingBlockParamResp struct{…}
type ToolUseBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Caller ToolUseBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type ToolResultBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Content []ToolResultBlockParamContentUnionRespoptional
[]ToolResultBlockParamContentUnionResp
type TextBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type ImageBlockParamResp struct{…}
Source ImageBlockParamSourceUnionResp
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type URLImageSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type SearchResultBlockParamResp struct{…}
Content []TextBlockParamResp
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptional
type DocumentBlockParamResp struct{…}
Source DocumentBlockParamSourceUnionResp
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
type ContentBlockSource struct{…}
Content ContentBlockSourceContentUnion
type TextBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type ImageBlockParamResp struct{…}
Source ImageBlockParamSourceUnionResp
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type URLImageSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type URLPDFSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptional
type ToolReferenceBlockParamResp struct{…}Tool reference block that can be included in tool_result content.
Tool reference block that can be included in tool_result content.
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type ServerToolUseBlockParamResp struct{…}
Name ServerToolUseBlockParamName
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Caller ServerToolUseBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type WebSearchToolResultBlockParamResp struct{…}
type WebSearchToolRequestError struct{…}
ErrorCode WebSearchToolResultErrorCode
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Caller WebSearchToolResultBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type WebFetchToolResultBlockParamResp struct{…}
Content WebFetchToolResultBlockParamContentUnionResp
type WebFetchToolResultErrorBlockParamResp struct{…}
ErrorCode WebFetchToolResultErrorCode
type WebFetchBlockParamResp struct{…}
Content DocumentBlockParamResp
Source DocumentBlockParamSourceUnionResp
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
type ContentBlockSource struct{…}
Content ContentBlockSourceContentUnion
type TextBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type ImageBlockParamResp struct{…}
Source ImageBlockParamSourceUnionResp
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type URLImageSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type URLPDFSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptional
Fetched content URL
ISO 8601 timestamp when the content was retrieved
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Caller WebFetchToolResultBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type CodeExecutionToolResultBlockParamResp struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type CodeExecutionToolResultErrorParamResp struct{…}
ErrorCode CodeExecutionToolResultErrorCode
type CodeExecutionResultBlockParamResp struct{…}
Content []CodeExecutionOutputBlockParamResp
type EncryptedCodeExecutionResultBlockParamResp struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []CodeExecutionOutputBlockParamResp
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type BashCodeExecutionToolResultBlockParamResp struct{…}
Content BashCodeExecutionToolResultBlockParamContentUnionResp
type BashCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BashCodeExecutionToolResultErrorCode
type BashCodeExecutionResultBlockParamResp struct{…}
Content []BashCodeExecutionOutputBlockParamResp
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type TextEditorCodeExecutionToolResultBlockParamResp struct{…}
Content TextEditorCodeExecutionToolResultBlockParamContentUnionResp
type TextEditorCodeExecutionToolResultErrorParamResp struct{…}
type TextEditorCodeExecutionViewResultBlockParamResp struct{…}
FileType TextEditorCodeExecutionViewResultBlockParamFileType
type TextEditorCodeExecutionCreateResultBlockParamResp struct{…}
type TextEditorCodeExecutionStrReplaceResultBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type ToolSearchToolResultBlockParamResp struct{…}
Content ToolSearchToolResultBlockParamContentUnionResp
type ToolSearchToolResultErrorParamResp struct{…}
ErrorCode ToolSearchToolResultErrorCode
type ToolSearchToolSearchResultBlockParamResp struct{…}
ToolReferences []ToolReferenceBlockParamResp
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type ContainerUploadBlockParamResp struct{…}A content block that represents a file to be uploaded to the container
Files uploaded via this block will be available in the container's input directory.
A content block that represents a file to be uploaded to the container Files uploaded via this block will be available in the container's input directory.
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Role MessageParamRole
type MessageTokensCount struct{…}
The total number of tokens across the provided list of messages, system prompt, and tools.
type Metadata struct{…}
UserID stringoptionalAn external identifier for the user who is associated with the request.
An external identifier for the user who is associated with the request.
This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number.
type Model interface{…}The model that will complete your prompt.
The model that will complete your prompt.
See models for additional details and options.
type Model stringThe model that will complete your prompt.
The model that will complete your prompt.
See models for additional details and options.
Most intelligent model for building agents and coding
Frontier intelligence at scale — built for coding, agents, and enterprise workflows
Premium model combining maximum intelligence with practical performance
Premium model combining maximum intelligence with practical performance
High-performance model with early extended thinking
High-performance model with early extended thinking
Fastest and most compact model for near-instant responsiveness
Our fastest model
Hybrid model, capable of near-instant responses and extended thinking
Hybrid model, capable of near-instant responses and extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
Our best model for real-world agents and coding
Our best model for real-world agents and coding
Our most capable model
Our most capable model
Our most capable model
Our most capable model
Excels at writing and complex tasks
Excels at writing and complex tasks
Our previous most fast and cost-effective
type OutputConfig struct{…}
Effort OutputConfigEffortoptionalAll possible effort levels.
All possible effort levels.
Format JSONOutputFormatoptionalA schema to specify Claude's output format in responses. See structured outputs
A schema to specify Claude's output format in responses. See structured outputs
The JSON schema of the format
type PlainTextSource struct{…}
type RawContentBlockDeltaUnion interface{…}
type TextDelta struct{…}
type InputJSONDelta struct{…}
type CitationsDelta struct{…}
Citation CitationsDeltaCitationUnion
type CitationCharLocation struct{…}
type CitationPageLocation struct{…}
type CitationContentBlockLocation struct{…}
type CitationsWebSearchResultLocation struct{…}
type CitationsSearchResultLocation struct{…}
type ThinkingDelta struct{…}
type SignatureDelta struct{…}
type ContentBlockDeltaEvent struct{…}
type TextDelta struct{…}
type InputJSONDelta struct{…}
type CitationsDelta struct{…}
Citation CitationsDeltaCitationUnion
type CitationCharLocation struct{…}
type CitationPageLocation struct{…}
type CitationContentBlockLocation struct{…}
type CitationsWebSearchResultLocation struct{…}
type CitationsSearchResultLocation struct{…}
type ThinkingDelta struct{…}
type SignatureDelta struct{…}
type ContentBlockStartEvent struct{…}
ContentBlock ContentBlockStartEventContentBlockUnionResponse model for a file uploaded to the container.
Response model for a file uploaded to the container.
type TextBlock struct{…}
Citations []TextCitationUnionCitations supporting the text block.
Citations supporting the text block.
The type of citation returned will depend on the type of document being cited. Citing a PDF results in page_location, plain text results in char_location, and content document results in content_block_location.
type CitationCharLocation struct{…}
type CitationPageLocation struct{…}
type CitationContentBlockLocation struct{…}
type CitationsWebSearchResultLocation struct{…}
type CitationsSearchResultLocation struct{…}
type ThinkingBlock struct{…}
type RedactedThinkingBlock struct{…}
type ToolUseBlock struct{…}
Caller ToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type ServerToolUseBlock struct{…}
Caller ServerToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Name ServerToolUseBlockName
type WebSearchToolResultBlock struct{…}
Caller WebSearchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type WebSearchToolResultError struct{…}
ErrorCode WebSearchToolResultErrorCode
type WebSearchToolResultBlockContentArray []WebSearchResultBlock
type WebFetchToolResultBlock struct{…}
Caller WebFetchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Content WebFetchToolResultBlockContentUnion
type WebFetchToolResultErrorBlock struct{…}
ErrorCode WebFetchToolResultErrorCode
type WebFetchBlock struct{…}
Content DocumentBlock
Citations CitationsConfigCitation configuration for the document
Citation configuration for the document
Source DocumentBlockSourceUnion
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
type CodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type CodeExecutionToolResultError struct{…}
ErrorCode CodeExecutionToolResultErrorCode
type CodeExecutionResultBlock struct{…}
Content []CodeExecutionOutputBlock
type EncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []CodeExecutionOutputBlock
type BashCodeExecutionToolResultBlock struct{…}
Content BashCodeExecutionToolResultBlockContentUnion
type BashCodeExecutionToolResultError struct{…}
ErrorCode BashCodeExecutionToolResultErrorCode
type BashCodeExecutionResultBlock struct{…}
Content []BashCodeExecutionOutputBlock
type TextEditorCodeExecutionToolResultBlock struct{…}
Content TextEditorCodeExecutionToolResultBlockContentUnion
type TextEditorCodeExecutionToolResultError struct{…}
type TextEditorCodeExecutionViewResultBlock struct{…}
FileType TextEditorCodeExecutionViewResultBlockFileType
type TextEditorCodeExecutionCreateResultBlock struct{…}
type TextEditorCodeExecutionStrReplaceResultBlock struct{…}
type ToolSearchToolResultBlock struct{…}
Content ToolSearchToolResultBlockContentUnion
type ToolSearchToolResultError struct{…}
ErrorCode ToolSearchToolResultErrorCode
type ToolSearchToolSearchResultBlock struct{…}
ToolReferences []ToolReferenceBlock
type ContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
type ContentBlockStopEvent struct{…}
type MessageDeltaEvent struct{…}
Delta MessageDeltaEventDelta
Container ContainerInformation about the container used in the request (for the code execution tool)
Information about the container used in the request (for the code execution tool)
Identifier for the container used in this request
The time at which the container will expire.
StopReason StopReason
Usage MessageDeltaUsageBilling and rate-limit usage.
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in usage will not match one-to-one with the exact visible content of an API request or response.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
The cumulative number of input tokens used to create the cache entry.
The cumulative number of input tokens read from the cache.
The cumulative number of input tokens which were used.
The cumulative number of output tokens which were used.
ServerToolUse ServerToolUsageThe number of server tool requests.
The number of server tool requests.
The number of web fetch tool requests.
The number of web search tool requests.
type MessageStartEvent struct{…}
Message Message
ID stringUnique object identifier.
Unique object identifier.
The format and length of IDs may change over time.
Container ContainerInformation about the container used in the request (for the code execution tool)
Information about the container used in the request (for the code execution tool)
Identifier for the container used in this request
The time at which the container will expire.
Content []ContentBlockUnionContent generated by the model.
Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
Example:
[{"type": "text", "text": "Hi, I'm Claude."}]
If the request input messages ended with an assistant turn, then the response content will continue directly from that last turn. You can use this to constrain the model's output.
For example, if the input messages were:
[
{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
{"role": "assistant", "content": "The best answer is ("}
]
Then the response content might be:
[{"type": "text", "text": "B)"}]
type TextBlock struct{…}
Citations []TextCitationUnionCitations supporting the text block.
Citations supporting the text block.
The type of citation returned will depend on the type of document being cited. Citing a PDF results in page_location, plain text results in char_location, and content document results in content_block_location.
type CitationCharLocation struct{…}
type CitationPageLocation struct{…}
type CitationContentBlockLocation struct{…}
type CitationsWebSearchResultLocation struct{…}
type CitationsSearchResultLocation struct{…}
type ThinkingBlock struct{…}
type RedactedThinkingBlock struct{…}
type ToolUseBlock struct{…}
Caller ToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type ServerToolUseBlock struct{…}
Caller ServerToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Name ServerToolUseBlockName
type WebSearchToolResultBlock struct{…}
Caller WebSearchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type WebSearchToolResultError struct{…}
ErrorCode WebSearchToolResultErrorCode
type WebSearchToolResultBlockContentArray []WebSearchResultBlock
type WebFetchToolResultBlock struct{…}
Caller WebFetchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Content WebFetchToolResultBlockContentUnion
type WebFetchToolResultErrorBlock struct{…}
ErrorCode WebFetchToolResultErrorCode
type WebFetchBlock struct{…}
Content DocumentBlock
Citations CitationsConfigCitation configuration for the document
Citation configuration for the document
Source DocumentBlockSourceUnion
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
type CodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type CodeExecutionToolResultError struct{…}
ErrorCode CodeExecutionToolResultErrorCode
type CodeExecutionResultBlock struct{…}
Content []CodeExecutionOutputBlock
type EncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []CodeExecutionOutputBlock
type BashCodeExecutionToolResultBlock struct{…}
Content BashCodeExecutionToolResultBlockContentUnion
type BashCodeExecutionToolResultError struct{…}
ErrorCode BashCodeExecutionToolResultErrorCode
type BashCodeExecutionResultBlock struct{…}
Content []BashCodeExecutionOutputBlock
type TextEditorCodeExecutionToolResultBlock struct{…}
Content TextEditorCodeExecutionToolResultBlockContentUnion
type TextEditorCodeExecutionToolResultError struct{…}
type TextEditorCodeExecutionViewResultBlock struct{…}
FileType TextEditorCodeExecutionViewResultBlockFileType
type TextEditorCodeExecutionCreateResultBlock struct{…}
type TextEditorCodeExecutionStrReplaceResultBlock struct{…}
type ToolSearchToolResultBlock struct{…}
Content ToolSearchToolResultBlockContentUnion
type ToolSearchToolResultError struct{…}
ErrorCode ToolSearchToolResultErrorCode
type ToolSearchToolSearchResultBlock struct{…}
ToolReferences []ToolReferenceBlock
type ContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
Model ModelThe model that will complete your prompt.
The model that will complete your prompt.
See models for additional details and options.
type Model stringThe model that will complete your prompt.
The model that will complete your prompt.
See models for additional details and options.
Most intelligent model for building agents and coding
Frontier intelligence at scale — built for coding, agents, and enterprise workflows
Premium model combining maximum intelligence with practical performance
Premium model combining maximum intelligence with practical performance
High-performance model with early extended thinking
High-performance model with early extended thinking
Fastest and most compact model for near-instant responsiveness
Our fastest model
Hybrid model, capable of near-instant responses and extended thinking
Hybrid model, capable of near-instant responses and extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
Our best model for real-world agents and coding
Our best model for real-world agents and coding
Our most capable model
Our most capable model
Our most capable model
Our most capable model
Excels at writing and complex tasks
Excels at writing and complex tasks
Our previous most fast and cost-effective
Role AssistantConversational role of the generated message.
Conversational role of the generated message.
This will always be "assistant".
StopReason StopReasonThe reason that we stopped.
The reason that we stopped.
This may be one the following values:
"end_turn": the model reached a natural stopping point"max_tokens": we exceeded the requestedmax_tokensor the model's maximum"stop_sequence": one of your provided customstop_sequenceswas generated"tool_use": the model invoked one or more tools"pause_turn": we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue."refusal": when streaming classifiers intervene to handle potential policy violations
In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
StopSequence stringWhich custom stop sequence was generated, if any.
Which custom stop sequence was generated, if any.
This value will be a non-null string if one of your custom stop sequences was generated.
Type MessageObject type.
Object type.
For Messages, this is always "message".
Usage UsageBilling and rate-limit usage.
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in usage will not match one-to-one with the exact visible content of an API request or response.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
CacheCreation CacheCreationBreakdown of cached tokens by TTL
Breakdown of cached tokens by TTL
The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the cache entry.
The number of input tokens read from the cache.
The geographic region where inference was performed for this request.
The number of input tokens which were used.
The number of output tokens which were used.
ServerToolUse ServerToolUsageThe number of server tool requests.
The number of server tool requests.
The number of web fetch tool requests.
The number of web search tool requests.
ServiceTier UsageServiceTierIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
type MessageStopEvent struct{…}
type MessageStreamEventUnion interface{…}
type MessageStartEvent struct{…}
Message Message
ID stringUnique object identifier.
Unique object identifier.
The format and length of IDs may change over time.
Container ContainerInformation about the container used in the request (for the code execution tool)
Information about the container used in the request (for the code execution tool)
Identifier for the container used in this request
The time at which the container will expire.
Content []ContentBlockUnionContent generated by the model.
Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
Example:
[{"type": "text", "text": "Hi, I'm Claude."}]
If the request input messages ended with an assistant turn, then the response content will continue directly from that last turn. You can use this to constrain the model's output.
For example, if the input messages were:
[
{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
{"role": "assistant", "content": "The best answer is ("}
]
Then the response content might be:
[{"type": "text", "text": "B)"}]
type TextBlock struct{…}
Citations []TextCitationUnionCitations supporting the text block.
Citations supporting the text block.
The type of citation returned will depend on the type of document being cited. Citing a PDF results in page_location, plain text results in char_location, and content document results in content_block_location.
type CitationCharLocation struct{…}
type CitationPageLocation struct{…}
type CitationContentBlockLocation struct{…}
type CitationsWebSearchResultLocation struct{…}
type CitationsSearchResultLocation struct{…}
type ThinkingBlock struct{…}
type RedactedThinkingBlock struct{…}
type ToolUseBlock struct{…}
Caller ToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type ServerToolUseBlock struct{…}
Caller ServerToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Name ServerToolUseBlockName
type WebSearchToolResultBlock struct{…}
Caller WebSearchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type WebSearchToolResultError struct{…}
ErrorCode WebSearchToolResultErrorCode
type WebSearchToolResultBlockContentArray []WebSearchResultBlock
type WebFetchToolResultBlock struct{…}
Caller WebFetchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Content WebFetchToolResultBlockContentUnion
type WebFetchToolResultErrorBlock struct{…}
ErrorCode WebFetchToolResultErrorCode
type WebFetchBlock struct{…}
Content DocumentBlock
Citations CitationsConfigCitation configuration for the document
Citation configuration for the document
Source DocumentBlockSourceUnion
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
type CodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type CodeExecutionToolResultError struct{…}
ErrorCode CodeExecutionToolResultErrorCode
type CodeExecutionResultBlock struct{…}
Content []CodeExecutionOutputBlock
type EncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []CodeExecutionOutputBlock
type BashCodeExecutionToolResultBlock struct{…}
Content BashCodeExecutionToolResultBlockContentUnion
type BashCodeExecutionToolResultError struct{…}
ErrorCode BashCodeExecutionToolResultErrorCode
type BashCodeExecutionResultBlock struct{…}
Content []BashCodeExecutionOutputBlock
type TextEditorCodeExecutionToolResultBlock struct{…}
Content TextEditorCodeExecutionToolResultBlockContentUnion
type TextEditorCodeExecutionToolResultError struct{…}
type TextEditorCodeExecutionViewResultBlock struct{…}
FileType TextEditorCodeExecutionViewResultBlockFileType
type TextEditorCodeExecutionCreateResultBlock struct{…}
type TextEditorCodeExecutionStrReplaceResultBlock struct{…}
type ToolSearchToolResultBlock struct{…}
Content ToolSearchToolResultBlockContentUnion
type ToolSearchToolResultError struct{…}
ErrorCode ToolSearchToolResultErrorCode
type ToolSearchToolSearchResultBlock struct{…}
ToolReferences []ToolReferenceBlock
type ContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
Model ModelThe model that will complete your prompt.
The model that will complete your prompt.
See models for additional details and options.
type Model stringThe model that will complete your prompt.
The model that will complete your prompt.
See models for additional details and options.
Most intelligent model for building agents and coding
Frontier intelligence at scale — built for coding, agents, and enterprise workflows
Premium model combining maximum intelligence with practical performance
Premium model combining maximum intelligence with practical performance
High-performance model with early extended thinking
High-performance model with early extended thinking
Fastest and most compact model for near-instant responsiveness
Our fastest model
Hybrid model, capable of near-instant responses and extended thinking
Hybrid model, capable of near-instant responses and extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
Our best model for real-world agents and coding
Our best model for real-world agents and coding
Our most capable model
Our most capable model
Our most capable model
Our most capable model
Excels at writing and complex tasks
Excels at writing and complex tasks
Our previous most fast and cost-effective
Role AssistantConversational role of the generated message.
Conversational role of the generated message.
This will always be "assistant".
StopReason StopReasonThe reason that we stopped.
The reason that we stopped.
This may be one the following values:
"end_turn": the model reached a natural stopping point"max_tokens": we exceeded the requestedmax_tokensor the model's maximum"stop_sequence": one of your provided customstop_sequenceswas generated"tool_use": the model invoked one or more tools"pause_turn": we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue."refusal": when streaming classifiers intervene to handle potential policy violations
In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
StopSequence stringWhich custom stop sequence was generated, if any.
Which custom stop sequence was generated, if any.
This value will be a non-null string if one of your custom stop sequences was generated.
Type MessageObject type.
Object type.
For Messages, this is always "message".
Usage UsageBilling and rate-limit usage.
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in usage will not match one-to-one with the exact visible content of an API request or response.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
CacheCreation CacheCreationBreakdown of cached tokens by TTL
Breakdown of cached tokens by TTL
The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the cache entry.
The number of input tokens read from the cache.
The geographic region where inference was performed for this request.
The number of input tokens which were used.
The number of output tokens which were used.
ServerToolUse ServerToolUsageThe number of server tool requests.
The number of server tool requests.
The number of web fetch tool requests.
The number of web search tool requests.
ServiceTier UsageServiceTierIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
type MessageDeltaEvent struct{…}
Delta MessageDeltaEventDelta
Container ContainerInformation about the container used in the request (for the code execution tool)
Information about the container used in the request (for the code execution tool)
Identifier for the container used in this request
The time at which the container will expire.
StopReason StopReason
Usage MessageDeltaUsageBilling and rate-limit usage.
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in usage will not match one-to-one with the exact visible content of an API request or response.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
The cumulative number of input tokens used to create the cache entry.
The cumulative number of input tokens read from the cache.
The cumulative number of input tokens which were used.
The cumulative number of output tokens which were used.
ServerToolUse ServerToolUsageThe number of server tool requests.
The number of server tool requests.
The number of web fetch tool requests.
The number of web search tool requests.
type MessageStopEvent struct{…}
type ContentBlockStartEvent struct{…}
ContentBlock ContentBlockStartEventContentBlockUnionResponse model for a file uploaded to the container.
Response model for a file uploaded to the container.
type TextBlock struct{…}
Citations []TextCitationUnionCitations supporting the text block.
Citations supporting the text block.
The type of citation returned will depend on the type of document being cited. Citing a PDF results in page_location, plain text results in char_location, and content document results in content_block_location.
type CitationCharLocation struct{…}
type CitationPageLocation struct{…}
type CitationContentBlockLocation struct{…}
type CitationsWebSearchResultLocation struct{…}
type CitationsSearchResultLocation struct{…}
type ThinkingBlock struct{…}
type RedactedThinkingBlock struct{…}
type ToolUseBlock struct{…}
Caller ToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type ServerToolUseBlock struct{…}
Caller ServerToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Name ServerToolUseBlockName
type WebSearchToolResultBlock struct{…}
Caller WebSearchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type WebSearchToolResultError struct{…}
ErrorCode WebSearchToolResultErrorCode
type WebSearchToolResultBlockContentArray []WebSearchResultBlock
type WebFetchToolResultBlock struct{…}
Caller WebFetchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Content WebFetchToolResultBlockContentUnion
type WebFetchToolResultErrorBlock struct{…}
ErrorCode WebFetchToolResultErrorCode
type WebFetchBlock struct{…}
Content DocumentBlock
Citations CitationsConfigCitation configuration for the document
Citation configuration for the document
Source DocumentBlockSourceUnion
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
type CodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type CodeExecutionToolResultError struct{…}
ErrorCode CodeExecutionToolResultErrorCode
type CodeExecutionResultBlock struct{…}
Content []CodeExecutionOutputBlock
type EncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []CodeExecutionOutputBlock
type BashCodeExecutionToolResultBlock struct{…}
Content BashCodeExecutionToolResultBlockContentUnion
type BashCodeExecutionToolResultError struct{…}
ErrorCode BashCodeExecutionToolResultErrorCode
type BashCodeExecutionResultBlock struct{…}
Content []BashCodeExecutionOutputBlock
type TextEditorCodeExecutionToolResultBlock struct{…}
Content TextEditorCodeExecutionToolResultBlockContentUnion
type TextEditorCodeExecutionToolResultError struct{…}
type TextEditorCodeExecutionViewResultBlock struct{…}
FileType TextEditorCodeExecutionViewResultBlockFileType
type TextEditorCodeExecutionCreateResultBlock struct{…}
type TextEditorCodeExecutionStrReplaceResultBlock struct{…}
type ToolSearchToolResultBlock struct{…}
Content ToolSearchToolResultBlockContentUnion
type ToolSearchToolResultError struct{…}
ErrorCode ToolSearchToolResultErrorCode
type ToolSearchToolSearchResultBlock struct{…}
ToolReferences []ToolReferenceBlock
type ContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
type ContentBlockDeltaEvent struct{…}
type TextDelta struct{…}
type InputJSONDelta struct{…}
type CitationsDelta struct{…}
Citation CitationsDeltaCitationUnion
type CitationCharLocation struct{…}
type CitationPageLocation struct{…}
type CitationContentBlockLocation struct{…}
type CitationsWebSearchResultLocation struct{…}
type CitationsSearchResultLocation struct{…}
type ThinkingDelta struct{…}
type SignatureDelta struct{…}
type ContentBlockStopEvent struct{…}
type RedactedThinkingBlock struct{…}
type RedactedThinkingBlockParamResp struct{…}
type SearchResultBlockParamResp struct{…}
Content []TextBlockParamResp
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptional
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type ServerToolUsage struct{…}
The number of web fetch tool requests.
The number of web search tool requests.
type ServerToolUseBlock struct{…}
Caller ServerToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Name ServerToolUseBlockName
type ServerToolUseBlockParamResp struct{…}
Name ServerToolUseBlockParamName
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Caller ServerToolUseBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type SignatureDelta struct{…}
type StopReason string
type TextBlock struct{…}
Citations []TextCitationUnionCitations supporting the text block.
Citations supporting the text block.
The type of citation returned will depend on the type of document being cited. Citing a PDF results in page_location, plain text results in char_location, and content document results in content_block_location.
type CitationCharLocation struct{…}
type CitationPageLocation struct{…}
type CitationContentBlockLocation struct{…}
type CitationsWebSearchResultLocation struct{…}
type CitationsSearchResultLocation struct{…}
type TextBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type TextCitationUnion interface{…}
type CitationCharLocation struct{…}
type CitationPageLocation struct{…}
type CitationContentBlockLocation struct{…}
type CitationsWebSearchResultLocation struct{…}
type CitationsSearchResultLocation struct{…}
type TextCitationParamUnionResp interface{…}
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type TextDelta struct{…}
type TextEditorCodeExecutionCreateResultBlock struct{…}
type TextEditorCodeExecutionCreateResultBlockParamResp struct{…}
type TextEditorCodeExecutionStrReplaceResultBlock struct{…}
type TextEditorCodeExecutionStrReplaceResultBlockParamResp struct{…}
type TextEditorCodeExecutionToolResultBlock struct{…}
Content TextEditorCodeExecutionToolResultBlockContentUnion
type TextEditorCodeExecutionToolResultError struct{…}
type TextEditorCodeExecutionViewResultBlock struct{…}
FileType TextEditorCodeExecutionViewResultBlockFileType
type TextEditorCodeExecutionCreateResultBlock struct{…}
type TextEditorCodeExecutionStrReplaceResultBlock struct{…}
type TextEditorCodeExecutionToolResultBlockParamResp struct{…}
Content TextEditorCodeExecutionToolResultBlockParamContentUnionResp
type TextEditorCodeExecutionToolResultErrorParamResp struct{…}
type TextEditorCodeExecutionViewResultBlockParamResp struct{…}
FileType TextEditorCodeExecutionViewResultBlockParamFileType
type TextEditorCodeExecutionCreateResultBlockParamResp struct{…}
type TextEditorCodeExecutionStrReplaceResultBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type TextEditorCodeExecutionToolResultError struct{…}
type TextEditorCodeExecutionToolResultErrorCode string
type TextEditorCodeExecutionToolResultErrorParamResp struct{…}
type TextEditorCodeExecutionViewResultBlock struct{…}
FileType TextEditorCodeExecutionViewResultBlockFileType
type TextEditorCodeExecutionViewResultBlockParamResp struct{…}
FileType TextEditorCodeExecutionViewResultBlockParamFileType
type ThinkingBlock struct{…}
type ThinkingBlockParamResp struct{…}
type ThinkingConfigAdaptive struct{…}
type ThinkingConfigDisabled struct{…}
type ThinkingConfigEnabled struct{…}
BudgetTokens int64Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.
Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.
Must be ≥1024 and less than max_tokens.
See extended thinking for details.
type ThinkingConfigParamUnionResp interface{…}Configuration for enabling Claude's extended thinking.
Configuration for enabling Claude's extended thinking.
When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your max_tokens limit.
See extended thinking for details.
type ThinkingConfigEnabled struct{…}
BudgetTokens int64Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.
Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.
Must be ≥1024 and less than max_tokens.
See extended thinking for details.
type ThinkingConfigDisabled struct{…}
type ThinkingConfigAdaptive struct{…}
type ThinkingDelta struct{…}
type Tool struct{…}
InputSchema ToolInputSchemaJSON schema for this tool's input.
JSON schema for this tool's input.
This defines the shape of the input that your tool accepts and that the model will produce.
Name stringName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
Description stringoptionalDescription of what this tool does.
Description of what this tool does.
Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.
Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers.
When true, guarantees schema validation on tool names and inputs
type ToolBash20250124 struct{…}
Name BashName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type ToolChoiceUnion interface{…}How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.
How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.
type ToolChoiceAuto struct{…}The model will automatically decide whether to use tools.
The model will automatically decide whether to use tools.
DisableParallelToolUse booloptionalWhether to disable parallel tool use.
Whether to disable parallel tool use.
Defaults to false. If set to true, the model will output at most one tool use.
type ToolChoiceAny struct{…}The model will use any available tools.
The model will use any available tools.
DisableParallelToolUse booloptionalWhether to disable parallel tool use.
Whether to disable parallel tool use.
Defaults to false. If set to true, the model will output exactly one tool use.
type ToolChoiceTool struct{…}The model will use the specified tool with tool_choice.name.
The model will use the specified tool with tool_choice.name.
The name of the tool to use.
DisableParallelToolUse booloptionalWhether to disable parallel tool use.
Whether to disable parallel tool use.
Defaults to false. If set to true, the model will output exactly one tool use.
type ToolChoiceNone struct{…}The model will not be allowed to use tools.
The model will not be allowed to use tools.
type ToolChoiceAny struct{…}The model will use any available tools.
The model will use any available tools.
DisableParallelToolUse booloptionalWhether to disable parallel tool use.
Whether to disable parallel tool use.
Defaults to false. If set to true, the model will output exactly one tool use.
type ToolChoiceAuto struct{…}The model will automatically decide whether to use tools.
The model will automatically decide whether to use tools.
DisableParallelToolUse booloptionalWhether to disable parallel tool use.
Whether to disable parallel tool use.
Defaults to false. If set to true, the model will output at most one tool use.
type ToolChoiceNone struct{…}The model will not be allowed to use tools.
The model will not be allowed to use tools.
type ToolChoiceTool struct{…}The model will use the specified tool with tool_choice.name.
The model will use the specified tool with tool_choice.name.
The name of the tool to use.
DisableParallelToolUse booloptionalWhether to disable parallel tool use.
Whether to disable parallel tool use.
Defaults to false. If set to true, the model will output exactly one tool use.
type ToolReferenceBlock struct{…}
type ToolReferenceBlockParamResp struct{…}Tool reference block that can be included in tool_result content.
Tool reference block that can be included in tool_result content.
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type ToolResultBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Content []ToolResultBlockParamContentUnionRespoptional
[]ToolResultBlockParamContentUnionResp
type TextBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type ImageBlockParamResp struct{…}
Source ImageBlockParamSourceUnionResp
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type URLImageSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type SearchResultBlockParamResp struct{…}
Content []TextBlockParamResp
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptional
type DocumentBlockParamResp struct{…}
Source DocumentBlockParamSourceUnionResp
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
type ContentBlockSource struct{…}
Content ContentBlockSourceContentUnion
type TextBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type ImageBlockParamResp struct{…}
Source ImageBlockParamSourceUnionResp
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type URLImageSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type URLPDFSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptional
type ToolReferenceBlockParamResp struct{…}Tool reference block that can be included in tool_result content.
Tool reference block that can be included in tool_result content.
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type ToolSearchToolBm25_20251119 struct{…}
Name ToolSearchToolBm25Name of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Type ToolSearchToolBm25_20251119Type
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type ToolSearchToolRegex20251119 struct{…}
Name ToolSearchToolRegexName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Type ToolSearchToolRegex20251119Type
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type ToolSearchToolResultBlock struct{…}
Content ToolSearchToolResultBlockContentUnion
type ToolSearchToolResultError struct{…}
ErrorCode ToolSearchToolResultErrorCode
type ToolSearchToolSearchResultBlock struct{…}
ToolReferences []ToolReferenceBlock
type ToolSearchToolResultBlockParamResp struct{…}
Content ToolSearchToolResultBlockParamContentUnionResp
type ToolSearchToolResultErrorParamResp struct{…}
ErrorCode ToolSearchToolResultErrorCode
type ToolSearchToolSearchResultBlockParamResp struct{…}
ToolReferences []ToolReferenceBlockParamResp
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type ToolSearchToolResultError struct{…}
ErrorCode ToolSearchToolResultErrorCode
type ToolSearchToolResultErrorCode string
type ToolSearchToolResultErrorParamResp struct{…}
ErrorCode ToolSearchToolResultErrorCode
type ToolSearchToolSearchResultBlock struct{…}
ToolReferences []ToolReferenceBlock
type ToolSearchToolSearchResultBlockParamResp struct{…}
ToolReferences []ToolReferenceBlockParamResp
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type ToolTextEditor20250124 struct{…}
Name StrReplaceEditorName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type ToolTextEditor20250429 struct{…}
Name StrReplaceBasedEditToolName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type ToolTextEditor20250728 struct{…}
Name StrReplaceBasedEditToolName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.
When true, guarantees schema validation on tool names and inputs
type ToolUnion interface{…}Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
type Tool struct{…}
InputSchema ToolInputSchemaJSON schema for this tool's input.
JSON schema for this tool's input.
This defines the shape of the input that your tool accepts and that the model will produce.
Name stringName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
Description stringoptionalDescription of what this tool does.
Description of what this tool does.
Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.
Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers.
When true, guarantees schema validation on tool names and inputs
type ToolBash20250124 struct{…}
Name BashName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type CodeExecutionTool20250522 struct{…}
Name CodeExecutionName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type CodeExecutionTool20250825 struct{…}
Name CodeExecutionName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type CodeExecutionTool20260120 struct{…}Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
Name CodeExecutionName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type MemoryTool20250818 struct{…}
Name MemoryName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type ToolTextEditor20250124 struct{…}
Name StrReplaceEditorName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type ToolTextEditor20250429 struct{…}
Name StrReplaceBasedEditToolName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type ToolTextEditor20250728 struct{…}
Name StrReplaceBasedEditToolName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.
When true, guarantees schema validation on tool names and inputs
type WebSearchTool20250305 struct{…}
Name WebSearchName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
If provided, only these domains will be included in results. Cannot be used alongside blocked_domains.
If provided, these domains will never appear in results. Cannot be used alongside allowed_domains.
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
Maximum number of times the tool can be used in the API request.
When true, guarantees schema validation on tool names and inputs
UserLocation UserLocationoptionalParameters for the user's location. Used to provide more relevant search results.
Parameters for the user's location. Used to provide more relevant search results.
The city of the user.
The two letter ISO country code of the user.
The region of the user.
The IANA timezone of the user.
type WebFetchTool20250910 struct{…}
Name WebFetchName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
List of domains to allow fetching from
List of domains to block fetching from
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptionalCitations configuration for fetched documents. Citations are disabled by default.
Citations configuration for fetched documents. Citations are disabled by default.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
Maximum number of times the tool can be used in the API request.
When true, guarantees schema validation on tool names and inputs
type WebSearchTool20260209 struct{…}
Name WebSearchName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
If provided, only these domains will be included in results. Cannot be used alongside blocked_domains.
If provided, these domains will never appear in results. Cannot be used alongside allowed_domains.
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
Maximum number of times the tool can be used in the API request.
When true, guarantees schema validation on tool names and inputs
UserLocation UserLocationoptionalParameters for the user's location. Used to provide more relevant search results.
Parameters for the user's location. Used to provide more relevant search results.
The city of the user.
The two letter ISO country code of the user.
The region of the user.
The IANA timezone of the user.
type WebFetchTool20260209 struct{…}
Name WebFetchName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
List of domains to allow fetching from
List of domains to block fetching from
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptionalCitations configuration for fetched documents. Citations are disabled by default.
Citations configuration for fetched documents. Citations are disabled by default.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
Maximum number of times the tool can be used in the API request.
When true, guarantees schema validation on tool names and inputs
type ToolSearchToolBm25_20251119 struct{…}
Name ToolSearchToolBm25Name of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Type ToolSearchToolBm25_20251119Type
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type ToolSearchToolRegex20251119 struct{…}
Name ToolSearchToolRegexName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Type ToolSearchToolRegex20251119Type
AllowedCallers []stringoptional
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
When true, guarantees schema validation on tool names and inputs
type ToolUseBlock struct{…}
Caller ToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type ToolUseBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Caller ToolUseBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type URLImageSource struct{…}
type URLPDFSource struct{…}
type Usage struct{…}
CacheCreation CacheCreationBreakdown of cached tokens by TTL
Breakdown of cached tokens by TTL
The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the cache entry.
The number of input tokens read from the cache.
The geographic region where inference was performed for this request.
The number of input tokens which were used.
The number of output tokens which were used.
ServerToolUse ServerToolUsageThe number of server tool requests.
The number of server tool requests.
The number of web fetch tool requests.
The number of web search tool requests.
ServiceTier UsageServiceTierIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
type UserLocation struct{…}
The city of the user.
The two letter ISO country code of the user.
The region of the user.
The IANA timezone of the user.
type WebFetchBlock struct{…}
Content DocumentBlock
Citations CitationsConfigCitation configuration for the document
Citation configuration for the document
Source DocumentBlockSourceUnion
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
type WebFetchBlockParamResp struct{…}
Content DocumentBlockParamResp
Source DocumentBlockParamSourceUnionResp
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
type ContentBlockSource struct{…}
Content ContentBlockSourceContentUnion
type TextBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type ImageBlockParamResp struct{…}
Source ImageBlockParamSourceUnionResp
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type URLImageSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type URLPDFSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptional
Fetched content URL
ISO 8601 timestamp when the content was retrieved
type WebFetchTool20250910 struct{…}
Name WebFetchName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
List of domains to allow fetching from
List of domains to block fetching from
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptionalCitations configuration for fetched documents. Citations are disabled by default.
Citations configuration for fetched documents. Citations are disabled by default.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
Maximum number of times the tool can be used in the API request.
When true, guarantees schema validation on tool names and inputs
type WebFetchTool20260209 struct{…}
Name WebFetchName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
List of domains to allow fetching from
List of domains to block fetching from
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptionalCitations configuration for fetched documents. Citations are disabled by default.
Citations configuration for fetched documents. Citations are disabled by default.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
Maximum number of times the tool can be used in the API request.
When true, guarantees schema validation on tool names and inputs
type WebFetchToolResultBlock struct{…}
Caller WebFetchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Content WebFetchToolResultBlockContentUnion
type WebFetchToolResultErrorBlock struct{…}
ErrorCode WebFetchToolResultErrorCode
type WebFetchBlock struct{…}
Content DocumentBlock
Citations CitationsConfigCitation configuration for the document
Citation configuration for the document
Source DocumentBlockSourceUnion
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
type WebFetchToolResultBlockParamResp struct{…}
Content WebFetchToolResultBlockParamContentUnionResp
type WebFetchToolResultErrorBlockParamResp struct{…}
ErrorCode WebFetchToolResultErrorCode
type WebFetchBlockParamResp struct{…}
Content DocumentBlockParamResp
Source DocumentBlockParamSourceUnionResp
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
type ContentBlockSource struct{…}
Content ContentBlockSourceContentUnion
type TextBlockParamResp struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations []TextCitationParamUnionRespoptional
type CitationCharLocationParamResp struct{…}
type CitationPageLocationParamResp struct{…}
type CitationContentBlockLocationParamResp struct{…}
type CitationWebSearchResultLocationParamResp struct{…}
type CitationSearchResultLocationParamResp struct{…}
type ImageBlockParamResp struct{…}
Source ImageBlockParamSourceUnionResp
type Base64ImageSource struct{…}
MediaType Base64ImageSourceMediaType
type URLImageSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type URLPDFSource struct{…}
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Citations CitationsConfigParamRespoptional
Fetched content URL
ISO 8601 timestamp when the content was retrieved
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Caller WebFetchToolResultBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type WebFetchToolResultErrorBlock struct{…}
ErrorCode WebFetchToolResultErrorCode
type WebFetchToolResultErrorBlockParamResp struct{…}
ErrorCode WebFetchToolResultErrorCode
type WebFetchToolResultErrorCode string
type WebSearchResultBlock struct{…}
type WebSearchResultBlockParamResp struct{…}
type WebSearchTool20250305 struct{…}
Name WebSearchName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
If provided, only these domains will be included in results. Cannot be used alongside blocked_domains.
If provided, these domains will never appear in results. Cannot be used alongside allowed_domains.
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
Maximum number of times the tool can be used in the API request.
When true, guarantees schema validation on tool names and inputs
UserLocation UserLocationoptionalParameters for the user's location. Used to provide more relevant search results.
Parameters for the user's location. Used to provide more relevant search results.
The city of the user.
The two letter ISO country code of the user.
The region of the user.
The IANA timezone of the user.
type WebSearchTool20260209 struct{…}
Name WebSearchName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
AllowedCallers []stringoptional
If provided, only these domains will be included in results. Cannot be used alongside blocked_domains.
If provided, these domains will never appear in results. Cannot be used alongside allowed_domains.
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
Maximum number of times the tool can be used in the API request.
When true, guarantees schema validation on tool names and inputs
UserLocation UserLocationoptionalParameters for the user's location. Used to provide more relevant search results.
Parameters for the user's location. Used to provide more relevant search results.
The city of the user.
The two letter ISO country code of the user.
The region of the user.
The IANA timezone of the user.
type WebSearchToolRequestError struct{…}
ErrorCode WebSearchToolResultErrorCode
type WebSearchToolResultBlock struct{…}
Caller WebSearchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type WebSearchToolResultError struct{…}
ErrorCode WebSearchToolResultErrorCode
type WebSearchToolResultBlockContentArray []WebSearchResultBlock
type WebSearchToolResultBlockContentUnion interface{…}
type WebSearchToolResultError struct{…}
ErrorCode WebSearchToolResultErrorCode
type WebSearchToolResultBlockContentArray []WebSearchResultBlock
type WebSearchToolResultBlockParamResp struct{…}
type WebSearchToolRequestError struct{…}
ErrorCode WebSearchToolResultErrorCode
CacheControl CacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL CacheControlEphemeralTTLoptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Caller WebSearchToolResultBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type WebSearchToolResultBlockParamContentUnionResp interface{…}
type WebSearchToolRequestError struct{…}
ErrorCode WebSearchToolResultErrorCode
type WebSearchToolResultError struct{…}
ErrorCode WebSearchToolResultErrorCode
type WebSearchToolResultErrorCode string
MessagesBatches
Create a Message Batch
Retrieve a Message Batch
List Message Batches
Cancel a Message Batch
Delete a Message Batch
Retrieve Message Batch results
ModelsExpand Collapse
type DeletedMessageBatch struct{…}
ID of the Message Batch.
Type MessageBatchDeletedDeleted object type.
Deleted object type.
For Message Batches, this is always "message_batch_deleted".
type MessageBatch struct{…}
ID stringUnique object identifier.
Unique object identifier.
The format and length of IDs may change over time.
RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable.
RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated.
RFC 3339 datetime string representing the time at which the Message Batch was created.
EndedAt TimeRFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.
RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.
Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired.
RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.
ProcessingStatus MessageBatchProcessingStatusProcessing status of the Message Batch.
Processing status of the Message Batch.
RequestCounts MessageBatchRequestCountsTallies requests within the Message Batch, categorized by their status.
Tallies requests within the Message Batch, categorized by their status.
Requests start as processing and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch.
Canceled int64Number of requests in the Message Batch that have been canceled.
Number of requests in the Message Batch that have been canceled.
This is zero until processing of the entire Message Batch has ended.
Errored int64Number of requests in the Message Batch that encountered an error.
Number of requests in the Message Batch that encountered an error.
This is zero until processing of the entire Message Batch has ended.
Expired int64Number of requests in the Message Batch that have expired.
Number of requests in the Message Batch that have expired.
This is zero until processing of the entire Message Batch has ended.
Number of requests in the Message Batch that are processing.
Succeeded int64Number of requests in the Message Batch that have completed successfully.
Number of requests in the Message Batch that have completed successfully.
This is zero until processing of the entire Message Batch has ended.
ResultsURL stringURL to a .jsonl file containing the results of the Message Batch requests. Specified only once processing ends.
URL to a .jsonl file containing the results of the Message Batch requests. Specified only once processing ends.
Results in the file are not guaranteed to be in the same order as requests. Use the custom_id field to match results to requests.
Type MessageBatchObject type.
Object type.
For Message Batches, this is always "message_batch".
type MessageBatchCanceledResult struct{…}
type MessageBatchErroredResult struct{…}
Error ErrorResponse
Error ErrorObjectUnion
type InvalidRequestError struct{…}
type AuthenticationError struct{…}
type BillingError struct{…}
type PermissionError struct{…}
type NotFoundError struct{…}
type RateLimitError struct{…}
type GatewayTimeoutError struct{…}
type APIErrorObject struct{…}
type OverloadedError struct{…}
type MessageBatchExpiredResult struct{…}
type MessageBatchIndividualResponse struct{…}This is a single line in the response .jsonl file and does not represent the response as a whole.
This is a single line in the response .jsonl file and does not represent the response as a whole.
CustomID stringDeveloper-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.
Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.
Must be unique for each request within the Message Batch.
Result MessageBatchResultUnionProcessing result for this request.
Processing result for this request.
Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.
type MessageBatchSucceededResult struct{…}
Message Message
ID stringUnique object identifier.
Unique object identifier.
The format and length of IDs may change over time.
Container ContainerInformation about the container used in the request (for the code execution tool)
Information about the container used in the request (for the code execution tool)
Identifier for the container used in this request
The time at which the container will expire.
Content []ContentBlockUnionContent generated by the model.
Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
Example:
[{"type": "text", "text": "Hi, I'm Claude."}]
If the request input messages ended with an assistant turn, then the response content will continue directly from that last turn. You can use this to constrain the model's output.
For example, if the input messages were:
[
{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
{"role": "assistant", "content": "The best answer is ("}
]
Then the response content might be:
[{"type": "text", "text": "B)"}]
type TextBlock struct{…}
Citations []TextCitationUnionCitations supporting the text block.
Citations supporting the text block.
The type of citation returned will depend on the type of document being cited. Citing a PDF results in page_location, plain text results in char_location, and content document results in content_block_location.
type CitationCharLocation struct{…}
type CitationPageLocation struct{…}
type CitationContentBlockLocation struct{…}
type CitationsWebSearchResultLocation struct{…}
type CitationsSearchResultLocation struct{…}
type ThinkingBlock struct{…}
type RedactedThinkingBlock struct{…}
type ToolUseBlock struct{…}
Caller ToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type ServerToolUseBlock struct{…}
Caller ServerToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Name ServerToolUseBlockName
type WebSearchToolResultBlock struct{…}
Caller WebSearchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type WebSearchToolResultError struct{…}
ErrorCode WebSearchToolResultErrorCode
type WebSearchToolResultBlockContentArray []WebSearchResultBlock
type WebFetchToolResultBlock struct{…}
Caller WebFetchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Content WebFetchToolResultBlockContentUnion
type WebFetchToolResultErrorBlock struct{…}
ErrorCode WebFetchToolResultErrorCode
type WebFetchBlock struct{…}
Content DocumentBlock
Citations CitationsConfigCitation configuration for the document
Citation configuration for the document
Source DocumentBlockSourceUnion
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
type CodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type CodeExecutionToolResultError struct{…}
ErrorCode CodeExecutionToolResultErrorCode
type CodeExecutionResultBlock struct{…}
Content []CodeExecutionOutputBlock
type EncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []CodeExecutionOutputBlock
type BashCodeExecutionToolResultBlock struct{…}
Content BashCodeExecutionToolResultBlockContentUnion
type BashCodeExecutionToolResultError struct{…}
ErrorCode BashCodeExecutionToolResultErrorCode
type BashCodeExecutionResultBlock struct{…}
Content []BashCodeExecutionOutputBlock
type TextEditorCodeExecutionToolResultBlock struct{…}
Content TextEditorCodeExecutionToolResultBlockContentUnion
type TextEditorCodeExecutionToolResultError struct{…}
type TextEditorCodeExecutionViewResultBlock struct{…}
FileType TextEditorCodeExecutionViewResultBlockFileType
type TextEditorCodeExecutionCreateResultBlock struct{…}
type TextEditorCodeExecutionStrReplaceResultBlock struct{…}
type ToolSearchToolResultBlock struct{…}
Content ToolSearchToolResultBlockContentUnion
type ToolSearchToolResultError struct{…}
ErrorCode ToolSearchToolResultErrorCode
type ToolSearchToolSearchResultBlock struct{…}
ToolReferences []ToolReferenceBlock
type ContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
Model ModelThe model that will complete your prompt.
The model that will complete your prompt.
See models for additional details and options.
type Model stringThe model that will complete your prompt.
The model that will complete your prompt.
See models for additional details and options.
Most intelligent model for building agents and coding
Frontier intelligence at scale — built for coding, agents, and enterprise workflows
Premium model combining maximum intelligence with practical performance
Premium model combining maximum intelligence with practical performance
High-performance model with early extended thinking
High-performance model with early extended thinking
Fastest and most compact model for near-instant responsiveness
Our fastest model
Hybrid model, capable of near-instant responses and extended thinking
Hybrid model, capable of near-instant responses and extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
Our best model for real-world agents and coding
Our best model for real-world agents and coding
Our most capable model
Our most capable model
Our most capable model
Our most capable model
Excels at writing and complex tasks
Excels at writing and complex tasks
Our previous most fast and cost-effective
Role AssistantConversational role of the generated message.
Conversational role of the generated message.
This will always be "assistant".
StopReason StopReasonThe reason that we stopped.
The reason that we stopped.
This may be one the following values:
"end_turn": the model reached a natural stopping point"max_tokens": we exceeded the requestedmax_tokensor the model's maximum"stop_sequence": one of your provided customstop_sequenceswas generated"tool_use": the model invoked one or more tools"pause_turn": we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue."refusal": when streaming classifiers intervene to handle potential policy violations
In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
StopSequence stringWhich custom stop sequence was generated, if any.
Which custom stop sequence was generated, if any.
This value will be a non-null string if one of your custom stop sequences was generated.
Type MessageObject type.
Object type.
For Messages, this is always "message".
Usage UsageBilling and rate-limit usage.
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in usage will not match one-to-one with the exact visible content of an API request or response.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
CacheCreation CacheCreationBreakdown of cached tokens by TTL
Breakdown of cached tokens by TTL
The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the cache entry.
The number of input tokens read from the cache.
The geographic region where inference was performed for this request.
The number of input tokens which were used.
The number of output tokens which were used.
ServerToolUse ServerToolUsageThe number of server tool requests.
The number of server tool requests.
The number of web fetch tool requests.
The number of web search tool requests.
ServiceTier UsageServiceTierIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
type MessageBatchErroredResult struct{…}
Error ErrorResponse
Error ErrorObjectUnion
type InvalidRequestError struct{…}
type AuthenticationError struct{…}
type BillingError struct{…}
type PermissionError struct{…}
type NotFoundError struct{…}
type RateLimitError struct{…}
type GatewayTimeoutError struct{…}
type APIErrorObject struct{…}
type OverloadedError struct{…}
type MessageBatchCanceledResult struct{…}
type MessageBatchExpiredResult struct{…}
type MessageBatchRequestCounts struct{…}
Canceled int64Number of requests in the Message Batch that have been canceled.
Number of requests in the Message Batch that have been canceled.
This is zero until processing of the entire Message Batch has ended.
Errored int64Number of requests in the Message Batch that encountered an error.
Number of requests in the Message Batch that encountered an error.
This is zero until processing of the entire Message Batch has ended.
Expired int64Number of requests in the Message Batch that have expired.
Number of requests in the Message Batch that have expired.
This is zero until processing of the entire Message Batch has ended.
Number of requests in the Message Batch that are processing.
Succeeded int64Number of requests in the Message Batch that have completed successfully.
Number of requests in the Message Batch that have completed successfully.
This is zero until processing of the entire Message Batch has ended.
type MessageBatchResultUnion interface{…}Processing result for this request.
Processing result for this request.
Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.
type MessageBatchSucceededResult struct{…}
Message Message
ID stringUnique object identifier.
Unique object identifier.
The format and length of IDs may change over time.
Container ContainerInformation about the container used in the request (for the code execution tool)
Information about the container used in the request (for the code execution tool)
Identifier for the container used in this request
The time at which the container will expire.
Content []ContentBlockUnionContent generated by the model.
Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
Example:
[{"type": "text", "text": "Hi, I'm Claude."}]
If the request input messages ended with an assistant turn, then the response content will continue directly from that last turn. You can use this to constrain the model's output.
For example, if the input messages were:
[
{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
{"role": "assistant", "content": "The best answer is ("}
]
Then the response content might be:
[{"type": "text", "text": "B)"}]
type TextBlock struct{…}
Citations []TextCitationUnionCitations supporting the text block.
Citations supporting the text block.
The type of citation returned will depend on the type of document being cited. Citing a PDF results in page_location, plain text results in char_location, and content document results in content_block_location.
type CitationCharLocation struct{…}
type CitationPageLocation struct{…}
type CitationContentBlockLocation struct{…}
type CitationsWebSearchResultLocation struct{…}
type CitationsSearchResultLocation struct{…}
type ThinkingBlock struct{…}
type RedactedThinkingBlock struct{…}
type ToolUseBlock struct{…}
Caller ToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type ServerToolUseBlock struct{…}
Caller ServerToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Name ServerToolUseBlockName
type WebSearchToolResultBlock struct{…}
Caller WebSearchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type WebSearchToolResultError struct{…}
ErrorCode WebSearchToolResultErrorCode
type WebSearchToolResultBlockContentArray []WebSearchResultBlock
type WebFetchToolResultBlock struct{…}
Caller WebFetchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Content WebFetchToolResultBlockContentUnion
type WebFetchToolResultErrorBlock struct{…}
ErrorCode WebFetchToolResultErrorCode
type WebFetchBlock struct{…}
Content DocumentBlock
Citations CitationsConfigCitation configuration for the document
Citation configuration for the document
Source DocumentBlockSourceUnion
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
type CodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type CodeExecutionToolResultError struct{…}
ErrorCode CodeExecutionToolResultErrorCode
type CodeExecutionResultBlock struct{…}
Content []CodeExecutionOutputBlock
type EncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []CodeExecutionOutputBlock
type BashCodeExecutionToolResultBlock struct{…}
Content BashCodeExecutionToolResultBlockContentUnion
type BashCodeExecutionToolResultError struct{…}
ErrorCode BashCodeExecutionToolResultErrorCode
type BashCodeExecutionResultBlock struct{…}
Content []BashCodeExecutionOutputBlock
type TextEditorCodeExecutionToolResultBlock struct{…}
Content TextEditorCodeExecutionToolResultBlockContentUnion
type TextEditorCodeExecutionToolResultError struct{…}
type TextEditorCodeExecutionViewResultBlock struct{…}
FileType TextEditorCodeExecutionViewResultBlockFileType
type TextEditorCodeExecutionCreateResultBlock struct{…}
type TextEditorCodeExecutionStrReplaceResultBlock struct{…}
type ToolSearchToolResultBlock struct{…}
Content ToolSearchToolResultBlockContentUnion
type ToolSearchToolResultError struct{…}
ErrorCode ToolSearchToolResultErrorCode
type ToolSearchToolSearchResultBlock struct{…}
ToolReferences []ToolReferenceBlock
type ContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
Model ModelThe model that will complete your prompt.
The model that will complete your prompt.
See models for additional details and options.
type Model stringThe model that will complete your prompt.
The model that will complete your prompt.
See models for additional details and options.
Most intelligent model for building agents and coding
Frontier intelligence at scale — built for coding, agents, and enterprise workflows
Premium model combining maximum intelligence with practical performance
Premium model combining maximum intelligence with practical performance
High-performance model with early extended thinking
High-performance model with early extended thinking
Fastest and most compact model for near-instant responsiveness
Our fastest model
Hybrid model, capable of near-instant responses and extended thinking
Hybrid model, capable of near-instant responses and extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
Our best model for real-world agents and coding
Our best model for real-world agents and coding
Our most capable model
Our most capable model
Our most capable model
Our most capable model
Excels at writing and complex tasks
Excels at writing and complex tasks
Our previous most fast and cost-effective
Role AssistantConversational role of the generated message.
Conversational role of the generated message.
This will always be "assistant".
StopReason StopReasonThe reason that we stopped.
The reason that we stopped.
This may be one the following values:
"end_turn": the model reached a natural stopping point"max_tokens": we exceeded the requestedmax_tokensor the model's maximum"stop_sequence": one of your provided customstop_sequenceswas generated"tool_use": the model invoked one or more tools"pause_turn": we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue."refusal": when streaming classifiers intervene to handle potential policy violations
In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
StopSequence stringWhich custom stop sequence was generated, if any.
Which custom stop sequence was generated, if any.
This value will be a non-null string if one of your custom stop sequences was generated.
Type MessageObject type.
Object type.
For Messages, this is always "message".
Usage UsageBilling and rate-limit usage.
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in usage will not match one-to-one with the exact visible content of an API request or response.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
CacheCreation CacheCreationBreakdown of cached tokens by TTL
Breakdown of cached tokens by TTL
The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the cache entry.
The number of input tokens read from the cache.
The geographic region where inference was performed for this request.
The number of input tokens which were used.
The number of output tokens which were used.
ServerToolUse ServerToolUsageThe number of server tool requests.
The number of server tool requests.
The number of web fetch tool requests.
The number of web search tool requests.
ServiceTier UsageServiceTierIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
type MessageBatchErroredResult struct{…}
Error ErrorResponse
Error ErrorObjectUnion
type InvalidRequestError struct{…}
type AuthenticationError struct{…}
type BillingError struct{…}
type PermissionError struct{…}
type NotFoundError struct{…}
type RateLimitError struct{…}
type GatewayTimeoutError struct{…}
type APIErrorObject struct{…}
type OverloadedError struct{…}
type MessageBatchCanceledResult struct{…}
type MessageBatchExpiredResult struct{…}
type MessageBatchSucceededResult struct{…}
Message Message
ID stringUnique object identifier.
Unique object identifier.
The format and length of IDs may change over time.
Container ContainerInformation about the container used in the request (for the code execution tool)
Information about the container used in the request (for the code execution tool)
Identifier for the container used in this request
The time at which the container will expire.
Content []ContentBlockUnionContent generated by the model.
Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
Example:
[{"type": "text", "text": "Hi, I'm Claude."}]
If the request input messages ended with an assistant turn, then the response content will continue directly from that last turn. You can use this to constrain the model's output.
For example, if the input messages were:
[
{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
{"role": "assistant", "content": "The best answer is ("}
]
Then the response content might be:
[{"type": "text", "text": "B)"}]
type TextBlock struct{…}
Citations []TextCitationUnionCitations supporting the text block.
Citations supporting the text block.
The type of citation returned will depend on the type of document being cited. Citing a PDF results in page_location, plain text results in char_location, and content document results in content_block_location.
type CitationCharLocation struct{…}
type CitationPageLocation struct{…}
type CitationContentBlockLocation struct{…}
type CitationsWebSearchResultLocation struct{…}
type CitationsSearchResultLocation struct{…}
type ThinkingBlock struct{…}
type RedactedThinkingBlock struct{…}
type ToolUseBlock struct{…}
Caller ToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type ServerToolUseBlock struct{…}
Caller ServerToolUseBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Name ServerToolUseBlockName
type WebSearchToolResultBlock struct{…}
Caller WebSearchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
type WebSearchToolResultError struct{…}
ErrorCode WebSearchToolResultErrorCode
type WebSearchToolResultBlockContentArray []WebSearchResultBlock
type WebFetchToolResultBlock struct{…}
Caller WebFetchToolResultBlockCallerUnionTool invocation directly from the model.
Tool invocation directly from the model.
type DirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type ServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type ServerToolCaller20260120 struct{…}
Content WebFetchToolResultBlockContentUnion
type WebFetchToolResultErrorBlock struct{…}
ErrorCode WebFetchToolResultErrorCode
type WebFetchBlock struct{…}
Content DocumentBlock
Citations CitationsConfigCitation configuration for the document
Citation configuration for the document
Source DocumentBlockSourceUnion
type Base64PDFSource struct{…}
type PlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
type CodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type CodeExecutionToolResultError struct{…}
ErrorCode CodeExecutionToolResultErrorCode
type CodeExecutionResultBlock struct{…}
Content []CodeExecutionOutputBlock
type EncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []CodeExecutionOutputBlock
type BashCodeExecutionToolResultBlock struct{…}
Content BashCodeExecutionToolResultBlockContentUnion
type BashCodeExecutionToolResultError struct{…}
ErrorCode BashCodeExecutionToolResultErrorCode
type BashCodeExecutionResultBlock struct{…}
Content []BashCodeExecutionOutputBlock
type TextEditorCodeExecutionToolResultBlock struct{…}
Content TextEditorCodeExecutionToolResultBlockContentUnion
type TextEditorCodeExecutionToolResultError struct{…}
type TextEditorCodeExecutionViewResultBlock struct{…}
FileType TextEditorCodeExecutionViewResultBlockFileType
type TextEditorCodeExecutionCreateResultBlock struct{…}
type TextEditorCodeExecutionStrReplaceResultBlock struct{…}
type ToolSearchToolResultBlock struct{…}
Content ToolSearchToolResultBlockContentUnion
type ToolSearchToolResultError struct{…}
ErrorCode ToolSearchToolResultErrorCode
type ToolSearchToolSearchResultBlock struct{…}
ToolReferences []ToolReferenceBlock
type ContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
Model ModelThe model that will complete your prompt.
The model that will complete your prompt.
See models for additional details and options.
type Model stringThe model that will complete your prompt.
The model that will complete your prompt.
See models for additional details and options.
Most intelligent model for building agents and coding
Frontier intelligence at scale — built for coding, agents, and enterprise workflows
Premium model combining maximum intelligence with practical performance
Premium model combining maximum intelligence with practical performance
High-performance model with early extended thinking
High-performance model with early extended thinking
Fastest and most compact model for near-instant responsiveness
Our fastest model
Hybrid model, capable of near-instant responses and extended thinking
Hybrid model, capable of near-instant responses and extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
Our best model for real-world agents and coding
Our best model for real-world agents and coding
Our most capable model
Our most capable model
Our most capable model
Our most capable model
Excels at writing and complex tasks
Excels at writing and complex tasks
Our previous most fast and cost-effective
Role AssistantConversational role of the generated message.
Conversational role of the generated message.
This will always be "assistant".
StopReason StopReasonThe reason that we stopped.
The reason that we stopped.
This may be one the following values:
"end_turn": the model reached a natural stopping point"max_tokens": we exceeded the requestedmax_tokensor the model's maximum"stop_sequence": one of your provided customstop_sequenceswas generated"tool_use": the model invoked one or more tools"pause_turn": we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue."refusal": when streaming classifiers intervene to handle potential policy violations
In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
StopSequence stringWhich custom stop sequence was generated, if any.
Which custom stop sequence was generated, if any.
This value will be a non-null string if one of your custom stop sequences was generated.
Type MessageObject type.
Object type.
For Messages, this is always "message".
Usage UsageBilling and rate-limit usage.
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in usage will not match one-to-one with the exact visible content of an API request or response.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
CacheCreation CacheCreationBreakdown of cached tokens by TTL
Breakdown of cached tokens by TTL
The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the cache entry.
The number of input tokens read from the cache.
The geographic region where inference was performed for this request.
The number of input tokens which were used.
The number of output tokens which were used.
ServerToolUse ServerToolUsageThe number of server tool requests.
The number of server tool requests.
The number of web fetch tool requests.
The number of web search tool requests.
ServiceTier UsageServiceTierIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.