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
    POST/v1/messages
    Count tokens in a Message
    POST/v1/messages/count_tokens
    ModelsExpand Collapse
    Base64ImageSource = object { data, media_type, type }
    data: string
    media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"
    Accepts one of the following:
    "image/jpeg"
    "image/png"
    "image/gif"
    "image/webp"
    type: "base64"
    Base64PDFSource = object { data, media_type, type }
    data: string
    media_type: "application/pdf"
    type: "base64"
    BashCodeExecutionOutputBlock = object { file_id, type }
    file_id: string
    type: "bash_code_execution_output"
    BashCodeExecutionOutputBlockParam = object { file_id, type }
    file_id: string
    type: "bash_code_execution_output"
    BashCodeExecutionResultBlock = object { content, return_code, stderr, 2 more }
    content: array of BashCodeExecutionOutputBlock { file_id, type }
    file_id: string
    type: "bash_code_execution_output"
    return_code: number
    stderr: string
    stdout: string
    type: "bash_code_execution_result"
    BashCodeExecutionResultBlockParam = object { content, return_code, stderr, 2 more }
    content: array of BashCodeExecutionOutputBlockParam { file_id, type }
    file_id: string
    type: "bash_code_execution_output"
    return_code: number
    stderr: string
    stdout: string
    type: "bash_code_execution_result"
    BashCodeExecutionToolResultBlock = object { content, tool_use_id, type }
    content: BashCodeExecutionToolResultError { error_code, type } or BashCodeExecutionResultBlock { content, return_code, stderr, 2 more }
    Accepts one of the following:
    BashCodeExecutionToolResultError = object { error_code, type }
    error_code: BashCodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    "output_file_too_large"
    type: "bash_code_execution_tool_result_error"
    BashCodeExecutionResultBlock = object { content, return_code, stderr, 2 more }
    content: array of BashCodeExecutionOutputBlock { file_id, type }
    file_id: string
    type: "bash_code_execution_output"
    return_code: number
    stderr: string
    stdout: string
    type: "bash_code_execution_result"
    tool_use_id: string
    type: "bash_code_execution_tool_result"
    BashCodeExecutionToolResultBlockParam = object { content, tool_use_id, type, cache_control }
    content: BashCodeExecutionToolResultErrorParam { error_code, type } or BashCodeExecutionResultBlockParam { content, return_code, stderr, 2 more }
    Accepts one of the following:
    BashCodeExecutionToolResultErrorParam = object { error_code, type }
    error_code: BashCodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    "output_file_too_large"
    type: "bash_code_execution_tool_result_error"
    BashCodeExecutionResultBlockParam = object { content, return_code, stderr, 2 more }
    content: array of BashCodeExecutionOutputBlockParam { file_id, type }
    file_id: string
    type: "bash_code_execution_output"
    return_code: number
    stderr: string
    stdout: string
    type: "bash_code_execution_result"
    tool_use_id: string
    type: "bash_code_execution_tool_result"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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"
    BashCodeExecutionToolResultError = object { error_code, type }
    error_code: BashCodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    "output_file_too_large"
    type: "bash_code_execution_tool_result_error"
    BashCodeExecutionToolResultErrorCode = "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    "output_file_too_large"
    BashCodeExecutionToolResultErrorParam = object { error_code, type }
    error_code: BashCodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    "output_file_too_large"
    type: "bash_code_execution_tool_result_error"
    CacheControlEphemeral = object { type, ttl }
    type: "ephemeral"
    ttl: optional "5m" or "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"
    CacheCreation = object { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }
    ephemeral_1h_input_tokens: number

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

    ephemeral_5m_input_tokens: number

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

    CitationCharLocation = object { cited_text, document_index, document_title, 4 more }
    cited_text: string
    document_index: number
    document_title: string
    end_char_index: number
    file_id: string
    start_char_index: number
    type: "char_location"
    CitationCharLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_char_index: number
    start_char_index: number
    type: "char_location"
    CitationContentBlockLocation = object { cited_text, document_index, document_title, 4 more }
    cited_text: string
    document_index: number
    document_title: string
    end_block_index: number
    file_id: string
    start_block_index: number
    type: "content_block_location"
    CitationContentBlockLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_block_index: number
    start_block_index: number
    type: "content_block_location"
    CitationPageLocation = object { cited_text, document_index, document_title, 4 more }
    cited_text: string
    document_index: number
    document_title: string
    end_page_number: number
    file_id: string
    start_page_number: number
    type: "page_location"
    CitationPageLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_page_number: number
    start_page_number: number
    type: "page_location"
    CitationSearchResultLocationParam = object { cited_text, end_block_index, search_result_index, 4 more }
    cited_text: string
    end_block_index: number
    search_result_index: number
    source: string
    start_block_index: number
    title: string
    type: "search_result_location"
    CitationWebSearchResultLocationParam = object { cited_text, encrypted_index, title, 2 more }
    cited_text: string
    encrypted_index: string
    title: string
    type: "web_search_result_location"
    url: string
    CitationsConfig = object { enabled }
    enabled: boolean
    CitationsConfigParam = object { enabled }
    enabled: optional boolean
    CitationsDelta = object { citation, type }
    citation: CitationCharLocation { cited_text, document_index, document_title, 4 more } or CitationPageLocation { cited_text, document_index, document_title, 4 more } or CitationContentBlockLocation { cited_text, document_index, document_title, 4 more } or 2 more
    Accepts one of the following:
    CitationCharLocation = object { cited_text, document_index, document_title, 4 more }
    cited_text: string
    document_index: number
    document_title: string
    end_char_index: number
    file_id: string
    start_char_index: number
    type: "char_location"
    CitationPageLocation = object { cited_text, document_index, document_title, 4 more }
    cited_text: string
    document_index: number
    document_title: string
    end_page_number: number
    file_id: string
    start_page_number: number
    type: "page_location"
    CitationContentBlockLocation = object { cited_text, document_index, document_title, 4 more }
    cited_text: string
    document_index: number
    document_title: string
    end_block_index: number
    file_id: string
    start_block_index: number
    type: "content_block_location"
    CitationsWebSearchResultLocation = object { cited_text, encrypted_index, title, 2 more }
    cited_text: string
    encrypted_index: string
    title: string
    type: "web_search_result_location"
    url: string
    CitationsSearchResultLocation = object { cited_text, end_block_index, search_result_index, 4 more }
    cited_text: string
    end_block_index: number
    search_result_index: number
    source: string
    start_block_index: number
    title: string
    type: "search_result_location"
    type: "citations_delta"
    CitationsSearchResultLocation = object { cited_text, end_block_index, search_result_index, 4 more }
    cited_text: string
    end_block_index: number
    search_result_index: number
    source: string
    start_block_index: number
    title: string
    type: "search_result_location"
    CitationsWebSearchResultLocation = object { cited_text, encrypted_index, title, 2 more }
    cited_text: string
    encrypted_index: string
    title: string
    type: "web_search_result_location"
    url: string
    CodeExecutionOutputBlock = object { file_id, type }
    file_id: string
    type: "code_execution_output"
    CodeExecutionOutputBlockParam = object { file_id, type }
    file_id: string
    type: "code_execution_output"
    CodeExecutionResultBlock = object { content, return_code, stderr, 2 more }
    content: array of CodeExecutionOutputBlock { file_id, type }
    file_id: string
    type: "code_execution_output"
    return_code: number
    stderr: string
    stdout: string
    type: "code_execution_result"
    CodeExecutionResultBlockParam = object { content, return_code, stderr, 2 more }
    content: array of CodeExecutionOutputBlockParam { file_id, type }
    file_id: string
    type: "code_execution_output"
    return_code: number
    stderr: string
    stdout: string
    type: "code_execution_result"
    CodeExecutionTool20250522 = object { name, type, allowed_callers, 3 more }
    name: "code_execution"

    Name of the tool.

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

    type: "code_execution_20250522"
    allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"
    Accepts one of the following:
    "direct"
    "code_execution_20250825"
    "code_execution_20260120"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 boolean

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

    strict: optional boolean

    When true, guarantees schema validation on tool names and inputs

    CodeExecutionTool20250825 = object { name, type, allowed_callers, 3 more }
    name: "code_execution"

    Name of the tool.

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

    type: "code_execution_20250825"
    allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"
    Accepts one of the following:
    "direct"
    "code_execution_20250825"
    "code_execution_20260120"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 boolean

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

    strict: optional boolean

    When true, guarantees schema validation on tool names and inputs

    CodeExecutionTool20260120 = object { name, type, allowed_callers, 3 more }

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

    name: "code_execution"

    Name of the tool.

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

    type: "code_execution_20260120"
    allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120"
    Accepts one of the following:
    "direct"
    "code_execution_20250825"
    "code_execution_20260120"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 boolean

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

    strict: optional boolean

    When true, guarantees schema validation on tool names and inputs

    CodeExecutionToolResultBlock = object { content, tool_use_id, type }
    content: CodeExecutionToolResultBlockContent

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

    Accepts one of the following:
    CodeExecutionToolResultError = object { error_code, type }
    error_code: CodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    type: "code_execution_tool_result_error"
    CodeExecutionResultBlock = object { content, return_code, stderr, 2 more }
    content: array of CodeExecutionOutputBlock { file_id, type }
    file_id: string
    type: "code_execution_output"
    return_code: number
    stderr: string
    stdout: string
    type: "code_execution_result"
    EncryptedCodeExecutionResultBlock = object { content, encrypted_stdout, return_code, 2 more }

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

    content: array of CodeExecutionOutputBlock { file_id, type }
    file_id: string
    type: "code_execution_output"
    encrypted_stdout: string
    return_code: number
    stderr: string
    type: "encrypted_code_execution_result"
    tool_use_id: string
    type: "code_execution_tool_result"
    CodeExecutionToolResultBlockContent = CodeExecutionToolResultError { error_code, type } or CodeExecutionResultBlock { content, return_code, stderr, 2 more } or EncryptedCodeExecutionResultBlock { content, encrypted_stdout, return_code, 2 more }

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

    Accepts one of the following:
    CodeExecutionToolResultError = object { error_code, type }
    error_code: CodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    type: "code_execution_tool_result_error"
    CodeExecutionResultBlock = object { content, return_code, stderr, 2 more }
    content: array of CodeExecutionOutputBlock { file_id, type }
    file_id: string
    type: "code_execution_output"
    return_code: number
    stderr: string
    stdout: string
    type: "code_execution_result"
    EncryptedCodeExecutionResultBlock = object { content, encrypted_stdout, return_code, 2 more }

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

    content: array of CodeExecutionOutputBlock { file_id, type }
    file_id: string
    type: "code_execution_output"
    encrypted_stdout: string
    return_code: number
    stderr: string
    type: "encrypted_code_execution_result"
    CodeExecutionToolResultBlockParam = object { content, tool_use_id, type, cache_control }
    content: CodeExecutionToolResultBlockParamContent

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

    Accepts one of the following:
    CodeExecutionToolResultErrorParam = object { error_code, type }
    error_code: CodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    type: "code_execution_tool_result_error"
    CodeExecutionResultBlockParam = object { content, return_code, stderr, 2 more }
    content: array of CodeExecutionOutputBlockParam { file_id, type }
    file_id: string
    type: "code_execution_output"
    return_code: number
    stderr: string
    stdout: string
    type: "code_execution_result"
    EncryptedCodeExecutionResultBlockParam = object { content, encrypted_stdout, return_code, 2 more }

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

    content: array of CodeExecutionOutputBlockParam { file_id, type }
    file_id: string
    type: "code_execution_output"
    encrypted_stdout: string
    return_code: number
    stderr: string
    type: "encrypted_code_execution_result"
    tool_use_id: string
    type: "code_execution_tool_result"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 = CodeExecutionToolResultErrorParam { error_code, type } or CodeExecutionResultBlockParam { content, return_code, stderr, 2 more } or EncryptedCodeExecutionResultBlockParam { content, encrypted_stdout, return_code, 2 more }

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

    Accepts one of the following:
    CodeExecutionToolResultErrorParam = object { error_code, type }
    error_code: CodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    type: "code_execution_tool_result_error"
    CodeExecutionResultBlockParam = object { content, return_code, stderr, 2 more }
    content: array of CodeExecutionOutputBlockParam { file_id, type }
    file_id: string
    type: "code_execution_output"
    return_code: number
    stderr: string
    stdout: string
    type: "code_execution_result"
    EncryptedCodeExecutionResultBlockParam = object { content, encrypted_stdout, return_code, 2 more }

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

    content: array of CodeExecutionOutputBlockParam { file_id, type }
    file_id: string
    type: "code_execution_output"
    encrypted_stdout: string
    return_code: number
    stderr: string
    type: "encrypted_code_execution_result"
    CodeExecutionToolResultError = object { error_code, type }
    error_code: CodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    type: "code_execution_tool_result_error"
    CodeExecutionToolResultErrorCode = "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    CodeExecutionToolResultErrorParam = object { error_code, type }
    error_code: CodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    type: "code_execution_tool_result_error"
    Container = object { id, expires_at }

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

    id: string

    Identifier for the container used in this request

    expires_at: string

    The time at which the container will expire.

    ContainerUploadBlock = object { file_id, type }

    Response model for a file uploaded to the container.

    file_id: string
    type: "container_upload"
    ContainerUploadBlockParam = object { 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.

    file_id: string
    type: "container_upload"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 = TextBlock { citations, text, type } or ThinkingBlock { signature, thinking, type } or RedactedThinkingBlock { data, type } or 9 more

    Response model for a file uploaded to the container.

    Accepts one of the following:
    TextBlock = object { citations, text, type }
    citations: array of 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:
    CitationCharLocation = object { cited_text, document_index, document_title, 4 more }
    cited_text: string
    document_index: number
    document_title: string
    end_char_index: number
    file_id: string
    start_char_index: number
    type: "char_location"
    CitationPageLocation = object { cited_text, document_index, document_title, 4 more }
    cited_text: string
    document_index: number
    document_title: string
    end_page_number: number
    file_id: string
    start_page_number: number
    type: "page_location"
    CitationContentBlockLocation = object { cited_text, document_index, document_title, 4 more }
    cited_text: string
    document_index: number
    document_title: string
    end_block_index: number
    file_id: string
    start_block_index: number
    type: "content_block_location"
    CitationsWebSearchResultLocation = object { cited_text, encrypted_index, title, 2 more }
    cited_text: string
    encrypted_index: string
    title: string
    type: "web_search_result_location"
    url: string
    CitationsSearchResultLocation = object { cited_text, end_block_index, search_result_index, 4 more }
    cited_text: string
    end_block_index: number
    search_result_index: number
    source: string
    start_block_index: number
    title: string
    type: "search_result_location"
    text: string
    type: "text"
    ThinkingBlock = object { signature, thinking, type }
    signature: string
    thinking: string
    type: "thinking"
    RedactedThinkingBlock = object { data, type }
    data: string
    type: "redacted_thinking"
    ToolUseBlock = object { id, caller, input, 2 more }
    id: string
    caller: DirectCaller { type } or ServerToolCaller { tool_id, type } or ServerToolCaller20260120 { tool_id, type }

    Tool invocation directly from the model.

    Accepts one of the following:
    DirectCaller = object { type }

    Tool invocation directly from the model.

    type: "direct"
    ServerToolCaller = object { tool_id, type }

    Tool invocation generated by a server-side tool.

    tool_id: string
    type: "code_execution_20250825"
    ServerToolCaller20260120 = object { tool_id, type }
    tool_id: string
    type: "code_execution_20260120"
    input: map[unknown]
    name: string
    type: "tool_use"
    ServerToolUseBlock = object { id, caller, input, 2 more }
    id: string
    caller: DirectCaller { type } or ServerToolCaller { tool_id, type } or ServerToolCaller20260120 { tool_id, type }

    Tool invocation directly from the model.

    Accepts one of the following:
    DirectCaller = object { type }

    Tool invocation directly from the model.

    type: "direct"
    ServerToolCaller = object { tool_id, type }

    Tool invocation generated by a server-side tool.

    tool_id: string
    type: "code_execution_20250825"
    ServerToolCaller20260120 = object { tool_id, type }
    tool_id: string
    type: "code_execution_20260120"
    input: map[unknown]
    name: "web_search" or "web_fetch" or "code_execution" or 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: "server_tool_use"
    WebSearchToolResultBlock = object { caller, content, tool_use_id, type }
    caller: DirectCaller { type } or ServerToolCaller { tool_id, type } or ServerToolCaller20260120 { tool_id, type }

    Tool invocation directly from the model.

    Accepts one of the following:
    DirectCaller = object { type }

    Tool invocation directly from the model.

    type: "direct"
    ServerToolCaller = object { tool_id, type }

    Tool invocation generated by a server-side tool.

    tool_id: string
    type: "code_execution_20250825"
    ServerToolCaller20260120 = object { tool_id, type }
    tool_id: string
    type: "code_execution_20260120"
    content: WebSearchToolResultBlockContent
    Accepts one of the following:
    WebSearchToolResultError = object { error_code, type }
    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: "web_search_tool_result_error"
    UnionMember1 = array of WebSearchResultBlock { encrypted_content, page_age, title, 2 more }
    encrypted_content: string
    page_age: string
    title: string
    type: "web_search_result"
    url: string
    tool_use_id: string
    type: "web_search_tool_result"
    WebFetchToolResultBlock = object { caller, content, tool_use_id, type }
    caller: DirectCaller { type } or ServerToolCaller { tool_id, type } or ServerToolCaller20260120 { tool_id, type }

    Tool invocation directly from the model.

    Accepts one of the following:
    DirectCaller = object { type }

    Tool invocation directly from the model.

    type: "direct"
    ServerToolCaller = object { tool_id, type }

    Tool invocation generated by a server-side tool.

    tool_id: string
    type: "code_execution_20250825"
    ServerToolCaller20260120 = object { tool_id, type }
    tool_id: string
    type: "code_execution_20260120"
    content: WebFetchToolResultErrorBlock { error_code, type } or WebFetchBlock { content, retrieved_at, type, url }
    Accepts one of the following:
    WebFetchToolResultErrorBlock = object { error_code, type }
    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: "web_fetch_tool_result_error"
    WebFetchBlock = object { content, retrieved_at, type, url }
    content: DocumentBlock { citations, source, title, type }
    citations: CitationsConfig { enabled }

    Citation configuration for the document

    enabled: boolean
    source: Base64PDFSource { data, media_type, type } or PlainTextSource { data, media_type, type }
    Accepts one of the following:
    Base64PDFSource = object { data, media_type, type }
    data: string
    media_type: "application/pdf"
    type: "base64"
    PlainTextSource = object { data, media_type, type }
    data: string
    media_type: "text/plain"
    type: "text"
    title: string

    The title of the document

    type: "document"
    retrieved_at: string

    ISO 8601 timestamp when the content was retrieved

    type: "web_fetch_result"
    url: string

    Fetched content URL

    tool_use_id: string
    type: "web_fetch_tool_result"
    CodeExecutionToolResultBlock = object { content, tool_use_id, type }
    content: CodeExecutionToolResultBlockContent

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

    Accepts one of the following:
    CodeExecutionToolResultError = object { error_code, type }
    error_code: CodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    type: "code_execution_tool_result_error"
    CodeExecutionResultBlock = object { content, return_code, stderr, 2 more }
    content: array of CodeExecutionOutputBlock { file_id, type }
    file_id: string
    type: "code_execution_output"
    return_code: number
    stderr: string
    stdout: string
    type: "code_execution_result"
    EncryptedCodeExecutionResultBlock = object { content, encrypted_stdout, return_code, 2 more }

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

    content: array of CodeExecutionOutputBlock { file_id, type }
    file_id: string
    type: "code_execution_output"
    encrypted_stdout: string
    return_code: number
    stderr: string
    type: "encrypted_code_execution_result"
    tool_use_id: string
    type: "code_execution_tool_result"
    BashCodeExecutionToolResultBlock = object { content, tool_use_id, type }
    content: BashCodeExecutionToolResultError { error_code, type } or BashCodeExecutionResultBlock { content, return_code, stderr, 2 more }
    Accepts one of the following:
    BashCodeExecutionToolResultError = object { error_code, type }
    error_code: BashCodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    "output_file_too_large"
    type: "bash_code_execution_tool_result_error"
    BashCodeExecutionResultBlock = object { content, return_code, stderr, 2 more }
    content: array of BashCodeExecutionOutputBlock { file_id, type }
    file_id: string
    type: "bash_code_execution_output"
    return_code: number
    stderr: string
    stdout: string
    type: "bash_code_execution_result"
    tool_use_id: string
    type: "bash_code_execution_tool_result"
    TextEditorCodeExecutionToolResultBlock = object { content, tool_use_id, type }
    content: TextEditorCodeExecutionToolResultError { error_code, error_message, type } or TextEditorCodeExecutionViewResultBlock { content, file_type, num_lines, 3 more } or TextEditorCodeExecutionCreateResultBlock { is_file_update, type } or TextEditorCodeExecutionStrReplaceResultBlock { lines, new_lines, new_start, 3 more }
    Accepts one of the following:
    TextEditorCodeExecutionToolResultError = object { error_code, error_message, type }
    error_code: TextEditorCodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    "file_not_found"
    error_message: string
    type: "text_editor_code_execution_tool_result_error"
    TextEditorCodeExecutionViewResultBlock = object { content, file_type, num_lines, 3 more }
    content: string
    file_type: "text" or "image" or "pdf"
    Accepts one of the following:
    "text"
    "image"
    "pdf"
    num_lines: number
    start_line: number
    total_lines: number
    type: "text_editor_code_execution_view_result"
    TextEditorCodeExecutionCreateResultBlock = object { is_file_update, type }
    is_file_update: boolean
    type: "text_editor_code_execution_create_result"
    TextEditorCodeExecutionStrReplaceResultBlock = object { lines, new_lines, new_start, 3 more }
    lines: array of string
    new_lines: number
    new_start: number
    old_lines: number
    old_start: number
    type: "text_editor_code_execution_str_replace_result"
    tool_use_id: string
    type: "text_editor_code_execution_tool_result"
    ToolSearchToolResultBlock = object { content, tool_use_id, type }
    content: ToolSearchToolResultError { error_code, error_message, type } or ToolSearchToolSearchResultBlock { tool_references, type }
    Accepts one of the following:
    ToolSearchToolResultError = object { error_code, error_message, type }
    error_code: ToolSearchToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    error_message: string
    type: "tool_search_tool_result_error"
    ToolSearchToolSearchResultBlock = object { tool_references, type }
    tool_references: array of ToolReferenceBlock { tool_name, type }
    tool_name: string
    type: "tool_reference"
    type: "tool_search_tool_search_result"
    tool_use_id: string
    type: "tool_search_tool_result"
    ContainerUploadBlock = object { file_id, type }

    Response model for a file uploaded to the container.

    file_id: string
    type: "container_upload"
    ContentBlockParam = TextBlockParam { text, type, cache_control, citations } or ImageBlockParam { source, type, cache_control } or DocumentBlockParam { source, type, cache_control, 3 more } or 13 more

    Regular text content.

    Accepts one of the following:
    TextBlockParam = object { text, type, cache_control, citations }
    text: string
    type: "text"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 array of TextCitationParam
    Accepts one of the following:
    CitationCharLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_char_index: number
    start_char_index: number
    type: "char_location"
    CitationPageLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_page_number: number
    start_page_number: number
    type: "page_location"
    CitationContentBlockLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_block_index: number
    start_block_index: number
    type: "content_block_location"
    CitationWebSearchResultLocationParam = object { cited_text, encrypted_index, title, 2 more }
    cited_text: string
    encrypted_index: string
    title: string
    type: "web_search_result_location"
    url: string
    CitationSearchResultLocationParam = object { cited_text, end_block_index, search_result_index, 4 more }
    cited_text: string
    end_block_index: number
    search_result_index: number
    source: string
    start_block_index: number
    title: string
    type: "search_result_location"
    ImageBlockParam = object { source, type, cache_control }
    source: Base64ImageSource { data, media_type, type } or URLImageSource { type, url }
    Accepts one of the following:
    Base64ImageSource = object { data, media_type, type }
    data: string
    media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"
    Accepts one of the following:
    "image/jpeg"
    "image/png"
    "image/gif"
    "image/webp"
    type: "base64"
    URLImageSource = object { type, url }
    type: "url"
    url: string
    type: "image"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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"
    DocumentBlockParam = object { source, type, cache_control, 3 more }
    source: Base64PDFSource { data, media_type, type } or PlainTextSource { data, media_type, type } or ContentBlockSource { content, type } or URLPDFSource { type, url }
    Accepts one of the following:
    Base64PDFSource = object { data, media_type, type }
    data: string
    media_type: "application/pdf"
    type: "base64"
    PlainTextSource = object { data, media_type, type }
    data: string
    media_type: "text/plain"
    type: "text"
    ContentBlockSource = object { content, type }
    content: string or array of ContentBlockSourceContent
    Accepts one of the following:
    UnionMember0 = string
    ContentBlockSourceContent = array of ContentBlockSourceContent
    Accepts one of the following:
    TextBlockParam = object { text, type, cache_control, citations }
    text: string
    type: "text"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 array of TextCitationParam
    Accepts one of the following:
    CitationCharLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_char_index: number
    start_char_index: number
    type: "char_location"
    CitationPageLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_page_number: number
    start_page_number: number
    type: "page_location"
    CitationContentBlockLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_block_index: number
    start_block_index: number
    type: "content_block_location"
    CitationWebSearchResultLocationParam = object { cited_text, encrypted_index, title, 2 more }
    cited_text: string
    encrypted_index: string
    title: string
    type: "web_search_result_location"
    url: string
    CitationSearchResultLocationParam = object { cited_text, end_block_index, search_result_index, 4 more }
    cited_text: string
    end_block_index: number
    search_result_index: number
    source: string
    start_block_index: number
    title: string
    type: "search_result_location"
    ImageBlockParam = object { source, type, cache_control }
    source: Base64ImageSource { data, media_type, type } or URLImageSource { type, url }
    Accepts one of the following:
    Base64ImageSource = object { data, media_type, type }
    data: string
    media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"
    Accepts one of the following:
    "image/jpeg"
    "image/png"
    "image/gif"
    "image/webp"
    type: "base64"
    URLImageSource = object { type, url }
    type: "url"
    url: string
    type: "image"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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: "content"
    URLPDFSource = object { type, url }
    type: "url"
    url: string
    type: "document"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 }
    enabled: optional boolean
    context: optional string
    title: optional string
    SearchResultBlockParam = object { content, source, title, 3 more }
    content: array of TextBlockParam { text, type, cache_control, citations }
    text: string
    type: "text"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 array of TextCitationParam
    Accepts one of the following:
    CitationCharLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_char_index: number
    start_char_index: number
    type: "char_location"
    CitationPageLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_page_number: number
    start_page_number: number
    type: "page_location"
    CitationContentBlockLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_block_index: number
    start_block_index: number
    type: "content_block_location"
    CitationWebSearchResultLocationParam = object { cited_text, encrypted_index, title, 2 more }
    cited_text: string
    encrypted_index: string
    title: string
    type: "web_search_result_location"
    url: string
    CitationSearchResultLocationParam = object { cited_text, end_block_index, search_result_index, 4 more }
    cited_text: string
    end_block_index: number
    search_result_index: number
    source: string
    start_block_index: number
    title: string
    type: "search_result_location"
    source: string
    title: string
    type: "search_result"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 }
    enabled: optional boolean
    ThinkingBlockParam = object { signature, thinking, type }
    signature: string
    thinking: string
    type: "thinking"
    RedactedThinkingBlockParam = object { data, type }
    data: string
    type: "redacted_thinking"
    ToolUseBlockParam = object { id, input, name, 3 more }
    id: string
    input: map[unknown]
    name: string
    type: "tool_use"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 DirectCaller { type } or ServerToolCaller { tool_id, type } or ServerToolCaller20260120 { tool_id, type }

    Tool invocation directly from the model.

    Accepts one of the following:
    DirectCaller = object { type }

    Tool invocation directly from the model.

    type: "direct"
    ServerToolCaller = object { tool_id, type }

    Tool invocation generated by a server-side tool.

    tool_id: string
    type: "code_execution_20250825"
    ServerToolCaller20260120 = object { tool_id, type }
    tool_id: string
    type: "code_execution_20260120"
    ToolResultBlockParam = object { tool_use_id, type, cache_control, 2 more }
    tool_use_id: string
    type: "tool_result"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 string or array of TextBlockParam { text, type, cache_control, citations } or ImageBlockParam { source, type, cache_control } or SearchResultBlockParam { content, source, title, 3 more } or 2 more
    Accepts one of the following:
    UnionMember0 = string
    UnionMember1 = array of TextBlockParam { text, type, cache_control, citations } or ImageBlockParam { source, type, cache_control } or SearchResultBlockParam { content, source, title, 3 more } or 2 more
    Accepts one of the following:
    TextBlockParam = object { text, type, cache_control, citations }
    text: string
    type: "text"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 array of TextCitationParam
    Accepts one of the following:
    CitationCharLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_char_index: number
    start_char_index: number
    type: "char_location"
    CitationPageLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_page_number: number
    start_page_number: number
    type: "page_location"
    CitationContentBlockLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_block_index: number
    start_block_index: number
    type: "content_block_location"
    CitationWebSearchResultLocationParam = object { cited_text, encrypted_index, title, 2 more }
    cited_text: string
    encrypted_index: string
    title: string
    type: "web_search_result_location"
    url: string
    CitationSearchResultLocationParam = object { cited_text, end_block_index, search_result_index, 4 more }
    cited_text: string
    end_block_index: number
    search_result_index: number
    source: string
    start_block_index: number
    title: string
    type: "search_result_location"
    ImageBlockParam = object { source, type, cache_control }
    source: Base64ImageSource { data, media_type, type } or URLImageSource { type, url }
    Accepts one of the following:
    Base64ImageSource = object { data, media_type, type }
    data: string
    media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"
    Accepts one of the following:
    "image/jpeg"
    "image/png"
    "image/gif"
    "image/webp"
    type: "base64"
    URLImageSource = object { type, url }
    type: "url"
    url: string
    type: "image"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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"
    SearchResultBlockParam = object { content, source, title, 3 more }
    content: array of TextBlockParam { text, type, cache_control, citations }
    text: string
    type: "text"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 array of TextCitationParam
    Accepts one of the following:
    CitationCharLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_char_index: number
    start_char_index: number
    type: "char_location"
    CitationPageLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_page_number: number
    start_page_number: number
    type: "page_location"
    CitationContentBlockLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_block_index: number
    start_block_index: number
    type: "content_block_location"
    CitationWebSearchResultLocationParam = object { cited_text, encrypted_index, title, 2 more }
    cited_text: string
    encrypted_index: string
    title: string
    type: "web_search_result_location"
    url: string
    CitationSearchResultLocationParam = object { cited_text, end_block_index, search_result_index, 4 more }
    cited_text: string
    end_block_index: number
    search_result_index: number
    source: string
    start_block_index: number
    title: string
    type: "search_result_location"
    source: string
    title: string
    type: "search_result"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 }
    enabled: optional boolean
    DocumentBlockParam = object { source, type, cache_control, 3 more }
    source: Base64PDFSource { data, media_type, type } or PlainTextSource { data, media_type, type } or ContentBlockSource { content, type } or URLPDFSource { type, url }
    Accepts one of the following:
    Base64PDFSource = object { data, media_type, type }
    data: string
    media_type: "application/pdf"
    type: "base64"
    PlainTextSource = object { data, media_type, type }
    data: string
    media_type: "text/plain"
    type: "text"
    ContentBlockSource = object { content, type }
    content: string or array of ContentBlockSourceContent
    Accepts one of the following:
    UnionMember0 = string
    ContentBlockSourceContent = array of ContentBlockSourceContent
    Accepts one of the following:
    TextBlockParam = object { text, type, cache_control, citations }
    text: string
    type: "text"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 array of TextCitationParam
    Accepts one of the following:
    CitationCharLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_char_index: number
    start_char_index: number
    type: "char_location"
    CitationPageLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_page_number: number
    start_page_number: number
    type: "page_location"
    CitationContentBlockLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_block_index: number
    start_block_index: number
    type: "content_block_location"
    CitationWebSearchResultLocationParam = object { cited_text, encrypted_index, title, 2 more }
    cited_text: string
    encrypted_index: string
    title: string
    type: "web_search_result_location"
    url: string
    CitationSearchResultLocationParam = object { cited_text, end_block_index, search_result_index, 4 more }
    cited_text: string
    end_block_index: number
    search_result_index: number
    source: string
    start_block_index: number
    title: string
    type: "search_result_location"
    ImageBlockParam = object { source, type, cache_control }
    source: Base64ImageSource { data, media_type, type } or URLImageSource { type, url }
    Accepts one of the following:
    Base64ImageSource = object { data, media_type, type }
    data: string
    media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"
    Accepts one of the following:
    "image/jpeg"
    "image/png"
    "image/gif"
    "image/webp"
    type: "base64"
    URLImageSource = object { type, url }
    type: "url"
    url: string
    type: "image"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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: "content"
    URLPDFSource = object { type, url }
    type: "url"
    url: string
    type: "document"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 }
    enabled: optional boolean
    context: optional string
    title: optional string
    ToolReferenceBlockParam = object { tool_name, type, cache_control }

    Tool reference block that can be included in tool_result content.

    tool_name: string
    type: "tool_reference"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 boolean
    ServerToolUseBlockParam = object { id, input, name, 3 more }
    id: string
    input: map[unknown]
    name: "web_search" or "web_fetch" or "code_execution" or 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: "server_tool_use"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 DirectCaller { type } or ServerToolCaller { tool_id, type } or ServerToolCaller20260120 { tool_id, type }

    Tool invocation directly from the model.

    Accepts one of the following:
    DirectCaller = object { type }

    Tool invocation directly from the model.

    type: "direct"
    ServerToolCaller = object { tool_id, type }

    Tool invocation generated by a server-side tool.

    tool_id: string
    type: "code_execution_20250825"
    ServerToolCaller20260120 = object { tool_id, type }
    tool_id: string
    type: "code_execution_20260120"
    WebSearchToolResultBlockParam = object { content, tool_use_id, type, 2 more }
    content: WebSearchToolResultBlockParamContent
    Accepts one of the following:
    WebSearchToolResultBlockItem = array of WebSearchResultBlockParam { encrypted_content, title, type, 2 more }
    encrypted_content: string
    title: string
    type: "web_search_result"
    url: string
    page_age: optional string
    WebSearchToolRequestError = object { error_code, type }
    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: "web_search_tool_result_error"
    tool_use_id: string
    type: "web_search_tool_result"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 DirectCaller { type } or ServerToolCaller { tool_id, type } or ServerToolCaller20260120 { tool_id, type }

    Tool invocation directly from the model.

    Accepts one of the following:
    DirectCaller = object { type }

    Tool invocation directly from the model.

    type: "direct"
    ServerToolCaller = object { tool_id, type }

    Tool invocation generated by a server-side tool.

    tool_id: string
    type: "code_execution_20250825"
    ServerToolCaller20260120 = object { tool_id, type }
    tool_id: string
    type: "code_execution_20260120"
    WebFetchToolResultBlockParam = object { content, tool_use_id, type, 2 more }
    content: WebFetchToolResultErrorBlockParam { error_code, type } or WebFetchBlockParam { content, type, url, retrieved_at }
    Accepts one of the following:
    WebFetchToolResultErrorBlockParam = object { error_code, type }
    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: "web_fetch_tool_result_error"
    WebFetchBlockParam = object { content, type, url, retrieved_at }
    content: DocumentBlockParam { source, type, cache_control, 3 more }
    source: Base64PDFSource { data, media_type, type } or PlainTextSource { data, media_type, type } or ContentBlockSource { content, type } or URLPDFSource { type, url }
    Accepts one of the following:
    Base64PDFSource = object { data, media_type, type }
    data: string
    media_type: "application/pdf"
    type: "base64"
    PlainTextSource = object { data, media_type, type }
    data: string
    media_type: "text/plain"
    type: "text"
    ContentBlockSource = object { content, type }
    content: string or array of ContentBlockSourceContent
    Accepts one of the following:
    UnionMember0 = string
    ContentBlockSourceContent = array of ContentBlockSourceContent
    Accepts one of the following:
    TextBlockParam = object { text, type, cache_control, citations }
    text: string
    type: "text"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 array of TextCitationParam
    Accepts one of the following:
    CitationCharLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_char_index: number
    start_char_index: number
    type: "char_location"
    CitationPageLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_page_number: number
    start_page_number: number
    type: "page_location"
    CitationContentBlockLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_block_index: number
    start_block_index: number
    type: "content_block_location"
    CitationWebSearchResultLocationParam = object { cited_text, encrypted_index, title, 2 more }
    cited_text: string
    encrypted_index: string
    title: string
    type: "web_search_result_location"
    url: string
    CitationSearchResultLocationParam = object { cited_text, end_block_index, search_result_index, 4 more }
    cited_text: string
    end_block_index: number
    search_result_index: number
    source: string
    start_block_index: number
    title: string
    type: "search_result_location"
    ImageBlockParam = object { source, type, cache_control }
    source: Base64ImageSource { data, media_type, type } or URLImageSource { type, url }
    Accepts one of the following:
    Base64ImageSource = object { data, media_type, type }
    data: string
    media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"
    Accepts one of the following:
    "image/jpeg"
    "image/png"
    "image/gif"
    "image/webp"
    type: "base64"
    URLImageSource = object { type, url }
    type: "url"
    url: string
    type: "image"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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: "content"
    URLPDFSource = object { type, url }
    type: "url"
    url: string
    type: "document"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 }
    enabled: optional boolean
    context: optional string
    title: optional string
    type: "web_fetch_result"
    url: string

    Fetched content URL

    retrieved_at: optional string

    ISO 8601 timestamp when the content was retrieved

    tool_use_id: string
    type: "web_fetch_tool_result"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 DirectCaller { type } or ServerToolCaller { tool_id, type } or ServerToolCaller20260120 { tool_id, type }

    Tool invocation directly from the model.

    Accepts one of the following:
    DirectCaller = object { type }

    Tool invocation directly from the model.

    type: "direct"
    ServerToolCaller = object { tool_id, type }

    Tool invocation generated by a server-side tool.

    tool_id: string
    type: "code_execution_20250825"
    ServerToolCaller20260120 = object { tool_id, type }
    tool_id: string
    type: "code_execution_20260120"
    CodeExecutionToolResultBlockParam = object { content, tool_use_id, type, cache_control }
    content: CodeExecutionToolResultBlockParamContent

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

    Accepts one of the following:
    CodeExecutionToolResultErrorParam = object { error_code, type }
    error_code: CodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    type: "code_execution_tool_result_error"
    CodeExecutionResultBlockParam = object { content, return_code, stderr, 2 more }
    content: array of CodeExecutionOutputBlockParam { file_id, type }
    file_id: string
    type: "code_execution_output"
    return_code: number
    stderr: string
    stdout: string
    type: "code_execution_result"
    EncryptedCodeExecutionResultBlockParam = object { content, encrypted_stdout, return_code, 2 more }

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

    content: array of CodeExecutionOutputBlockParam { file_id, type }
    file_id: string
    type: "code_execution_output"
    encrypted_stdout: string
    return_code: number
    stderr: string
    type: "encrypted_code_execution_result"
    tool_use_id: string
    type: "code_execution_tool_result"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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"
    BashCodeExecutionToolResultBlockParam = object { content, tool_use_id, type, cache_control }
    content: BashCodeExecutionToolResultErrorParam { error_code, type } or BashCodeExecutionResultBlockParam { content, return_code, stderr, 2 more }
    Accepts one of the following:
    BashCodeExecutionToolResultErrorParam = object { error_code, type }
    error_code: BashCodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    "output_file_too_large"
    type: "bash_code_execution_tool_result_error"
    BashCodeExecutionResultBlockParam = object { content, return_code, stderr, 2 more }
    content: array of BashCodeExecutionOutputBlockParam { file_id, type }
    file_id: string
    type: "bash_code_execution_output"
    return_code: number
    stderr: string
    stdout: string
    type: "bash_code_execution_result"
    tool_use_id: string
    type: "bash_code_execution_tool_result"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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"
    TextEditorCodeExecutionToolResultBlockParam = object { content, tool_use_id, type, cache_control }
    content: TextEditorCodeExecutionToolResultErrorParam { error_code, type, error_message } or TextEditorCodeExecutionViewResultBlockParam { content, file_type, type, 3 more } or TextEditorCodeExecutionCreateResultBlockParam { is_file_update, type } or TextEditorCodeExecutionStrReplaceResultBlockParam { type, lines, new_lines, 3 more }
    Accepts one of the following:
    TextEditorCodeExecutionToolResultErrorParam = object { error_code, type, error_message }
    error_code: TextEditorCodeExecutionToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    "file_not_found"
    type: "text_editor_code_execution_tool_result_error"
    error_message: optional string
    TextEditorCodeExecutionViewResultBlockParam = object { content, file_type, type, 3 more }
    content: string
    file_type: "text" or "image" or "pdf"
    Accepts one of the following:
    "text"
    "image"
    "pdf"
    type: "text_editor_code_execution_view_result"
    num_lines: optional number
    start_line: optional number
    total_lines: optional number
    TextEditorCodeExecutionCreateResultBlockParam = object { is_file_update, type }
    is_file_update: boolean
    type: "text_editor_code_execution_create_result"
    TextEditorCodeExecutionStrReplaceResultBlockParam = object { type, lines, new_lines, 3 more }
    type: "text_editor_code_execution_str_replace_result"
    lines: optional array of string
    new_lines: optional number
    new_start: optional number
    old_lines: optional number
    old_start: optional number
    tool_use_id: string
    type: "text_editor_code_execution_tool_result"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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"
    ToolSearchToolResultBlockParam = object { content, tool_use_id, type, cache_control }
    content: ToolSearchToolResultErrorParam { error_code, type } or ToolSearchToolSearchResultBlockParam { tool_references, type }
    Accepts one of the following:
    ToolSearchToolResultErrorParam = object { error_code, type }
    error_code: ToolSearchToolResultErrorCode
    Accepts one of the following:
    "invalid_tool_input"
    "unavailable"
    "too_many_requests"
    "execution_time_exceeded"
    type: "tool_search_tool_result_error"
    ToolSearchToolSearchResultBlockParam = object { tool_references, type }
    tool_references: array of ToolReferenceBlockParam { tool_name, type, cache_control }
    tool_name: string
    type: "tool_reference"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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: "tool_search_tool_search_result"
    tool_use_id: string
    type: "tool_search_tool_result"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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"
    ContainerUploadBlockParam = object { 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.

    file_id: string
    type: "container_upload"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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"
    ContentBlockSource = object { content, type }
    content: string or array of ContentBlockSourceContent
    Accepts one of the following:
    UnionMember0 = string
    ContentBlockSourceContent = array of ContentBlockSourceContent
    Accepts one of the following:
    TextBlockParam = object { text, type, cache_control, citations }
    text: string
    type: "text"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 array of TextCitationParam
    Accepts one of the following:
    CitationCharLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_char_index: number
    start_char_index: number
    type: "char_location"
    CitationPageLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_page_number: number
    start_page_number: number
    type: "page_location"
    CitationContentBlockLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_block_index: number
    start_block_index: number
    type: "content_block_location"
    CitationWebSearchResultLocationParam = object { cited_text, encrypted_index, title, 2 more }
    cited_text: string
    encrypted_index: string
    title: string
    type: "web_search_result_location"
    url: string
    CitationSearchResultLocationParam = object { cited_text, end_block_index, search_result_index, 4 more }
    cited_text: string
    end_block_index: number
    search_result_index: number
    source: string
    start_block_index: number
    title: string
    type: "search_result_location"
    ImageBlockParam = object { source, type, cache_control }
    source: Base64ImageSource { data, media_type, type } or URLImageSource { type, url }
    Accepts one of the following:
    Base64ImageSource = object { data, media_type, type }
    data: string
    media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"
    Accepts one of the following:
    "image/jpeg"
    "image/png"
    "image/gif"
    "image/webp"
    type: "base64"
    URLImageSource = object { type, url }
    type: "url"
    url: string
    type: "image"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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: "content"
    ContentBlockSourceContent = TextBlockParam { text, type, cache_control, citations } or ImageBlockParam { source, type, cache_control }
    Accepts one of the following:
    TextBlockParam = object { text, type, cache_control, citations }
    text: string
    type: "text"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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 array of TextCitationParam
    Accepts one of the following:
    CitationCharLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_char_index: number
    start_char_index: number
    type: "char_location"
    CitationPageLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_page_number: number
    start_page_number: number
    type: "page_location"
    CitationContentBlockLocationParam = object { cited_text, document_index, document_title, 3 more }
    cited_text: string
    document_index: number
    document_title: string
    end_block_index: number
    start_block_index: number
    type: "content_block_location"
    CitationWebSearchResultLocationParam = object { cited_text, encrypted_index, title, 2 more }
    cited_text: string
    encrypted_index: string
    title: string
    type: "web_search_result_location"
    url: string
    CitationSearchResultLocationParam = object { cited_text, end_block_index, search_result_index, 4 more }
    cited_text: string
    end_block_index: number
    search_result_index: number
    source: string
    start_block_index: number
    title: string
    type: "search_result_location"
    ImageBlockParam = object { source, type, cache_control }
    source: Base64ImageSource { data, media_type, type } or URLImageSource { type, url }
    Accepts one of the following:
    Base64ImageSource = object { data, media_type, type }
    data: string
    media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"
    Accepts one of the following:
    "image/jpeg"
    "image/png"
    "image/gif"
    "image/webp"
    type: "base64"
    URLImageSource = object { type, url }
    type: "url"
    url: string
    type: "image"
    cache_control: optional CacheControlEphemeral { type, ttl }

    Create a cache control breakpoint at this content block.

    type: "ephemeral"
    ttl: optional "5m" or "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"
    DirectCaller = object { type }

    Tool invocation directly from the model.