Claude Platform Docs

Nachrichten

Eine Nachricht erstellen
client.Messages.New(ctx, params) (*Message, error)
POST/v1/messages

Sende eine strukturierte Liste von Eingabenachrichten mit Text- und/oder Bildinhalten, und das Modell generiert die nächste Nachricht in der Konversation.

Tokens in einer Nachricht zählen
client.Messages.CountTokens(ctx, params) (*MessageTokensCount, error)
POST/v1/messages/count_tokens

Zähle die Anzahl der Tokens in einer Nachricht.

Models
type Base64ImageSourceParam struct { Type: "base64"; Data; MediaType }
Type Base64
Data string
formatbyte
MediaType Base64ImageSourceMediaType
One of the following:
const Base64ImageSourceMediaTypeImageJPEG Base64ImageSourceMediaType = "image/jpeg"
const Base64ImageSourceMediaTypeImagePNG Base64ImageSourceMediaType = "image/png"
const Base64ImageSourceMediaTypeImageGIF Base64ImageSourceMediaType = "image/gif"
const Base64ImageSourceMediaTypeImageWebP Base64ImageSourceMediaType = "image/webp"
type Base64PDFSource struct { Type: "base64"; Data; MediaType }
Type Base64
Data string
formatbyte
MediaType ApplicationPDF
type BashCodeExecutionOutputBlock struct { Type: "bash_code_execution_output"; FileID }
Type BashCodeExecutionOutput
defaultbash_code_execution_output
FileID string
type BashCodeExecutionOutputBlockParam struct { Type: "bash_code_execution_output"; FileID }
Type BashCodeExecutionOutput
FileID string
type BashCodeExecutionResultBlock struct { Type: "bash_code_execution_result"; Content; ReturnCode; /* 2 more */ }
Type BashCodeExecutionResult
defaultbash_code_execution_result
Type BashCodeExecutionOutput
defaultbash_code_execution_output
FileID string
ReturnCode int64
Stderr string
Stdout string
type BashCodeExecutionResultBlockParam struct { Type: "bash_code_execution_result"; Content; ReturnCode; /* 2 more */ }
Type BashCodeExecutionResult
Type BashCodeExecutionOutput
FileID string
ReturnCode int64
Stderr string
Stdout string
type BashCodeExecutionToolResultBlock struct { Type: "bash_code_execution_tool_result"; Content; ToolUseID }
type BashCodeExecutionToolResultBlockParam struct { Type: "bash_code_execution_tool_result"; Content; ToolUseID; CacheControl }
type BashCodeExecutionToolResultError struct { Type: "bash_code_execution_tool_result_error"; ErrorCode }
Type BashCodeExecutionToolResultError
defaultbash_code_execution_tool_result_error
One of the following:
const BashCodeExecutionToolResultErrorCodeInvalidToolInput BashCodeExecutionToolResultErrorCode = "invalid_tool_input"
const BashCodeExecutionToolResultErrorCodeUnavailable BashCodeExecutionToolResultErrorCode = "unavailable"
const BashCodeExecutionToolResultErrorCodeTooManyRequests BashCodeExecutionToolResultErrorCode = "too_many_requests"
const BashCodeExecutionToolResultErrorCodeExecutionTimeExceeded BashCodeExecutionToolResultErrorCode = "execution_time_exceeded"
const BashCodeExecutionToolResultErrorCodeOutputFileTooLarge BashCodeExecutionToolResultErrorCode = "output_file_too_large"
type BashCodeExecutionToolResultErrorCode string
One of the following:
const BashCodeExecutionToolResultErrorCodeInvalidToolInput BashCodeExecutionToolResultErrorCode = "invalid_tool_input"
const BashCodeExecutionToolResultErrorCodeUnavailable BashCodeExecutionToolResultErrorCode = "unavailable"
const BashCodeExecutionToolResultErrorCodeTooManyRequests BashCodeExecutionToolResultErrorCode = "too_many_requests"
const BashCodeExecutionToolResultErrorCodeExecutionTimeExceeded BashCodeExecutionToolResultErrorCode = "execution_time_exceeded"
const BashCodeExecutionToolResultErrorCodeOutputFileTooLarge BashCodeExecutionToolResultErrorCode = "output_file_too_large"
type BashCodeExecutionToolResultErrorParam struct { Type: "bash_code_execution_tool_result_error"; ErrorCode }
Type BashCodeExecutionToolResultError
One of the following:
const BashCodeExecutionToolResultErrorCodeInvalidToolInput BashCodeExecutionToolResultErrorCode = "invalid_tool_input"
const BashCodeExecutionToolResultErrorCodeUnavailable BashCodeExecutionToolResultErrorCode = "unavailable"
const BashCodeExecutionToolResultErrorCodeTooManyRequests BashCodeExecutionToolResultErrorCode = "too_many_requests"
const BashCodeExecutionToolResultErrorCodeExecutionTimeExceeded BashCodeExecutionToolResultErrorCode = "execution_time_exceeded"
const BashCodeExecutionToolResultErrorCodeOutputFileTooLarge BashCodeExecutionToolResultErrorCode = "output_file_too_large"
type BrowserClickTargetUnion interface{…}

Where to act: either a viewport coordinate or an element reference.

One of the following:
type BrowserCoordinateTarget struct { Type: "coordinate"; X; Y }

A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot).

Type Coordinate
X int64

Pixels from the left edge of the viewport.

minimum0
Y int64

Pixels from the top edge of the viewport.

minimum0
type BrowserRefTarget struct { Type: "ref"; Ref }

An element on the page, identified by a reference from a prior read_page or find result. References are scoped to the tab that produced them and become stale after navigation or a major re-render.

Type Ref
Ref string

An element reference (e.g. "ref_7") returned by a prior read_page or find result.

type BrowserCloseTabConfigParam struct { DeferLoading; Enabled }

close_tab's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserCloseTabInput struct { TabID }

Close the tab with the given tab_id.

TabID string

The tab to close.

type BrowserCloseTabToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserCoordinateTarget struct { Type: "coordinate"; X; Y }

A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot).

Type Coordinate
X int64

Pixels from the left edge of the viewport.

minimum0
Y int64

Pixels from the top edge of the viewport.

minimum0
type BrowserDoubleClickConfigParam struct { DeferLoading; Enabled }

double_click's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserDoubleClickInput struct { Target; Modifiers; TabID }

Double left-click at a viewport coordinate or on an element by reference.

Where to act: either a viewport coordinate or an element reference.

One of the following:
type BrowserCoordinateTarget struct { Type: "coordinate"; X; Y }

A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot).

Type Coordinate
X int64

Pixels from the left edge of the viewport.

minimum0
Y int64

Pixels from the top edge of the viewport.

minimum0
type BrowserRefTarget struct { Type: "ref"; Ref }

An element on the page, identified by a reference from a prior read_page or find result. References are scoped to the tab that produced them and become stale after navigation or a major re-render.

Type Ref
Ref string

An element reference (e.g. "ref_7") returned by a prior read_page or find result.

Modifiers string Optional

Optional modifier key chord to hold for the duration of this action (e.g. "shift", "ctrl+shift", "cmd+alt").

TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserDoubleClickToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserFileUploadConfigParam struct { DeferLoading; Enabled }

file_upload's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserFileUploadInput struct { Target; DocumentIDs; Paths; TabID }

Set the value of a file-input element to one or more files. The target must be an element reference; at least one of paths or document_ids is required.

An element on the page, identified by a reference from a prior read_page or find result. References are scoped to the tab that produced them and become stale after navigation or a major re-render.

Type Ref
Ref string

An element reference (e.g. "ref_7") returned by a prior read_page or find result.

DocumentIDs []string Optional

References to files the harness has staged, for deployments where the browser executor cannot read the caller's filesystem.

minItems1
Paths []string Optional

File paths on the browser executor's filesystem.

minItems1
TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserFileUploadToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserFindConfigParam struct { DeferLoading; Enabled }

find's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserFindInput struct { Query; TabID }

Find elements matching a natural-language description (e.g. "search bar", "add to cart button") and return up to 20 matches with element references.

Query string

Natural-language description of the element(s) to find.

TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserFindToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserFormInputConfigParam struct { DeferLoading; Enabled }

form_input's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserFormInputInput struct { Target; Value; TabID }

Set the value of a form element (input, textarea, select, checkbox). Use a boolean for checkboxes, an option value or text for selects.

An element on the page, identified by a reference from a prior read_page or find result. References are scoped to the tab that produced them and become stale after navigation or a major re-render.

Type Ref
Ref string

An element reference (e.g. "ref_7") returned by a prior read_page or find result.

The value to set.

One of the following:
string
float64
bool
TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserFormInputToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserFormInputValueUnion interface{…}
One of the following:
string
float64
bool
type BrowserGetPageTextConfigParam struct { DeferLoading; Enabled }

get_page_text's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserGetPageTextInput struct { TabID }

Return the page's visible text content as plain text, prioritizing article content. Suited to articles, documentation, and other text-heavy pages.

TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserGetPageTextToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserHoldKeyConfigParam struct { DeferLoading; Enabled }

hold_key's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserHoldKeyInput struct { Duration; Text; TabID }

Hold a key or key chord down for a duration, then release it. Uses the same key names and "+" chord syntax as the key action.

Duration float64

Seconds to hold the key down (maximum 30).

minimum0
maximum30
Text string

The key or chord to hold.

TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserHoldKeyToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserHoverConfigParam struct { DeferLoading; Enabled }

hover's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserHoverInput struct { Target; TabID }

Move the cursor to a coordinate or element without clicking.

Where to act: either a viewport coordinate or an element reference.

One of the following:
type BrowserCoordinateTarget struct { Type: "coordinate"; X; Y }

A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot).

Type Coordinate
X int64

Pixels from the left edge of the viewport.

minimum0
Y int64

Pixels from the top edge of the viewport.

minimum0
type BrowserRefTarget struct { Type: "ref"; Ref }

An element on the page, identified by a reference from a prior read_page or find result. References are scoped to the tab that produced them and become stale after navigation or a major re-render.

Type Ref
Ref string

An element reference (e.g. "ref_7") returned by a prior read_page or find result.

TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserHoverToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserJavascriptExecConfigParam struct { DeferLoading; Enabled }

javascript_exec's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserJavascriptExecInput struct { Text; TabID }

Execute JavaScript in the page context and return the value of the last expression. The code runs with access to the DOM, window, and page variables. Write the expression you want evaluated — do NOT use return.

Text string

JavaScript to execute in the page context.

TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserJavascriptExecToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserKeyConfigParam struct { DeferLoading; Enabled }

key's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserKeyInput struct { Text; Repeat; TabID }

Press a key or key chord. Use "+" to combine modifiers with a key (e.g. "ctrl+a", "cmd+shift+p") and space to sequence presses (e.g. "Backspace Backspace Delete"). Common names like "Return", "Tab", "Escape", "BackSpace" are supported.

Text string

The key, chord, or space-separated sequence to press.

Repeat int64 Optional

Number of times to repeat. Default 1.

