Beta
ModelsExpand Collapse
AnthropicBeta = String | :"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 17 more
:"message-batches-2024-09-24" | :"prompt-caching-2024-07-31" | :"computer-use-2024-10-22" | 17 more
class BetaAPIError { message, type }
class BetaAuthenticationError { message, type }
class BetaBillingError { message, type }
BetaError = BetaInvalidRequestError { message, type } | BetaAuthenticationError { message, type } | BetaBillingError { message, type } | 6 more
class BetaInvalidRequestError { message, type }
class BetaAuthenticationError { message, type }
class BetaBillingError { message, type }
class BetaPermissionError { message, type }
class BetaNotFoundError { message, type }
class BetaRateLimitError { message, type }
class BetaGatewayTimeoutError { message, type }
class BetaAPIError { message, type }
class BetaOverloadedError { message, type }
class BetaErrorResponse { error, request_id, type }
error: BetaError
class BetaInvalidRequestError { message, type }
class BetaAuthenticationError { message, type }
class BetaBillingError { message, type }
class BetaPermissionError { message, type }
class BetaNotFoundError { message, type }
class BetaRateLimitError { message, type }
class BetaGatewayTimeoutError { message, type }
class BetaAPIError { message, type }
class BetaOverloadedError { message, type }
class BetaGatewayTimeoutError { message, type }
class BetaInvalidRequestError { message, type }
class BetaNotFoundError { message, type }
class BetaOverloadedError { message, type }
class BetaPermissionError { message, type }
class BetaRateLimitError { message, type }
BetaModels
List Models
Get a Model
ModelsExpand Collapse
class BetaModelInfo { id, created_at, display_name, type }
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
Create a Message
Count tokens in a Message
ModelsExpand Collapse
class BetaAllThinkingTurns { type }
class BetaBase64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
class BetaBase64PDFSource { data, media_type, type }
class BetaBashCodeExecutionOutputBlock { file_id, type }
class BetaBashCodeExecutionOutputBlockParam { file_id, type }
class BetaBashCodeExecutionResultBlock { content, return_code, stderr, 2 more }
content: Array[BetaBashCodeExecutionOutputBlock { file_id, type } ]
class BetaBashCodeExecutionResultBlockParam { content, return_code, stderr, 2 more }
content: Array[BetaBashCodeExecutionOutputBlockParam { file_id, type } ]
class BetaBashCodeExecutionToolResultBlock { content, tool_use_id, type }
content: BetaBashCodeExecutionToolResultError { error_code, type } | BetaBashCodeExecutionResultBlock { content, return_code, stderr, 2 more }
class BetaBashCodeExecutionToolResultError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :too_many_requests | 2 more
class BetaBashCodeExecutionResultBlock { content, return_code, stderr, 2 more }
content: Array[BetaBashCodeExecutionOutputBlock { file_id, type } ]
class BetaBashCodeExecutionToolResultBlockParam { content, tool_use_id, type, cache_control }
content: BetaBashCodeExecutionToolResultErrorParam { error_code, type } | BetaBashCodeExecutionResultBlockParam { content, return_code, stderr, 2 more }
class BetaBashCodeExecutionToolResultErrorParam { error_code, type }
error_code: :invalid_tool_input | :unavailable | :too_many_requests | 2 more
class BetaBashCodeExecutionResultBlockParam { content, return_code, stderr, 2 more }
content: Array[BetaBashCodeExecutionOutputBlockParam { file_id, type } ]
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class BetaBashCodeExecutionToolResultError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :too_many_requests | 2 more
class BetaBashCodeExecutionToolResultErrorParam { error_code, type }
error_code: :invalid_tool_input | :unavailable | :too_many_requests | 2 more
class BetaCacheControlEphemeral { type, ttl }
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class BetaCacheCreation { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }
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.
class BetaCitationCharLocation { cited_text, document_index, document_title, 4 more }
class BetaCitationCharLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationConfig { enabled }
class BetaCitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
class BetaCitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationPageLocation { cited_text, document_index, document_title, 4 more }
class BetaCitationPageLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
class BetaCitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
class BetaCitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
class BetaCitationsConfigParam { enabled }
class BetaCitationsDelta { citation, type }
citation: BetaCitationCharLocation { cited_text, document_index, document_title, 4 more } | BetaCitationPageLocation { cited_text, document_index, document_title, 4 more } | BetaCitationContentBlockLocation { cited_text, document_index, document_title, 4 more } | 2 more
class BetaCitationCharLocation { cited_text, document_index, document_title, 4 more }
class BetaCitationPageLocation { cited_text, document_index, document_title, 4 more }
class BetaCitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
class BetaCitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
class BetaCitationSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
class BetaCitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
class BetaClearThinking20251015Edit { type, keep }
keep: BetaThinkingTurns { type, value } | BetaAllThinkingTurns { type } | :allNumber 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.
class BetaThinkingTurns { type, value }
class BetaAllThinkingTurns { type }
class BetaClearThinking20251015EditResponse { cleared_input_tokens, cleared_thinking_turns, type }
Number of input tokens cleared by this edit.
Number of thinking turns that were cleared.
The type of context management edit applied.
class BetaClearToolUses20250919Edit { type, clear_at_least, clear_tool_inputs, 3 more }
clear_at_least: BetaInputTokensClearAtLeast { type, value } Minimum 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.
clear_tool_inputs: bool | Array[String]Whether 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: BetaToolUsesKeep { type, value } Number of tool uses to retain in the conversation
Number of tool uses to retain in the conversation
trigger: BetaInputTokensTrigger { type, value } | BetaToolUsesTrigger { type, value } Condition that triggers the context management strategy
Condition that triggers the context management strategy
class BetaInputTokensTrigger { type, value }
class BetaToolUsesTrigger { type, value }
class BetaClearToolUses20250919EditResponse { cleared_input_tokens, cleared_tool_uses, type }
Number of input tokens cleared by this edit.
Number of tool uses that were cleared.
The type of context management edit applied.
class BetaCodeExecutionOutputBlock { file_id, type }
class BetaCodeExecutionOutputBlockParam { file_id, type }
class BetaCodeExecutionResultBlock { content, return_code, stderr, 2 more }
content: Array[BetaCodeExecutionOutputBlock { file_id, type } ]
class BetaCodeExecutionResultBlockParam { content, return_code, stderr, 2 more }
content: Array[BetaCodeExecutionOutputBlockParam { file_id, type } ]
class BetaCodeExecutionTool20250522 { name, type, allowed_callers, 3 more }
name: :code_executionName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
allowed_callers: Array[:direct | :code_execution_20250825 | :code_execution_20260120]
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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
class BetaCodeExecutionTool20250825 { name, type, allowed_callers, 3 more }
name: :code_executionName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
allowed_callers: Array[:direct | :code_execution_20250825 | :code_execution_20260120]
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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
class BetaCodeExecutionTool20260120 { name, type, allowed_callers, 3 more } Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
name: :code_executionName of the tool.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
allowed_callers: Array[:direct | :code_execution_20250825 | :code_execution_20260120]
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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
class BetaCodeExecutionToolResultBlock { content, tool_use_id, type }
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
class BetaCodeExecutionToolResultError { error_code, type }
error_code: BetaCodeExecutionToolResultErrorCode
class BetaCodeExecutionResultBlock { content, return_code, stderr, 2 more }
content: Array[BetaCodeExecutionOutputBlock { file_id, type } ]
class BetaEncryptedCodeExecutionResultBlock { content, encrypted_stdout, return_code, 2 more } Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
content: Array[BetaCodeExecutionOutputBlock { file_id, type } ]
BetaCodeExecutionToolResultBlockContent = BetaCodeExecutionToolResultError { error_code, type } | BetaCodeExecutionResultBlock { content, return_code, stderr, 2 more } | BetaEncryptedCodeExecutionResultBlock { content, encrypted_stdout, return_code, 2 more } Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
class BetaCodeExecutionToolResultError { error_code, type }
error_code: BetaCodeExecutionToolResultErrorCode
class BetaCodeExecutionResultBlock { content, return_code, stderr, 2 more }
content: Array[BetaCodeExecutionOutputBlock { file_id, type } ]
class BetaEncryptedCodeExecutionResultBlock { content, encrypted_stdout, return_code, 2 more } Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
content: Array[BetaCodeExecutionOutputBlock { file_id, type } ]
class BetaCodeExecutionToolResultBlockParam { content, tool_use_id, type, cache_control }
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
class BetaCodeExecutionToolResultErrorParam { error_code, type }
error_code: BetaCodeExecutionToolResultErrorCode
class BetaCodeExecutionResultBlockParam { content, return_code, stderr, 2 more }
content: Array[BetaCodeExecutionOutputBlockParam { file_id, type } ]
class BetaEncryptedCodeExecutionResultBlockParam { content, encrypted_stdout, return_code, 2 more } Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
content: Array[BetaCodeExecutionOutputBlockParam { file_id, type } ]
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
BetaCodeExecutionToolResultBlockParamContent = BetaCodeExecutionToolResultErrorParam { error_code, type } | BetaCodeExecutionResultBlockParam { content, return_code, stderr, 2 more } | BetaEncryptedCodeExecutionResultBlockParam { content, encrypted_stdout, return_code, 2 more } Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
class BetaCodeExecutionToolResultErrorParam { error_code, type }
error_code: BetaCodeExecutionToolResultErrorCode
class BetaCodeExecutionResultBlockParam { content, return_code, stderr, 2 more }
content: Array[BetaCodeExecutionOutputBlockParam { file_id, type } ]
class BetaEncryptedCodeExecutionResultBlockParam { content, encrypted_stdout, return_code, 2 more } Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
content: Array[BetaCodeExecutionOutputBlockParam { file_id, type } ]
class BetaCodeExecutionToolResultError { error_code, type }
error_code: BetaCodeExecutionToolResultErrorCode
BetaCodeExecutionToolResultErrorCode = :invalid_tool_input | :unavailable | :too_many_requests | :execution_time_exceeded
class BetaCodeExecutionToolResultErrorParam { error_code, type }
error_code: BetaCodeExecutionToolResultErrorCode
class BetaCompact20260112Edit { type, instructions, pause_after_compaction, trigger } 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: BetaInputTokensTrigger { type, value } When to trigger compaction. Defaults to 150000 input tokens.
When to trigger compaction. Defaults to 150000 input tokens.
class BetaCompactionBlock { content, type } 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
class BetaCompactionBlockParam { content, type, cache_control } 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
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class BetaCompactionContentBlockDelta { content, type }
class BetaCompactionIterationUsage { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more } Token usage for a compaction iteration.
Token usage for a compaction iteration.
cache_creation: BetaCacheCreation { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens } Breakdown 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
class BetaContainer { id, expires_at, skills } 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: Array[BetaSkill { skill_id, type, version } ]Skills loaded in the container
Skills loaded in the container
Skill ID
type: :anthropic | :customType 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
class BetaContainerParams { id, skills } Container parameters with skills to be loaded.
Container parameters with skills to be loaded.
Container id
skills: Array[BetaSkillParams { skill_id, type, version } ]List of skills to load in the container
List of skills to load in the container
Skill ID
type: :anthropic | :customType 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
class BetaContainerUploadBlock { file_id, type } Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
class BetaContainerUploadBlockParam { file_id, type, cache_control } 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.
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
BetaContentBlock = BetaTextBlock { citations, text, type } | BetaThinkingBlock { signature, thinking, type } | BetaRedactedThinkingBlock { data, type } | 12 moreResponse model for a file uploaded to the container.
Response model for a file uploaded to the container.
class BetaTextBlock { citations, text, type }
citations: Array[BetaTextCitation]Citations 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.
class BetaCitationCharLocation { cited_text, document_index, document_title, 4 more }
class BetaCitationPageLocation { cited_text, document_index, document_title, 4 more }
class BetaCitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
class BetaCitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
class BetaCitationSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
class BetaThinkingBlock { signature, thinking, type }
class BetaRedactedThinkingBlock { data, type }
class BetaToolUseBlock { id, input, name, 2 more }
caller_: BetaDirectCaller { type } | BetaServerToolCaller { tool_id, type } | BetaServerToolCaller20260120 { tool_id, type } Tool invocation directly from the model.
Tool invocation directly from the model.
class BetaDirectCaller { type } Tool invocation directly from the model.
Tool invocation directly from the model.
class BetaServerToolCaller { tool_id, type } Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
class BetaServerToolCaller20260120 { tool_id, type }
class BetaServerToolUseBlock { id, input, name, 2 more }
name: :web_search | :web_fetch | :code_execution | 4 more
caller_: BetaDirectCaller { type } | BetaServerToolCaller { tool_id, type } | BetaServerToolCaller20260120 { tool_id, type } Tool invocation directly from the model.
Tool invocation directly from the model.
class BetaDirectCaller { type } Tool invocation directly from the model.
Tool invocation directly from the model.
class BetaServerToolCaller { tool_id, type } Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
class BetaServerToolCaller20260120 { tool_id, type }
class BetaWebSearchToolResultBlock { content, tool_use_id, type, caller_ }
content: BetaWebSearchToolResultBlockContent
class BetaWebSearchToolResultError { error_code, type }
error_code: BetaWebSearchToolResultErrorCode
Array[BetaWebSearchResultBlock { encrypted_content, page_age, title, 2 more } ]
caller_: BetaDirectCaller { type } | BetaServerToolCaller { tool_id, type } | BetaServerToolCaller20260120 { tool_id, type } Tool invocation directly from the model.
Tool invocation directly from the model.
class BetaDirectCaller { type } Tool invocation directly from the model.
Tool invocation directly from the model.
class BetaServerToolCaller { tool_id, type } Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
class BetaServerToolCaller20260120 { tool_id, type }
class BetaWebFetchToolResultBlock { content, tool_use_id, type, caller_ }
content: BetaWebFetchToolResultErrorBlock { error_code, type } | BetaWebFetchBlock { content, retrieved_at, type, url }
class BetaWebFetchToolResultErrorBlock { error_code, type }
error_code: BetaWebFetchToolResultErrorCode
class BetaWebFetchBlock { content, retrieved_at, type, url }
content: BetaDocumentBlock { citations, source, title, type }
citations: BetaCitationConfig { enabled } Citation configuration for the document
Citation configuration for the document
source: BetaBase64PDFSource { data, media_type, type } | BetaPlainTextSource { data, media_type, type }
class BetaBase64PDFSource { data, media_type, type }
class BetaPlainTextSource { data, media_type, type }
The title of the document
ISO 8601 timestamp when the content was retrieved
Fetched content URL
caller_: BetaDirectCaller { type } | BetaServerToolCaller { tool_id, type } | BetaServerToolCaller20260120 { tool_id, type } Tool invocation directly from the model.
Tool invocation directly from the model.
class BetaDirectCaller { type } Tool invocation directly from the model.
Tool invocation directly from the model.
class BetaServerToolCaller { tool_id, type } Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
class BetaServerToolCaller20260120 { tool_id, type }
class BetaCodeExecutionToolResultBlock { content, tool_use_id, type }
Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
class BetaCodeExecutionToolResultError { error_code, type }
error_code: BetaCodeExecutionToolResultErrorCode
class BetaCodeExecutionResultBlock { content, return_code, stderr, 2 more }
content: Array[BetaCodeExecutionOutputBlock { file_id, type } ]
class BetaEncryptedCodeExecutionResultBlock { content, encrypted_stdout, return_code, 2 more } Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
content: Array[BetaCodeExecutionOutputBlock { file_id, type } ]
class BetaBashCodeExecutionToolResultBlock { content, tool_use_id, type }
content: BetaBashCodeExecutionToolResultError { error_code, type } | BetaBashCodeExecutionResultBlock { content, return_code, stderr, 2 more }
class BetaBashCodeExecutionToolResultError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :too_many_requests | 2 more
class BetaBashCodeExecutionResultBlock { content, return_code, stderr, 2 more }
content: Array[BetaBashCodeExecutionOutputBlock { file_id, type } ]
class BetaTextEditorCodeExecutionToolResultBlock { content, tool_use_id, type }
content: BetaTextEditorCodeExecutionToolResultError { error_code, error_message, type } | BetaTextEditorCodeExecutionViewResultBlock { content, file_type, num_lines, 3 more } | BetaTextEditorCodeExecutionCreateResultBlock { is_file_update, type } | BetaTextEditorCodeExecutionStrReplaceResultBlock { lines, new_lines, new_start, 3 more }
class BetaTextEditorCodeExecutionToolResultError { error_code, error_message, type }
error_code: :invalid_tool_input | :unavailable | :too_many_requests | 2 more
class BetaTextEditorCodeExecutionViewResultBlock { content, file_type, num_lines, 3 more }
file_type: :text | :image | :pdf
class BetaTextEditorCodeExecutionCreateResultBlock { is_file_update, type }
class BetaTextEditorCodeExecutionStrReplaceResultBlock { lines, new_lines, new_start, 3 more }
class BetaToolSearchToolResultBlock { content, tool_use_id, type }
content: BetaToolSearchToolResultError { error_code, error_message, type } | BetaToolSearchToolSearchResultBlock { tool_references, type }
class BetaToolSearchToolResultError { error_code, error_message, type }
error_code: :invalid_tool_input | :unavailable | :too_many_requests | :execution_time_exceeded
class BetaToolSearchToolSearchResultBlock { tool_references, type }
tool_references: Array[BetaToolReferenceBlock { tool_name, type } ]
class BetaMCPToolUseBlock { id, input, name, 2 more }
The name of the MCP tool
The name of the MCP server
class BetaMCPToolResultBlock { content, is_error, tool_use_id, type }
content: String | Array[BetaTextBlock { citations, text, type } ]
Array[BetaTextBlock { citations, text, type } ]
citations: Array[BetaTextCitation]Citations 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.
class BetaCitationCharLocation { cited_text, document_index, document_title, 4 more }
class BetaCitationPageLocation { cited_text, document_index, document_title, 4 more }
class BetaCitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
class BetaCitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
class BetaCitationSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
class BetaContainerUploadBlock { file_id, type } Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
class BetaCompactionBlock { content, type } 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
BetaContentBlockParam = BetaTextBlockParam { text, type, cache_control, citations } | BetaImageBlockParam { source, type, cache_control } | BetaRequestDocumentBlock { source, type, cache_control, 3 more } | 16 moreRegular text content.
Regular text content.
class BetaTextBlockParam { text, type, cache_control, citations }
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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: Array[BetaTextCitationParam]
class BetaCitationCharLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationPageLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
class BetaCitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
class BetaImageBlockParam { source, type, cache_control }
source: BetaBase64ImageSource { data, media_type, type } | BetaURLImageSource { type, url } | BetaFileImageSource { file_id, type }
class BetaBase64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
class BetaURLImageSource { type, url }
class BetaFileImageSource { file_id, type }
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class BetaRequestDocumentBlock { source, type, cache_control, 3 more }
source: BetaBase64PDFSource { data, media_type, type } | BetaPlainTextSource { data, media_type, type } | BetaContentBlockSource { content, type } | 2 more
class BetaBase64PDFSource { data, media_type, type }
class BetaPlainTextSource { data, media_type, type }
class BetaContentBlockSource { content, type }
content: String | Array[BetaContentBlockSourceContent]
class BetaTextBlockParam { text, type, cache_control, citations }
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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: Array[BetaTextCitationParam]
class BetaCitationCharLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationPageLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
class BetaCitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
class BetaImageBlockParam { source, type, cache_control }
source: BetaBase64ImageSource { data, media_type, type } | BetaURLImageSource { type, url } | BetaFileImageSource { file_id, type }
class BetaBase64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
class BetaURLImageSource { type, url }
class BetaFileImageSource { file_id, type }
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class BetaURLPDFSource { type, url }
class BetaFileDocumentSource { file_id, type }
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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: BetaCitationsConfigParam { enabled }
class BetaSearchResultBlockParam { content, source, title, 3 more }
content: Array[BetaTextBlockParam { text, type, cache_control, citations } ]
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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: Array[BetaTextCitationParam]
class BetaCitationCharLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationPageLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
class BetaCitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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: BetaCitationsConfigParam { enabled }
class BetaThinkingBlockParam { signature, thinking, type }
class BetaRedactedThinkingBlockParam { data, type }
class BetaToolUseBlockParam { id, input, name, 3 more }
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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_: BetaDirectCaller { type } | BetaServerToolCaller { tool_id, type } | BetaServerToolCaller20260120 { tool_id, type } Tool invocation directly from the model.
Tool invocation directly from the model.
class BetaDirectCaller { type } Tool invocation directly from the model.
Tool invocation directly from the model.
class BetaServerToolCaller { tool_id, type } Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
class BetaServerToolCaller20260120 { tool_id, type }
class BetaToolResultBlockParam { tool_use_id, type, cache_control, 2 more }
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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: String | Array[BetaTextBlockParam { text, type, cache_control, citations } | BetaImageBlockParam { source, type, cache_control } | BetaSearchResultBlockParam { content, source, title, 3 more } | 2 more]
Array[BetaTextBlockParam { text, type, cache_control, citations } | BetaImageBlockParam { source, type, cache_control } | BetaSearchResultBlockParam { content, source, title, 3 more } | 2 more]
class BetaTextBlockParam { text, type, cache_control, citations }
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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: Array[BetaTextCitationParam]
class BetaCitationCharLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationPageLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
class BetaCitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
class BetaImageBlockParam { source, type, cache_control }
source: BetaBase64ImageSource { data, media_type, type } | BetaURLImageSource { type, url } | BetaFileImageSource { file_id, type }
class BetaBase64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
class BetaURLImageSource { type, url }
class BetaFileImageSource { file_id, type }
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class BetaSearchResultBlockParam { content, source, title, 3 more }
content: Array[BetaTextBlockParam { text, type, cache_control, citations } ]
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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: Array[BetaTextCitationParam]
class BetaCitationCharLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationPageLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
class BetaCitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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: BetaCitationsConfigParam { enabled }
class BetaRequestDocumentBlock { source, type, cache_control, 3 more }
source: BetaBase64PDFSource { data, media_type, type } | BetaPlainTextSource { data, media_type, type } | BetaContentBlockSource { content, type } | 2 more
class BetaBase64PDFSource { data, media_type, type }
class BetaPlainTextSource { data, media_type, type }
class BetaContentBlockSource { content, type }
content: String | Array[BetaContentBlockSourceContent]
class BetaTextBlockParam { text, type, cache_control, citations }
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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: Array[BetaTextCitationParam]
class BetaCitationCharLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationPageLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
class BetaCitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
class BetaImageBlockParam { source, type, cache_control }
source: BetaBase64ImageSource { data, media_type, type } | BetaURLImageSource { type, url } | BetaFileImageSource { file_id, type }
class BetaBase64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
class BetaURLImageSource { type, url }
class BetaFileImageSource { file_id, type }
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class BetaURLPDFSource { type, url }
class BetaFileDocumentSource { file_id, type }
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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: BetaCitationsConfigParam { enabled }
class BetaToolReferenceBlockParam { tool_name, type, cache_control } Tool reference block that can be included in tool_result content.
Tool reference block that can be included in tool_result content.
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class BetaServerToolUseBlockParam { id, input, name, 3 more }
name: :web_search | :web_fetch | :code_execution | 4 more
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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_: BetaDirectCaller { type } | BetaServerToolCaller { tool_id, type } | BetaServerToolCaller20260120 { tool_id, type } Tool invocation directly from the model.
Tool invocation directly from the model.
class BetaDirectCaller { type } Tool invocation directly from the model.
Tool invocation directly from the model.
class BetaServerToolCaller { tool_id, type } Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
class BetaServerToolCaller20260120 { tool_id, type }
class BetaWebSearchToolResultBlockParam { content, tool_use_id, type, 2 more }
Array[BetaWebSearchResultBlockParam { encrypted_content, title, type, 2 more } ]
class BetaWebSearchToolRequestError { error_code, type }
error_code: BetaWebSearchToolResultErrorCode
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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_: BetaDirectCaller { type } | BetaServerToolCaller { tool_id, type } | BetaServerToolCaller20260120 { tool_id, type } Tool invocation directly from the model.
Tool invocation directly from the model.
class BetaDirectCaller { type } Tool invocation directly from the model.
Tool invocation directly from the model.
class BetaServerToolCaller { tool_id, type } Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
class BetaServerToolCaller20260120 { tool_id, type }
class BetaWebFetchToolResultBlockParam { content, tool_use_id, type, 2 more }
content: BetaWebFetchToolResultErrorBlockParam { error_code, type } | BetaWebFetchBlockParam { content, type, url, retrieved_at }
class BetaWebFetchToolResultErrorBlockParam { error_code, type }
error_code: BetaWebFetchToolResultErrorCode
class BetaWebFetchBlockParam { content, type, url, retrieved_at }
content: BetaRequestDocumentBlock { source, type, cache_control, 3 more }
source: BetaBase64PDFSource { data, media_type, type } | BetaPlainTextSource { data, media_type, type } | BetaContentBlockSource { content, type } | 2 more
class BetaBase64PDFSource { data, media_type, type }
class BetaPlainTextSource { data, media_type, type }
class BetaContentBlockSource { content, type }
content: String | Array[BetaContentBlockSourceContent]
class BetaTextBlockParam { text, type, cache_control, citations }
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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: Array[BetaTextCitationParam]
class BetaCitationCharLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationPageLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
class BetaCitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
class BetaCitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
class BetaImageBlockParam { source, type, cache_control }
source: BetaBase64ImageSource { data, media_type, type } | BetaURLImageSource { type, url } | BetaFileImageSource { file_id, type }
class BetaBase64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
class BetaURLImageSource { type, url }
class BetaFileImageSource { file_id, type }
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class BetaURLPDFSource { type, url }
class BetaFileDocumentSource { file_id, type }
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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: BetaCitationsConfigParam { enabled }
Fetched content URL
ISO 8601 timestamp when the content was retrieved
cache_control: BetaCacheControlEphemeral { type, ttl } Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
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_: BetaDirectCaller { type } | BetaServerToolCaller { tool_id, type } | BetaServerToolCaller20260120 { tool_id, type } Tool invocation directly from the model.
Tool invocation directly from the model.
class BetaDirectCaller { type } Tool invocation directly from the model.
Tool invocation directly from the model.