Loading...
    • Developer Guide
    • API Reference
    • MCP
    • Resources
    • Release Notes
    Search...
    ⌘K
    Using the API
    API overviewBeta headersErrors
    Messages
    Create a Message
    Count tokens in a Message
    Models
    List Models
    Get a Model
    Beta
    Admin
    Completions
    Create a Text Completion
    Support & configuration
    Rate limitsService tiersVersionsIP addressesSupported regionsOpenAI SDK compatibility
    Console
    Log in

    Messages

    Create a Message
    messages.create(MessageCreateParams**kwargs) -> Message
    POST/v1/messages
    Count tokens in a Message
    messages.count_tokens(MessageCountTokensParams**kwargs) -> MessageTokensCount
    POST/v1/messages/count_tokens
    ModelsExpand Collapse
    class Base64ImageSource: …
    data: str
    media_type: Literal["image/jpeg", "image/png", "image/gif", "image/webp"]
    Accepts one of the following:
    "image/jpeg"
    "image/png"
    "image/gif"
    "image/webp"
    type: Literal["base64"]
    class Base64PDFSource: …
    data: str
    media_type: Literal["application/pdf"]
    type: Literal["base64"]
    class BashCodeExecutionOutputBlock: …
    file_id: str
    type: Literal["bash_code_execution_output"]
    class BashCodeExecutionOutputBlockParam: …
    file_id: str
    type: Literal["bash_code_execution_output"]
    class BashCodeExecutionResultBlock: …
    content: List[BashCodeExecutionOutputBlock]
    file_id: str
    type: Literal["bash_code_execution_output"]
    return_code: int
    stderr: str
    stdout: str
    type: Literal["bash_code_execution_result"]
    class BashCodeExecutionResultBlockParam: …
    content: List[BashCodeExecutionOutputBlockParam]
    file_id: str
    type: Literal["bash_code_execution_output"]
    return_code: int
    stderr: str
    stdout: str
    type: Literal["bash_code_execution_result"]
    class BashCodeExecutionToolResultBlock: …
    content: Content
    Accepts one of the following:
    class BashCodeExecutionToolResultError: …
    error_code: BashCodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    "output_file_too_large"
    type: Literal["bash_code_execution_tool_result_error"]
    class BashCodeExecutionResultBlock: …
    content: List[BashCodeExecutionOutputBlock]
    file_id: str
    type: Literal["bash_code_execution_output"]
    return_code: int
    stderr: str
    stdout: str
    type: Literal["bash_code_execution_result"]
    tool_use_id: str
    type: Literal["bash_code_execution_tool_result"]
    class BashCodeExecutionToolResultBlockParam: …
    content: Content
    Accepts one of the following:
    class BashCodeExecutionToolResultErrorParam: …
    error_code: BashCodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    "output_file_too_large"
    type: Literal["bash_code_execution_tool_result_error"]
    class BashCodeExecutionResultBlockParam: …
    content: List[BashCodeExecutionOutputBlockParam]
    file_id: str
    type: Literal["bash_code_execution_output"]
    return_code: int
    stderr: str
    stdout: str
    type: Literal["bash_code_execution_result"]
    tool_use_id: str
    type: Literal["bash_code_execution_tool_result"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    class BashCodeExecutionToolResultError: …
    error_code: BashCodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    "output_file_too_large"
    type: Literal["bash_code_execution_tool_result_error"]
    Literal["invalid_tool_input", "unavailable", "too_many_requests", 2 more]
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    "output_file_too_large"
    class BashCodeExecutionToolResultErrorParam: …
    error_code: BashCodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    "output_file_too_large"
    type: Literal["bash_code_execution_tool_result_error"]
    class CacheControlEphemeral: …
    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    class CacheCreation: …
    ephemeral_1h_input_tokens: int

    The number of input tokens used to create the 1 hour cache entry.

    ephemeral_5m_input_tokens: int

    The number of input tokens used to create the 5 minute cache entry.

    class CitationCharLocation: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_char_index: int
    file_id: Optional[str]
    start_char_index: int
    type: Literal["char_location"]
    class CitationCharLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_char_index: int
    start_char_index: int
    type: Literal["char_location"]
    class CitationContentBlockLocation: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_block_index: int
    file_id: Optional[str]
    start_block_index: int
    type: Literal["content_block_location"]
    class CitationContentBlockLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_block_index: int
    start_block_index: int
    type: Literal["content_block_location"]
    class CitationPageLocation: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_page_number: int
    file_id: Optional[str]
    start_page_number: int
    type: Literal["page_location"]
    class CitationPageLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_page_number: int
    start_page_number: int
    type: Literal["page_location"]
    class CitationSearchResultLocationParam: …
    cited_text: str
    end_block_index: int
    search_result_index: int
    source: str
    start_block_index: int
    title: Optional[str]
    type: Literal["search_result_location"]
    class CitationWebSearchResultLocationParam: …
    cited_text: str
    encrypted_index: str
    title: Optional[str]
    type: Literal["web_search_result_location"]
    url: str
    class CitationsConfig: …
    enabled: bool
    class CitationsConfigParam: …
    enabled: Optional[bool]
    class CitationsDelta: …
    citation: Citation
    Accepts one of the following:
    class CitationCharLocation: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_char_index: int
    file_id: Optional[str]
    start_char_index: int
    type: Literal["char_location"]
    class CitationPageLocation: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_page_number: int
    file_id: Optional[str]
    start_page_number: int
    type: Literal["page_location"]
    class CitationContentBlockLocation: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_block_index: int
    file_id: Optional[str]
    start_block_index: int
    type: Literal["content_block_location"]
    class CitationsWebSearchResultLocation: …
    cited_text: str
    encrypted_index: str
    title: Optional[str]
    type: Literal["web_search_result_location"]
    url: str
    class CitationsSearchResultLocation: …
    cited_text: str
    end_block_index: int
    search_result_index: int
    source: str
    start_block_index: int
    title: Optional[str]
    type: Literal["search_result_location"]
    type: Literal["citations_delta"]
    class CitationsSearchResultLocation: …
    cited_text: str
    end_block_index: int
    search_result_index: int
    source: str
    start_block_index: int
    title: Optional[str]
    type: Literal["search_result_location"]
    class CitationsWebSearchResultLocation: …
    cited_text: str
    encrypted_index: str
    title: Optional[str]
    type: Literal["web_search_result_location"]
    url: str
    class CodeExecutionOutputBlock: …
    file_id: str
    type: Literal["code_execution_output"]
    class CodeExecutionOutputBlockParam: …
    file_id: str
    type: Literal["code_execution_output"]
    class CodeExecutionResultBlock: …
    content: List[CodeExecutionOutputBlock]
    file_id: str
    type: Literal["code_execution_output"]
    return_code: int
    stderr: str
    stdout: str
    type: Literal["code_execution_result"]
    class CodeExecutionResultBlockParam: …
    content: List[CodeExecutionOutputBlockParam]
    file_id: str
    type: Literal["code_execution_output"]
    return_code: int
    stderr: str
    stdout: str
    type: Literal["code_execution_result"]
    class CodeExecutionTool20250522: …
    name: Literal["code_execution"]

    Name of the tool.

    This is how the tool will be called by the model and in tool_use blocks.

    type: Literal["code_execution_20250522"]
    allowed_callers: Optional[List[Literal["direct", "code_execution_20250825", "code_execution_20260120"]]]
    Accepts one of the following:
    "direct"
    "code_execution_20250825"
    "code_execution_20260120"
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    defer_loading: Optional[bool]

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    strict: Optional[bool]

    When true, guarantees schema validation on tool names and inputs

    class CodeExecutionTool20250825: …
    name: Literal["code_execution"]

    Name of the tool.

    This is how the tool will be called by the model and in tool_use blocks.

    type: Literal["code_execution_20250825"]
    allowed_callers: Optional[List[Literal["direct", "code_execution_20250825", "code_execution_20260120"]]]
    Accepts one of the following:
    "direct"
    "code_execution_20250825"
    "code_execution_20260120"
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    defer_loading: Optional[bool]

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    strict: Optional[bool]

    When true, guarantees schema validation on tool names and inputs

    class CodeExecutionTool20260120: …

    Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).

    name: Literal["code_execution"]

    Name of the tool.

    This is how the tool will be called by the model and in tool_use blocks.

    type: Literal["code_execution_20260120"]
    allowed_callers: Optional[List[Literal["direct", "code_execution_20250825", "code_execution_20260120"]]]
    Accepts one of the following:
    "direct"
    "code_execution_20250825"
    "code_execution_20260120"
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    defer_loading: Optional[bool]

    If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

    strict: Optional[bool]

    When true, guarantees schema validation on tool names and inputs

    class CodeExecutionToolResultBlock: …
    content: CodeExecutionToolResultBlockContent

    Code execution result with encrypted stdout for PFC + web_search results.

    Accepts one of the following:
    class CodeExecutionToolResultError: …
    error_code: CodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    type: Literal["code_execution_tool_result_error"]
    class CodeExecutionResultBlock: …
    content: List[CodeExecutionOutputBlock]
    file_id: str
    type: Literal["code_execution_output"]
    return_code: int
    stderr: str
    stdout: str
    type: Literal["code_execution_result"]
    class EncryptedCodeExecutionResultBlock: …

    Code execution result with encrypted stdout for PFC + web_search results.

    content: List[CodeExecutionOutputBlock]
    file_id: str
    type: Literal["code_execution_output"]
    encrypted_stdout: str
    return_code: int
    stderr: str
    type: Literal["encrypted_code_execution_result"]
    tool_use_id: str
    type: Literal["code_execution_tool_result"]
    CodeExecutionToolResultBlockContent

    Code execution result with encrypted stdout for PFC + web_search results.

    Accepts one of the following:
    class CodeExecutionToolResultError: …
    error_code: CodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    type: Literal["code_execution_tool_result_error"]
    class CodeExecutionResultBlock: …
    content: List[CodeExecutionOutputBlock]
    file_id: str
    type: Literal["code_execution_output"]
    return_code: int
    stderr: str
    stdout: str
    type: Literal["code_execution_result"]
    class EncryptedCodeExecutionResultBlock: …

    Code execution result with encrypted stdout for PFC + web_search results.

    content: List[CodeExecutionOutputBlock]
    file_id: str
    type: Literal["code_execution_output"]
    encrypted_stdout: str
    return_code: int
    stderr: str
    type: Literal["encrypted_code_execution_result"]
    class CodeExecutionToolResultBlockParam: …
    content: CodeExecutionToolResultBlockParamContent

    Code execution result with encrypted stdout for PFC + web_search results.

    Accepts one of the following:
    class CodeExecutionToolResultErrorParam: …
    error_code: CodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    type: Literal["code_execution_tool_result_error"]
    class CodeExecutionResultBlockParam: …
    content: List[CodeExecutionOutputBlockParam]
    file_id: str
    type: Literal["code_execution_output"]
    return_code: int
    stderr: str
    stdout: str
    type: Literal["code_execution_result"]
    class EncryptedCodeExecutionResultBlockParam: …

    Code execution result with encrypted stdout for PFC + web_search results.

    content: List[CodeExecutionOutputBlockParam]
    file_id: str
    type: Literal["code_execution_output"]
    encrypted_stdout: str
    return_code: int
    stderr: str
    type: Literal["encrypted_code_execution_result"]
    tool_use_id: str
    type: Literal["code_execution_tool_result"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    CodeExecutionToolResultBlockParamContent

    Code execution result with encrypted stdout for PFC + web_search results.

    Accepts one of the following:
    class CodeExecutionToolResultErrorParam: …
    error_code: CodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    type: Literal["code_execution_tool_result_error"]
    class CodeExecutionResultBlockParam: …
    content: List[CodeExecutionOutputBlockParam]
    file_id: str
    type: Literal["code_execution_output"]
    return_code: int
    stderr: str
    stdout: str
    type: Literal["code_execution_result"]
    class EncryptedCodeExecutionResultBlockParam: …

    Code execution result with encrypted stdout for PFC + web_search results.

    content: List[CodeExecutionOutputBlockParam]
    file_id: str
    type: Literal["code_execution_output"]
    encrypted_stdout: str
    return_code: int
    stderr: str
    type: Literal["encrypted_code_execution_result"]
    class CodeExecutionToolResultError: …
    error_code: CodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    type: Literal["code_execution_tool_result_error"]
    Literal["invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded"]
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    class CodeExecutionToolResultErrorParam: …
    error_code: CodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    type: Literal["code_execution_tool_result_error"]
    class Container: …

    Information about the container used in the request (for the code execution tool)

    id: str

    Identifier for the container used in this request

    expires_at: datetime

    The time at which the container will expire.

    class ContainerUploadBlock: …

    Response model for a file uploaded to the container.

    file_id: str
    type: Literal["container_upload"]
    class ContainerUploadBlockParam: …

    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.

    file_id: str
    type: Literal["container_upload"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    ContentBlock

    Response model for a file uploaded to the container.

    Accepts one of the following:
    class TextBlock: …
    citations: Optional[List[TextCitation]]

    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.

    Accepts one of the following:
    class CitationCharLocation: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_char_index: int
    file_id: Optional[str]
    start_char_index: int
    type: Literal["char_location"]
    class CitationPageLocation: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_page_number: int
    file_id: Optional[str]
    start_page_number: int
    type: Literal["page_location"]
    class CitationContentBlockLocation: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_block_index: int
    file_id: Optional[str]
    start_block_index: int
    type: Literal["content_block_location"]
    class CitationsWebSearchResultLocation: …
    cited_text: str
    encrypted_index: str
    title: Optional[str]
    type: Literal["web_search_result_location"]
    url: str
    class CitationsSearchResultLocation: …
    cited_text: str
    end_block_index: int
    search_result_index: int
    source: str
    start_block_index: int
    title: Optional[str]
    type: Literal["search_result_location"]
    text: str
    type: Literal["text"]
    class ThinkingBlock: …
    signature: str
    thinking: str
    type: Literal["thinking"]
    class RedactedThinkingBlock: …
    data: str
    type: Literal["redacted_thinking"]
    class ToolUseBlock: …
    id: str
    caller: Caller

    Tool invocation directly from the model.

    Accepts one of the following:
    class DirectCaller: …

    Tool invocation directly from the model.

    type: Literal["direct"]
    class ServerToolCaller: …

    Tool invocation generated by a server-side tool.

    tool_id: str
    type: Literal["code_execution_20250825"]
    class ServerToolCaller20260120: …
    tool_id: str
    type: Literal["code_execution_20260120"]
    input: Dict[str, object]
    name: str
    type: Literal["tool_use"]
    class ServerToolUseBlock: …
    id: str
    caller: Caller

    Tool invocation directly from the model.

    Accepts one of the following:
    class DirectCaller: …

    Tool invocation directly from the model.

    type: Literal["direct"]
    class ServerToolCaller: …

    Tool invocation generated by a server-side tool.

    tool_id: str
    type: Literal["code_execution_20250825"]
    class ServerToolCaller20260120: …
    tool_id: str
    type: Literal["code_execution_20260120"]
    input: Dict[str, object]
    name: Literal["web_search", "web_fetch", "code_execution", 4 more]
    Accepts one of the following:
    "web_search"
    "web_fetch"
    "code_execution"
    "bash_code_execution"
    "text_editor_code_execution"
    "tool_search_tool_regex"
    "tool_search_tool_bm25"
    type: Literal["server_tool_use"]
    class WebSearchToolResultBlock: …
    caller: Caller

    Tool invocation directly from the model.

    Accepts one of the following:
    class DirectCaller: …

    Tool invocation directly from the model.

    type: Literal["direct"]
    class ServerToolCaller: …

    Tool invocation generated by a server-side tool.

    tool_id: str
    type: Literal["code_execution_20250825"]
    class ServerToolCaller20260120: …
    tool_id: str
    type: Literal["code_execution_20260120"]
    content: WebSearchToolResultBlockContent
    Accepts one of the following:
    class WebSearchToolResultError: …
    error_code: WebSearchToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "max_uses_exceeded"
    "too_many_requests"
    "query_too_long"
    "request_too_large"
    type: Literal["web_search_tool_result_error"]
    List[WebSearchResultBlock]
    encrypted_content: str
    page_age: Optional[str]
    title: str
    type: Literal["web_search_result"]
    url: str
    tool_use_id: str
    type: Literal["web_search_tool_result"]
    class WebFetchToolResultBlock: …
    caller: Caller

    Tool invocation directly from the model.

    Accepts one of the following:
    class DirectCaller: …

    Tool invocation directly from the model.

    type: Literal["direct"]
    class ServerToolCaller: …

    Tool invocation generated by a server-side tool.

    tool_id: str
    type: Literal["code_execution_20250825"]
    class ServerToolCaller20260120: …
    tool_id: str
    type: Literal["code_execution_20260120"]
    content: Content
    Accepts one of the following:
    class WebFetchToolResultErrorBlock: …
    error_code: WebFetchToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "url_too_long"
    "url_not_allowed"
    "url_not_accessible"
    "unsupported_content_type"
    "too_many_requests"
    "max_uses_exceeded"
    "unavailable"
    type: Literal["web_fetch_tool_result_error"]
    class WebFetchBlock: …
    content: DocumentBlock
    citations: Optional[CitationsConfig]

    Citation configuration for the document

    enabled: bool
    source: Source
    Accepts one of the following:
    class Base64PDFSource: …
    data: str
    media_type: Literal["application/pdf"]
    type: Literal["base64"]
    class PlainTextSource: …
    data: str
    media_type: Literal["text/plain"]
    type: Literal["text"]
    title: Optional[str]

    The title of the document

    type: Literal["document"]
    retrieved_at: Optional[str]

    ISO 8601 timestamp when the content was retrieved

    type: Literal["web_fetch_result"]
    url: str

    Fetched content URL

    tool_use_id: str
    type: Literal["web_fetch_tool_result"]
    class CodeExecutionToolResultBlock: …
    content: CodeExecutionToolResultBlockContent

    Code execution result with encrypted stdout for PFC + web_search results.

    Accepts one of the following:
    class CodeExecutionToolResultError: …
    error_code: CodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    type: Literal["code_execution_tool_result_error"]
    class CodeExecutionResultBlock: …
    content: List[CodeExecutionOutputBlock]
    file_id: str
    type: Literal["code_execution_output"]
    return_code: int
    stderr: str
    stdout: str
    type: Literal["code_execution_result"]
    class EncryptedCodeExecutionResultBlock: …

    Code execution result with encrypted stdout for PFC + web_search results.

    content: List[CodeExecutionOutputBlock]
    file_id: str
    type: Literal["code_execution_output"]
    encrypted_stdout: str
    return_code: int
    stderr: str
    type: Literal["encrypted_code_execution_result"]
    tool_use_id: str
    type: Literal["code_execution_tool_result"]
    class BashCodeExecutionToolResultBlock: …
    content: Content
    Accepts one of the following:
    class BashCodeExecutionToolResultError: …
    error_code: BashCodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    "output_file_too_large"
    type: Literal["bash_code_execution_tool_result_error"]
    class BashCodeExecutionResultBlock: …
    content: List[BashCodeExecutionOutputBlock]
    file_id: str
    type: Literal["bash_code_execution_output"]
    return_code: int
    stderr: str
    stdout: str
    type: Literal["bash_code_execution_result"]
    tool_use_id: str
    type: Literal["bash_code_execution_tool_result"]
    class TextEditorCodeExecutionToolResultBlock: …
    content: Content
    Accepts one of the following:
    class TextEditorCodeExecutionToolResultError: …
    error_code: TextEditorCodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    "file_not_found"
    error_message: Optional[str]
    type: Literal["text_editor_code_execution_tool_result_error"]
    class TextEditorCodeExecutionViewResultBlock: …
    content: str
    file_type: Literal["text", "image", "pdf"]
    Accepts one of the following:
    "text"
    "image"
    "pdf"
    num_lines: Optional[int]
    start_line: Optional[int]
    total_lines: Optional[int]
    type: Literal["text_editor_code_execution_view_result"]
    class TextEditorCodeExecutionCreateResultBlock: …
    is_file_update: bool
    type: Literal["text_editor_code_execution_create_result"]
    class TextEditorCodeExecutionStrReplaceResultBlock: …
    lines: Optional[List[str]]
    new_lines: Optional[int]
    new_start: Optional[int]
    old_lines: Optional[int]
    old_start: Optional[int]
    type: Literal["text_editor_code_execution_str_replace_result"]
    tool_use_id: str
    type: Literal["text_editor_code_execution_tool_result"]
    class ToolSearchToolResultBlock: …
    content: Content
    Accepts one of the following:
    class ToolSearchToolResultError: …
    error_code: ToolSearchToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    error_message: Optional[str]
    type: Literal["tool_search_tool_result_error"]
    class ToolSearchToolSearchResultBlock: …
    tool_references: List[ToolReferenceBlock]
    tool_name: str
    type: Literal["tool_reference"]
    type: Literal["tool_search_tool_search_result"]
    tool_use_id: str
    type: Literal["tool_search_tool_result"]
    class ContainerUploadBlock: …

    Response model for a file uploaded to the container.

    file_id: str
    type: Literal["container_upload"]
    Union[TextBlockParam, ImageBlockParam, DocumentBlockParam, 13 more]

    Regular text content.

    Accepts one of the following:
    class TextBlockParam: …
    text: str
    type: Literal["text"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    citations: Optional[List[TextCitationParam]]
    Accepts one of the following:
    class CitationCharLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_char_index: int
    start_char_index: int
    type: Literal["char_location"]
    class CitationPageLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_page_number: int
    start_page_number: int
    type: Literal["page_location"]
    class CitationContentBlockLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_block_index: int
    start_block_index: int
    type: Literal["content_block_location"]
    class CitationWebSearchResultLocationParam: …
    cited_text: str
    encrypted_index: str
    title: Optional[str]
    type: Literal["web_search_result_location"]
    url: str
    class CitationSearchResultLocationParam: …
    cited_text: str
    end_block_index: int
    search_result_index: int
    source: str
    start_block_index: int
    title: Optional[str]
    type: Literal["search_result_location"]
    class ImageBlockParam: …
    source: Source
    Accepts one of the following:
    class Base64ImageSource: …
    data: str
    media_type: Literal["image/jpeg", "image/png", "image/gif", "image/webp"]
    Accepts one of the following:
    "image/jpeg"
    "image/png"
    "image/gif"
    "image/webp"
    type: Literal["base64"]
    class URLImageSource: …
    type: Literal["url"]
    url: str
    type: Literal["image"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    class DocumentBlockParam: …
    source: Source
    Accepts one of the following:
    class Base64PDFSource: …
    data: str
    media_type: Literal["application/pdf"]
    type: Literal["base64"]
    class PlainTextSource: …
    data: str
    media_type: Literal["text/plain"]
    type: Literal["text"]
    class ContentBlockSource: …
    content: Union[str, List[ContentBlockSourceContent]]
    Accepts one of the following:
    str
    List[ContentBlockSourceContent]
    Accepts one of the following:
    class TextBlockParam: …
    text: str
    type: Literal["text"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    citations: Optional[List[TextCitationParam]]
    Accepts one of the following:
    class CitationCharLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_char_index: int
    start_char_index: int
    type: Literal["char_location"]
    class CitationPageLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_page_number: int
    start_page_number: int
    type: Literal["page_location"]
    class CitationContentBlockLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_block_index: int
    start_block_index: int
    type: Literal["content_block_location"]
    class CitationWebSearchResultLocationParam: …
    cited_text: str
    encrypted_index: str
    title: Optional[str]
    type: Literal["web_search_result_location"]
    url: str
    class CitationSearchResultLocationParam: …
    cited_text: str
    end_block_index: int
    search_result_index: int
    source: str
    start_block_index: int
    title: Optional[str]
    type: Literal["search_result_location"]
    class ImageBlockParam: …
    source: Source
    Accepts one of the following:
    class Base64ImageSource: …
    data: str
    media_type: Literal["image/jpeg", "image/png", "image/gif", "image/webp"]
    Accepts one of the following:
    "image/jpeg"
    "image/png"
    "image/gif"
    "image/webp"
    type: Literal["base64"]
    class URLImageSource: …
    type: Literal["url"]
    url: str
    type: Literal["image"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    type: Literal["content"]
    class URLPDFSource: …
    type: Literal["url"]
    url: str
    type: Literal["document"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    citations: Optional[CitationsConfigParam]
    enabled: Optional[bool]
    context: Optional[str]
    title: Optional[str]
    class SearchResultBlockParam: …
    content: List[TextBlockParam]
    text: str
    type: Literal["text"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    citations: Optional[List[TextCitationParam]]
    Accepts one of the following:
    class CitationCharLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_char_index: int
    start_char_index: int
    type: Literal["char_location"]
    class CitationPageLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_page_number: int
    start_page_number: int
    type: Literal["page_location"]
    class CitationContentBlockLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_block_index: int
    start_block_index: int
    type: Literal["content_block_location"]
    class CitationWebSearchResultLocationParam: …
    cited_text: str
    encrypted_index: str
    title: Optional[str]
    type: Literal["web_search_result_location"]
    url: str
    class CitationSearchResultLocationParam: …
    cited_text: str
    end_block_index: int
    search_result_index: int
    source: str
    start_block_index: int
    title: Optional[str]
    type: Literal["search_result_location"]
    source: str
    title: str
    type: Literal["search_result"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    citations: Optional[CitationsConfigParam]
    enabled: Optional[bool]
    class ThinkingBlockParam: …
    signature: str
    thinking: str
    type: Literal["thinking"]
    class RedactedThinkingBlockParam: …
    data: str
    type: Literal["redacted_thinking"]
    class ToolUseBlockParam: …
    id: str
    input: Dict[str, object]
    name: str
    type: Literal["tool_use"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    caller: Optional[Caller]

    Tool invocation directly from the model.

    Accepts one of the following:
    class DirectCaller: …

    Tool invocation directly from the model.

    type: Literal["direct"]
    class ServerToolCaller: …

    Tool invocation generated by a server-side tool.

    tool_id: str
    type: Literal["code_execution_20250825"]
    class ServerToolCaller20260120: …
    tool_id: str
    type: Literal["code_execution_20260120"]
    class ToolResultBlockParam: …
    tool_use_id: str
    type: Literal["tool_result"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    content: Optional[Union[str, List[Content], null]]
    Accepts one of the following:
    str
    List[Content]
    Accepts one of the following:
    class TextBlockParam: …
    text: str
    type: Literal["text"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    citations: Optional[List[TextCitationParam]]
    Accepts one of the following:
    class CitationCharLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_char_index: int
    start_char_index: int
    type: Literal["char_location"]
    class CitationPageLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_page_number: int
    start_page_number: int
    type: Literal["page_location"]
    class CitationContentBlockLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_block_index: int
    start_block_index: int
    type: Literal["content_block_location"]
    class CitationWebSearchResultLocationParam: …
    cited_text: str
    encrypted_index: str
    title: Optional[str]
    type: Literal["web_search_result_location"]
    url: str
    class CitationSearchResultLocationParam: …
    cited_text: str
    end_block_index: int
    search_result_index: int
    source: str
    start_block_index: int
    title: Optional[str]
    type: Literal["search_result_location"]
    class ImageBlockParam: …
    source: Source
    Accepts one of the following:
    class Base64ImageSource: …
    data: str
    media_type: Literal["image/jpeg", "image/png", "image/gif", "image/webp"]
    Accepts one of the following:
    "image/jpeg"
    "image/png"
    "image/gif"
    "image/webp"
    type: Literal["base64"]
    class URLImageSource: …
    type: Literal["url"]
    url: str
    type: Literal["image"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    class SearchResultBlockParam: …
    content: List[TextBlockParam]
    text: str
    type: Literal["text"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    citations: Optional[List[TextCitationParam]]
    Accepts one of the following:
    class CitationCharLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_char_index: int
    start_char_index: int
    type: Literal["char_location"]
    class CitationPageLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_page_number: int
    start_page_number: int
    type: Literal["page_location"]
    class CitationContentBlockLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_block_index: int
    start_block_index: int
    type: Literal["content_block_location"]
    class CitationWebSearchResultLocationParam: …
    cited_text: str
    encrypted_index: str
    title: Optional[str]
    type: Literal["web_search_result_location"]
    url: str
    class CitationSearchResultLocationParam: …
    cited_text: str
    end_block_index: int
    search_result_index: int
    source: str
    start_block_index: int
    title: Optional[str]
    type: Literal["search_result_location"]
    source: str
    title: str
    type: Literal["search_result"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    citations: Optional[CitationsConfigParam]
    enabled: Optional[bool]
    class DocumentBlockParam: …
    source: Source
    Accepts one of the following:
    class Base64PDFSource: …
    data: str
    media_type: Literal["application/pdf"]
    type: Literal["base64"]
    class PlainTextSource: …
    data: str
    media_type: Literal["text/plain"]
    type: Literal["text"]
    class ContentBlockSource: …
    content: Union[str, List[ContentBlockSourceContent]]
    Accepts one of the following:
    str
    List[ContentBlockSourceContent]
    Accepts one of the following:
    class TextBlockParam: …
    text: str
    type: Literal["text"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    citations: Optional[List[TextCitationParam]]
    Accepts one of the following:
    class CitationCharLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_char_index: int
    start_char_index: int
    type: Literal["char_location"]
    class CitationPageLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_page_number: int
    start_page_number: int
    type: Literal["page_location"]
    class CitationContentBlockLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_block_index: int
    start_block_index: int
    type: Literal["content_block_location"]
    class CitationWebSearchResultLocationParam: …
    cited_text: str
    encrypted_index: str
    title: Optional[str]
    type: Literal["web_search_result_location"]
    url: str
    class CitationSearchResultLocationParam: …
    cited_text: str
    end_block_index: int
    search_result_index: int
    source: str
    start_block_index: int
    title: Optional[str]
    type: Literal["search_result_location"]
    class ImageBlockParam: …
    source: Source
    Accepts one of the following:
    class Base64ImageSource: …
    data: str
    media_type: Literal["image/jpeg", "image/png", "image/gif", "image/webp"]
    Accepts one of the following:
    "image/jpeg"
    "image/png"
    "image/gif"
    "image/webp"
    type: Literal["base64"]
    class URLImageSource: …
    type: Literal["url"]
    url: str
    type: Literal["image"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    type: Literal["content"]
    class URLPDFSource: …
    type: Literal["url"]
    url: str
    type: Literal["document"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    citations: Optional[CitationsConfigParam]
    enabled: Optional[bool]
    context: Optional[str]
    title: Optional[str]
    class ToolReferenceBlockParam: …

    Tool reference block that can be included in tool_result content.

    tool_name: str
    type: Literal["tool_reference"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    is_error: Optional[bool]
    class ServerToolUseBlockParam: …
    id: str
    input: Dict[str, object]
    name: Literal["web_search", "web_fetch", "code_execution", 4 more]
    Accepts one of the following:
    "web_search"
    "web_fetch"
    "code_execution"
    "bash_code_execution"
    "text_editor_code_execution"
    "tool_search_tool_regex"
    "tool_search_tool_bm25"
    type: Literal["server_tool_use"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    caller: Optional[Caller]

    Tool invocation directly from the model.

    Accepts one of the following:
    class DirectCaller: …

    Tool invocation directly from the model.

    type: Literal["direct"]
    class ServerToolCaller: …

    Tool invocation generated by a server-side tool.

    tool_id: str
    type: Literal["code_execution_20250825"]
    class ServerToolCaller20260120: …
    tool_id: str
    type: Literal["code_execution_20260120"]
    class WebSearchToolResultBlockParam: …
    content: WebSearchToolResultBlockParamContent
    Accepts one of the following:
    List[WebSearchResultBlockParam]
    encrypted_content: str
    title: str
    type: Literal["web_search_result"]
    url: str
    page_age: Optional[str]
    class WebSearchToolRequestError: …
    error_code: WebSearchToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "max_uses_exceeded"
    "too_many_requests"
    "query_too_long"
    "request_too_large"
    type: Literal["web_search_tool_result_error"]
    tool_use_id: str
    type: Literal["web_search_tool_result"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    caller: Optional[Caller]

    Tool invocation directly from the model.

    Accepts one of the following:
    class DirectCaller: …

    Tool invocation directly from the model.

    type: Literal["direct"]
    class ServerToolCaller: …

    Tool invocation generated by a server-side tool.

    tool_id: str
    type: Literal["code_execution_20250825"]
    class ServerToolCaller20260120: …
    tool_id: str
    type: Literal["code_execution_20260120"]
    class WebFetchToolResultBlockParam: …
    content: Content
    Accepts one of the following:
    class WebFetchToolResultErrorBlockParam: …
    error_code: WebFetchToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "url_too_long"
    "url_not_allowed"
    "url_not_accessible"
    "unsupported_content_type"
    "too_many_requests"
    "max_uses_exceeded"
    "unavailable"
    type: Literal["web_fetch_tool_result_error"]
    class WebFetchBlockParam: …
    content: DocumentBlockParam
    source: Source
    Accepts one of the following:
    class Base64PDFSource: …
    data: str
    media_type: Literal["application/pdf"]
    type: Literal["base64"]
    class PlainTextSource: …
    data: str
    media_type: Literal["text/plain"]
    type: Literal["text"]
    class ContentBlockSource: …
    content: Union[str, List[ContentBlockSourceContent]]
    Accepts one of the following:
    str
    List[ContentBlockSourceContent]
    Accepts one of the following:
    class TextBlockParam: …
    text: str
    type: Literal["text"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    citations: Optional[List[TextCitationParam]]
    Accepts one of the following:
    class CitationCharLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_char_index: int
    start_char_index: int
    type: Literal["char_location"]
    class CitationPageLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_page_number: int
    start_page_number: int
    type: Literal["page_location"]
    class CitationContentBlockLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_block_index: int
    start_block_index: int
    type: Literal["content_block_location"]
    class CitationWebSearchResultLocationParam: …
    cited_text: str
    encrypted_index: str
    title: Optional[str]
    type: Literal["web_search_result_location"]
    url: str
    class CitationSearchResultLocationParam: …
    cited_text: str
    end_block_index: int
    search_result_index: int
    source: str
    start_block_index: int
    title: Optional[str]
    type: Literal["search_result_location"]
    class ImageBlockParam: …
    source: Source
    Accepts one of the following:
    class Base64ImageSource: …
    data: str
    media_type: Literal["image/jpeg", "image/png", "image/gif", "image/webp"]
    Accepts one of the following:
    "image/jpeg"
    "image/png"
    "image/gif"
    "image/webp"
    type: Literal["base64"]
    class URLImageSource: …
    type: Literal["url"]
    url: str
    type: Literal["image"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    type: Literal["content"]
    class URLPDFSource: …
    type: Literal["url"]
    url: str
    type: Literal["document"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    citations: Optional[CitationsConfigParam]
    enabled: Optional[bool]
    context: Optional[str]
    title: Optional[str]
    type: Literal["web_fetch_result"]
    url: str

    Fetched content URL

    retrieved_at: Optional[str]

    ISO 8601 timestamp when the content was retrieved

    tool_use_id: str
    type: Literal["web_fetch_tool_result"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    caller: Optional[Caller]

    Tool invocation directly from the model.

    Accepts one of the following:
    class DirectCaller: …

    Tool invocation directly from the model.

    type: Literal["direct"]
    class ServerToolCaller: …

    Tool invocation generated by a server-side tool.

    tool_id: str
    type: Literal["code_execution_20250825"]
    class ServerToolCaller20260120: …
    tool_id: str
    type: Literal["code_execution_20260120"]
    class CodeExecutionToolResultBlockParam: …
    content: CodeExecutionToolResultBlockParamContent

    Code execution result with encrypted stdout for PFC + web_search results.

    Accepts one of the following:
    class CodeExecutionToolResultErrorParam: …
    error_code: CodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    type: Literal["code_execution_tool_result_error"]
    class CodeExecutionResultBlockParam: …
    content: List[CodeExecutionOutputBlockParam]
    file_id: str
    type: Literal["code_execution_output"]
    return_code: int
    stderr: str
    stdout: str
    type: Literal["code_execution_result"]
    class EncryptedCodeExecutionResultBlockParam: …

    Code execution result with encrypted stdout for PFC + web_search results.

    content: List[CodeExecutionOutputBlockParam]
    file_id: str
    type: Literal["code_execution_output"]
    encrypted_stdout: str
    return_code: int
    stderr: str
    type: Literal["encrypted_code_execution_result"]
    tool_use_id: str
    type: Literal["code_execution_tool_result"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    class BashCodeExecutionToolResultBlockParam: …
    content: Content
    Accepts one of the following:
    class BashCodeExecutionToolResultErrorParam: …
    error_code: BashCodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    "output_file_too_large"
    type: Literal["bash_code_execution_tool_result_error"]
    class BashCodeExecutionResultBlockParam: …
    content: List[BashCodeExecutionOutputBlockParam]
    file_id: str
    type: Literal["bash_code_execution_output"]
    return_code: int
    stderr: str
    stdout: str
    type: Literal["bash_code_execution_result"]
    tool_use_id: str
    type: Literal["bash_code_execution_tool_result"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    class TextEditorCodeExecutionToolResultBlockParam: …
    content: Content
    Accepts one of the following:
    class TextEditorCodeExecutionToolResultErrorParam: …
    error_code: TextEditorCodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    "file_not_found"
    type: Literal["text_editor_code_execution_tool_result_error"]
    error_message: Optional[str]
    class TextEditorCodeExecutionViewResultBlockParam: …
    content: str
    file_type: Literal["text", "image", "pdf"]
    Accepts one of the following:
    "text"
    "image"
    "pdf"
    type: Literal["text_editor_code_execution_view_result"]
    num_lines: Optional[int]
    start_line: Optional[int]
    total_lines: Optional[int]
    class TextEditorCodeExecutionCreateResultBlockParam: …
    is_file_update: bool
    type: Literal["text_editor_code_execution_create_result"]
    class TextEditorCodeExecutionStrReplaceResultBlockParam: …
    type: Literal["text_editor_code_execution_str_replace_result"]
    lines: Optional[List[str]]
    new_lines: Optional[int]
    new_start: Optional[int]
    old_lines: Optional[int]
    old_start: Optional[int]
    tool_use_id: str
    type: Literal["text_editor_code_execution_tool_result"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    class ToolSearchToolResultBlockParam: …
    content: Content
    Accepts one of the following:
    class ToolSearchToolResultErrorParam: …
    error_code: ToolSearchToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    type: Literal["tool_search_tool_result_error"]
    class ToolSearchToolSearchResultBlockParam: …
    tool_references: List[ToolReferenceBlockParam]
    tool_name: str
    type: Literal["tool_reference"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    type: Literal["tool_search_tool_search_result"]
    tool_use_id: str
    type: Literal["tool_search_tool_result"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    class ContainerUploadBlockParam: …

    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.

    file_id: str
    type: Literal["container_upload"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    class ContentBlockSource: …
    content: Union[str, List[ContentBlockSourceContent]]
    Accepts one of the following:
    str
    List[ContentBlockSourceContent]
    Accepts one of the following:
    class TextBlockParam: …
    text: str
    type: Literal["text"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    citations: Optional[List[TextCitationParam]]
    Accepts one of the following:
    class CitationCharLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_char_index: int
    start_char_index: int
    type: Literal["char_location"]
    class CitationPageLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_page_number: int
    start_page_number: int
    type: Literal["page_location"]
    class CitationContentBlockLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_block_index: int
    start_block_index: int
    type: Literal["content_block_location"]
    class CitationWebSearchResultLocationParam: …
    cited_text: str
    encrypted_index: str
    title: Optional[str]
    type: Literal["web_search_result_location"]
    url: str
    class CitationSearchResultLocationParam: …
    cited_text: str
    end_block_index: int
    search_result_index: int
    source: str
    start_block_index: int
    title: Optional[str]
    type: Literal["search_result_location"]
    class ImageBlockParam: …
    source: Source
    Accepts one of the following:
    class Base64ImageSource: …
    data: str
    media_type: Literal["image/jpeg", "image/png", "image/gif", "image/webp"]
    Accepts one of the following:
    "image/jpeg"
    "image/png"
    "image/gif"
    "image/webp"
    type: Literal["base64"]
    class URLImageSource: …
    type: Literal["url"]
    url: str
    type: Literal["image"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    type: Literal["content"]
    ContentBlockSourceContent
    Accepts one of the following:
    class TextBlockParam: …
    text: str
    type: Literal["text"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    citations: Optional[List[TextCitationParam]]
    Accepts one of the following:
    class CitationCharLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_char_index: int
    start_char_index: int
    type: Literal["char_location"]
    class CitationPageLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_page_number: int
    start_page_number: int
    type: Literal["page_location"]
    class CitationContentBlockLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_block_index: int
    start_block_index: int
    type: Literal["content_block_location"]
    class CitationWebSearchResultLocationParam: …
    cited_text: str
    encrypted_index: str
    title: Optional[str]
    type: Literal["web_search_result_location"]
    url: str
    class CitationSearchResultLocationParam: …
    cited_text: str
    end_block_index: int
    search_result_index: int
    source: str
    start_block_index: int
    title: Optional[str]
    type: Literal["search_result_location"]
    class ImageBlockParam: …
    source: Source
    Accepts one of the following:
    class Base64ImageSource: …
    data: str
    media_type: Literal["image/jpeg", "image/png", "image/gif", "image/webp"]
    Accepts one of the following:
    "image/jpeg"
    "image/png"
    "image/gif"
    "image/webp"
    type: Literal["base64"]
    class URLImageSource: …
    type: Literal["url"]
    url: str
    type: Literal["image"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    class DirectCaller: …

    Tool invocation directly from the model.

    type: Literal["direct"]
    class DocumentBlock: …
    citations: Optional[CitationsConfig]

    Citation configuration for the document

    enabled: bool
    source: Source
    Accepts one of the following:
    class Base64PDFSource: …
    data: str
    media_type: Literal["application/pdf"]
    type: Literal["base64"]
    class PlainTextSource: …
    data: str
    media_type: Literal["text/plain"]
    type: Literal["text"]
    title: Optional[str]

    The title of the document

    type: Literal["document"]
    class DocumentBlockParam: …
    source: Source
    Accepts one of the following:
    class Base64PDFSource: …
    data: str
    media_type: Literal["application/pdf"]
    type: Literal["base64"]
    class PlainTextSource: …
    data: str
    media_type: Literal["text/plain"]
    type: Literal["text"]
    class ContentBlockSource: …
    content: Union[str, List[ContentBlockSourceContent]]
    Accepts one of the following:
    str
    List[ContentBlockSourceContent]
    Accepts one of the following:
    class TextBlockParam: …
    text: str
    type: Literal["text"]
    cache_control: Optional[CacheControlEphemeral]

    Create a cache control breakpoint at this content block.

    type: Literal["ephemeral"]
    ttl: Optional[Literal["5m", "1h"]]

    The time-to-live for the cache control breakpoint.

    This may be one the following values:

    • 5m: 5 minutes
    • 1h: 1 hour

    Defaults to 5m.

    Accepts one of the following:
    "5m"
    "1h"
    citations: Optional[List[TextCitationParam]]
    Accepts one of the following:
    class CitationCharLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_char_index: int
    start_char_index: int
    type: Literal["char_location"]
    class CitationPageLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_page_number: int
    start_page_number: int
    type: Literal["page_location"]
    class CitationContentBlockLocationParam: …
    cited_text: str
    document_index: int
    document_title: Optional[str]
    end_block_index: int
    start_block_index: int
    type: Literal["content_block_location"]
    class CitationWebSearchResultLocationParam: …
    cited_text: str
    encrypted_index: str
    title: Optional[str]
    type: Literal["web_search_result_location"]
    url: str
    class CitationSearchResultLocationParam: …
    cited_text: str
    end_block_index: int
    search_result_index: int