minimum1
maximum100
TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserKeyToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserLeftClickConfigParam struct { DeferLoading; Enabled }

left_click's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserLeftClickDragConfigParam struct { DeferLoading; Enabled }

left_click_drag's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserLeftClickDragInput struct { From; Target; TabID }

Press at from, drag to target, release. Both must be coordinate targets.

A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot).

Type Coordinate
X int64

Pixels from the left edge of the viewport.

minimum0
Y int64

Pixels from the top edge of the viewport.

minimum0

A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot).

Type Coordinate
X int64

Pixels from the left edge of the viewport.

minimum0
Y int64

Pixels from the top edge of the viewport.

minimum0
TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserLeftClickDragToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserLeftClickInput struct { Target; Modifiers; TabID }

Left-click at a viewport coordinate or on an element by reference.

Where to act: either a viewport coordinate or an element reference.

One of the following:
type BrowserCoordinateTarget struct { Type: "coordinate"; X; Y }

A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot).

Type Coordinate
X int64

Pixels from the left edge of the viewport.

minimum0
Y int64

Pixels from the top edge of the viewport.

minimum0
type BrowserRefTarget struct { Type: "ref"; Ref }

An element on the page, identified by a reference from a prior read_page or find result. References are scoped to the tab that produced them and become stale after navigation or a major re-render.

Type Ref
Ref string

An element reference (e.g. "ref_7") returned by a prior read_page or find result.

Modifiers string Optional

Optional modifier key chord to hold for the duration of this action (e.g. "shift", "ctrl+shift", "cmd+alt").

TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserLeftClickToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserLeftMouseDownConfigParam struct { DeferLoading; Enabled }

left_mouse_down's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserLeftMouseDownInput struct { Target; TabID }

Press and hold the left mouse button at a viewport coordinate. Pair with left_mouse_up to perform a custom drag.

A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot).

Type Coordinate
X int64

Pixels from the left edge of the viewport.

minimum0
Y int64

Pixels from the top edge of the viewport.

minimum0
TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserLeftMouseDownToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserLeftMouseUpConfigParam struct { DeferLoading; Enabled }

left_mouse_up's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserLeftMouseUpInput struct { Target; TabID }

Release the left mouse button at a viewport coordinate.

A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot).

Type Coordinate
X int64

Pixels from the left edge of the viewport.

minimum0
Y int64

Pixels from the top edge of the viewport.

minimum0
TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserLeftMouseUpToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserListTabsConfigParam struct { DeferLoading; Enabled }

list_tabs's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserListTabsInput struct{…}

List all open tabs with each tab's tab_id, title, and URL.

type BrowserListTabsToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserMiddleClickConfigParam struct { DeferLoading; Enabled }

middle_click's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserMiddleClickInput struct { Target; Modifiers; TabID }

Middle-click at a viewport coordinate or on an element by reference.

Where to act: either a viewport coordinate or an element reference.

One of the following:
type BrowserCoordinateTarget struct { Type: "coordinate"; X; Y }

A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot).

Type Coordinate
X int64

Pixels from the left edge of the viewport.

minimum0
Y int64

Pixels from the top edge of the viewport.

minimum0
type BrowserRefTarget struct { Type: "ref"; Ref }

An element on the page, identified by a reference from a prior read_page or find result. References are scoped to the tab that produced them and become stale after navigation or a major re-render.

Type Ref
Ref string

An element reference (e.g. "ref_7") returned by a prior read_page or find result.

Modifiers string Optional

Optional modifier key chord to hold for the duration of this action (e.g. "shift", "ctrl+shift", "cmd+alt").

TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserMiddleClickToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserMouseMoveConfigParam struct { DeferLoading; Enabled }

mouse_move's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserMouseMoveInput struct { Target; TabID }

Move the pointer to a viewport coordinate without clicking.

A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot).

Type Coordinate
X int64

Pixels from the left edge of the viewport.

minimum0
Y int64

Pixels from the top edge of the viewport.

minimum0
TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserMouseMoveToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserNavigateConfigParam struct { DeferLoading; Enabled }

navigate's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserNavigateInput struct { URL; TabID }

Navigate to a URL, or go back/forward/reload in history. The protocol may be omitted (defaults to https://).

URL string

The URL to navigate to, or "back" / "forward" / "reload" for history navigation.

TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserNavigateToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserNewTabConfigParam struct { DeferLoading; Enabled }

new_tab's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserNewTabInput struct{…}

Open a new empty tab and return its tab_id.

type BrowserNewTabToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserReadConsoleConfigParam struct { DeferLoading; Enabled }

read_console's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserReadConsoleInput struct { TabID }

Return console output (log entries, errors, warnings) accumulated since the driver attached to the tab and since the last read, one line per entry. An empty result does not mean no traffic for a tab that predates attach.

TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserReadConsoleToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserReadNetworkConfigParam struct { DeferLoading; Enabled }

read_network's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserReadNetworkInput struct { TabID }

Return the network requests (method, URL, status, MIME type, timing) recorded since the driver attached to the tab and since the last read, one line per entry. An empty result does not mean no traffic for a tab that predates attach.

TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserReadNetworkToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserReadPageConfigParam struct { DeferLoading; Enabled }

read_page's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserReadPageFilter string
One of the following:
const BrowserReadPageFilterAll BrowserReadPageFilter = "all"
const BrowserReadPageFilterInteractive BrowserReadPageFilter = "interactive"
type BrowserReadPageInput struct { Depth; Filter; Ref; TabID }

Return a structured accessibility tree of the page (or the subtree rooted at ref), with element references like [ref_7] that can be used as targets on later actions. Output is capped at 50,000 characters — narrow with ref or a smaller depth when exceeded.

Depth int64 Optional

Maximum tree depth. Default 15.

minimum1
Filter BrowserReadPageFilter Optional

Which elements to include. Omitted: every visible element. "interactive": interactive elements only. "all": additionally includes off-viewport elements.

One of the following:
const BrowserReadPageFilterAll BrowserReadPageFilter = "all"
const BrowserReadPageFilterInteractive BrowserReadPageFilter = "interactive"
Ref string Optional

Element reference to read a subtree from. Omit to read from the page root.

TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserReadPageToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserRefTarget struct { Type: "ref"; Ref }

An element on the page, identified by a reference from a prior read_page or find result. References are scoped to the tab that produced them and become stale after navigation or a major re-render.

Type Ref
Ref string

An element reference (e.g. "ref_7") returned by a prior read_page or find result.

type BrowserRightClickConfigParam struct { DeferLoading; Enabled }

right_click's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserRightClickInput struct { Target; Modifiers; TabID }

Right-click at a viewport coordinate or on an element by reference.

Where to act: either a viewport coordinate or an element reference.

One of the following:
type BrowserCoordinateTarget struct { Type: "coordinate"; X; Y }

A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot).

Type Coordinate
X int64

Pixels from the left edge of the viewport.

minimum0
Y int64

Pixels from the top edge of the viewport.

minimum0
type BrowserRefTarget struct { Type: "ref"; Ref }

An element on the page, identified by a reference from a prior read_page or find result. References are scoped to the tab that produced them and become stale after navigation or a major re-render.

Type Ref
Ref string

An element reference (e.g. "ref_7") returned by a prior read_page or find result.

Modifiers string Optional

Optional modifier key chord to hold for the duration of this action (e.g. "shift", "ctrl+shift", "cmd+alt").

TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserRightClickToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserScreenshotConfigParam struct { DeferLoading; Enabled }

screenshot's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserScreenshotInput struct { TabID }

Capture the current browser viewport.

TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserScreenshotToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserScrollConfigParam struct { DeferLoading; Enabled }

scroll's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserScrollDirection string
One of the following:
const BrowserScrollDirectionUp BrowserScrollDirection = "up"
const BrowserScrollDirectionDown BrowserScrollDirection = "down"
const BrowserScrollDirectionLeft BrowserScrollDirection = "left"
const BrowserScrollDirectionRight BrowserScrollDirection = "right"
type BrowserScrollInput struct { ScrollDirection; Target; ScrollAmount; TabID }

Scroll at a viewport position. target must be a coordinate target.

ScrollDirection BrowserScrollDirection
One of the following:
const BrowserScrollDirectionUp BrowserScrollDirection = "up"
const BrowserScrollDirectionDown BrowserScrollDirection = "down"
const BrowserScrollDirectionLeft BrowserScrollDirection = "left"
const BrowserScrollDirectionRight BrowserScrollDirection = "right"

A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot).

Type Coordinate
X int64

Pixels from the left edge of the viewport.

minimum0
Y int64

Pixels from the top edge of the viewport.

minimum0
ScrollAmount int64 Optional

Scroll-wheel notches (1–10). Default 3.

minimum1
maximum10
TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserScrollToConfigParam struct { DeferLoading; Enabled }

scroll_to's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserScrollToInput struct { Target; TabID }

Scroll an element into view.

An element on the page, identified by a reference from a prior read_page or find result. References are scoped to the tab that produced them and become stale after navigation or a major re-render.

Type Ref
Ref string

An element reference (e.g. "ref_7") returned by a prior read_page or find result.

TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserScrollToToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserScrollToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserStateBlockParam struct { Type: "browser_state"; Tabs; CacheControl; StateChanges }

The caller's browser state after a browser toolset member call — the full inventory of open tabs, which tab is active, and any side effects (tabs opened, download state changes) the call produced.

At most one per tool_result, only on a non-error result answering a browser toolset member tool_use. The server renders the model-visible text from it; the model never sees the raw fields.

type BrowserStateChangeUnionParam interface{…}
One of the following:
type BrowserStateChangeDownloadCompletedParam struct { Type: "download_completed"; DownloadID; URL; /* 2 more */ }

A file download that finished during this call, reported with the same download_id as its download_started — or without a prior download_started, when the download finished during the call that started it (at most one state change per download_id per result).

Type DownloadCompleted
DownloadID string

The caller-assigned identifier for this download, stable across the state changes reporting it.

minLength1
maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
URL string

The final post-redirect URL the download was served from.

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
Path string Optional

Where the executor saved the file, on the executor's filesystem. Only included when another tool in the same environment can read the file at that path.

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
SizeBytes int64 Optional

The completed download's size.

minimum0
type BrowserStateChangeDownloadFailedParam struct { Type: "download_failed"; DownloadID; URL; Error }

A file download that failed — or was cancelled — during this call.

Type DownloadFailed
DownloadID string

The caller-assigned identifier for this download, stable across the state changes reporting it.

minLength1
maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
URL string

The final post-redirect URL the download was served from.

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
Error string Optional

The failure or cancellation detail, when known.

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
type BrowserStateChangeDownloadStartedParam struct { Type: "download_started"; DownloadID; URL }

A file download that started during this call.

Type DownloadStarted
DownloadID string

The caller-assigned identifier for this download, stable across the state changes reporting it.

minLength1
maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
URL string

The final post-redirect URL the download was served from.

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
type BrowserStateChangeTabOpenedParam struct { Type: "tab_opened"; TabID }

A tab this call's execution opened that remains open at its end — the creation delta of the tabs inventory, not an event log.

