Beta
ModelsExpand Collapse
type AnthropicBeta interface{…}
type AnthropicBeta string
type BetaAPIError struct{…}
type BetaAuthenticationError struct{…}
type BetaBillingError struct{…}
type BetaErrorUnion interface{…}
type BetaInvalidRequestError struct{…}
type BetaAuthenticationError struct{…}
type BetaBillingError struct{…}
type BetaPermissionError struct{…}
type BetaNotFoundError struct{…}
type BetaRateLimitError struct{…}
type BetaGatewayTimeoutError struct{…}
type BetaAPIError struct{…}
type BetaOverloadedError struct{…}
type BetaErrorResponse struct{…}
Error BetaErrorUnion
type BetaInvalidRequestError struct{…}
type BetaAuthenticationError struct{…}
type BetaBillingError struct{…}
type BetaPermissionError struct{…}
type BetaNotFoundError struct{…}
type BetaRateLimitError struct{…}
type BetaGatewayTimeoutError struct{…}
type BetaAPIError struct{…}
type BetaOverloadedError struct{…}
type BetaGatewayTimeoutError struct{…}
type BetaInvalidRequestError struct{…}
type BetaNotFoundError struct{…}
type BetaOverloadedError struct{…}
type BetaPermissionError struct{…}
type BetaRateLimitError struct{…}
BetaModels
Get a Model
ModelsExpand Collapse
type BetaModelInfo struct{…}
Unique model identifier.
RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown.
A human-readable name for the model.
Type ModelObject type.
Object type.
For Models, this is always "model".
BetaMessages
Count tokens in a Message
ModelsExpand Collapse
type BetaAllThinkingTurns struct{…}
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaBase64PDFSource struct{…}
type BetaBashCodeExecutionOutputBlock struct{…}
type BetaBashCodeExecutionOutputBlockParamResp struct{…}
type BetaBashCodeExecutionResultBlock struct{…}
Content []BetaBashCodeExecutionOutputBlock
type BetaBashCodeExecutionResultBlockParamResp struct{…}
type BetaBashCodeExecutionToolResultBlock struct{…}
Content BetaBashCodeExecutionToolResultBlockContentUnion
type BetaBashCodeExecutionToolResultError struct{…}
ErrorCode BetaBashCodeExecutionToolResultErrorErrorCode
type BetaBashCodeExecutionResultBlock struct{…}
Content []BetaBashCodeExecutionOutputBlock
type BetaBashCodeExecutionToolResultBlockParamResp struct{…}
Content BetaBashCodeExecutionToolResultBlockParamContentUnionResp
type BetaBashCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BetaBashCodeExecutionToolResultErrorParamErrorCode
type BetaBashCodeExecutionResultBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaBashCodeExecutionToolResultError struct{…}
ErrorCode BetaBashCodeExecutionToolResultErrorErrorCode
type BetaBashCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BetaBashCodeExecutionToolResultErrorParamErrorCode
type BetaCacheControlEphemeral struct{…}
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCacheCreation 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 BetaCitationCharLocation struct{…}
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationConfig struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationsConfigParamResp struct{…}
type BetaCitationsDelta struct{…}
Citation BetaCitationsDeltaCitationUnion
type BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaClearThinking20251015Edit struct{…}
Keep BetaClearThinking20251015EditKeepUnionoptionalNumber of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed.
Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed.
type BetaThinkingTurns struct{…}
type BetaAllThinkingTurns struct{…}
type BetaClearThinking20251015EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of thinking turns that were cleared.
The type of context management edit applied.
type BetaClearToolUses20250919Edit struct{…}
ClearAtLeast BetaInputTokensClearAtLeastoptionalMinimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed.
Minimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed.
ClearToolInputs BetaClearToolUses20250919EditClearToolInputsUnionoptionalWhether to clear all tool inputs (bool) or specific tool inputs to clear (list)
Whether to clear all tool inputs (bool) or specific tool inputs to clear (list)
Tool names whose uses are preserved from clearing
Keep BetaToolUsesKeepoptionalNumber of tool uses to retain in the conversation
Number of tool uses to retain in the conversation
Trigger BetaClearToolUses20250919EditTriggerUnionoptionalCondition that triggers the context management strategy
Condition that triggers the context management strategy
type BetaInputTokensTrigger struct{…}
type BetaToolUsesTrigger struct{…}
type BetaClearToolUses20250919EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of tool uses that were cleared.
The type of context management edit applied.
type BetaCodeExecutionOutputBlock struct{…}
type BetaCodeExecutionOutputBlockParamResp struct{…}
type BetaCodeExecutionResultBlock struct{…}
Content []BetaCodeExecutionOutputBlock
type BetaCodeExecutionResultBlockParamResp struct{…}
Content []BetaCodeExecutionOutputBlockParamResp
type BetaCodeExecutionTool20250522 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCodeExecutionTool20250825 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCodeExecutionTool20260120 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type BetaCodeExecutionToolResultError struct{…}
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCodeExecutionResultBlock struct{…}
Content []BetaCodeExecutionOutputBlock
type BetaEncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []BetaCodeExecutionOutputBlock
type BetaCodeExecutionToolResultBlockContentUnion interface{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type BetaCodeExecutionToolResultError struct{…}
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCodeExecutionResultBlock struct{…}
Content []BetaCodeExecutionOutputBlock
type BetaEncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []BetaCodeExecutionOutputBlock
type BetaCodeExecutionToolResultBlockParamResp struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type BetaCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCodeExecutionResultBlockParamResp struct{…}
Content []BetaCodeExecutionOutputBlockParamResp
type BetaEncryptedCodeExecutionResultBlockParamResp struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []BetaCodeExecutionOutputBlockParamResp
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCodeExecutionToolResultBlockParamContentUnionResp interface{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type BetaCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCodeExecutionResultBlockParamResp struct{…}
Content []BetaCodeExecutionOutputBlockParamResp
type BetaEncryptedCodeExecutionResultBlockParamResp struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []BetaCodeExecutionOutputBlockParamResp
type BetaCodeExecutionToolResultError struct{…}
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCodeExecutionToolResultErrorCode string
type BetaCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCompact20260112Edit struct{…}Automatically compact older context when reaching the configured trigger threshold.
Automatically compact older context when reaching the configured trigger threshold.
Additional instructions for summarization.
Whether to pause after compaction and return the compaction block to the user.
Trigger BetaInputTokensTriggeroptionalWhen to trigger compaction. Defaults to 150000 input tokens.
When to trigger compaction. Defaults to 150000 input tokens.
type BetaCompactionBlock struct{…}A compaction block returned when autocompact is triggered.
A compaction block returned when autocompact is triggered.
When content is None, it indicates the compaction failed to produce a valid summary (e.g., malformed output from the model). Clients may round-trip compaction blocks with null content; the server treats them as no-ops.
Summary of compacted content, or null if compaction failed
type BetaCompactionBlockParamResp struct{…}A compaction block containing summary of previous context.
A compaction block containing summary of previous context.
Users should round-trip these blocks from responses to subsequent requests to maintain context across compaction boundaries.
When content is None, the block represents a failed compaction. The server treats these as no-ops. Empty string content is not allowed.
Summary of previously compacted content, or null if compaction failed
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCompactionContentBlockDelta struct{…}
type BetaCompactionIterationUsage struct{…}Token usage for a compaction iteration.
Token usage for a compaction iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a compaction iteration
type BetaContainer 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.
Skills []BetaSkillSkills loaded in the container
Skills loaded in the container
Skill ID
Type BetaSkillTypeType of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Skill version or 'latest' for most recent version
type BetaContainerParamsResp struct{…}Container parameters with skills to be loaded.
Container parameters with skills to be loaded.
Container id
Skills []BetaSkillParamsRespoptionalList of skills to load in the container
List of skills to load in the container
Skill ID
Type BetaSkillParamsTypeType of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Skill version or 'latest' for most recent version
type BetaContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
type BetaContainerUploadBlockParamResp 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaContentBlockUnion interface{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
type BetaTextBlock struct{…}
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaThinkingBlock struct{…}
type BetaRedactedThinkingBlock struct{…}
type BetaToolUseBlock struct{…}
Caller BetaToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaServerToolUseBlock struct{…}
Name BetaServerToolUseBlockName
Caller BetaServerToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebSearchToolResultBlock struct{…}
type BetaWebSearchToolResultError struct{…}
ErrorCode BetaWebSearchToolResultErrorCode
type BetaWebSearchToolResultBlockContentArray []BetaWebSearchResultBlock
Caller BetaWebSearchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebFetchToolResultBlock struct{…}
Content BetaWebFetchToolResultBlockContentUnion
type BetaWebFetchToolResultErrorBlock struct{…}
ErrorCode BetaWebFetchToolResultErrorCode
type BetaWebFetchBlock struct{…}
Content BetaDocumentBlock
Citations BetaCitationConfigCitation configuration for the document
Citation configuration for the document
Source BetaDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
Caller BetaWebFetchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaCodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type BetaCodeExecutionToolResultError struct{…}
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCodeExecutionResultBlock struct{…}
Content []BetaCodeExecutionOutputBlock
type BetaEncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []BetaCodeExecutionOutputBlock
type BetaBashCodeExecutionToolResultBlock struct{…}
Content BetaBashCodeExecutionToolResultBlockContentUnion
type BetaBashCodeExecutionToolResultError struct{…}
ErrorCode BetaBashCodeExecutionToolResultErrorErrorCode
type BetaBashCodeExecutionResultBlock struct{…}
Content []BetaBashCodeExecutionOutputBlock
type BetaTextEditorCodeExecutionToolResultBlock struct{…}
Content BetaTextEditorCodeExecutionToolResultBlockContentUnion
type BetaTextEditorCodeExecutionToolResultError struct{…}
ErrorCode BetaTextEditorCodeExecutionToolResultErrorErrorCode
type BetaTextEditorCodeExecutionViewResultBlock struct{…}
FileType BetaTextEditorCodeExecutionViewResultBlockFileType
type BetaTextEditorCodeExecutionCreateResultBlock struct{…}
type BetaTextEditorCodeExecutionStrReplaceResultBlock struct{…}
type BetaToolSearchToolResultBlock struct{…}
Content BetaToolSearchToolResultBlockContentUnion
type BetaToolSearchToolResultError struct{…}
ErrorCode BetaToolSearchToolResultErrorErrorCode
type BetaToolSearchToolSearchResultBlock struct{…}
ToolReferences []BetaToolReferenceBlock
type BetaMCPToolUseBlock struct{…}
The name of the MCP tool
The name of the MCP server
type BetaMCPToolResultBlock struct{…}
Content BetaMCPToolResultBlockContentUnion
type BetaMCPToolResultBlockContentBetaMCPToolResultBlockContent []BetaTextBlock
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
type BetaCompactionBlock struct{…}A compaction block returned when autocompact is triggered.
A compaction block returned when autocompact is triggered.
When content is None, it indicates the compaction failed to produce a valid summary (e.g., malformed output from the model). Clients may round-trip compaction blocks with null content; the server treats them as no-ops.
Summary of compacted content, or null if compaction failed
type BetaContentBlockParamUnionResp interface{…}Regular text content.
Regular text content.
type BetaTextBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaImageBlockParamResp struct{…}
Source BetaImageBlockParamSourceUnionResp
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaURLImageSource struct{…}
type BetaFileImageSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaRequestDocumentBlock struct{…}
Source BetaRequestDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
type BetaContentBlockSource struct{…}
Content BetaContentBlockSourceContentUnion
type BetaTextBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaImageBlockParamResp struct{…}
Source BetaImageBlockParamSourceUnionResp
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaURLImageSource struct{…}
type BetaFileImageSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaURLPDFSource struct{…}
type BetaFileDocumentSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptional
type BetaSearchResultBlockParamResp struct{…}
Content []BetaTextBlockParamResp
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptional
type BetaThinkingBlockParamResp struct{…}
type BetaRedactedThinkingBlockParamResp struct{…}
type BetaToolUseBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolUseBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaToolResultBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaToolResultBlockParamContentUnionRespoptional
[]BetaToolResultBlockParamContentUnionResp
type BetaTextBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaImageBlockParamResp struct{…}
Source BetaImageBlockParamSourceUnionResp
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaURLImageSource struct{…}
type BetaFileImageSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaSearchResultBlockParamResp struct{…}
Content []BetaTextBlockParamResp
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptional
type BetaRequestDocumentBlock struct{…}
Source BetaRequestDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
type BetaContentBlockSource struct{…}
Content BetaContentBlockSourceContentUnion
type BetaTextBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaImageBlockParamResp struct{…}
Source BetaImageBlockParamSourceUnionResp
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaURLImageSource struct{…}
type BetaFileImageSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaURLPDFSource struct{…}
type BetaFileDocumentSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptional
type BetaToolReferenceBlockParamResp struct{…}Tool reference block that can be included in tool_result content.
Tool reference block that can be included in tool_result content.
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaServerToolUseBlockParamResp struct{…}
Name BetaServerToolUseBlockParamName
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaServerToolUseBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebSearchToolResultBlockParamResp struct{…}
type BetaWebSearchToolRequestError struct{…}
ErrorCode BetaWebSearchToolResultErrorCode
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaWebSearchToolResultBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebFetchToolResultBlockParamResp struct{…}
Content BetaWebFetchToolResultBlockParamContentUnionResp
type BetaWebFetchToolResultErrorBlockParamResp struct{…}
ErrorCode BetaWebFetchToolResultErrorCode
type BetaWebFetchBlockParamResp struct{…}
Content BetaRequestDocumentBlock
Source BetaRequestDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
type BetaContentBlockSource struct{…}
Content BetaContentBlockSourceContentUnion
type BetaTextBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaImageBlockParamResp struct{…}
Source BetaImageBlockParamSourceUnionResp
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaURLImageSource struct{…}
type BetaFileImageSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaURLPDFSource struct{…}
type BetaFileDocumentSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptional
Fetched content URL
ISO 8601 timestamp when the content was retrieved
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaWebFetchToolResultBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaCodeExecutionToolResultBlockParamResp struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type BetaCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCodeExecutionResultBlockParamResp struct{…}
Content []BetaCodeExecutionOutputBlockParamResp
type BetaEncryptedCodeExecutionResultBlockParamResp struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []BetaCodeExecutionOutputBlockParamResp
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaBashCodeExecutionToolResultBlockParamResp struct{…}
Content BetaBashCodeExecutionToolResultBlockParamContentUnionResp
type BetaBashCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BetaBashCodeExecutionToolResultErrorParamErrorCode
type BetaBashCodeExecutionResultBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaTextEditorCodeExecutionToolResultBlockParamResp struct{…}
Content BetaTextEditorCodeExecutionToolResultBlockParamContentUnionResp
type BetaTextEditorCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BetaTextEditorCodeExecutionToolResultErrorParamErrorCode
type BetaTextEditorCodeExecutionViewResultBlockParamResp struct{…}
FileType BetaTextEditorCodeExecutionViewResultBlockParamFileType
type BetaTextEditorCodeExecutionCreateResultBlockParamResp struct{…}
type BetaTextEditorCodeExecutionStrReplaceResultBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolSearchToolResultBlockParamResp struct{…}
Content BetaToolSearchToolResultBlockParamContentUnionResp
type BetaToolSearchToolResultErrorParamResp struct{…}
ErrorCode BetaToolSearchToolResultErrorParamErrorCode
type BetaToolSearchToolSearchResultBlockParamResp struct{…}
ToolReferences []BetaToolReferenceBlockParamResp
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaMCPToolUseBlockParamResp struct{…}
The name of the MCP server
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaRequestMCPToolResultBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaRequestMCPToolResultBlockParamContentUnionRespoptional
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaContainerUploadBlockParamResp 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCompactionBlockParamResp struct{…}A compaction block containing summary of previous context.
A compaction block containing summary of previous context.
Users should round-trip these blocks from responses to subsequent requests to maintain context across compaction boundaries.
When content is None, the block represents a failed compaction. The server treats these as no-ops. Empty string content is not allowed.
Summary of previously compacted content, or null if compaction failed
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaContentBlockSource struct{…}
Content BetaContentBlockSourceContentUnion
type BetaTextBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaImageBlockParamResp struct{…}
Source BetaImageBlockParamSourceUnionResp
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaURLImageSource struct{…}
type BetaFileImageSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaContentBlockSourceContentUnion interface{…}
type BetaTextBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaImageBlockParamResp struct{…}
Source BetaImageBlockParamSourceUnionResp
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaURLImageSource struct{…}
type BetaFileImageSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaContextManagementConfig struct{…}
Edits []BetaContextManagementConfigEditUnionoptionalList of context management edits to apply
List of context management edits to apply
type BetaClearToolUses20250919Edit struct{…}
ClearAtLeast BetaInputTokensClearAtLeastoptionalMinimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed.
Minimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed.
ClearToolInputs BetaClearToolUses20250919EditClearToolInputsUnionoptionalWhether to clear all tool inputs (bool) or specific tool inputs to clear (list)
Whether to clear all tool inputs (bool) or specific tool inputs to clear (list)
Tool names whose uses are preserved from clearing
Keep BetaToolUsesKeepoptionalNumber of tool uses to retain in the conversation
Number of tool uses to retain in the conversation
Trigger BetaClearToolUses20250919EditTriggerUnionoptionalCondition that triggers the context management strategy
Condition that triggers the context management strategy
type BetaInputTokensTrigger struct{…}
type BetaToolUsesTrigger struct{…}
type BetaClearThinking20251015Edit struct{…}
Keep BetaClearThinking20251015EditKeepUnionoptionalNumber of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed.
Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed.
type BetaThinkingTurns struct{…}
type BetaAllThinkingTurns struct{…}
type BetaCompact20260112Edit struct{…}Automatically compact older context when reaching the configured trigger threshold.
Automatically compact older context when reaching the configured trigger threshold.
Additional instructions for summarization.
Whether to pause after compaction and return the compaction block to the user.
Trigger BetaInputTokensTriggeroptionalWhen to trigger compaction. Defaults to 150000 input tokens.
When to trigger compaction. Defaults to 150000 input tokens.
type BetaContextManagementResponse struct{…}
AppliedEdits []BetaContextManagementResponseAppliedEditUnionList of context management edits that were applied.
List of context management edits that were applied.
type BetaClearToolUses20250919EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of tool uses that were cleared.
The type of context management edit applied.
type BetaClearThinking20251015EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of thinking turns that were cleared.
The type of context management edit applied.
type BetaCountTokensContextManagementResponse struct{…}
The original token count before context management was applied
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaDocumentBlock struct{…}
Citations BetaCitationConfigCitation configuration for the document
Citation configuration for the document
Source BetaDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
The title of the document
type BetaEncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []BetaCodeExecutionOutputBlock
type BetaEncryptedCodeExecutionResultBlockParamResp struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []BetaCodeExecutionOutputBlockParamResp
type BetaFileDocumentSource struct{…}
type BetaFileImageSource struct{…}
type BetaImageBlockParamResp struct{…}
Source BetaImageBlockParamSourceUnionResp
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaURLImageSource struct{…}
type BetaFileImageSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaInputJSONDelta struct{…}
type BetaInputTokensClearAtLeast struct{…}
type BetaInputTokensTrigger struct{…}
type BetaIterationsUsage []BetaIterationsUsageItemUnionPer-iteration token usage breakdown.
Per-iteration token usage breakdown.
Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:
- Determine which iterations exceeded long context thresholds (>=200k tokens)
- Calculate the true context window size from the last iteration
- Understand token accumulation across server-side tool use loops
type BetaMessageIterationUsage struct{…}Token usage for a sampling iteration.
Token usage for a sampling iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a sampling iteration
type BetaCompactionIterationUsage struct{…}Token usage for a compaction iteration.
Token usage for a compaction iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a compaction iteration
type BetaJSONOutputFormat struct{…}
The JSON schema of the format
type BetaMCPToolConfig struct{…}Configuration for a specific tool in an MCP toolset.
Configuration for a specific tool in an MCP toolset.
type BetaMCPToolDefaultConfig struct{…}Default configuration for tools in an MCP toolset.
Default configuration for tools in an MCP toolset.
type BetaMCPToolResultBlock struct{…}
Content BetaMCPToolResultBlockContentUnion
type BetaMCPToolResultBlockContentBetaMCPToolResultBlockContent []BetaTextBlock
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaMCPToolUseBlock struct{…}
The name of the MCP tool
The name of the MCP server
type BetaMCPToolUseBlockParamResp struct{…}
The name of the MCP server
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaMCPToolset struct{…}Configuration for a group of tools from an MCP server.
Configuration for a group of tools from an MCP server.
Allows configuring enabled status and defer_loading for all tools from an MCP server, with optional per-tool overrides.
Name of the MCP server to configure tools for
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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.
Configs map[string, BetaMCPToolConfig]optionalConfiguration overrides for specific tools, keyed by tool name
Configuration overrides for specific tools, keyed by tool name
DefaultConfig BetaMCPToolDefaultConfigoptionalDefault configuration applied to all tools from this server
Default configuration applied to all tools from this server
type BetaMemoryTool20250818 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaMemoryTool20250818CommandUnion interface{…}
type BetaMemoryTool20250818ViewCommand struct{…}
Command type identifier
Path to directory or file to view
Optional line range for viewing specific lines
type BetaMemoryTool20250818CreateCommand struct{…}
Command type identifier
Content to write to the file
Path where the file should be created
type BetaMemoryTool20250818StrReplaceCommand struct{…}
Command type identifier
Text to replace with
Text to search for and replace
Path to the file where text should be replaced
type BetaMemoryTool20250818InsertCommand struct{…}
Command type identifier
Line number where text should be inserted
Text to insert at the specified line
Path to the file where text should be inserted
type BetaMemoryTool20250818DeleteCommand struct{…}
Command type identifier
Path to the file or directory to delete
type BetaMemoryTool20250818RenameCommand struct{…}
Command type identifier
New path for the file or directory
Current path of the file or directory
type BetaMemoryTool20250818CreateCommand struct{…}
Command type identifier
Content to write to the file
Path where the file should be created
type BetaMemoryTool20250818DeleteCommand struct{…}
Command type identifier
Path to the file or directory to delete
type BetaMemoryTool20250818InsertCommand struct{…}
Command type identifier
Line number where text should be inserted
Text to insert at the specified line
Path to the file where text should be inserted
type BetaMemoryTool20250818RenameCommand struct{…}
Command type identifier
New path for the file or directory
Current path of the file or directory
type BetaMemoryTool20250818StrReplaceCommand struct{…}
Command type identifier
Text to replace with
Text to search for and replace
Path to the file where text should be replaced
type BetaMemoryTool20250818ViewCommand struct{…}
Command type identifier
Path to directory or file to view
Optional line range for viewing specific lines
type BetaMessage struct{…}
ID stringUnique object identifier.
Unique object identifier.
The format and length of IDs may change over time.
Container BetaContainerInformation 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.
Skills []BetaSkillSkills loaded in the container
Skills loaded in the container
Skill ID
Type BetaSkillTypeType of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Skill version or 'latest' for most recent version
Content []BetaContentBlockUnionContent 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 BetaTextBlock struct{…}
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaThinkingBlock struct{…}
type BetaRedactedThinkingBlock struct{…}
type BetaToolUseBlock struct{…}
Caller BetaToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaServerToolUseBlock struct{…}
Name BetaServerToolUseBlockName
Caller BetaServerToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebSearchToolResultBlock struct{…}
type BetaWebSearchToolResultError struct{…}
ErrorCode BetaWebSearchToolResultErrorCode
type BetaWebSearchToolResultBlockContentArray []BetaWebSearchResultBlock
Caller BetaWebSearchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebFetchToolResultBlock struct{…}
Content BetaWebFetchToolResultBlockContentUnion
type BetaWebFetchToolResultErrorBlock struct{…}
ErrorCode BetaWebFetchToolResultErrorCode
type BetaWebFetchBlock struct{…}
Content BetaDocumentBlock
Citations BetaCitationConfigCitation configuration for the document
Citation configuration for the document
Source BetaDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
Caller BetaWebFetchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaCodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type BetaCodeExecutionToolResultError struct{…}
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCodeExecutionResultBlock struct{…}
Content []BetaCodeExecutionOutputBlock
type BetaEncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []BetaCodeExecutionOutputBlock
type BetaBashCodeExecutionToolResultBlock struct{…}
Content BetaBashCodeExecutionToolResultBlockContentUnion
type BetaBashCodeExecutionToolResultError struct{…}
ErrorCode BetaBashCodeExecutionToolResultErrorErrorCode
type BetaBashCodeExecutionResultBlock struct{…}
Content []BetaBashCodeExecutionOutputBlock
type BetaTextEditorCodeExecutionToolResultBlock struct{…}
Content BetaTextEditorCodeExecutionToolResultBlockContentUnion
type BetaTextEditorCodeExecutionToolResultError struct{…}
ErrorCode BetaTextEditorCodeExecutionToolResultErrorErrorCode
type BetaTextEditorCodeExecutionViewResultBlock struct{…}
FileType BetaTextEditorCodeExecutionViewResultBlockFileType
type BetaTextEditorCodeExecutionCreateResultBlock struct{…}
type BetaTextEditorCodeExecutionStrReplaceResultBlock struct{…}
type BetaToolSearchToolResultBlock struct{…}
Content BetaToolSearchToolResultBlockContentUnion
type BetaToolSearchToolResultError struct{…}
ErrorCode BetaToolSearchToolResultErrorErrorCode
type BetaToolSearchToolSearchResultBlock struct{…}
ToolReferences []BetaToolReferenceBlock
type BetaMCPToolUseBlock struct{…}
The name of the MCP tool
The name of the MCP server
type BetaMCPToolResultBlock struct{…}
Content BetaMCPToolResultBlockContentUnion
type BetaMCPToolResultBlockContentBetaMCPToolResultBlockContent []BetaTextBlock
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
type BetaCompactionBlock struct{…}A compaction block returned when autocompact is triggered.
A compaction block returned when autocompact is triggered.
When content is None, it indicates the compaction failed to produce a valid summary (e.g., malformed output from the model). Clients may round-trip compaction blocks with null content; the server treats them as no-ops.
Summary of compacted content, or null if compaction failed
ContextManagement BetaContextManagementResponseContext management response.
Context management response.
Information about context management strategies applied during the request.
AppliedEdits []BetaContextManagementResponseAppliedEditUnionList of context management edits that were applied.
List of context management edits that were applied.
type BetaClearToolUses20250919EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of tool uses that were cleared.
The type of context management edit applied.
type BetaClearThinking20251015EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of thinking turns that were cleared.
The type of context management edit applied.
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 BetaStopReasonThe 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 BetaUsageBilling 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 BetaCacheCreationBreakdown 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.
Iterations BetaIterationsUsagePer-iteration token usage breakdown.
Per-iteration token usage breakdown.
Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:
- Determine which iterations exceeded long context thresholds (>=200k tokens)
- Calculate the true context window size from the last iteration
- Understand token accumulation across server-side tool use loops
type BetaMessageIterationUsage struct{…}Token usage for a sampling iteration.
Token usage for a sampling iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a sampling iteration
type BetaCompactionIterationUsage struct{…}Token usage for a compaction iteration.
Token usage for a compaction iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a compaction iteration
The number of output tokens which were used.
ServerToolUse BetaServerToolUsageThe 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 BetaUsageServiceTierIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
Speed BetaUsageSpeedThe inference speed mode used for this request.
The inference speed mode used for this request.
type BetaMessageDeltaUsage 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.
Iterations BetaIterationsUsagePer-iteration token usage breakdown.
Per-iteration token usage breakdown.
Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:
- Determine which iterations exceeded long context thresholds (>=200k tokens)
- Calculate the true context window size from the last iteration
- Understand token accumulation across server-side tool use loops
type BetaMessageIterationUsage struct{…}Token usage for a sampling iteration.
Token usage for a sampling iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a sampling iteration
type BetaCompactionIterationUsage struct{…}Token usage for a compaction iteration.
Token usage for a compaction iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a compaction iteration
The cumulative number of output tokens which were used.
ServerToolUse BetaServerToolUsageThe 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 BetaMessageIterationUsage struct{…}Token usage for a sampling iteration.
Token usage for a sampling iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a sampling iteration
type BetaMessageParamResp struct{…}
Content []BetaContentBlockParamUnionResp
type BetaTextBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaImageBlockParamResp struct{…}
Source BetaImageBlockParamSourceUnionResp
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaURLImageSource struct{…}
type BetaFileImageSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaRequestDocumentBlock struct{…}
Source BetaRequestDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
type BetaContentBlockSource struct{…}
Content BetaContentBlockSourceContentUnion
type BetaTextBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaImageBlockParamResp struct{…}
Source BetaImageBlockParamSourceUnionResp
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaURLImageSource struct{…}
type BetaFileImageSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaURLPDFSource struct{…}
type BetaFileDocumentSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptional
type BetaSearchResultBlockParamResp struct{…}
Content []BetaTextBlockParamResp
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptional
type BetaThinkingBlockParamResp struct{…}
type BetaRedactedThinkingBlockParamResp struct{…}
type BetaToolUseBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolUseBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaToolResultBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaToolResultBlockParamContentUnionRespoptional
[]BetaToolResultBlockParamContentUnionResp
type BetaTextBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaImageBlockParamResp struct{…}
Source BetaImageBlockParamSourceUnionResp
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaURLImageSource struct{…}
type BetaFileImageSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaSearchResultBlockParamResp struct{…}
Content []BetaTextBlockParamResp
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptional
type BetaRequestDocumentBlock struct{…}
Source BetaRequestDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
type BetaContentBlockSource struct{…}
Content BetaContentBlockSourceContentUnion
type BetaTextBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaImageBlockParamResp struct{…}
Source BetaImageBlockParamSourceUnionResp
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaURLImageSource struct{…}
type BetaFileImageSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaURLPDFSource struct{…}
type BetaFileDocumentSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptional
type BetaToolReferenceBlockParamResp struct{…}Tool reference block that can be included in tool_result content.
Tool reference block that can be included in tool_result content.
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaServerToolUseBlockParamResp struct{…}
Name BetaServerToolUseBlockParamName
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaServerToolUseBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebSearchToolResultBlockParamResp struct{…}
type BetaWebSearchToolRequestError struct{…}
ErrorCode BetaWebSearchToolResultErrorCode
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaWebSearchToolResultBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebFetchToolResultBlockParamResp struct{…}
Content BetaWebFetchToolResultBlockParamContentUnionResp
type BetaWebFetchToolResultErrorBlockParamResp struct{…}
ErrorCode BetaWebFetchToolResultErrorCode
type BetaWebFetchBlockParamResp struct{…}
Content BetaRequestDocumentBlock
Source BetaRequestDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
type BetaContentBlockSource struct{…}
Content BetaContentBlockSourceContentUnion
type BetaTextBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaImageBlockParamResp struct{…}
Source BetaImageBlockParamSourceUnionResp
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaURLImageSource struct{…}
type BetaFileImageSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaURLPDFSource struct{…}
type BetaFileDocumentSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptional
Fetched content URL
ISO 8601 timestamp when the content was retrieved
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaWebFetchToolResultBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaCodeExecutionToolResultBlockParamResp struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type BetaCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCodeExecutionResultBlockParamResp struct{…}
Content []BetaCodeExecutionOutputBlockParamResp
type BetaEncryptedCodeExecutionResultBlockParamResp struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []BetaCodeExecutionOutputBlockParamResp
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaBashCodeExecutionToolResultBlockParamResp struct{…}
Content BetaBashCodeExecutionToolResultBlockParamContentUnionResp
type BetaBashCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BetaBashCodeExecutionToolResultErrorParamErrorCode
type BetaBashCodeExecutionResultBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaTextEditorCodeExecutionToolResultBlockParamResp struct{…}
Content BetaTextEditorCodeExecutionToolResultBlockParamContentUnionResp
type BetaTextEditorCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BetaTextEditorCodeExecutionToolResultErrorParamErrorCode
type BetaTextEditorCodeExecutionViewResultBlockParamResp struct{…}
FileType BetaTextEditorCodeExecutionViewResultBlockParamFileType
type BetaTextEditorCodeExecutionCreateResultBlockParamResp struct{…}
type BetaTextEditorCodeExecutionStrReplaceResultBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolSearchToolResultBlockParamResp struct{…}
Content BetaToolSearchToolResultBlockParamContentUnionResp
type BetaToolSearchToolResultErrorParamResp struct{…}
ErrorCode BetaToolSearchToolResultErrorParamErrorCode
type BetaToolSearchToolSearchResultBlockParamResp struct{…}
ToolReferences []BetaToolReferenceBlockParamResp
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaMCPToolUseBlockParamResp struct{…}
The name of the MCP server
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaRequestMCPToolResultBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaRequestMCPToolResultBlockParamContentUnionRespoptional
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaContainerUploadBlockParamResp 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCompactionBlockParamResp struct{…}A compaction block containing summary of previous context.
A compaction block containing summary of previous context.
Users should round-trip these blocks from responses to subsequent requests to maintain context across compaction boundaries.
When content is None, the block represents a failed compaction. The server treats these as no-ops. Empty string content is not allowed.
Summary of previously compacted content, or null if compaction failed
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaMessageParamRole
type BetaMessageTokensCount struct{…}
ContextManagement BetaCountTokensContextManagementResponseInformation about context management applied to the message.
Information about context management applied to the message.
The original token count before context management was applied
The total number of tokens across the provided list of messages, system prompt, and tools.
type BetaMetadata 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 BetaOutputConfig struct{…}
Effort BetaOutputConfigEffortoptionalAll possible effort levels.
All possible effort levels.
Format BetaJSONOutputFormatoptionalA 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 BetaPlainTextSource struct{…}
type BetaRawContentBlockDeltaUnion interface{…}
type BetaTextDelta struct{…}
type BetaInputJSONDelta struct{…}
type BetaCitationsDelta struct{…}
Citation BetaCitationsDeltaCitationUnion
type BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaThinkingDelta struct{…}
type BetaSignatureDelta struct{…}
type BetaCompactionContentBlockDelta struct{…}
type BetaRawContentBlockDeltaEvent struct{…}
type BetaTextDelta struct{…}
type BetaInputJSONDelta struct{…}
type BetaCitationsDelta struct{…}
Citation BetaCitationsDeltaCitationUnion
type BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaThinkingDelta struct{…}
type BetaSignatureDelta struct{…}
type BetaCompactionContentBlockDelta struct{…}
type BetaRawContentBlockStartEvent struct{…}
ContentBlock BetaRawContentBlockStartEventContentBlockUnionResponse model for a file uploaded to the container.
Response model for a file uploaded to the container.
type BetaTextBlock struct{…}
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaThinkingBlock struct{…}
type BetaRedactedThinkingBlock struct{…}
type BetaToolUseBlock struct{…}
Caller BetaToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaServerToolUseBlock struct{…}
Name BetaServerToolUseBlockName
Caller BetaServerToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebSearchToolResultBlock struct{…}
type BetaWebSearchToolResultError struct{…}
ErrorCode BetaWebSearchToolResultErrorCode
type BetaWebSearchToolResultBlockContentArray []BetaWebSearchResultBlock
Caller BetaWebSearchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebFetchToolResultBlock struct{…}
Content BetaWebFetchToolResultBlockContentUnion
type BetaWebFetchToolResultErrorBlock struct{…}
ErrorCode BetaWebFetchToolResultErrorCode
type BetaWebFetchBlock struct{…}
Content BetaDocumentBlock
Citations BetaCitationConfigCitation configuration for the document
Citation configuration for the document
Source BetaDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
Caller BetaWebFetchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaCodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type BetaCodeExecutionToolResultError struct{…}
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCodeExecutionResultBlock struct{…}
Content []BetaCodeExecutionOutputBlock
type BetaEncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []BetaCodeExecutionOutputBlock
type BetaBashCodeExecutionToolResultBlock struct{…}
Content BetaBashCodeExecutionToolResultBlockContentUnion
type BetaBashCodeExecutionToolResultError struct{…}
ErrorCode BetaBashCodeExecutionToolResultErrorErrorCode
type BetaBashCodeExecutionResultBlock struct{…}
Content []BetaBashCodeExecutionOutputBlock
type BetaTextEditorCodeExecutionToolResultBlock struct{…}
Content BetaTextEditorCodeExecutionToolResultBlockContentUnion
type BetaTextEditorCodeExecutionToolResultError struct{…}
ErrorCode BetaTextEditorCodeExecutionToolResultErrorErrorCode
type BetaTextEditorCodeExecutionViewResultBlock struct{…}
FileType BetaTextEditorCodeExecutionViewResultBlockFileType
type BetaTextEditorCodeExecutionCreateResultBlock struct{…}
type BetaTextEditorCodeExecutionStrReplaceResultBlock struct{…}
type BetaToolSearchToolResultBlock struct{…}
Content BetaToolSearchToolResultBlockContentUnion
type BetaToolSearchToolResultError struct{…}
ErrorCode BetaToolSearchToolResultErrorErrorCode
type BetaToolSearchToolSearchResultBlock struct{…}
ToolReferences []BetaToolReferenceBlock
type BetaMCPToolUseBlock struct{…}
The name of the MCP tool
The name of the MCP server
type BetaMCPToolResultBlock struct{…}
Content BetaMCPToolResultBlockContentUnion
type BetaMCPToolResultBlockContentBetaMCPToolResultBlockContent []BetaTextBlock
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
type BetaCompactionBlock struct{…}A compaction block returned when autocompact is triggered.
A compaction block returned when autocompact is triggered.
When content is None, it indicates the compaction failed to produce a valid summary (e.g., malformed output from the model). Clients may round-trip compaction blocks with null content; the server treats them as no-ops.
Summary of compacted content, or null if compaction failed
type BetaRawContentBlockStopEvent struct{…}
type BetaRawMessageDeltaEvent struct{…}
ContextManagement BetaContextManagementResponseInformation about context management strategies applied during the request
Information about context management strategies applied during the request
AppliedEdits []BetaContextManagementResponseAppliedEditUnionList of context management edits that were applied.
List of context management edits that were applied.
type BetaClearToolUses20250919EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of tool uses that were cleared.
The type of context management edit applied.
type BetaClearThinking20251015EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of thinking turns that were cleared.
The type of context management edit applied.
Delta BetaRawMessageDeltaEventDelta
Container BetaContainerInformation 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.
Skills []BetaSkillSkills loaded in the container
Skills loaded in the container
Skill ID
Type BetaSkillTypeType of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Skill version or 'latest' for most recent version
StopReason BetaStopReason
Usage BetaMessageDeltaUsageBilling 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.
Iterations BetaIterationsUsagePer-iteration token usage breakdown.
Per-iteration token usage breakdown.
Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:
- Determine which iterations exceeded long context thresholds (>=200k tokens)
- Calculate the true context window size from the last iteration
- Understand token accumulation across server-side tool use loops
type BetaMessageIterationUsage struct{…}Token usage for a sampling iteration.
Token usage for a sampling iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a sampling iteration
type BetaCompactionIterationUsage struct{…}Token usage for a compaction iteration.
Token usage for a compaction iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a compaction iteration
The cumulative number of output tokens which were used.
ServerToolUse BetaServerToolUsageThe 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 BetaRawMessageStartEvent struct{…}
Message BetaMessage
ID stringUnique object identifier.
Unique object identifier.
The format and length of IDs may change over time.
Container BetaContainerInformation 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.
Skills []BetaSkillSkills loaded in the container
Skills loaded in the container
Skill ID
Type BetaSkillTypeType of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Skill version or 'latest' for most recent version
Content []BetaContentBlockUnionContent 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 BetaTextBlock struct{…}
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaThinkingBlock struct{…}
type BetaRedactedThinkingBlock struct{…}
type BetaToolUseBlock struct{…}
Caller BetaToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaServerToolUseBlock struct{…}
Name BetaServerToolUseBlockName
Caller BetaServerToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebSearchToolResultBlock struct{…}
type BetaWebSearchToolResultError struct{…}
ErrorCode BetaWebSearchToolResultErrorCode
type BetaWebSearchToolResultBlockContentArray []BetaWebSearchResultBlock
Caller BetaWebSearchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebFetchToolResultBlock struct{…}
Content BetaWebFetchToolResultBlockContentUnion
type BetaWebFetchToolResultErrorBlock struct{…}
ErrorCode BetaWebFetchToolResultErrorCode
type BetaWebFetchBlock struct{…}
Content BetaDocumentBlock
Citations BetaCitationConfigCitation configuration for the document
Citation configuration for the document
Source BetaDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
Caller BetaWebFetchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaCodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type BetaCodeExecutionToolResultError struct{…}
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCodeExecutionResultBlock struct{…}
Content []BetaCodeExecutionOutputBlock
type BetaEncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []BetaCodeExecutionOutputBlock
type BetaBashCodeExecutionToolResultBlock struct{…}
Content BetaBashCodeExecutionToolResultBlockContentUnion
type BetaBashCodeExecutionToolResultError struct{…}
ErrorCode BetaBashCodeExecutionToolResultErrorErrorCode
type BetaBashCodeExecutionResultBlock struct{…}
Content []BetaBashCodeExecutionOutputBlock
type BetaTextEditorCodeExecutionToolResultBlock struct{…}
Content BetaTextEditorCodeExecutionToolResultBlockContentUnion
type BetaTextEditorCodeExecutionToolResultError struct{…}
ErrorCode BetaTextEditorCodeExecutionToolResultErrorErrorCode
type BetaTextEditorCodeExecutionViewResultBlock struct{…}
FileType BetaTextEditorCodeExecutionViewResultBlockFileType
type BetaTextEditorCodeExecutionCreateResultBlock struct{…}
type BetaTextEditorCodeExecutionStrReplaceResultBlock struct{…}
type BetaToolSearchToolResultBlock struct{…}
Content BetaToolSearchToolResultBlockContentUnion
type BetaToolSearchToolResultError struct{…}
ErrorCode BetaToolSearchToolResultErrorErrorCode
type BetaToolSearchToolSearchResultBlock struct{…}
ToolReferences []BetaToolReferenceBlock
type BetaMCPToolUseBlock struct{…}
The name of the MCP tool
The name of the MCP server
type BetaMCPToolResultBlock struct{…}
Content BetaMCPToolResultBlockContentUnion
type BetaMCPToolResultBlockContentBetaMCPToolResultBlockContent []BetaTextBlock
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
type BetaCompactionBlock struct{…}A compaction block returned when autocompact is triggered.
A compaction block returned when autocompact is triggered.
When content is None, it indicates the compaction failed to produce a valid summary (e.g., malformed output from the model). Clients may round-trip compaction blocks with null content; the server treats them as no-ops.
Summary of compacted content, or null if compaction failed
ContextManagement BetaContextManagementResponseContext management response.
Context management response.
Information about context management strategies applied during the request.
AppliedEdits []BetaContextManagementResponseAppliedEditUnionList of context management edits that were applied.
List of context management edits that were applied.
type BetaClearToolUses20250919EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of tool uses that were cleared.
The type of context management edit applied.
type BetaClearThinking20251015EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of thinking turns that were cleared.
The type of context management edit applied.
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 BetaStopReasonThe 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 BetaUsageBilling 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 BetaCacheCreationBreakdown 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.
Iterations BetaIterationsUsagePer-iteration token usage breakdown.
Per-iteration token usage breakdown.
Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:
- Determine which iterations exceeded long context thresholds (>=200k tokens)
- Calculate the true context window size from the last iteration
- Understand token accumulation across server-side tool use loops
type BetaMessageIterationUsage struct{…}Token usage for a sampling iteration.
Token usage for a sampling iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a sampling iteration
type BetaCompactionIterationUsage struct{…}Token usage for a compaction iteration.
Token usage for a compaction iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a compaction iteration
The number of output tokens which were used.
ServerToolUse BetaServerToolUsageThe 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 BetaUsageServiceTierIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
Speed BetaUsageSpeedThe inference speed mode used for this request.
The inference speed mode used for this request.
type BetaRawMessageStopEvent struct{…}
type BetaRawMessageStreamEventUnion interface{…}
type BetaRawMessageStartEvent struct{…}
Message BetaMessage
ID stringUnique object identifier.
Unique object identifier.
The format and length of IDs may change over time.
Container BetaContainerInformation 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.
Skills []BetaSkillSkills loaded in the container
Skills loaded in the container
Skill ID
Type BetaSkillTypeType of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Skill version or 'latest' for most recent version
Content []BetaContentBlockUnionContent 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 BetaTextBlock struct{…}
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaThinkingBlock struct{…}
type BetaRedactedThinkingBlock struct{…}
type BetaToolUseBlock struct{…}
Caller BetaToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaServerToolUseBlock struct{…}
Name BetaServerToolUseBlockName
Caller BetaServerToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebSearchToolResultBlock struct{…}
type BetaWebSearchToolResultError struct{…}
ErrorCode BetaWebSearchToolResultErrorCode
type BetaWebSearchToolResultBlockContentArray []BetaWebSearchResultBlock
Caller BetaWebSearchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebFetchToolResultBlock struct{…}
Content BetaWebFetchToolResultBlockContentUnion
type BetaWebFetchToolResultErrorBlock struct{…}
ErrorCode BetaWebFetchToolResultErrorCode
type BetaWebFetchBlock struct{…}
Content BetaDocumentBlock
Citations BetaCitationConfigCitation configuration for the document
Citation configuration for the document
Source BetaDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
Caller BetaWebFetchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaCodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type BetaCodeExecutionToolResultError struct{…}
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCodeExecutionResultBlock struct{…}
Content []BetaCodeExecutionOutputBlock
type BetaEncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []BetaCodeExecutionOutputBlock
type BetaBashCodeExecutionToolResultBlock struct{…}
Content BetaBashCodeExecutionToolResultBlockContentUnion
type BetaBashCodeExecutionToolResultError struct{…}
ErrorCode BetaBashCodeExecutionToolResultErrorErrorCode
type BetaBashCodeExecutionResultBlock struct{…}
Content []BetaBashCodeExecutionOutputBlock
type BetaTextEditorCodeExecutionToolResultBlock struct{…}
Content BetaTextEditorCodeExecutionToolResultBlockContentUnion
type BetaTextEditorCodeExecutionToolResultError struct{…}
ErrorCode BetaTextEditorCodeExecutionToolResultErrorErrorCode
type BetaTextEditorCodeExecutionViewResultBlock struct{…}
FileType BetaTextEditorCodeExecutionViewResultBlockFileType
type BetaTextEditorCodeExecutionCreateResultBlock struct{…}
type BetaTextEditorCodeExecutionStrReplaceResultBlock struct{…}
type BetaToolSearchToolResultBlock struct{…}
Content BetaToolSearchToolResultBlockContentUnion
type BetaToolSearchToolResultError struct{…}
ErrorCode BetaToolSearchToolResultErrorErrorCode
type BetaToolSearchToolSearchResultBlock struct{…}
ToolReferences []BetaToolReferenceBlock
type BetaMCPToolUseBlock struct{…}
The name of the MCP tool
The name of the MCP server
type BetaMCPToolResultBlock struct{…}
Content BetaMCPToolResultBlockContentUnion
type BetaMCPToolResultBlockContentBetaMCPToolResultBlockContent []BetaTextBlock
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
type BetaCompactionBlock struct{…}A compaction block returned when autocompact is triggered.
A compaction block returned when autocompact is triggered.
When content is None, it indicates the compaction failed to produce a valid summary (e.g., malformed output from the model). Clients may round-trip compaction blocks with null content; the server treats them as no-ops.
Summary of compacted content, or null if compaction failed
ContextManagement BetaContextManagementResponseContext management response.
Context management response.
Information about context management strategies applied during the request.
AppliedEdits []BetaContextManagementResponseAppliedEditUnionList of context management edits that were applied.
List of context management edits that were applied.
type BetaClearToolUses20250919EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of tool uses that were cleared.
The type of context management edit applied.
type BetaClearThinking20251015EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of thinking turns that were cleared.
The type of context management edit applied.
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 BetaStopReasonThe 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 BetaUsageBilling 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 BetaCacheCreationBreakdown 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.
Iterations BetaIterationsUsagePer-iteration token usage breakdown.
Per-iteration token usage breakdown.
Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:
- Determine which iterations exceeded long context thresholds (>=200k tokens)
- Calculate the true context window size from the last iteration
- Understand token accumulation across server-side tool use loops
type BetaMessageIterationUsage struct{…}Token usage for a sampling iteration.
Token usage for a sampling iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a sampling iteration
type BetaCompactionIterationUsage struct{…}Token usage for a compaction iteration.
Token usage for a compaction iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a compaction iteration
The number of output tokens which were used.
ServerToolUse BetaServerToolUsageThe 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 BetaUsageServiceTierIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
Speed BetaUsageSpeedThe inference speed mode used for this request.
The inference speed mode used for this request.
type BetaRawMessageDeltaEvent struct{…}
ContextManagement BetaContextManagementResponseInformation about context management strategies applied during the request
Information about context management strategies applied during the request
AppliedEdits []BetaContextManagementResponseAppliedEditUnionList of context management edits that were applied.
List of context management edits that were applied.
type BetaClearToolUses20250919EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of tool uses that were cleared.
The type of context management edit applied.
type BetaClearThinking20251015EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of thinking turns that were cleared.
The type of context management edit applied.
Delta BetaRawMessageDeltaEventDelta
Container BetaContainerInformation 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.
Skills []BetaSkillSkills loaded in the container
Skills loaded in the container
Skill ID
Type BetaSkillTypeType of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Skill version or 'latest' for most recent version
StopReason BetaStopReason
Usage BetaMessageDeltaUsageBilling 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.
Iterations BetaIterationsUsagePer-iteration token usage breakdown.
Per-iteration token usage breakdown.
Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:
- Determine which iterations exceeded long context thresholds (>=200k tokens)
- Calculate the true context window size from the last iteration
- Understand token accumulation across server-side tool use loops
type BetaMessageIterationUsage struct{…}Token usage for a sampling iteration.
Token usage for a sampling iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a sampling iteration
type BetaCompactionIterationUsage struct{…}Token usage for a compaction iteration.
Token usage for a compaction iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a compaction iteration
The cumulative number of output tokens which were used.
ServerToolUse BetaServerToolUsageThe 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 BetaRawMessageStopEvent struct{…}
type BetaRawContentBlockStartEvent struct{…}
ContentBlock BetaRawContentBlockStartEventContentBlockUnionResponse model for a file uploaded to the container.
Response model for a file uploaded to the container.
type BetaTextBlock struct{…}
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaThinkingBlock struct{…}
type BetaRedactedThinkingBlock struct{…}
type BetaToolUseBlock struct{…}
Caller BetaToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaServerToolUseBlock struct{…}
Name BetaServerToolUseBlockName
Caller BetaServerToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebSearchToolResultBlock struct{…}
type BetaWebSearchToolResultError struct{…}
ErrorCode BetaWebSearchToolResultErrorCode
type BetaWebSearchToolResultBlockContentArray []BetaWebSearchResultBlock
Caller BetaWebSearchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebFetchToolResultBlock struct{…}
Content BetaWebFetchToolResultBlockContentUnion
type BetaWebFetchToolResultErrorBlock struct{…}
ErrorCode BetaWebFetchToolResultErrorCode
type BetaWebFetchBlock struct{…}
Content BetaDocumentBlock
Citations BetaCitationConfigCitation configuration for the document
Citation configuration for the document
Source BetaDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
Caller BetaWebFetchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaCodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type BetaCodeExecutionToolResultError struct{…}
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCodeExecutionResultBlock struct{…}
Content []BetaCodeExecutionOutputBlock
type BetaEncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []BetaCodeExecutionOutputBlock
type BetaBashCodeExecutionToolResultBlock struct{…}
Content BetaBashCodeExecutionToolResultBlockContentUnion
type BetaBashCodeExecutionToolResultError struct{…}
ErrorCode BetaBashCodeExecutionToolResultErrorErrorCode
type BetaBashCodeExecutionResultBlock struct{…}
Content []BetaBashCodeExecutionOutputBlock
type BetaTextEditorCodeExecutionToolResultBlock struct{…}
Content BetaTextEditorCodeExecutionToolResultBlockContentUnion
type BetaTextEditorCodeExecutionToolResultError struct{…}
ErrorCode BetaTextEditorCodeExecutionToolResultErrorErrorCode
type BetaTextEditorCodeExecutionViewResultBlock struct{…}
FileType BetaTextEditorCodeExecutionViewResultBlockFileType
type BetaTextEditorCodeExecutionCreateResultBlock struct{…}
type BetaTextEditorCodeExecutionStrReplaceResultBlock struct{…}
type BetaToolSearchToolResultBlock struct{…}
Content BetaToolSearchToolResultBlockContentUnion
type BetaToolSearchToolResultError struct{…}
ErrorCode BetaToolSearchToolResultErrorErrorCode
type BetaToolSearchToolSearchResultBlock struct{…}
ToolReferences []BetaToolReferenceBlock
type BetaMCPToolUseBlock struct{…}
The name of the MCP tool
The name of the MCP server
type BetaMCPToolResultBlock struct{…}
Content BetaMCPToolResultBlockContentUnion
type BetaMCPToolResultBlockContentBetaMCPToolResultBlockContent []BetaTextBlock
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
type BetaCompactionBlock struct{…}A compaction block returned when autocompact is triggered.
A compaction block returned when autocompact is triggered.
When content is None, it indicates the compaction failed to produce a valid summary (e.g., malformed output from the model). Clients may round-trip compaction blocks with null content; the server treats them as no-ops.
Summary of compacted content, or null if compaction failed
type BetaRawContentBlockDeltaEvent struct{…}
type BetaTextDelta struct{…}
type BetaInputJSONDelta struct{…}
type BetaCitationsDelta struct{…}
Citation BetaCitationsDeltaCitationUnion
type BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaThinkingDelta struct{…}
type BetaSignatureDelta struct{…}
type BetaCompactionContentBlockDelta struct{…}
type BetaRawContentBlockStopEvent struct{…}
type BetaRedactedThinkingBlock struct{…}
type BetaRedactedThinkingBlockParamResp struct{…}
type BetaRequestDocumentBlock struct{…}
Source BetaRequestDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
type BetaContentBlockSource struct{…}
Content BetaContentBlockSourceContentUnion
type BetaTextBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaImageBlockParamResp struct{…}
Source BetaImageBlockParamSourceUnionResp
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaURLImageSource struct{…}
type BetaFileImageSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaURLPDFSource struct{…}
type BetaFileDocumentSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptional
type BetaRequestMCPServerToolConfiguration struct{…}
type BetaRequestMCPServerURLDefinition struct{…}
ToolConfiguration BetaRequestMCPServerToolConfigurationoptional
type BetaRequestMCPToolResultBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaRequestMCPToolResultBlockParamContentUnionRespoptional
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaSearchResultBlockParamResp struct{…}
Content []BetaTextBlockParamResp
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptional
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaServerToolUsage struct{…}
The number of web fetch tool requests.
The number of web search tool requests.
type BetaServerToolUseBlock struct{…}
Name BetaServerToolUseBlockName
Caller BetaServerToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaServerToolUseBlockParamResp struct{…}
Name BetaServerToolUseBlockParamName
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaServerToolUseBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaSignatureDelta struct{…}
type BetaSkill struct{…}A skill that was loaded in a container (response model).
A skill that was loaded in a container (response model).
Skill ID
Type BetaSkillTypeType of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Skill version or 'latest' for most recent version
type BetaSkillParamsResp struct{…}Specification for a skill to be loaded in a container (request model).
Specification for a skill to be loaded in a container (request model).
Skill ID
Type BetaSkillParamsTypeType of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Skill version or 'latest' for most recent version
type BetaStopReason string
type BetaTextBlock struct{…}
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaTextBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaTextCitationUnion interface{…}
type BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaTextCitationParamUnionResp interface{…}
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaTextDelta struct{…}
type BetaTextEditorCodeExecutionCreateResultBlock struct{…}
type BetaTextEditorCodeExecutionCreateResultBlockParamResp struct{…}
type BetaTextEditorCodeExecutionStrReplaceResultBlock struct{…}
type BetaTextEditorCodeExecutionStrReplaceResultBlockParamResp struct{…}
type BetaTextEditorCodeExecutionToolResultBlock struct{…}
Content BetaTextEditorCodeExecutionToolResultBlockContentUnion
type BetaTextEditorCodeExecutionToolResultError struct{…}
ErrorCode BetaTextEditorCodeExecutionToolResultErrorErrorCode
type BetaTextEditorCodeExecutionViewResultBlock struct{…}
FileType BetaTextEditorCodeExecutionViewResultBlockFileType
type BetaTextEditorCodeExecutionCreateResultBlock struct{…}
type BetaTextEditorCodeExecutionStrReplaceResultBlock struct{…}
type BetaTextEditorCodeExecutionToolResultBlockParamResp struct{…}
Content BetaTextEditorCodeExecutionToolResultBlockParamContentUnionResp
type BetaTextEditorCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BetaTextEditorCodeExecutionToolResultErrorParamErrorCode
type BetaTextEditorCodeExecutionViewResultBlockParamResp struct{…}
FileType BetaTextEditorCodeExecutionViewResultBlockParamFileType
type BetaTextEditorCodeExecutionCreateResultBlockParamResp struct{…}
type BetaTextEditorCodeExecutionStrReplaceResultBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaTextEditorCodeExecutionToolResultError struct{…}
ErrorCode BetaTextEditorCodeExecutionToolResultErrorErrorCode
type BetaTextEditorCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BetaTextEditorCodeExecutionToolResultErrorParamErrorCode
type BetaTextEditorCodeExecutionViewResultBlock struct{…}
FileType BetaTextEditorCodeExecutionViewResultBlockFileType
type BetaTextEditorCodeExecutionViewResultBlockParamResp struct{…}
FileType BetaTextEditorCodeExecutionViewResultBlockParamFileType
type BetaThinkingBlock struct{…}
type BetaThinkingBlockParamResp struct{…}
type BetaThinkingConfigAdaptive struct{…}
type BetaThinkingConfigDisabled struct{…}
type BetaThinkingConfigEnabled 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 BetaThinkingConfigParamUnionResp 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 BetaThinkingConfigEnabled 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 BetaThinkingConfigDisabled struct{…}
type BetaThinkingConfigAdaptive struct{…}
type BetaThinkingDelta struct{…}
type BetaThinkingTurns struct{…}
type BetaTool struct{…}
InputSchema BetaToolInputSchemaJSON 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolBash20241022 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolBash20250124 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolChoiceUnion 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 BetaToolChoiceAuto 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 BetaToolChoiceAny 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 BetaToolChoiceTool 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 BetaToolChoiceNone struct{…}The model will not be allowed to use tools.
The model will not be allowed to use tools.
type BetaToolChoiceAny 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 BetaToolChoiceAuto 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 BetaToolChoiceNone struct{…}The model will not be allowed to use tools.
The model will not be allowed to use tools.
type BetaToolChoiceTool 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 BetaToolComputerUse20241022 struct{…}
The height of the display in pixels.
The width of the display in pixels.
Name ComputerName 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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.
The X11 display number (e.g. 0, 1) for the display.
When true, guarantees schema validation on tool names and inputs
type BetaToolComputerUse20250124 struct{…}
The height of the display in pixels.
The width of the display in pixels.
Name ComputerName 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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.
The X11 display number (e.g. 0, 1) for the display.
When true, guarantees schema validation on tool names and inputs
type BetaToolComputerUse20251124 struct{…}
The height of the display in pixels.
The width of the display in pixels.
Name ComputerName 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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.
The X11 display number (e.g. 0, 1) for the display.
Whether to enable an action to take a zoomed-in screenshot of the screen.
When true, guarantees schema validation on tool names and inputs
type BetaToolReferenceBlock struct{…}
type BetaToolReferenceBlockParamResp struct{…}Tool reference block that can be included in tool_result content.
Tool reference block that can be included in tool_result content.
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolResultBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaToolResultBlockParamContentUnionRespoptional
[]BetaToolResultBlockParamContentUnionResp
type BetaTextBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaImageBlockParamResp struct{…}
Source BetaImageBlockParamSourceUnionResp
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaURLImageSource struct{…}
type BetaFileImageSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaSearchResultBlockParamResp struct{…}
Content []BetaTextBlockParamResp
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptional
type BetaRequestDocumentBlock struct{…}
Source BetaRequestDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
type BetaContentBlockSource struct{…}
Content BetaContentBlockSourceContentUnion
type BetaTextBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaImageBlockParamResp struct{…}
Source BetaImageBlockParamSourceUnionResp
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaURLImageSource struct{…}
type BetaFileImageSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaURLPDFSource struct{…}
type BetaFileDocumentSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptional
type BetaToolReferenceBlockParamResp struct{…}Tool reference block that can be included in tool_result content.
Tool reference block that can be included in tool_result content.
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolSearchToolBm25_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 BetaToolSearchToolBm25_20251119Type
AllowedCallers []stringoptional
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolSearchToolRegex20251119 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 BetaToolSearchToolRegex20251119Type
AllowedCallers []stringoptional
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolSearchToolResultBlock struct{…}
Content BetaToolSearchToolResultBlockContentUnion
type BetaToolSearchToolResultError struct{…}
ErrorCode BetaToolSearchToolResultErrorErrorCode
type BetaToolSearchToolSearchResultBlock struct{…}
ToolReferences []BetaToolReferenceBlock
type BetaToolSearchToolResultBlockParamResp struct{…}
Content BetaToolSearchToolResultBlockParamContentUnionResp
type BetaToolSearchToolResultErrorParamResp struct{…}
ErrorCode BetaToolSearchToolResultErrorParamErrorCode
type BetaToolSearchToolSearchResultBlockParamResp struct{…}
ToolReferences []BetaToolReferenceBlockParamResp
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolSearchToolResultError struct{…}
ErrorCode BetaToolSearchToolResultErrorErrorCode
type BetaToolSearchToolResultErrorParamResp struct{…}
ErrorCode BetaToolSearchToolResultErrorParamErrorCode
type BetaToolSearchToolSearchResultBlock struct{…}
ToolReferences []BetaToolReferenceBlock
type BetaToolSearchToolSearchResultBlockParamResp struct{…}
ToolReferences []BetaToolReferenceBlockParamResp
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolTextEditor20241022 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolTextEditor20250124 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolTextEditor20250429 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolTextEditor20250728 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolUnion interface{…}Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
type BetaTool struct{…}
InputSchema BetaToolInputSchemaJSON 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolBash20241022 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolBash20250124 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCodeExecutionTool20250522 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCodeExecutionTool20250825 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCodeExecutionTool20260120 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolComputerUse20241022 struct{…}
The height of the display in pixels.
The width of the display in pixels.
Name ComputerName 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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.
The X11 display number (e.g. 0, 1) for the display.
When true, guarantees schema validation on tool names and inputs
type BetaMemoryTool20250818 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolComputerUse20250124 struct{…}
The height of the display in pixels.
The width of the display in pixels.
Name ComputerName 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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.
The X11 display number (e.g. 0, 1) for the display.
When true, guarantees schema validation on tool names and inputs
type BetaToolTextEditor20241022 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolComputerUse20251124 struct{…}
The height of the display in pixels.
The width of the display in pixels.
Name ComputerName 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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.
The X11 display number (e.g. 0, 1) for the display.
Whether to enable an action to take a zoomed-in screenshot of the screen.
When true, guarantees schema validation on tool names and inputs
type BetaToolTextEditor20250124 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolTextEditor20250429 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolTextEditor20250728 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaWebSearchTool20250305 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaUserLocationoptionalParameters 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 BetaWebFetchTool20250910 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptionalCitations 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 BetaWebSearchTool20260209 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaUserLocationoptionalParameters 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 BetaWebFetchTool20260209 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptionalCitations 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 BetaToolSearchToolBm25_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 BetaToolSearchToolBm25_20251119Type
AllowedCallers []stringoptional
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolSearchToolRegex20251119 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 BetaToolSearchToolRegex20251119Type
AllowedCallers []stringoptional
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaMCPToolset struct{…}Configuration for a group of tools from an MCP server.
Configuration for a group of tools from an MCP server.
Allows configuring enabled status and defer_loading for all tools from an MCP server, with optional per-tool overrides.
Name of the MCP server to configure tools for
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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.
Configs map[string, BetaMCPToolConfig]optionalConfiguration overrides for specific tools, keyed by tool name
Configuration overrides for specific tools, keyed by tool name
DefaultConfig BetaMCPToolDefaultConfigoptionalDefault configuration applied to all tools from this server
Default configuration applied to all tools from this server
type BetaToolUseBlock struct{…}
Caller BetaToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaToolUseBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaToolUseBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaToolUsesKeep struct{…}
type BetaToolUsesTrigger struct{…}
type BetaURLImageSource struct{…}
type BetaURLPDFSource struct{…}
type BetaUsage struct{…}
CacheCreation BetaCacheCreationBreakdown 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.
Iterations BetaIterationsUsagePer-iteration token usage breakdown.
Per-iteration token usage breakdown.
Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:
- Determine which iterations exceeded long context thresholds (>=200k tokens)
- Calculate the true context window size from the last iteration
- Understand token accumulation across server-side tool use loops
type BetaMessageIterationUsage struct{…}Token usage for a sampling iteration.
Token usage for a sampling iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a sampling iteration
type BetaCompactionIterationUsage struct{…}Token usage for a compaction iteration.
Token usage for a compaction iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a compaction iteration
The number of output tokens which were used.
ServerToolUse BetaServerToolUsageThe 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 BetaUsageServiceTierIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
Speed BetaUsageSpeedThe inference speed mode used for this request.
The inference speed mode used for this request.
type BetaUserLocation 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 BetaWebFetchBlock struct{…}
Content BetaDocumentBlock
Citations BetaCitationConfigCitation configuration for the document
Citation configuration for the document
Source BetaDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
type BetaWebFetchBlockParamResp struct{…}
Content BetaRequestDocumentBlock
Source BetaRequestDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
type BetaContentBlockSource struct{…}
Content BetaContentBlockSourceContentUnion
type BetaTextBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaImageBlockParamResp struct{…}
Source BetaImageBlockParamSourceUnionResp
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaURLImageSource struct{…}
type BetaFileImageSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaURLPDFSource struct{…}
type BetaFileDocumentSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptional
Fetched content URL
ISO 8601 timestamp when the content was retrieved
type BetaWebFetchTool20250910 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptionalCitations 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 BetaWebFetchTool20260209 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptionalCitations 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 BetaWebFetchToolResultBlock struct{…}
Content BetaWebFetchToolResultBlockContentUnion
type BetaWebFetchToolResultErrorBlock struct{…}
ErrorCode BetaWebFetchToolResultErrorCode
type BetaWebFetchBlock struct{…}
Content BetaDocumentBlock
Citations BetaCitationConfigCitation configuration for the document
Citation configuration for the document
Source BetaDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
Caller BetaWebFetchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebFetchToolResultBlockParamResp struct{…}
Content BetaWebFetchToolResultBlockParamContentUnionResp
type BetaWebFetchToolResultErrorBlockParamResp struct{…}
ErrorCode BetaWebFetchToolResultErrorCode
type BetaWebFetchBlockParamResp struct{…}
Content BetaRequestDocumentBlock
Source BetaRequestDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
type BetaContentBlockSource struct{…}
Content BetaContentBlockSourceContentUnion
type BetaTextBlockParamResp struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 []BetaTextCitationParamUnionRespoptional
type BetaCitationCharLocationParamResp struct{…}
type BetaCitationPageLocationParamResp struct{…}
type BetaCitationContentBlockLocationParamResp struct{…}
type BetaCitationWebSearchResultLocationParamResp struct{…}
type BetaCitationSearchResultLocationParamResp struct{…}
type BetaImageBlockParamResp struct{…}
Source BetaImageBlockParamSourceUnionResp
type BetaBase64ImageSource struct{…}
MediaType BetaBase64ImageSourceMediaType
type BetaURLImageSource struct{…}
type BetaFileImageSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaURLPDFSource struct{…}
type BetaFileDocumentSource struct{…}
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaCitationsConfigParamRespoptional
Fetched content URL
ISO 8601 timestamp when the content was retrieved
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaWebFetchToolResultBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebFetchToolResultErrorBlock struct{…}
ErrorCode BetaWebFetchToolResultErrorCode
type BetaWebFetchToolResultErrorBlockParamResp struct{…}
ErrorCode BetaWebFetchToolResultErrorCode
type BetaWebFetchToolResultErrorCode string
type BetaWebSearchResultBlock struct{…}
type BetaWebSearchResultBlockParamResp struct{…}
type BetaWebSearchTool20250305 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaUserLocationoptionalParameters 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 BetaWebSearchTool20260209 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 BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaUserLocationoptionalParameters 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 BetaWebSearchToolRequestError struct{…}
ErrorCode BetaWebSearchToolResultErrorCode
type BetaWebSearchToolResultBlock struct{…}
type BetaWebSearchToolResultError struct{…}
ErrorCode BetaWebSearchToolResultErrorCode
type BetaWebSearchToolResultBlockContentArray []BetaWebSearchResultBlock
Caller BetaWebSearchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebSearchToolResultBlockContentUnion interface{…}
type BetaWebSearchToolResultError struct{…}
ErrorCode BetaWebSearchToolResultErrorCode
type BetaWebSearchToolResultBlockContentArray []BetaWebSearchResultBlock
type BetaWebSearchToolResultBlockParamResp struct{…}
type BetaWebSearchToolRequestError struct{…}
ErrorCode BetaWebSearchToolResultErrorCode
CacheControl BetaCacheControlEphemeraloptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTLoptionalThe 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 BetaWebSearchToolResultBlockParamCallerUnionRespoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebSearchToolResultBlockParamContentUnionResp interface{…}
type BetaWebSearchToolRequestError struct{…}
ErrorCode BetaWebSearchToolResultErrorCode
type BetaWebSearchToolResultError struct{…}
ErrorCode BetaWebSearchToolResultErrorCode
type BetaWebSearchToolResultErrorCode string
BetaMessagesBatches
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 BetaDeletedMessageBatch struct{…}
ID of the Message Batch.
Type MessageBatchDeletedDeleted object type.
Deleted object type.
For Message Batches, this is always "message_batch_deleted".
type BetaMessageBatch 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 BetaMessageBatchProcessingStatusProcessing status of the Message Batch.
Processing status of the Message Batch.
RequestCounts BetaMessageBatchRequestCountsTallies 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 BetaMessageBatchCanceledResult struct{…}
type BetaMessageBatchErroredResult struct{…}
Error BetaErrorResponse
Error BetaErrorUnion
type BetaInvalidRequestError struct{…}
type BetaAuthenticationError struct{…}
type BetaBillingError struct{…}
type BetaPermissionError struct{…}
type BetaNotFoundError struct{…}
type BetaRateLimitError struct{…}
type BetaGatewayTimeoutError struct{…}
type BetaAPIError struct{…}
type BetaOverloadedError struct{…}
type BetaMessageBatchExpiredResult struct{…}
type BetaMessageBatchIndividualResponse 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 BetaMessageBatchResultUnionProcessing 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 BetaMessageBatchSucceededResult struct{…}
Message BetaMessage
ID stringUnique object identifier.
Unique object identifier.
The format and length of IDs may change over time.
Container BetaContainerInformation 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.
Skills []BetaSkillSkills loaded in the container
Skills loaded in the container
Skill ID
Type BetaSkillTypeType of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Skill version or 'latest' for most recent version
Content []BetaContentBlockUnionContent 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 BetaTextBlock struct{…}
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaThinkingBlock struct{…}
type BetaRedactedThinkingBlock struct{…}
type BetaToolUseBlock struct{…}
Caller BetaToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaServerToolUseBlock struct{…}
Name BetaServerToolUseBlockName
Caller BetaServerToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebSearchToolResultBlock struct{…}
type BetaWebSearchToolResultError struct{…}
ErrorCode BetaWebSearchToolResultErrorCode
type BetaWebSearchToolResultBlockContentArray []BetaWebSearchResultBlock
Caller BetaWebSearchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebFetchToolResultBlock struct{…}
Content BetaWebFetchToolResultBlockContentUnion
type BetaWebFetchToolResultErrorBlock struct{…}
ErrorCode BetaWebFetchToolResultErrorCode
type BetaWebFetchBlock struct{…}
Content BetaDocumentBlock
Citations BetaCitationConfigCitation configuration for the document
Citation configuration for the document
Source BetaDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
Caller BetaWebFetchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaCodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type BetaCodeExecutionToolResultError struct{…}
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCodeExecutionResultBlock struct{…}
Content []BetaCodeExecutionOutputBlock
type BetaEncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []BetaCodeExecutionOutputBlock
type BetaBashCodeExecutionToolResultBlock struct{…}
Content BetaBashCodeExecutionToolResultBlockContentUnion
type BetaBashCodeExecutionToolResultError struct{…}
ErrorCode BetaBashCodeExecutionToolResultErrorErrorCode
type BetaBashCodeExecutionResultBlock struct{…}
Content []BetaBashCodeExecutionOutputBlock
type BetaTextEditorCodeExecutionToolResultBlock struct{…}
Content BetaTextEditorCodeExecutionToolResultBlockContentUnion
type BetaTextEditorCodeExecutionToolResultError struct{…}
ErrorCode BetaTextEditorCodeExecutionToolResultErrorErrorCode
type BetaTextEditorCodeExecutionViewResultBlock struct{…}
FileType BetaTextEditorCodeExecutionViewResultBlockFileType
type BetaTextEditorCodeExecutionCreateResultBlock struct{…}
type BetaTextEditorCodeExecutionStrReplaceResultBlock struct{…}
type BetaToolSearchToolResultBlock struct{…}
Content BetaToolSearchToolResultBlockContentUnion
type BetaToolSearchToolResultError struct{…}
ErrorCode BetaToolSearchToolResultErrorErrorCode
type BetaToolSearchToolSearchResultBlock struct{…}
ToolReferences []BetaToolReferenceBlock
type BetaMCPToolUseBlock struct{…}
The name of the MCP tool
The name of the MCP server
type BetaMCPToolResultBlock struct{…}
Content BetaMCPToolResultBlockContentUnion
type BetaMCPToolResultBlockContentBetaMCPToolResultBlockContent []BetaTextBlock
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
type BetaCompactionBlock struct{…}A compaction block returned when autocompact is triggered.
A compaction block returned when autocompact is triggered.
When content is None, it indicates the compaction failed to produce a valid summary (e.g., malformed output from the model). Clients may round-trip compaction blocks with null content; the server treats them as no-ops.
Summary of compacted content, or null if compaction failed
ContextManagement BetaContextManagementResponseContext management response.
Context management response.
Information about context management strategies applied during the request.
AppliedEdits []BetaContextManagementResponseAppliedEditUnionList of context management edits that were applied.
List of context management edits that were applied.
type BetaClearToolUses20250919EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of tool uses that were cleared.
The type of context management edit applied.
type BetaClearThinking20251015EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of thinking turns that were cleared.
The type of context management edit applied.
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 BetaStopReasonThe 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 BetaUsageBilling 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 BetaCacheCreationBreakdown 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.
Iterations BetaIterationsUsagePer-iteration token usage breakdown.
Per-iteration token usage breakdown.
Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:
- Determine which iterations exceeded long context thresholds (>=200k tokens)
- Calculate the true context window size from the last iteration
- Understand token accumulation across server-side tool use loops
type BetaMessageIterationUsage struct{…}Token usage for a sampling iteration.
Token usage for a sampling iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a sampling iteration
type BetaCompactionIterationUsage struct{…}Token usage for a compaction iteration.
Token usage for a compaction iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a compaction iteration
The number of output tokens which were used.
ServerToolUse BetaServerToolUsageThe 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 BetaUsageServiceTierIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
Speed BetaUsageSpeedThe inference speed mode used for this request.
The inference speed mode used for this request.
type BetaMessageBatchErroredResult struct{…}
Error BetaErrorResponse
Error BetaErrorUnion
type BetaInvalidRequestError struct{…}
type BetaAuthenticationError struct{…}
type BetaBillingError struct{…}
type BetaPermissionError struct{…}
type BetaNotFoundError struct{…}
type BetaRateLimitError struct{…}
type BetaGatewayTimeoutError struct{…}
type BetaAPIError struct{…}
type BetaOverloadedError struct{…}
type BetaMessageBatchCanceledResult struct{…}
type BetaMessageBatchExpiredResult struct{…}
type BetaMessageBatchRequestCounts 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 BetaMessageBatchResultUnion 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 BetaMessageBatchSucceededResult struct{…}
Message BetaMessage
ID stringUnique object identifier.
Unique object identifier.
The format and length of IDs may change over time.
Container BetaContainerInformation 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.
Skills []BetaSkillSkills loaded in the container
Skills loaded in the container
Skill ID
Type BetaSkillTypeType of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Skill version or 'latest' for most recent version
Content []BetaContentBlockUnionContent 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 BetaTextBlock struct{…}
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaThinkingBlock struct{…}
type BetaRedactedThinkingBlock struct{…}
type BetaToolUseBlock struct{…}
Caller BetaToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaServerToolUseBlock struct{…}
Name BetaServerToolUseBlockName
Caller BetaServerToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebSearchToolResultBlock struct{…}
type BetaWebSearchToolResultError struct{…}
ErrorCode BetaWebSearchToolResultErrorCode
type BetaWebSearchToolResultBlockContentArray []BetaWebSearchResultBlock
Caller BetaWebSearchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebFetchToolResultBlock struct{…}
Content BetaWebFetchToolResultBlockContentUnion
type BetaWebFetchToolResultErrorBlock struct{…}
ErrorCode BetaWebFetchToolResultErrorCode
type BetaWebFetchBlock struct{…}
Content BetaDocumentBlock
Citations BetaCitationConfigCitation configuration for the document
Citation configuration for the document
Source BetaDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
Caller BetaWebFetchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaCodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type BetaCodeExecutionToolResultError struct{…}
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCodeExecutionResultBlock struct{…}
Content []BetaCodeExecutionOutputBlock
type BetaEncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []BetaCodeExecutionOutputBlock
type BetaBashCodeExecutionToolResultBlock struct{…}
Content BetaBashCodeExecutionToolResultBlockContentUnion
type BetaBashCodeExecutionToolResultError struct{…}
ErrorCode BetaBashCodeExecutionToolResultErrorErrorCode
type BetaBashCodeExecutionResultBlock struct{…}
Content []BetaBashCodeExecutionOutputBlock
type BetaTextEditorCodeExecutionToolResultBlock struct{…}
Content BetaTextEditorCodeExecutionToolResultBlockContentUnion
type BetaTextEditorCodeExecutionToolResultError struct{…}
ErrorCode BetaTextEditorCodeExecutionToolResultErrorErrorCode
type BetaTextEditorCodeExecutionViewResultBlock struct{…}
FileType BetaTextEditorCodeExecutionViewResultBlockFileType
type BetaTextEditorCodeExecutionCreateResultBlock struct{…}
type BetaTextEditorCodeExecutionStrReplaceResultBlock struct{…}
type BetaToolSearchToolResultBlock struct{…}
Content BetaToolSearchToolResultBlockContentUnion
type BetaToolSearchToolResultError struct{…}
ErrorCode BetaToolSearchToolResultErrorErrorCode
type BetaToolSearchToolSearchResultBlock struct{…}
ToolReferences []BetaToolReferenceBlock
type BetaMCPToolUseBlock struct{…}
The name of the MCP tool
The name of the MCP server
type BetaMCPToolResultBlock struct{…}
Content BetaMCPToolResultBlockContentUnion
type BetaMCPToolResultBlockContentBetaMCPToolResultBlockContent []BetaTextBlock
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
type BetaCompactionBlock struct{…}A compaction block returned when autocompact is triggered.
A compaction block returned when autocompact is triggered.
When content is None, it indicates the compaction failed to produce a valid summary (e.g., malformed output from the model). Clients may round-trip compaction blocks with null content; the server treats them as no-ops.
Summary of compacted content, or null if compaction failed
ContextManagement BetaContextManagementResponseContext management response.
Context management response.
Information about context management strategies applied during the request.
AppliedEdits []BetaContextManagementResponseAppliedEditUnionList of context management edits that were applied.
List of context management edits that were applied.
type BetaClearToolUses20250919EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of tool uses that were cleared.
The type of context management edit applied.
type BetaClearThinking20251015EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of thinking turns that were cleared.
The type of context management edit applied.
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 BetaStopReasonThe 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 BetaUsageBilling 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 BetaCacheCreationBreakdown 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.
Iterations BetaIterationsUsagePer-iteration token usage breakdown.
Per-iteration token usage breakdown.
Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:
- Determine which iterations exceeded long context thresholds (>=200k tokens)
- Calculate the true context window size from the last iteration
- Understand token accumulation across server-side tool use loops
type BetaMessageIterationUsage struct{…}Token usage for a sampling iteration.
Token usage for a sampling iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a sampling iteration
type BetaCompactionIterationUsage struct{…}Token usage for a compaction iteration.
Token usage for a compaction iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a compaction iteration
The number of output tokens which were used.
ServerToolUse BetaServerToolUsageThe 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 BetaUsageServiceTierIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
Speed BetaUsageSpeedThe inference speed mode used for this request.
The inference speed mode used for this request.
type BetaMessageBatchErroredResult struct{…}
Error BetaErrorResponse
Error BetaErrorUnion
type BetaInvalidRequestError struct{…}
type BetaAuthenticationError struct{…}
type BetaBillingError struct{…}
type BetaPermissionError struct{…}
type BetaNotFoundError struct{…}
type BetaRateLimitError struct{…}
type BetaGatewayTimeoutError struct{…}
type BetaAPIError struct{…}
type BetaOverloadedError struct{…}
type BetaMessageBatchCanceledResult struct{…}
type BetaMessageBatchExpiredResult struct{…}
type BetaMessageBatchSucceededResult struct{…}
Message BetaMessage
ID stringUnique object identifier.
Unique object identifier.
The format and length of IDs may change over time.
Container BetaContainerInformation 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.
Skills []BetaSkillSkills loaded in the container
Skills loaded in the container
Skill ID
Type BetaSkillTypeType of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Skill version or 'latest' for most recent version
Content []BetaContentBlockUnionContent 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 BetaTextBlock struct{…}
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaThinkingBlock struct{…}
type BetaRedactedThinkingBlock struct{…}
type BetaToolUseBlock struct{…}
Caller BetaToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaServerToolUseBlock struct{…}
Name BetaServerToolUseBlockName
Caller BetaServerToolUseBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebSearchToolResultBlock struct{…}
type BetaWebSearchToolResultError struct{…}
ErrorCode BetaWebSearchToolResultErrorCode
type BetaWebSearchToolResultBlockContentArray []BetaWebSearchResultBlock
Caller BetaWebSearchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaWebFetchToolResultBlock struct{…}
Content BetaWebFetchToolResultBlockContentUnion
type BetaWebFetchToolResultErrorBlock struct{…}
ErrorCode BetaWebFetchToolResultErrorCode
type BetaWebFetchBlock struct{…}
Content BetaDocumentBlock
Citations BetaCitationConfigCitation configuration for the document
Citation configuration for the document
Source BetaDocumentBlockSourceUnion
type BetaBase64PDFSource struct{…}
type BetaPlainTextSource struct{…}
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
Caller BetaWebFetchToolResultBlockCallerUnionoptionalTool invocation directly from the model.
Tool invocation directly from the model.
type BetaDirectCaller struct{…}Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaServerToolCaller struct{…}Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
type BetaServerToolCaller20260120 struct{…}
type BetaCodeExecutionToolResultBlock struct{…}
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
type BetaCodeExecutionToolResultError struct{…}
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCodeExecutionResultBlock struct{…}
Content []BetaCodeExecutionOutputBlock
type BetaEncryptedCodeExecutionResultBlock struct{…}Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []BetaCodeExecutionOutputBlock
type BetaBashCodeExecutionToolResultBlock struct{…}
Content BetaBashCodeExecutionToolResultBlockContentUnion
type BetaBashCodeExecutionToolResultError struct{…}
ErrorCode BetaBashCodeExecutionToolResultErrorErrorCode
type BetaBashCodeExecutionResultBlock struct{…}
Content []BetaBashCodeExecutionOutputBlock
type BetaTextEditorCodeExecutionToolResultBlock struct{…}
Content BetaTextEditorCodeExecutionToolResultBlockContentUnion
type BetaTextEditorCodeExecutionToolResultError struct{…}
ErrorCode BetaTextEditorCodeExecutionToolResultErrorErrorCode
type BetaTextEditorCodeExecutionViewResultBlock struct{…}
FileType BetaTextEditorCodeExecutionViewResultBlockFileType
type BetaTextEditorCodeExecutionCreateResultBlock struct{…}
type BetaTextEditorCodeExecutionStrReplaceResultBlock struct{…}
type BetaToolSearchToolResultBlock struct{…}
Content BetaToolSearchToolResultBlockContentUnion
type BetaToolSearchToolResultError struct{…}
ErrorCode BetaToolSearchToolResultErrorErrorCode
type BetaToolSearchToolSearchResultBlock struct{…}
ToolReferences []BetaToolReferenceBlock
type BetaMCPToolUseBlock struct{…}
The name of the MCP tool
The name of the MCP server
type BetaMCPToolResultBlock struct{…}
Content BetaMCPToolResultBlockContentUnion
type BetaMCPToolResultBlockContentBetaMCPToolResultBlockContent []BetaTextBlock
Citations []BetaTextCitationUnionCitations 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 BetaCitationCharLocation struct{…}
type BetaCitationPageLocation struct{…}
type BetaCitationContentBlockLocation struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
type BetaCitationSearchResultLocation struct{…}
type BetaContainerUploadBlock struct{…}Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
type BetaCompactionBlock struct{…}A compaction block returned when autocompact is triggered.
A compaction block returned when autocompact is triggered.
When content is None, it indicates the compaction failed to produce a valid summary (e.g., malformed output from the model). Clients may round-trip compaction blocks with null content; the server treats them as no-ops.
Summary of compacted content, or null if compaction failed
ContextManagement BetaContextManagementResponseContext management response.
Context management response.
Information about context management strategies applied during the request.
AppliedEdits []BetaContextManagementResponseAppliedEditUnionList of context management edits that were applied.
List of context management edits that were applied.
type BetaClearToolUses20250919EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of tool uses that were cleared.
The type of context management edit applied.
type BetaClearThinking20251015EditResponse struct{…}
Number of input tokens cleared by this edit.
Number of thinking turns that were cleared.
The type of context management edit applied.
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 BetaStopReasonThe 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 BetaUsageBilling 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 BetaCacheCreationBreakdown 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.
Iterations BetaIterationsUsagePer-iteration token usage breakdown.
Per-iteration token usage breakdown.
Each entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:
- Determine which iterations exceeded long context thresholds (>=200k tokens)
- Calculate the true context window size from the last iteration
- Understand token accumulation across server-side tool use loops
type BetaMessageIterationUsage struct{…}Token usage for a sampling iteration.
Token usage for a sampling iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a sampling iteration
type BetaCompactionIterationUsage struct{…}Token usage for a compaction iteration.
Token usage for a compaction iteration.
CacheCreation BetaCacheCreationBreakdown 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 number of input tokens which were used.
The number of output tokens which were used.
Usage for a compaction iteration
The number of output tokens which were used.
ServerToolUse BetaServerToolUsageThe 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 BetaUsageServiceTierIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
Speed BetaUsageSpeedThe inference speed mode used for this request.
The inference speed mode used for this request.
BetaFiles
Download File
Get File Metadata
Delete File
ModelsExpand Collapse
type DeletedFile struct{…}
ID of the deleted file.
Type DeletedFileTypeoptionalDeleted object type.
Deleted object type.
For file deletion, this is always "file_deleted".
type FileMetadata struct{…}
ID stringUnique object identifier.
Unique object identifier.
The format and length of IDs may change over time.
RFC 3339 datetime string representing when the file was created.
Original filename of the uploaded file.
MIME type of the file.
Size of the file in bytes.
Type FileObject type.
Object type.
For files, this is always "file".
Whether the file can be downloaded.