Carries only the tab_id; the tab's title and url live on its tabs entry, which must include the same tab_id. A tab opened during a failed call gets no deferred tab_opened; it simply appears in the next result's tabs inventory.

Type TabOpened
TabID string

The tab_id of the opened tab, present in tabs.

minLength1
maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
type BrowserStateTabEntryParam struct { TabID; Title; URL; Active }

One open browser tab reported in a browser_state block's tabs inventory.

tab_id is the caller-assigned identifier for the tab; title and url describe the page the tab is currently showing and may be empty strings (a blank tab legitimately has both empty). active marks the tab that is active after this call; whenever tabs is non-empty, exactly one entry is marked.

TabID string

The caller-assigned identifier for this tab, unique within the inventory.

minLength1
maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
Title string

The title of the page the tab is showing. May be empty.

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
URL string

The URL of the page the tab is showing. May be empty.

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
Active bool Optional

Whether this tab is the active tab after this call. Whenever tabs is non-empty, exactly one entry is marked active: true.

type BrowserSwitchTabConfigParam struct { DeferLoading; Enabled }

switch_tab's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserSwitchTabInput struct { TabID }

Make the tab with the given tab_id the active tab — the tab that actions without a tab_id apply to.

TabID string

The tab to switch to.

type BrowserSwitchTabToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserToolUseBlockUnion interface{…}
One of the following:
type BrowserToolset20260801Param struct { Type: "browser_toolset_20260801"; CacheControl; Configs }

The browser toolset: a single tools[] entry (carrying no name) that declares the browser tool family. The model is served the family's tool with any members disabled via configs removed from its schema.

Type BrowserToolset20260801
CacheControl CacheControlEphemeralParam Optional

Create a cache control breakpoint at this content block.

Type Ephemeral
TTL CacheControlEphemeralTTL Optional

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. See prompt caching pricing for details.

One of the following:
const CacheControlEphemeralTTLTTL5m CacheControlEphemeralTTL = "5m"
const CacheControlEphemeralTTLTTL1h CacheControlEphemeralTTL = "1h"
Configs BrowserToolsetConfigsParam Optional

Sparse per-member overrides, keyed by member name. Absent, null, and {} are equivalent; a member's defaults apply wherever its key is absent.

type BrowserToolsetConfigsParam struct { Type; CloseTab; DoubleClick; /* 28 more */ }

Per-member configuration for browser_toolset_20260801: one optional field per member tool, keyed by the member name — the same name the member's tool_use blocks carry. Every member is an accepted key, and a member's defaults apply wherever its key is absent. Unknown keys are rejected: the field set is this toolset version's complete member set.

type BrowserTripleClickConfigParam struct { DeferLoading; Enabled }

triple_click's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserTripleClickInput struct { Target; Modifiers; TabID }

Triple left-click at a viewport coordinate or on an element by reference (typically selects a line or paragraph).

Where to act: either a viewport coordinate or an element reference.

One of the following:
type BrowserCoordinateTarget struct { Type: "coordinate"; X; Y }

A point in the browser viewport, in viewport pixels (the same frame as a full-viewport screenshot).

Type Coordinate
X int64

Pixels from the left edge of the viewport.

minimum0
Y int64

Pixels from the top edge of the viewport.

minimum0
type BrowserRefTarget struct { Type: "ref"; Ref }

An element on the page, identified by a reference from a prior read_page or find result. References are scoped to the tab that produced them and become stale after navigation or a major re-render.

Type Ref
Ref string

An element reference (e.g. "ref_7") returned by a prior read_page or find result.

Modifiers string Optional

Optional modifier key chord to hold for the duration of this action (e.g. "shift", "ctrl+shift", "cmd+alt").

TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserTripleClickToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserTypeConfigParam struct { DeferLoading; Enabled }

type's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserTypeInput struct { Text; TabID }

Type a literal string at the current focus.

Text string

The text to type.

TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserTypeToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserWaitConfigParam struct { DeferLoading; Enabled }

wait's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserWaitInput struct { Duration; TabID }

Pause for the given duration.

Duration float64

Seconds to wait (maximum 30).

minimum0
maximum30
TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserWaitToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type BrowserZoomConfigParam struct { DeferLoading; Enabled }

zoom's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type BrowserZoomInput struct { Region; TabID }

Return a cropped screenshot of the given viewport region, scaled up for closer inspection — useful for small icons, buttons, or text. Coordinates are in the same viewport-pixel space as a full screenshot.

Region []int64

[x0, y0, x1, y1] in viewport pixels.

minItems4
maxItems4
TabID string Optional

Tab to act on. Defaults to the active tab when omitted.

type BrowserZoomToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type CacheControlEphemeralParam struct { Type: "ephemeral"; TTL }
Type Ephemeral
TTL CacheControlEphemeralTTL Optional

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. See prompt caching pricing for details.

One of the following:
const CacheControlEphemeralTTLTTL5m CacheControlEphemeralTTL = "5m"
const CacheControlEphemeralTTLTTL1h CacheControlEphemeralTTL = "1h"
type CacheCreation struct { Ephemeral1hInputTokens; Ephemeral5mInputTokens }
Ephemeral1hInputTokens int64

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

default0
minimum0
Ephemeral5mInputTokens int64

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

default0
minimum0
type CacheMissMessagesChanged struct { Type: "messages_changed"; CacheMissedInputTokens }
Type MessagesChanged
defaultmessages_changed
CacheMissedInputTokens int64

Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

type CacheMissModelChanged struct { Type: "model_changed"; CacheMissedInputTokens }
Type ModelChanged
defaultmodel_changed
CacheMissedInputTokens int64

Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

type CacheMissPreviousMessageNotFound struct { Type: "previous_message_not_found" }
Type PreviousMessageNotFound
defaultprevious_message_not_found
type CacheMissReasonUnion interface{…}
One of the following:
type CacheMissSystemChanged struct { Type: "system_changed"; CacheMissedInputTokens }
Type SystemChanged
defaultsystem_changed
CacheMissedInputTokens int64

Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

type CacheMissToolsChanged struct { Type: "tools_changed"; CacheMissedInputTokens }
Type ToolsChanged
defaulttools_changed
CacheMissedInputTokens int64

Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

type CacheMissUnavailable struct { Type: "unavailable" }
Type Unavailable
defaultunavailable
type CitationCharLocation struct { Type: "char_location"; CitedText; DocumentIndex; /* 4 more */ }
Type CharLocation
defaultchar_location
CitedText string
DocumentIndex int64
minimum0
DocumentTitle string
EndCharIndex int64
FileID string
StartCharIndex int64
minimum0
type CitationCharLocationParam struct { Type: "char_location"; CitedText; DocumentIndex; /* 3 more */ }
Type CharLocation
CitedText string
DocumentIndex int64
minimum0
DocumentTitle string
minLength1
maxLength500
EndCharIndex int64
StartCharIndex int64
minimum0
type CitationContentBlockLocation struct { Type: "content_block_location"; CitedText; DocumentIndex; /* 4 more */ }
Type ContentBlockLocation
defaultcontent_block_location
CitedText string

The full text of the cited block range, concatenated.

Always equals the contents of content[start_block_index:end_block_index] joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

DocumentIndex int64
minimum0
DocumentTitle string
EndBlockIndex int64

Exclusive 0-based end index of the cited block range in the source's content array.

Always greater than start_block_index; a single-block citation has end_block_index = start_block_index + 1.

FileID string
StartBlockIndex int64

0-based index of the first cited block in the source's content array.

minimum0
type CitationContentBlockLocationParam struct { Type: "content_block_location"; CitedText; DocumentIndex; /* 3 more */ }
Type ContentBlockLocation
CitedText string

The full text of the cited block range, concatenated.

Always equals the contents of content[start_block_index:end_block_index] joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

DocumentIndex int64
minimum0
DocumentTitle string
minLength1
maxLength500
EndBlockIndex int64

Exclusive 0-based end index of the cited block range in the source's content array.

Always greater than start_block_index; a single-block citation has end_block_index = start_block_index + 1.

StartBlockIndex int64

0-based index of the first cited block in the source's content array.

minimum0
type CitationPageLocation struct { Type: "page_location"; CitedText; DocumentIndex; /* 4 more */ }
Type PageLocation
defaultpage_location
CitedText string
DocumentIndex int64
minimum0
DocumentTitle string
EndPageNumber int64
FileID string
StartPageNumber int64
minimum1
type CitationPageLocationParam struct { Type: "page_location"; CitedText; DocumentIndex; /* 3 more */ }
Type PageLocation
CitedText string
DocumentIndex int64
minimum0
DocumentTitle string
minLength1
maxLength500
EndPageNumber int64
StartPageNumber int64
minimum1
type CitationSearchResultLocationParam struct { Type: "search_result_location"; CitedText; EndBlockIndex; /* 4 more */ }
Type SearchResultLocation
CitedText string

The full text of the cited block range, concatenated.

Always equals the contents of content[start_block_index:end_block_index] joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

EndBlockIndex int64

Exclusive 0-based end index of the cited block range in the source's content array.

Always greater than start_block_index; a single-block citation has end_block_index = start_block_index + 1.

SearchResultIndex int64

0-based index of the cited search result among all search_result content blocks in the request, in the order they appear across messages and tool results.

Counted separately from document_index; server-side web search results are not included in this count.

minimum0
Source string
StartBlockIndex int64

0-based index of the first cited block in the source's content array.

minimum0
Title string
type CitationWebSearchResultLocationParam struct { Type: "web_search_result_location"; CitedText; EncryptedIndex; /* 2 more */ }
Type WebSearchResultLocation
CitedText string
EncryptedIndex string
Title string
minLength1
maxLength512
URL string
minLength1
type CitationsConfig struct { Enabled }
Enabled bool
defaultfalse
type CitationsConfigParam struct { Enabled }
Enabled bool Optional
type CitationsDelta struct { Type: "citations_delta"; Citation }
type CitationsSearchResultLocation struct { Type: "search_result_location"; CitedText; EndBlockIndex; /* 4 more */ }
Type SearchResultLocation
defaultsearch_result_location
CitedText string

The full text of the cited block range, concatenated.

Always equals the contents of content[start_block_index:end_block_index] joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

EndBlockIndex int64

Exclusive 0-based end index of the cited block range in the source's content array.

Always greater than start_block_index; a single-block citation has end_block_index = start_block_index + 1.

SearchResultIndex int64

0-based index of the cited search result among all search_result content blocks in the request, in the order they appear across messages and tool results.

Counted separately from document_index; server-side web search results are not included in this count.

minimum0
Source string
StartBlockIndex int64

0-based index of the first cited block in the source's content array.

minimum0
Title string
type CitationsWebSearchResultLocation struct { Type: "web_search_result_location"; CitedText; EncryptedIndex; /* 2 more */ }
Type WebSearchResultLocation
defaultweb_search_result_location
CitedText string
EncryptedIndex string
Title string
maxLength512
URL string
type CodeExecutionOutputBlock struct { Type: "code_execution_output"; FileID }
Type CodeExecutionOutput
defaultcode_execution_output
FileID string
type CodeExecutionOutputBlockParam struct { Type: "code_execution_output"; FileID }
Type CodeExecutionOutput
FileID string
type CodeExecutionResultBlock struct { Type: "code_execution_result"; Content; ReturnCode; /* 2 more */ }
Type CodeExecutionResult
defaultcode_execution_result
Type CodeExecutionOutput
defaultcode_execution_output
FileID string
ReturnCode int64
Stderr string
Stdout string
type CodeExecutionResultBlockParam struct { Type: "code_execution_result"; Content; ReturnCode; /* 2 more */ }
Type CodeExecutionResult
Type CodeExecutionOutput
FileID string
ReturnCode int64
Stderr string
Stdout string
type CodeExecutionTool20250522Param struct { Type: "code_execution_20250522"; Name; AllowedCallers; /* 3 more */ }
type CodeExecutionTool20250825Param struct { Type: "code_execution_20250825"; Name; AllowedCallers; /* 3 more */ }
type CodeExecutionTool20260120Param struct { Type: "code_execution_20260120"; Name; AllowedCallers; /* 3 more */ }

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

type CodeExecutionTool20260521Param struct { Type: "code_execution_20260521"; Name; AllowedCallers; /* 3 more */ }

Code execution tool with REPL state persistence.

type CodeExecutionToolResultBlock struct { Type: "code_execution_tool_result"; Content; ToolUseID }
Type CodeExecutionToolResult
defaultcode_execution_tool_result
One of the following:
ToolUseID string
pattern^srvtoolu_[a-zA-Z0-9_]+$
type CodeExecutionToolResultBlockContentUnion interface{…}
One of the following:
type CodeExecutionToolResultBlockParam struct { Type: "code_execution_tool_result"; Content; ToolUseID; CacheControl }
Type CodeExecutionToolResult
One of the following:
ToolUseID string
pattern^srvtoolu_[a-zA-Z0-9_]+$
CacheControl CacheControlEphemeralParam Optional

Create a cache control breakpoint at this content block.

Type Ephemeral
TTL CacheControlEphemeralTTL Optional

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. See prompt caching pricing for details.

One of the following:
const CacheControlEphemeralTTLTTL5m CacheControlEphemeralTTL = "5m"
const CacheControlEphemeralTTLTTL1h CacheControlEphemeralTTL = "1h"
type CodeExecutionToolResultBlockParamContentUnion interface{…}
One of the following:
type CodeExecutionToolResultError struct { Type: "code_execution_tool_result_error"; ErrorCode }
Type CodeExecutionToolResultError
defaultcode_execution_tool_result_error
One of the following:
const CodeExecutionToolResultErrorCodeInvalidToolInput CodeExecutionToolResultErrorCode = "invalid_tool_input"
const CodeExecutionToolResultErrorCodeUnavailable CodeExecutionToolResultErrorCode = "unavailable"
const CodeExecutionToolResultErrorCodeTooManyRequests CodeExecutionToolResultErrorCode = "too_many_requests"
const CodeExecutionToolResultErrorCodeExecutionTimeExceeded CodeExecutionToolResultErrorCode = "execution_time_exceeded"
type CodeExecutionToolResultErrorCode string
One of the following:
const CodeExecutionToolResultErrorCodeInvalidToolInput CodeExecutionToolResultErrorCode = "invalid_tool_input"
const CodeExecutionToolResultErrorCodeUnavailable CodeExecutionToolResultErrorCode = "unavailable"
const CodeExecutionToolResultErrorCodeTooManyRequests CodeExecutionToolResultErrorCode = "too_many_requests"
const CodeExecutionToolResultErrorCodeExecutionTimeExceeded CodeExecutionToolResultErrorCode = "execution_time_exceeded"
type CodeExecutionToolResultErrorParam struct { Type: "code_execution_tool_result_error"; ErrorCode }
Type CodeExecutionToolResultError
One of the following:
const CodeExecutionToolResultErrorCodeInvalidToolInput CodeExecutionToolResultErrorCode = "invalid_tool_input"
const CodeExecutionToolResultErrorCodeUnavailable CodeExecutionToolResultErrorCode = "unavailable"
const CodeExecutionToolResultErrorCodeTooManyRequests CodeExecutionToolResultErrorCode = "too_many_requests"
const CodeExecutionToolResultErrorCodeExecutionTimeExceeded CodeExecutionToolResultErrorCode = "execution_time_exceeded"
type ComputerCursorPositionConfigParam struct { DeferLoading; Enabled }

cursor_position's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type ComputerCursorPositionInput struct{…}

Get the current (x, y) pixel coordinate of the cursor.

type ComputerCursorPositionToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type ComputerDoubleClickConfigParam struct { DeferLoading; Enabled }

double_click's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type ComputerDoubleClickInput struct { Coordinate; Text }

Double-click the left mouse button at the specified (x, y) pixel coordinate, or the current cursor position if coordinate is omitted.

Coordinate []int64 Optional

(x, y): x pixels from the left edge, y pixels from the top edge.

minItems2
maxItems2
Text string Optional

Optional key combination to hold down during this action (e.g. "ctrl", "shift", "ctrl+shift").

type ComputerDoubleClickToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type ComputerHoldKeyConfigParam struct { DeferLoading; Enabled }

hold_key's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type ComputerHoldKeyInput struct { Duration; Text }

Hold down a key or key-combination for a specified duration. Uses the same key syntax as key.

Duration int64

Duration to hold the key, in seconds.

maximum300
Text string

The key or key-combination to hold.

type ComputerHoldKeyToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type ComputerKeyConfigParam struct { DeferLoading; Enabled }

key's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type ComputerKeyInput struct { Text; Repeat }

Press a key or key-combination on the keyboard. Use "+" to combine modifiers with a key (e.g. "ctrl+s", "alt+Tab", "ctrl+shift+Escape"). Key names are case-insensitive; common names like "Return", "Tab", "Escape", "Up", "Down", "Left", "Right", "Home", "End", "Page_Up", "Page_Down", "Delete", "BackSpace" are supported.

Text string

The key or key-combination to press.

Repeat int64 Optional

Number of times to repeat the key press. Default is 1.

minimum1
maximum100
type ComputerKeyToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type ComputerLeftClickConfigParam struct { DeferLoading; Enabled }

left_click's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type ComputerLeftClickDragConfigParam struct { DeferLoading; Enabled }

left_click_drag's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type ComputerLeftClickDragInput struct { Coordinate; StartCoordinate; Text }

Click and drag the cursor from start_coordinate to coordinate.

Coordinate []int64

(x, y): x pixels from the left edge, y pixels from the top edge.

minItems2
maxItems2
StartCoordinate []int64

(x, y): x pixels from the left edge, y pixels from the top edge.

minItems2
maxItems2
Text string Optional

Optional key combination to hold down during this action (e.g. "ctrl", "shift", "ctrl+shift").

type ComputerLeftClickDragToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type ComputerLeftClickInput struct { Coordinate; Text }

Click the left mouse button at the specified (x, y) pixel coordinate, or the current cursor position if coordinate is omitted.

Coordinate []int64 Optional

(x, y): x pixels from the left edge, y pixels from the top edge.

minItems2
maxItems2
Text string Optional

Optional key combination to hold down during this action (e.g. "ctrl", "shift", "ctrl+shift").

type ComputerLeftClickToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type ComputerLeftMouseDownConfigParam struct { DeferLoading; Enabled }

left_mouse_down's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type ComputerLeftMouseDownInput struct{…}

Press and hold the left mouse button at the current cursor position.

type ComputerLeftMouseDownToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type ComputerLeftMouseUpConfigParam struct { DeferLoading; Enabled }

left_mouse_up's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type ComputerLeftMouseUpInput struct{…}

Release the left mouse button.

type ComputerLeftMouseUpToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type ComputerMiddleClickConfigParam struct { DeferLoading; Enabled }

middle_click's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type ComputerMiddleClickInput struct { Coordinate; Text }

Click the middle mouse button at the specified (x, y) pixel coordinate, or the current cursor position if coordinate is omitted.

Coordinate []int64 Optional

(x, y): x pixels from the left edge, y pixels from the top edge.

minItems2
maxItems2
Text string Optional

Optional key combination to hold down during this action (e.g. "ctrl", "shift", "ctrl+shift").

type ComputerMiddleClickToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type ComputerMouseMoveConfigParam struct { DeferLoading; Enabled }

mouse_move's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type ComputerMouseMoveInput struct { Coordinate }

Move the cursor to a specified (x, y) pixel coordinate. Use this ONLY to hover without clicking; otherwise use a click action directly.

Coordinate []int64

(x, y): x pixels from the left edge, y pixels from the top edge.

minItems2
maxItems2
type ComputerMouseMoveToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type ComputerRightClickConfigParam struct { DeferLoading; Enabled }

right_click's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type ComputerRightClickInput struct { Coordinate; Text }

Click the right mouse button at the specified (x, y) pixel coordinate, or the current cursor position if coordinate is omitted.

Coordinate []int64 Optional

(x, y): x pixels from the left edge, y pixels from the top edge.

minItems2
maxItems2
Text string Optional

Optional key combination to hold down during this action (e.g. "ctrl", "shift", "ctrl+shift").

type ComputerRightClickToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type ComputerScreenshotConfigParam struct { DeferLoading; Enabled }

screenshot's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type ComputerScreenshotInput struct{…}

Take a screenshot of the screen.

type ComputerScreenshotToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type ComputerScrollConfigParam struct { DeferLoading; Enabled }

scroll's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type ComputerScrollDirection string
One of the following:
const ComputerScrollDirectionUp ComputerScrollDirection = "up"
const ComputerScrollDirectionDown ComputerScrollDirection = "down"
const ComputerScrollDirectionLeft ComputerScrollDirection = "left"
const ComputerScrollDirectionRight ComputerScrollDirection = "right"
type ComputerScrollInput struct { ScrollAmount; ScrollDirection; Coordinate; Text }

Scroll the screen at the specified (x, y) pixel coordinate, or the current cursor position if coordinate is omitted. Do NOT use PageUp/PageDown to scroll.

ScrollAmount int64

Number of 'clicks' of the scroll wheel.

ScrollDirection ComputerScrollDirection
One of the following:
const ComputerScrollDirectionUp ComputerScrollDirection = "up"
const ComputerScrollDirectionDown ComputerScrollDirection = "down"
const ComputerScrollDirectionLeft ComputerScrollDirection = "left"
const ComputerScrollDirectionRight ComputerScrollDirection = "right"
Coordinate []int64 Optional

(x, y): x pixels from the left edge, y pixels from the top edge.

minItems2
maxItems2
Text string Optional

Optional key combination to hold down during this action (e.g. "ctrl", "shift", "ctrl+shift").

type ComputerScrollToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type ComputerToolUseBlockUnion interface{…}
One of the following:
type ComputerToolset20260801Param struct { Type: "computer_toolset_20260801"; CacheControl; Configs }

The computer toolset: a single tools[] entry (carrying no name) that declares the computer tool family. The model is served the family's tool with any members disabled via configs removed from its schema. Every member is enabled by default, zoom included. The single-tool options display_number and enable_zoom are not fields of a toolset entry — it carries only type, configs, and cache_control; zoom is controlled via configs.zoom.enabled.

Type ComputerToolset20260801
CacheControl CacheControlEphemeralParam Optional

Create a cache control breakpoint at this content block.

Type Ephemeral
TTL CacheControlEphemeralTTL Optional

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. See prompt caching pricing for details.

One of the following:
const CacheControlEphemeralTTLTTL5m CacheControlEphemeralTTL = "5m"
const CacheControlEphemeralTTLTTL1h CacheControlEphemeralTTL = "1h"
Configs ComputerToolsetConfigsParam Optional

Sparse per-member overrides, keyed by member name. Absent, null, and {} are equivalent; a member's defaults apply wherever its key is absent.

type ComputerToolsetConfigsParam struct { Type; CursorPosition; DoubleClick; /* 14 more */ }

Per-member configuration for computer_toolset_20260801: one optional field per member tool, keyed by the member name — the same name the member's tool_use blocks carry. Every member is an accepted key, and a member's defaults apply wherever its key is absent. Unknown keys are rejected: the field set is this toolset version's complete member set.

type ComputerTripleClickConfigParam struct { DeferLoading; Enabled }

triple_click's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type ComputerTripleClickInput struct { Coordinate; Text }

Triple-click the left mouse button at the specified (x, y) pixel coordinate, or the current cursor position if coordinate is omitted.

Coordinate []int64 Optional

(x, y): x pixels from the left edge, y pixels from the top edge.

minItems2
maxItems2
Text string Optional

Optional key combination to hold down during this action (e.g. "ctrl", "shift", "ctrl+shift").

type ComputerTripleClickToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type ComputerTypeConfigParam struct { DeferLoading; Enabled }

type's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type ComputerTypeInput struct { Text }

Type a string of text on the keyboard.

Text string

The text to type.

type ComputerTypeToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type ComputerWaitConfigParam struct { DeferLoading; Enabled }

wait's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type ComputerWaitInput struct { Duration }

Wait for a specified duration.

Duration int64

Duration to wait, in seconds.

maximum300
type ComputerWaitToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type ComputerZoomConfigParam struct { DeferLoading; Enabled }

zoom's config overrides.

DeferLoading bool Optional

Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.

Enabled bool Optional

Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.

type ComputerZoomInput struct { Region }

Take a screenshot of a rectangular region. Region coordinates are in the full-screenshot space (not physical display pixels). The crop is scaled up to fill the image budget so fine details become legible.

Region []int64

(x0, y0, x1, y1): The region to capture.

minItems4
maxItems4
type ComputerZoomToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type Container struct { ID; ExpiresAt; Skills }

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

ID string

Identifier for the container used in this request

ExpiresAt Time

The time at which the container will expire.

formatdate-time
Skills []ContainerSkill

Skills loaded in the container

Type ContainerSkillType

Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

One of the following:
const ContainerSkillTypeAnthropic ContainerSkillType = "anthropic"
const ContainerSkillTypeCustom ContainerSkillType = "custom"
SkillID string

Skill ID

minLength1
maxLength64
Version string

The resolved version: a skill version ID for custom skills.

minLength1
maxLength64
type ContainerParams struct { ID; Skills }

Container parameters with skills to be loaded.

ID string Optional

Container id

Skills []SkillParams Optional

List of skills to load in the container

maxItems20
Type SkillParamsType

Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

One of the following:
const SkillParamsTypeAnthropic SkillParamsType = "anthropic"
const SkillParamsTypeCustom SkillParamsType = "custom"
SkillID string

Skill ID

minLength1
maxLength64
Version string Optional

Skill version or 'latest' for most recent version

minLength1
maxLength64
type ContainerSkill struct { Type; SkillID; Version }

A skill that was loaded in a container (response model).

Type ContainerSkillType

Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

One of the following:
const ContainerSkillTypeAnthropic ContainerSkillType = "anthropic"
const ContainerSkillTypeCustom ContainerSkillType = "custom"
SkillID string

Skill ID

minLength1
maxLength64
Version string

The resolved version: a skill version ID for custom skills.

minLength1
maxLength64
type ContainerUploadBlock struct { Type: "container_upload"; FileID }

Response model for a file uploaded to the container.

Type ContainerUpload
defaultcontainer_upload
FileID string
type ContainerUploadBlockParam struct { Type: "container_upload"; FileID; CacheControl }

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.

Type ContainerUpload
FileID string
CacheControl CacheControlEphemeralParam Optional

Create a cache control breakpoint at this content block.

Type Ephemeral
TTL CacheControlEphemeralTTL Optional

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. See prompt caching pricing for details.

One of the following:
const CacheControlEphemeralTTLTTL5m CacheControlEphemeralTTL = "5m"
const CacheControlEphemeralTTLTTL1h CacheControlEphemeralTTL = "1h"
type ContentBlockUnion interface{…}
One of the following:
type ContentBlockParamUnion interface{…}
One of the following:
type ContentBlockSourceParam struct { Type: "content"; Content }
Type Content
Content ContentBlockSourceContentUnionParam
One of the following:
string
One of the following:
type TextBlockParam struct { Type: "text"; Text; CacheControl; Citations }
type ImageBlockParam struct { Type: "image"; Source; CacheControl; Transformations }
type ContentBlockSourceContentItemUnionParam interface{…}
One of the following:
type TextBlockParam struct { Type: "text"; Text; CacheControl; Citations }
type ImageBlockParam struct { Type: "image"; Source; CacheControl; Transformations }
type Diagnostics struct { CacheMissReason }

Request-level diagnostics: why the prompt cache could not fully reuse the prefix of the request named by diagnostics.previous_message_id.

CacheMissReason CacheMissReasonUnion

Explains why the prompt cache could not fully reuse the prefix from the request identified by diagnostics.previous_message_id. null means diagnosis is still pending — the response was serialized before the background comparison completed.

One of the following:
type DiagnosticsParam struct { PreviousMessageID }

Request-level diagnostics. Currently carries the previous response id for prompt-cache divergence reporting.

PreviousMessageID string Optional

The id (msg_...) from this client's previous /v1/messages response. The server compares that request's prompt fingerprint against this one and returns diagnostics.cache_miss_reason when the prompt-cache prefix could not be reused. Pass null on the first turn to opt in without a prior message to compare.

maxLength256
type DirectCaller struct { Type: "direct" }

Tool invocation directly from the model.

Type Direct
type DocumentBlock struct { Type: "document"; Citations; Source; Title }
type DocumentBlockParam struct { Type: "document"; Source; CacheControl; /* 3 more */ }
type EncryptedCodeExecutionResultBlock struct { Type: "encrypted_code_execution_result"; Content; EncryptedStdout; /* 2 more */ }

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

Type EncryptedCodeExecutionResult
defaultencrypted_code_execution_result
Type CodeExecutionOutput
defaultcode_execution_output
FileID string
EncryptedStdout string
ReturnCode int64
Stderr string
type EncryptedCodeExecutionResultBlockParam struct { Type: "encrypted_code_execution_result"; Content; EncryptedStdout; /* 2 more */ }

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

Type EncryptedCodeExecutionResult
Type CodeExecutionOutput
FileID string
EncryptedStdout string
ReturnCode int64
Stderr string
type FileDocumentSourceParam struct { Type: "file"; FileID }
Type File
FileID string
type FileImageSourceParam struct { Type: "file"; FileID }
Type File
FileID string
type ImageBlockParam struct { Type: "image"; Source; CacheControl; Transformations }
type ImageTransformationsParam struct { OversizedImage }

Configures the transformations the server applies to this image before the model observes it. Each key names a condition the server transforms images for; its value selects the transformation applied. Omitted keys keep their default behavior, and an empty object is equivalent to omitting the field.

OversizedImage ImageTransformationsParamOversizedImage Optional

What the server does when this image exceeds the model's maximum image size. "downsize" (the default) scales the image down to fit, which changes the dimensions the model observes without telling you. "error" instead rejects the request with a 400 error naming the image's dimensions and the largest dimensions that fit, so you can scale the image deliberately — your image is never silently scaled down.

One of the following:
const ImageTransformationsParamOversizedImageDownsize ImageTransformationsParamOversizedImage = "downsize"
const ImageTransformationsParamOversizedImageError ImageTransformationsParamOversizedImage = "error"
type InputJSONDelta struct { Type: "input_json_delta"; PartialJSON }
Type InputJSONDelta
defaultinput_json_delta
PartialJSON string
type JSONOutputFormatParam struct { Type: "json_schema"; Schema }
Type JSONSchema
Schema map[string, any]

The JSON schema of the format

type MemoryTool20250818Param struct { Type: "memory_20250818"; Name; AllowedCallers; /* 4 more */ }
type Message struct { Type: "message"; ID; Container; /* 8 more */ }
type MessageCountTokensToolUnionParam interface{…}
One of the following:
type MessageCreateParamsContainerUnion interface{…}

Container identifier for reuse across requests.

One of the following:
type ContainerParams struct { ID; Skills }

Container parameters with skills to be loaded.

ID string Optional

Container id

Skills []SkillParams Optional

List of skills to load in the container

maxItems20
Type SkillParamsType

Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

One of the following:
const SkillParamsTypeAnthropic SkillParamsType = "anthropic"
const SkillParamsTypeCustom SkillParamsType = "custom"
SkillID string

Skill ID

minLength1
maxLength64
Version string Optional

Skill version or 'latest' for most recent version

minLength1
maxLength64
string
type MessageDeltaUsage struct { CacheCreationInputTokens; CacheReadInputTokens; InputTokens; /* 3 more */ }
CacheCreationInputTokens int64

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

minimum0
CacheReadInputTokens int64

The cumulative number of input tokens read from the cache.

minimum0
InputTokens int64

The cumulative number of input tokens which were used.

minimum0
OutputTokens int64

The cumulative number of output tokens which were used.

OutputTokensDetails OutputTokensDetails

Breakdown of output tokens by category.

output_tokens remains the inclusive, authoritative total used for billing. This object provides a read-only decomposition for observability — for example, how many of the billed output tokens were spent on internal reasoning that may have been summarized before being returned to you.

ThinkingTokens int64

Number of output tokens the model generated as internal reasoning, including the thinking-block delimiter tokens.

Reflects the raw reasoning the model produced, not the (possibly shorter) summarized thinking text returned in the response body. Computed by re-tokenizing the raw reasoning text, so it may differ from the model's exact generation count by a small number of tokens. Always ≤ output_tokens; output_tokens - thinking_tokens approximates the non-reasoning output.

default0
minimum0
ServerToolUse ServerToolUsage

The number of server tool requests.

WebFetchRequests int64

The number of web fetch tool requests.

default0
minimum0
WebSearchRequests int64

The number of web search tool requests.

default0
minimum0
type MessageParam struct { Content; Role }
type MessageTokensCount struct { InputTokens }
InputTokens int64

The total number of tokens across the provided list of messages, system prompt, and tools.

type MetadataParam struct { UserID }
UserID string Optional

An external identifier for the user who is associated with the request.

This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number.

maxLength512
type Model string

The model that will complete your prompt.

See models for additional details and options.

One of the following:
type OutputConfigParam struct { Effort; Format }
Effort OutputConfigEffort Optional

How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.

Valid values are low, medium, high, xhigh, or max.

One of the following:
const OutputConfigEffortLow OutputConfigEffort = "low"
const OutputConfigEffortMedium OutputConfigEffort = "medium"
const OutputConfigEffortHigh OutputConfigEffort = "high"
const OutputConfigEffortXhigh OutputConfigEffort = "xhigh"
const OutputConfigEffortMax OutputConfigEffort = "max"
Format JSONOutputFormatParam Optional

A schema to specify Claude's output format in responses. See structured outputs

Type JSONSchema
Schema map[string, any]

The JSON schema of the format

type OutputTokensDetails struct { ThinkingTokens }
ThinkingTokens int64

Number of output tokens the model generated as internal reasoning, including the thinking-block delimiter tokens.

Reflects the raw reasoning the model produced, not the (possibly shorter) summarized thinking text returned in the response body. Computed by re-tokenizing the raw reasoning text, so it may differ from the model's exact generation count by a small number of tokens. Always ≤ output_tokens; output_tokens - thinking_tokens approximates the non-reasoning output.

default0
minimum0
type PlainTextSource struct { Type: "text"; Data; MediaType }
Type Text
Data string
MediaType TextPlain
type RawContentBlockDeltaUnion interface{…}
One of the following:
type ContentBlockDeltaEvent struct { Type: "content_block_delta"; Delta; Index }
Type ContentBlockDelta
defaultcontent_block_delta
One of the following:
Index int64
type ContentBlockStartEvent struct { Type: "content_block_start"; ContentBlock; Index }
type ContentBlockStopEvent struct { Type: "content_block_stop"; Index }
Type ContentBlockStop
defaultcontent_block_stop
Index int64
type MessageDeltaEvent struct { Type: "message_delta"; Delta; Usage }
type MessageStartEvent struct { Type: "message_start"; Message }
Type MessageStart
defaultmessage_start
Message Message
type MessageStopEvent struct { Type: "message_stop" }
Type MessageStop
defaultmessage_stop
type MessageStreamEventUnion interface{…}
One of the following:
type RedactedThinkingBlock struct { Type: "redacted_thinking"; Data }
Type RedactedThinking
defaultredacted_thinking
Data string

The contents of this redacted thinking block, returned when portions of the model's thinking were safety-redacted. This field is opaque and encrypted, with no readable content.

Pass redacted_thinking blocks back to the API unchanged when continuing a multi-turn conversation.

See extended thinking for details.

type RedactedThinkingBlockParam struct { Type: "redacted_thinking"; Data }
Type RedactedThinking
Data string

The data value of this redacted thinking block, exactly as returned by the API in a previous response. Opaque and encrypted; pass it back unchanged.

type RefusalStopDetails struct { Type: "refusal"; Category; Explanation }

Structured information about a refusal.

Type Refusal
defaultrefusal
Category RefusalStopDetailsCategory

The policy category that triggered the refusal.

null when the refusal doesn't map to a named category.

One of the following:
const RefusalStopDetailsCategoryCyber RefusalStopDetailsCategory = "cyber"

The request could enable cyber harm, such as malware or exploit development. Benign cybersecurity work can also trigger this category.

const RefusalStopDetailsCategoryBio RefusalStopDetailsCategory = "bio"

The request could enable biological harm, such as dangerous lab methods. Beneficial life sciences work can also trigger this category.

const RefusalStopDetailsCategoryFrontierLLM RefusalStopDetailsCategory = "frontier_llm"

The request could assist the development of competing AI models, which is restricted under Anthropic's commercial terms. Benign machine learning work can also trigger this category.

const RefusalStopDetailsCategoryReasoningExtraction RefusalStopDetailsCategory = "reasoning_extraction"

The request asks the model to reproduce its internal reasoning in the response text. To get reasoning in a structured form instead, use adaptive thinking.

const RefusalStopDetailsCategoryGeneralHarms RefusalStopDetailsCategory = "general_harms"

The request could be related to an area that was determined as harmful. Benign work might sometimes trigger this category.

Explanation string

Human-readable explanation of the refusal.

This text is not guaranteed to be stable. null when no explanation is available for the category.

type SearchResultBlockParam struct { Type: "search_result"; Content; Source; /* 3 more */ }
type ServerToolCaller struct { Type: "code_execution_20250825"; ToolID }

Tool invocation generated by a server-side tool.

Type CodeExecution20250825
ToolID string
pattern^srvtoolu_[a-zA-Z0-9_]+$
type ServerToolCaller20260120 struct { Type: "code_execution_20260120"; ToolID }
Type CodeExecution20260120
ToolID string
pattern^srvtoolu_[a-zA-Z0-9_]+$
type ServerToolUsage struct { WebFetchRequests; WebSearchRequests }
WebFetchRequests int64

The number of web fetch tool requests.

default0
minimum0
WebSearchRequests int64

The number of web search tool requests.

default0
minimum0
type ServerToolUseBlock struct { Type: "server_tool_use"; ID; Caller; /* 2 more */ }
type ServerToolUseBlockParam struct { Type: "server_tool_use"; ID; Input; /* 3 more */ }
type SignatureDelta struct { Type: "signature_delta"; Signature }
Type SignatureDelta
defaultsignature_delta
Signature string

The signature for this thinking block: an opaque value used to verify that the block was generated by Claude when it is passed back to the API. Delivered in a signature_delta event just before the block's content_block_stop event.

type SkillParams struct { Type; SkillID; Version }

Specification for a skill to be loaded in a container (request model).

Type SkillParamsType

Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

One of the following:
const SkillParamsTypeAnthropic SkillParamsType = "anthropic"
const SkillParamsTypeCustom SkillParamsType = "custom"
SkillID string

Skill ID

minLength1
maxLength64
Version string Optional

Skill version or 'latest' for most recent version

minLength1
maxLength64
type StopReason string
One of the following:
const StopReasonEndTurn StopReason = "end_turn"
const StopReasonMaxTokens StopReason = "max_tokens"
const StopReasonStopSequence StopReason = "stop_sequence"
const StopReasonToolUse StopReason = "tool_use"
const StopReasonPauseTurn StopReason = "pause_turn"
const StopReasonRefusal StopReason = "refusal"
const StopReasonModelContextWindowExceeded StopReason = "model_context_window_exceeded"
type TextBlock struct { Type: "text"; Citations; Text }
type TextBlockParam struct { Type: "text"; Text; CacheControl; Citations }
type TextCitationUnion interface{…}
One of the following:
type TextCitationParamUnion interface{…}
One of the following:
type TextDelta struct { Type: "text_delta"; Text }
Type TextDelta
defaulttext_delta
Text string
type TextEditorCodeExecutionCreateResultBlock struct { Type: "text_editor_code_execution_create_result"; IsFileUpdate }
Type TextEditorCodeExecutionCreateResult
defaulttext_editor_code_execution_create_result
IsFileUpdate bool
type TextEditorCodeExecutionCreateResultBlockParam struct { Type: "text_editor_code_execution_create_result"; IsFileUpdate }
Type TextEditorCodeExecutionCreateResult
IsFileUpdate bool
type TextEditorCodeExecutionStrReplaceResultBlock struct { Type: "text_editor_code_execution_str_replace_result"; Lines; NewLines; /* 3 more */ }
Type TextEditorCodeExecutionStrReplaceResult
defaulttext_editor_code_execution_str_replace_result
Lines []string
NewLines int64
NewStart int64
OldLines int64
OldStart int64
type TextEditorCodeExecutionStrReplaceResultBlockParam struct { Type: "text_editor_code_execution_str_replace_result"; Lines; NewLines; /* 3 more */ }
Type TextEditorCodeExecutionStrReplaceResult
Lines []string Optional
NewLines int64 Optional
NewStart int64 Optional
OldLines int64 Optional
OldStart int64 Optional
type TextEditorCodeExecutionToolResultBlock struct { Type: "text_editor_code_execution_tool_result"; Content; ToolUseID }
type TextEditorCodeExecutionToolResultBlockParam struct { Type: "text_editor_code_execution_tool_result"; Content; ToolUseID; CacheControl }
type TextEditorCodeExecutionToolResultError struct { Type: "text_editor_code_execution_tool_result_error"; ErrorCode; ErrorMessage }
Type TextEditorCodeExecutionToolResultError
defaulttext_editor_code_execution_tool_result_error
One of the following:
const TextEditorCodeExecutionToolResultErrorCodeInvalidToolInput TextEditorCodeExecutionToolResultErrorCode = "invalid_tool_input"
const TextEditorCodeExecutionToolResultErrorCodeUnavailable TextEditorCodeExecutionToolResultErrorCode = "unavailable"
const TextEditorCodeExecutionToolResultErrorCodeTooManyRequests TextEditorCodeExecutionToolResultErrorCode = "too_many_requests"
const TextEditorCodeExecutionToolResultErrorCodeExecutionTimeExceeded TextEditorCodeExecutionToolResultErrorCode = "execution_time_exceeded"
const TextEditorCodeExecutionToolResultErrorCodeFileNotFound TextEditorCodeExecutionToolResultErrorCode = "file_not_found"
ErrorMessage string
type TextEditorCodeExecutionToolResultErrorCode string
One of the following:
const TextEditorCodeExecutionToolResultErrorCodeInvalidToolInput TextEditorCodeExecutionToolResultErrorCode = "invalid_tool_input"
const TextEditorCodeExecutionToolResultErrorCodeUnavailable TextEditorCodeExecutionToolResultErrorCode = "unavailable"
const TextEditorCodeExecutionToolResultErrorCodeTooManyRequests TextEditorCodeExecutionToolResultErrorCode = "too_many_requests"
const TextEditorCodeExecutionToolResultErrorCodeExecutionTimeExceeded TextEditorCodeExecutionToolResultErrorCode = "execution_time_exceeded"
const TextEditorCodeExecutionToolResultErrorCodeFileNotFound TextEditorCodeExecutionToolResultErrorCode = "file_not_found"
type TextEditorCodeExecutionToolResultErrorParam struct { Type: "text_editor_code_execution_tool_result_error"; ErrorCode; ErrorMessage }
Type TextEditorCodeExecutionToolResultError
One of the following:
const TextEditorCodeExecutionToolResultErrorCodeInvalidToolInput TextEditorCodeExecutionToolResultErrorCode = "invalid_tool_input"
const TextEditorCodeExecutionToolResultErrorCodeUnavailable TextEditorCodeExecutionToolResultErrorCode = "unavailable"
const TextEditorCodeExecutionToolResultErrorCodeTooManyRequests TextEditorCodeExecutionToolResultErrorCode = "too_many_requests"
const TextEditorCodeExecutionToolResultErrorCodeExecutionTimeExceeded TextEditorCodeExecutionToolResultErrorCode = "execution_time_exceeded"
const TextEditorCodeExecutionToolResultErrorCodeFileNotFound TextEditorCodeExecutionToolResultErrorCode = "file_not_found"
ErrorMessage string Optional
type TextEditorCodeExecutionViewResultBlock struct { Type: "text_editor_code_execution_view_result"; Content; FileType; /* 3 more */ }
Type TextEditorCodeExecutionViewResult
defaulttext_editor_code_execution_view_result
Content string
FileType TextEditorCodeExecutionViewResultBlockFileType
One of the following:
const TextEditorCodeExecutionViewResultBlockFileTypeText TextEditorCodeExecutionViewResultBlockFileType = "text"
const TextEditorCodeExecutionViewResultBlockFileTypeImage TextEditorCodeExecutionViewResultBlockFileType = "image"
const TextEditorCodeExecutionViewResultBlockFileTypePDF TextEditorCodeExecutionViewResultBlockFileType = "pdf"
NumLines int64
StartLine int64
TotalLines int64
type TextEditorCodeExecutionViewResultBlockParam struct { Type: "text_editor_code_execution_view_result"; Content; FileType; /* 3 more */ }
Type TextEditorCodeExecutionViewResult
Content string
FileType TextEditorCodeExecutionViewResultBlockParamFileType
One of the following:
const TextEditorCodeExecutionViewResultBlockParamFileTypeText TextEditorCodeExecutionViewResultBlockParamFileType = "text"
const TextEditorCodeExecutionViewResultBlockParamFileTypeImage TextEditorCodeExecutionViewResultBlockParamFileType = "image"
const TextEditorCodeExecutionViewResultBlockParamFileTypePDF TextEditorCodeExecutionViewResultBlockParamFileType = "pdf"
NumLines int64 Optional
StartLine int64 Optional
TotalLines int64 Optional
type ThinkingBlock struct { Type: "thinking"; Signature; Thinking }
Type Thinking
defaultthinking
Signature string

A value used to verify that this thinking block was generated by Claude when it is passed back to the API.

This is an opaque field and should not be interpreted or parsed. When passing thinking blocks back to the API (required when using tools with extended thinking), pass them back exactly as received, with this field intact.

See extended thinking for details.

Thinking string

The text of Claude's thinking process for this block.

type ThinkingBlockParam struct { Type: "thinking"; Signature; Thinking }
Type Thinking
Signature string

The signature value of this thinking block, exactly as returned by the API in a previous response. Used to verify that the block was generated by Claude.

Thinking blocks must be passed back unmodified and in their original order; a modified block results in a 400 invalid_request_error.

Thinking string

The thinking text of this block as returned by the API.

type ThinkingConfigAdaptiveParam struct { Type: "adaptive"; Display }
Type Adaptive
Display ThinkingConfigAdaptiveDisplay Optional

Controls how thinking content appears in the response. When set to summarized, thinking is returned normally. When set to omitted, thinking content is redacted but a signature is returned for multi-turn continuity. The default depends on the model; see Controlling thinking display.

One of the following:
const ThinkingConfigAdaptiveDisplaySummarized ThinkingConfigAdaptiveDisplay = "summarized"
const ThinkingConfigAdaptiveDisplayOmitted ThinkingConfigAdaptiveDisplay = "omitted"
type ThinkingConfigBetweenToolsParam struct { Type: "between_tools" }
Type BetweenTools
type ThinkingConfigDisabledParam struct { Type: "disabled" }
Type Disabled
type ThinkingConfigEnabledParam struct { Type: "enabled"; BudgetTokens; Display }
Type Enabled
BudgetTokens int64

Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.

Must be ≥1024 and less than max_tokens.

See extended thinking for details.

minimum1024
Display ThinkingConfigEnabledDisplay Optional

Controls how thinking content appears in the response. When set to summarized, thinking is returned normally. When set to omitted, thinking content is redacted but a signature is returned for multi-turn continuity. The default depends on the model; see Controlling thinking display.

One of the following:
const ThinkingConfigEnabledDisplaySummarized ThinkingConfigEnabledDisplay = "summarized"
const ThinkingConfigEnabledDisplayOmitted ThinkingConfigEnabledDisplay = "omitted"
type ThinkingConfigParamUnion interface{…}

Configuration for Claude's thinking.

With {"type": "adaptive"}, Claude decides when and how much to think. With {"type": "enabled"} (manual extended thinking), you set a budget_tokens of at least 1,024. Thinking tokens count toward your max_tokens limit.

Which type values are accepted, and what happens when you omit thinking, depend on the model. See thinking for each model's behavior.

One of the following:
type ThinkingDelta struct { Type: "thinking_delta"; Thinking }
Type ThinkingDelta
defaultthinking_delta
Thinking string

The incremental thinking text for this content block. Concatenate the thinking values of successive thinking_delta events to assemble the block's full thinking value.

type ToolParam struct { Type: "custom"; InputSchema; Name; /* 7 more */ }
type ToolBash20250124Param struct { Type: "bash_20250124"; Name; AllowedCallers; /* 4 more */ }
type ToolChoiceUnionParam interface{…}

How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.

One of the following:
type ToolChoiceAnyParam struct { Type: "any"; DisableParallelToolUse }

The model will use any available tools.

Type Any
DisableParallelToolUse bool Optional

Whether to disable parallel tool use.

Defaults to false. If set to true, the model will output exactly one tool use.

type ToolChoiceAutoParam struct { Type: "auto"; DisableParallelToolUse }

The model will automatically decide whether to use tools.

Type Auto
DisableParallelToolUse bool Optional

Whether to disable parallel tool use.

Defaults to false. If set to true, the model will output at most one tool use.

type ToolChoiceNoneParam struct { Type: "none" }

The model will not be allowed to use tools.

Type None
type ToolChoiceToolParam struct { Type: "tool"; Name; DisableParallelToolUse }

The model will use the specified tool with tool_choice.name.

Type Tool
Name string

The name of the tool to use.

DisableParallelToolUse bool Optional

Whether to disable parallel tool use.

Defaults to false. If set to true, the model will output exactly one tool use.

type ToolReferenceBlock struct { Type: "tool_reference"; ToolName }
Type ToolReference
defaulttool_reference
ToolName string
minLength1
maxLength256
pattern^[a-zA-Z0-9_-]{1,256}$
type ToolReferenceBlockParam struct { Type: "tool_reference"; ToolName; CacheControl }

Tool reference block that can be included in tool_result content.

Type ToolReference
ToolName string
minLength1
maxLength256
pattern^[a-zA-Z0-9_-]{1,256}$
CacheControl CacheControlEphemeralParam Optional

Create a cache control breakpoint at this content block.

Type Ephemeral
TTL CacheControlEphemeralTTL Optional

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. See prompt caching pricing for details.

One of the following:
const CacheControlEphemeralTTLTTL5m CacheControlEphemeralTTL = "5m"
const CacheControlEphemeralTTLTTL1h CacheControlEphemeralTTL = "1h"
type ToolResultBlockParam struct { Type: "tool_result"; ToolUseID; CacheControl; /* 3 more */ }
type ToolSearchToolBm25_20251119Param struct { Type; Name; AllowedCallers; /* 3 more */ }
type ToolSearchToolRegex20251119Param struct { Type; Name; AllowedCallers; /* 3 more */ }
type ToolSearchToolResultBlock struct { Type: "tool_search_tool_result"; Content; ToolUseID }
type ToolSearchToolResultBlockParam struct { Type: "tool_search_tool_result"; Content; ToolUseID; CacheControl }
type ToolSearchToolResultError struct { Type: "tool_search_tool_result_error"; ErrorCode; ErrorMessage }
Type ToolSearchToolResultError
defaulttool_search_tool_result_error
One of the following:
const ToolSearchToolResultErrorCodeInvalidToolInput ToolSearchToolResultErrorCode = "invalid_tool_input"
const ToolSearchToolResultErrorCodeUnavailable ToolSearchToolResultErrorCode = "unavailable"
const ToolSearchToolResultErrorCodeTooManyRequests ToolSearchToolResultErrorCode = "too_many_requests"
const ToolSearchToolResultErrorCodeExecutionTimeExceeded ToolSearchToolResultErrorCode = "execution_time_exceeded"
ErrorMessage string
type ToolSearchToolResultErrorCode string
One of the following:
const ToolSearchToolResultErrorCodeInvalidToolInput ToolSearchToolResultErrorCode = "invalid_tool_input"
const ToolSearchToolResultErrorCodeUnavailable ToolSearchToolResultErrorCode = "unavailable"
const ToolSearchToolResultErrorCodeTooManyRequests ToolSearchToolResultErrorCode = "too_many_requests"
const ToolSearchToolResultErrorCodeExecutionTimeExceeded ToolSearchToolResultErrorCode = "execution_time_exceeded"
type ToolSearchToolResultErrorParam struct { Type: "tool_search_tool_result_error"; ErrorCode; ErrorMessage }
Type ToolSearchToolResultError
One of the following:
const ToolSearchToolResultErrorCodeInvalidToolInput ToolSearchToolResultErrorCode = "invalid_tool_input"
const ToolSearchToolResultErrorCodeUnavailable ToolSearchToolResultErrorCode = "unavailable"
const ToolSearchToolResultErrorCodeTooManyRequests ToolSearchToolResultErrorCode = "too_many_requests"
const ToolSearchToolResultErrorCodeExecutionTimeExceeded ToolSearchToolResultErrorCode = "execution_time_exceeded"
ErrorMessage string Optional
type ToolSearchToolSearchResultBlock struct { Type: "tool_search_tool_search_result"; ToolReferences }
Type ToolSearchToolSearchResult
defaulttool_search_tool_search_result
ToolReferences []ToolReferenceBlock
Type ToolReference
defaulttool_reference
ToolName string
minLength1
maxLength256
pattern^[a-zA-Z0-9_-]{1,256}$
type ToolSearchToolSearchResultBlockParam struct { Type: "tool_search_tool_search_result"; ToolReferences }
Type ToolSearchToolSearchResult
ToolReferences []ToolReferenceBlockParam
Type ToolReference
ToolName string
minLength1
maxLength256
pattern^[a-zA-Z0-9_-]{1,256}$
CacheControl CacheControlEphemeralParam Optional

Create a cache control breakpoint at this content block.

Type Ephemeral
TTL CacheControlEphemeralTTL Optional

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. See prompt caching pricing for details.

One of the following:
const CacheControlEphemeralTTLTTL5m CacheControlEphemeralTTL = "5m"
const CacheControlEphemeralTTLTTL1h CacheControlEphemeralTTL = "1h"
type ToolTextEditor20250124Param struct { Type: "text_editor_20250124"; Name; AllowedCallers; /* 4 more */ }
type ToolTextEditor20250429Param struct { Type: "text_editor_20250429"; Name; AllowedCallers; /* 4 more */ }
type ToolTextEditor20250728Param struct { Type: "text_editor_20250728"; Name; AllowedCallers; /* 5 more */ }
type ToolUnionParam interface{…}
One of the following:
type ToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type ToolUseBlockParam struct { Type: "tool_use"; ID; Input; /* 4 more */ }
type ToolUseCallerUnion interface{…}

Which party invoked the tool call: the model directly, or a server tool on its behalf.

One of the following:
type DirectCaller struct { Type: "direct" }

Tool invocation directly from the model.

Type Direct
type ServerToolCaller struct { Type: "code_execution_20250825"; ToolID }

Tool invocation generated by a server-side tool.

Type CodeExecution20250825
ToolID string
pattern^srvtoolu_[a-zA-Z0-9_]+$
type ServerToolCaller20260120 struct { Type: "code_execution_20260120"; ToolID }
Type CodeExecution20260120
ToolID string
pattern^srvtoolu_[a-zA-Z0-9_]+$
type ToolsetToolUseBlockUnion interface{…}
One of the following:
type BrowserToolUseBlockUnion interface{…}
One of the following:
type ComputerToolUseBlockUnion interface{…}
One of the following:
type ToolUseBlock struct { Type: "tool_use"; ID; Caller; /* 3 more */ }
type URLImageSourceParam struct { Type: "url"; URL }
Type URL
URL string
type URLPDFSourceParam struct { Type: "url"; URL }
Type URL
URL string
type Usage struct { CacheCreation; CacheCreationInputTokens; CacheReadInputTokens; /* 7 more */ }
type UserLocationParam struct { Type: "approximate"; City; Country; /* 2 more */ }
Type Approximate
City string Optional

The city of the user.

minLength1
maxLength255
Country string Optional

The two letter ISO country code of the user.

minLength2
maxLength2
Region string Optional

The region of the user.

minLength1
maxLength255
Timezone string Optional

The IANA timezone of the user.

minLength1
maxLength255
type WebFetchBlock struct { Type: "web_fetch_result"; Content; RetrievedAt; URL }
type WebFetchBlockParam struct { Type: "web_fetch_result"; Content; URL; RetrievedAt }
Type WebFetchResult
URL string

Fetched content URL

RetrievedAt string Optional

ISO 8601 timestamp when the content was retrieved

type WebFetchTool20250910Param struct { Type: "web_fetch_20250910"; Name; AllowedCallers; /* 9 more */ }
type WebFetchTool20260209Param struct { Type: "web_fetch_20260209"; Name; AllowedCallers; /* 9 more */ }
type WebFetchTool20260309Param struct { Type: "web_fetch_20260309"; Name; AllowedCallers; /* 10 more */ }

Web fetch tool with use_cache parameter for bypassing cached content.

type WebFetchTool20260318Param struct { Type: "web_fetch_20260318"; Name; AllowedCallers; /* 11 more */ }
type WebFetchToolResultBlock struct { Type: "web_fetch_tool_result"; Caller; Content; ToolUseID }
type WebFetchToolResultBlockParam struct { Type: "web_fetch_tool_result"; Content; ToolUseID; /* 2 more */ }
type WebFetchToolResultErrorBlock struct { Type: "web_fetch_tool_result_error"; ErrorCode }
type WebFetchToolResultErrorBlockParam struct { Type: "web_fetch_tool_result_error"; ErrorCode }
type WebFetchToolResultErrorCode string
One of the following:
const WebFetchToolResultErrorCodeInvalidToolInput WebFetchToolResultErrorCode = "invalid_tool_input"
const WebFetchToolResultErrorCodeURLTooLong WebFetchToolResultErrorCode = "url_too_long"
const WebFetchToolResultErrorCodeURLNotAllowed WebFetchToolResultErrorCode = "url_not_allowed"
const WebFetchToolResultErrorCodeURLNotInPriorContext WebFetchToolResultErrorCode = "url_not_in_prior_context"
const WebFetchToolResultErrorCodeURLNotAccessible WebFetchToolResultErrorCode = "url_not_accessible"
const WebFetchToolResultErrorCodeUnsupportedContentType WebFetchToolResultErrorCode = "unsupported_content_type"
const WebFetchToolResultErrorCodeTooManyRequests WebFetchToolResultErrorCode = "too_many_requests"
const WebFetchToolResultErrorCodeMaxUsesExceeded WebFetchToolResultErrorCode = "max_uses_exceeded"
const WebFetchToolResultErrorCodeUnavailable WebFetchToolResultErrorCode = "unavailable"
const WebFetchToolResultErrorCodeContentTooLarge WebFetchToolResultErrorCode = "content_too_large"
type WebFetchURLSourceAllParam struct { Type: "all" }

The url_sources variant under which a source contributes in full: every result of the tool filter's source, or all user input.

Type All
type WebFetchURLSourceExceptParam struct { Type: "except"; Tools }

The tool filter variant under which every result but the named tools' contributes.

Type Except
Type ToolReference
Name string
type WebFetchURLSourceNoneParam struct { Type: "none" }

The url_sources variant under which a source contributes nothing: no result of the tool filter's source, or no user input.

Type None
type WebFetchURLSourceOnlyParam struct { Type: "only"; Tools }

The tool filter variant under which only the named tools' results contribute.

Type Only
Type ToolReference
Name string
type WebFetchURLSourceToolReferenceParam struct { Type: "tool_reference"; Name }

One entry of a tool filter's tools: it must name a tool declared in this request's tools[].

Type ToolReference
Name string
type WebFetchURLSourcesParam struct { ClientToolResults; ServerToolResults; UserInput }

Which sources contribute to the set of URLs web fetch may fetch.

Each key is a tagged variant: user_input is all or none; the two tool filters are all, none, only (only the named tools' results) or except (every result but the named tools'). A named tool must be declared in this request's tools[].

type WebSearchResultBlock struct { Type: "web_search_result"; EncryptedContent; PageAge; /* 2 more */ }
Type WebSearchResult
defaultweb_search_result
EncryptedContent string
PageAge string
Title string
URL string
type WebSearchResultBlockParam struct { Type: "web_search_result"; EncryptedContent; Title; /* 2 more */ }
Type WebSearchResult
EncryptedContent string
Title string
URL string
PageAge string Optional
type WebSearchTool20250305Param struct { Type: "web_search_20250305"; Name; AllowedCallers; /* 7 more */ }
type WebSearchTool20260209Param struct { Type: "web_search_20260209"; Name; AllowedCallers; /* 7 more */ }
type WebSearchTool20260318Param struct { Type: "web_search_20260318"; Name; AllowedCallers; /* 8 more */ }
type WebSearchToolRequestErrorParam struct { Type: "web_search_tool_result_error"; ErrorCode }
Type WebSearchToolResultError
One of the following:
const WebSearchToolResultErrorCodeInvalidToolInput WebSearchToolResultErrorCode = "invalid_tool_input"
const WebSearchToolResultErrorCodeUnavailable WebSearchToolResultErrorCode = "unavailable"
const WebSearchToolResultErrorCodeMaxUsesExceeded WebSearchToolResultErrorCode = "max_uses_exceeded"
const WebSearchToolResultErrorCodeTooManyRequests WebSearchToolResultErrorCode = "too_many_requests"
const WebSearchToolResultErrorCodeQueryTooLong WebSearchToolResultErrorCode = "query_too_long"
const WebSearchToolResultErrorCodeRequestTooLarge WebSearchToolResultErrorCode = "request_too_large"
type WebSearchToolResultBlock struct { Type: "web_search_tool_result"; Caller; Content; ToolUseID }
type WebSearchToolResultBlockContentUnion interface{…}
One of the following:
type WebSearchToolResultBlockParam struct { Type: "web_search_tool_result"; Content; ToolUseID; /* 2 more */ }
type WebSearchToolResultBlockParamContentUnion interface{…}
One of the following:
type WebSearchToolResultError struct { Type: "web_search_tool_result_error"; ErrorCode }
Type WebSearchToolResultError
defaultweb_search_tool_result_error
One of the following:
const WebSearchToolResultErrorCodeInvalidToolInput WebSearchToolResultErrorCode = "invalid_tool_input"
const WebSearchToolResultErrorCodeUnavailable WebSearchToolResultErrorCode = "unavailable"
const WebSearchToolResultErrorCodeMaxUsesExceeded WebSearchToolResultErrorCode = "max_uses_exceeded"
const WebSearchToolResultErrorCodeTooManyRequests WebSearchToolResultErrorCode = "too_many_requests"
const WebSearchToolResultErrorCodeQueryTooLong WebSearchToolResultErrorCode = "query_too_long"
const WebSearchToolResultErrorCodeRequestTooLarge WebSearchToolResultErrorCode = "request_too_large"
type WebSearchToolResultErrorCode string
One of the following:
const WebSearchToolResultErrorCodeInvalidToolInput WebSearchToolResultErrorCode = "invalid_tool_input"
const WebSearchToolResultErrorCodeUnavailable WebSearchToolResultErrorCode = "unavailable"
const WebSearchToolResultErrorCodeMaxUsesExceeded WebSearchToolResultErrorCode = "max_uses_exceeded"
const WebSearchToolResultErrorCodeTooManyRequests WebSearchToolResultErrorCode = "too_many_requests"
const WebSearchToolResultErrorCodeQueryTooLong WebSearchToolResultErrorCode = "query_too_long"
const WebSearchToolResultErrorCodeRequestTooLarge WebSearchToolResultErrorCode = "request_too_large"

NachrichtenBatches

Einen Message Batch erstellen
client.Messages.Batches.New(ctx, params) (*MessageBatch, error)
POST/v1/messages/batches

Sende einen Batch von Anfragen zur Erstellung von Nachrichten.

Einen Message Batch abrufen
client.Messages.Batches.Get(ctx, messageBatchID, query) (*MessageBatch, error)
GET/v1/messages/batches/{message_batch_id}

Dieser Endpunkt ist idempotent und kann verwendet werden, um den Abschluss eines Message Batch per Polling abzufragen. Um auf die Ergebnisse eines Message Batch zuzugreifen, sende eine Anfrage an die im Feld results_url der Antwort angegebene URL.

Message Batches auflisten
client.Messages.Batches.List(ctx, params) (*Page[MessageBatch], error)
GET/v1/messages/batches

Liste alle Message Batches innerhalb eines Workspace auf. Die zuletzt erstellten Batches werden zuerst zurückgegeben.

Einen Message Batch abbrechen
client.Messages.Batches.Cancel(ctx, messageBatchID, body) (*MessageBatch, error)
POST/v1/messages/batches/{message_batch_id}/cancel

Batches können jederzeit vor Ende der Verarbeitung abgebrochen werden. Sobald der Abbruch eingeleitet wurde, wechselt der Batch in den Zustand canceling; in dieser Zeit kann das System laufende, nicht unterbrechbare Anfragen noch abschließen, bevor der Abbruch finalisiert wird.

Einen Message Batch löschen
client.Messages.Batches.Delete(ctx, messageBatchID, body) (*DeletedMessageBatch, error)
DELETE/v1/messages/batches/{message_batch_id}

Lösche einen Message Batch.

Ergebnisse eines Message Batch abrufen
client.Messages.Batches.ResultsStreaming(ctx, messageBatchID, query) *jsonl.Stream[MessageBatchIndividualResponse]
GET/v1/messages/batches/{message_batch_id}/results

Streamt die Ergebnisse eines Message Batch als .jsonl-Datei.