Claude Platform Docs

消息

创建消息
messages.create(**kwargs) -> Message
POST/v1/messages

发送包含文本和/或图像内容的结构化输入消息列表,模型将生成对话中的下一条消息。

计算消息中的令牌数
messages.count_tokens(**kwargs) -> MessageTokensCount
POST/v1/messages/count_tokens

计算消息中的令牌数量。

Models
class Base64ImageSource: type: "base64"; data; media_type
type: Literal["base64"]
data: str
formatbyte
media_type: Literal["image/jpeg", "image/png", "image/gif", "image/webp"]
One of the following:
"image/jpeg"
"image/png"
"image/gif"
"image/webp"
class Base64PDFSource: type: "base64"; data; media_type
type: Literal["base64"]
data: str
formatbyte
media_type: Literal["application/pdf"]
class BashCodeExecutionOutputBlock: type: "bash_code_execution_output"; file_id
type: Literal["bash_code_execution_output"]
defaultbash_code_execution_output
file_id: str
class BashCodeExecutionOutputBlockParam: type: "bash_code_execution_output"; file_id
type: Literal["bash_code_execution_output"]
file_id: str
class BashCodeExecutionResultBlock: type: "bash_code_execution_result"; content; return_code; ... # 2 more
type: Literal["bash_code_execution_result"]
defaultbash_code_execution_result
type: Literal["bash_code_execution_output"]
defaultbash_code_execution_output
file_id: str
return_code: int
stderr: str
stdout: str
class BashCodeExecutionResultBlockParam: type: "bash_code_execution_result"; content; return_code; ... # 2 more
type: Literal["bash_code_execution_result"]
type: Literal["bash_code_execution_output"]
file_id: str
return_code: int
stderr: str
stdout: str
class BashCodeExecutionToolResultBlock: type: "bash_code_execution_tool_result"; content; tool_use_id
class BashCodeExecutionToolResultBlockParam: type: "bash_code_execution_tool_result"; content; tool_use_id; cache_control
class BashCodeExecutionToolResultError: type: "bash_code_execution_tool_result_error"; error_code
type: Literal["bash_code_execution_tool_result_error"]
defaultbash_code_execution_tool_result_error
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
"output_file_too_large"
type BashCodeExecutionToolResultErrorCode = Literal["invalid_tool_input", "unavailable", "too_many_requests", 2 more]
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
"output_file_too_large"
class BashCodeExecutionToolResultErrorParam: type: "bash_code_execution_tool_result_error"; error_code
type: Literal["bash_code_execution_tool_result_error"]
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
"output_file_too_large"
type BrowserClickTarget = ...

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

One of the following:
class BrowserCoordinateTarget: type: "coordinate"; x; y

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

type: Literal["coordinate"]
x: int

Pixels from the left edge of the viewport.

minimum0
y: int

Pixels from the top edge of the viewport.

minimum0
class BrowserRefTarget: 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: Literal["ref"]
ref: str

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

class BrowserCloseTabConfig: defer_loading; enabled

close_tab's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserCloseTabInput: tab_id

Close the tab with the given tab_id.

tab_id: str

The tab to close.

class BrowserCloseTabToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserCoordinateTarget: type: "coordinate"; x; y

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

type: Literal["coordinate"]
x: int

Pixels from the left edge of the viewport.

minimum0
y: int

Pixels from the top edge of the viewport.

minimum0
class BrowserDoubleClickConfig: defer_loading; enabled

double_click's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserDoubleClickInput: target; modifiers; tab_id

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

class BrowserDoubleClickToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserFileUploadConfig: defer_loading; enabled

file_upload's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserFileUploadInput: target; document_ids; paths; tab_id

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.

target: BrowserRefTarget

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: Literal["ref"]
ref: str

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

document_ids: Optional[List[str]]

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

minItems1
paths: Optional[List[str]]

File paths on the browser executor's filesystem.

minItems1
tab_id: Optional[str]

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

class BrowserFileUploadToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserFindConfig: defer_loading; enabled

find's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserFindInput: query; tab_id

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: str

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

tab_id: Optional[str]

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

class BrowserFindToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserFormInputConfig: defer_loading; enabled

form_input's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserFormInputInput: target; value; tab_id

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

target: BrowserRefTarget

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: Literal["ref"]
ref: str

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

The value to set.

One of the following:
str
float
bool
tab_id: Optional[str]

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

class BrowserFormInputToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
type BrowserFormInputValue = Union[str, float, bool]
One of the following:
str
float
bool
class BrowserGetPageTextConfig: defer_loading; enabled

get_page_text's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserGetPageTextInput: tab_id

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

tab_id: Optional[str]

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

class BrowserGetPageTextToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserHoldKeyConfig: defer_loading; enabled

hold_key's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserHoldKeyInput: duration; text; tab_id

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: float

Seconds to hold the key down (maximum 30).

minimum0
maximum30
text: str

The key or chord to hold.

tab_id: Optional[str]

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

class BrowserHoldKeyToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserHoverConfig: defer_loading; enabled

hover's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserHoverInput: target; tab_id

Move the cursor to a coordinate or element without clicking.

class BrowserHoverToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserJavascriptExecConfig: defer_loading; enabled

javascript_exec's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserJavascriptExecInput: text; tab_id

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: str

JavaScript to execute in the page context.

tab_id: Optional[str]

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

class BrowserJavascriptExecToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserKeyConfig: defer_loading; enabled

key's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserKeyInput: text; repeat; tab_id

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: str

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

repeat: Optional[int]

Number of times to repeat. Default 1.

minimum1
maximum100
tab_id: Optional[str]

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

class BrowserKeyToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserLeftClickConfig: defer_loading; enabled

left_click's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserLeftClickDragConfig: defer_loading; enabled

left_click_drag's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserLeftClickDragInput: from_; target; tab_id

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: Literal["coordinate"]
x: int

Pixels from the left edge of the viewport.

minimum0
y: int

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: Literal["coordinate"]
x: int

Pixels from the left edge of the viewport.

minimum0
y: int

Pixels from the top edge of the viewport.

minimum0
tab_id: Optional[str]

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

class BrowserLeftClickDragToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserLeftClickInput: target; modifiers; tab_id

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

class BrowserLeftClickToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserLeftMouseDownConfig: defer_loading; enabled

left_mouse_down's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserLeftMouseDownInput: target; tab_id

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: Literal["coordinate"]
x: int

Pixels from the left edge of the viewport.

minimum0
y: int

Pixels from the top edge of the viewport.

minimum0
tab_id: Optional[str]

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

class BrowserLeftMouseDownToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserLeftMouseUpConfig: defer_loading; enabled

left_mouse_up's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserLeftMouseUpInput: target; tab_id

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: Literal["coordinate"]
x: int

Pixels from the left edge of the viewport.

minimum0
y: int

Pixels from the top edge of the viewport.

minimum0
tab_id: Optional[str]

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

class BrowserLeftMouseUpToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserListTabsConfig: defer_loading; enabled

list_tabs's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserListTabsInput: ...

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

class BrowserListTabsToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserMiddleClickConfig: defer_loading; enabled

middle_click's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserMiddleClickInput: target; modifiers; tab_id

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

class BrowserMiddleClickToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserMouseMoveConfig: defer_loading; enabled

mouse_move's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserMouseMoveInput: target; tab_id

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: Literal["coordinate"]
x: int

Pixels from the left edge of the viewport.

minimum0
y: int

Pixels from the top edge of the viewport.

minimum0
tab_id: Optional[str]

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

class BrowserMouseMoveToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserNavigateConfig: defer_loading; enabled

navigate's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserNavigateInput: url; tab_id

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

url: str

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

tab_id: Optional[str]

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

class BrowserNavigateToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserNewTabConfig: defer_loading; enabled

new_tab's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserNewTabInput: ...

Open a new empty tab and return its tab_id.

class BrowserNewTabToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserReadConsoleConfig: defer_loading; enabled

read_console's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserReadConsoleInput: tab_id

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.

tab_id: Optional[str]

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

class BrowserReadConsoleToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserReadNetworkConfig: defer_loading; enabled

read_network's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserReadNetworkInput: tab_id

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.

tab_id: Optional[str]

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

class BrowserReadNetworkToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserReadPageConfig: defer_loading; enabled

read_page's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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 = Literal["all", "interactive"]
One of the following:
"all"
"interactive"
class BrowserReadPageInput: depth; filter; ref; tab_id

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: Optional[int]

Maximum tree depth. Default 15.

minimum1
filter: Optional[BrowserReadPageFilter]

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

One of the following:
"all"
"interactive"
ref: Optional[str]

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

tab_id: Optional[str]

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

class BrowserReadPageToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserRefTarget: 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: Literal["ref"]
ref: str

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

class BrowserRightClickConfig: defer_loading; enabled

right_click's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserRightClickInput: target; modifiers; tab_id

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

class BrowserRightClickToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserScreenshotConfig: defer_loading; enabled

screenshot's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserScreenshotInput: tab_id

Capture the current browser viewport.

tab_id: Optional[str]

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

class BrowserScreenshotToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserScrollConfig: defer_loading; enabled

scroll's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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 = Literal["up", "down", "left", "right"]
One of the following:
"up"
"down"
"left"
"right"
class BrowserScrollInput: scroll_direction; target; scroll_amount; tab_id

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

scroll_direction: BrowserScrollDirection
One of the following:
"up"
"down"
"left"
"right"

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

type: Literal["coordinate"]
x: int

Pixels from the left edge of the viewport.

minimum0
y: int

Pixels from the top edge of the viewport.

minimum0
scroll_amount: Optional[int]

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

minimum1
maximum10
tab_id: Optional[str]

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

class BrowserScrollToConfig: defer_loading; enabled

scroll_to's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserScrollToInput: target; tab_id

Scroll an element into view.

target: BrowserRefTarget

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: Literal["ref"]
ref: str

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

tab_id: Optional[str]

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

class BrowserScrollToToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserScrollToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserStateBlockParam: type: "browser_state"; tabs; cache_control; state_changes

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 BrowserStateChange = ...
One of the following:
class BrowserStateChangeDownloadCompleted: type: "download_completed"; download_id; 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: Literal["download_completed"]
download_id: str

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

minLength1
maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
url: str

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

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
path: Optional[str]

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]*$
size_bytes: Optional[int]

The completed download's size.

minimum0
class BrowserStateChangeDownloadFailed: type: "download_failed"; download_id; url; error

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

type: Literal["download_failed"]
download_id: str

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

minLength1
maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
url: str

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

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
error: Optional[str]

The failure or cancellation detail, when known.

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
class BrowserStateChangeDownloadStarted: type: "download_started"; download_id; url

A file download that started during this call.

type: Literal["download_started"]
download_id: str

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

minLength1
maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
url: str

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

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
class BrowserStateChangeTabOpened: type: "tab_opened"; tab_id

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: Literal["tab_opened"]
tab_id: str

The tab_id of the opened tab, present in tabs.

minLength1
maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
class BrowserStateTabEntry: tab_id; 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.

tab_id: str

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

minLength1
maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
title: str

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

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
url: str

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

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

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

class BrowserSwitchTabConfig: defer_loading; enabled

switch_tab's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserSwitchTabInput: tab_id

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

tab_id: str

The tab to switch to.

class BrowserSwitchTabToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
type BrowserToolUseBlock = ...
One of the following:
class BrowserToolset20260801: type: "browser_toolset_20260801"; cache_control; 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: Literal["browser_toolset_20260801"]
cache_control: Optional[CacheControlEphemeral]

Create a cache control breakpoint at this content block.

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

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

This may be one the following values:

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

Defaults to 5m. See prompt caching pricing for details.

One of the following:
"5m"
"1h"
configs: Optional[BrowserToolsetConfigs]

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

class BrowserToolsetConfigs: type; close_tab; double_click; ... # 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.

class BrowserTripleClickConfig: defer_loading; enabled

triple_click's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserTripleClickInput: target; modifiers; tab_id

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

class BrowserTripleClickToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserTypeConfig: defer_loading; enabled

type's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserTypeInput: text; tab_id

Type a literal string at the current focus.

text: str

The text to type.

tab_id: Optional[str]

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

class BrowserTypeToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserWaitConfig: defer_loading; enabled

wait's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserWaitInput: duration; tab_id

Pause for the given duration.

duration: float

Seconds to wait (maximum 30).

minimum0
maximum30
tab_id: Optional[str]

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

class BrowserWaitToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class BrowserZoomConfig: defer_loading; enabled

zoom's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class BrowserZoomInput: region; tab_id

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: List[int]

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

minItems4
maxItems4
tab_id: Optional[str]

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

class BrowserZoomToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class CacheControlEphemeral: type: "ephemeral"; ttl
type: Literal["ephemeral"]
ttl: Optional[Literal["5m", "1h"]]

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

This may be one the following values:

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

Defaults to 5m. See prompt caching pricing for details.

One of the following:
"5m"
"1h"
class CacheCreation: ephemeral_1h_input_tokens; ephemeral_5m_input_tokens
ephemeral_1h_input_tokens: int

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

default0
minimum0
ephemeral_5m_input_tokens: int

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

default0
minimum0
class CacheMissMessagesChanged: type: "messages_changed"; cache_missed_input_tokens
type: Literal["messages_changed"]
defaultmessages_changed
cache_missed_input_tokens: int

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

class CacheMissModelChanged: type: "model_changed"; cache_missed_input_tokens
type: Literal["model_changed"]
defaultmodel_changed
cache_missed_input_tokens: int

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

class CacheMissPreviousMessageNotFound: type: "previous_message_not_found"
type: Literal["previous_message_not_found"]
defaultprevious_message_not_found
type CacheMissReason = ...
One of the following:
class CacheMissSystemChanged: type: "system_changed"; cache_missed_input_tokens
type: Literal["system_changed"]
defaultsystem_changed
cache_missed_input_tokens: int

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

class CacheMissToolsChanged: type: "tools_changed"; cache_missed_input_tokens
type: Literal["tools_changed"]
defaulttools_changed
cache_missed_input_tokens: int

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

class CacheMissUnavailable: type: "unavailable"
type: Literal["unavailable"]
defaultunavailable
class CitationCharLocation: type: "char_location"; cited_text; document_index; ... # 4 more
type: Literal["char_location"]
defaultchar_location
cited_text: str
document_index: int
minimum0
document_title: Optional[str]
end_char_index: int
file_id: Optional[str]
start_char_index: int
minimum0
class CitationCharLocationParam: type: "char_location"; cited_text; document_index; ... # 3 more
type: Literal["char_location"]
cited_text: str
document_index: int
minimum0
document_title: Optional[str]
minLength1
maxLength500
end_char_index: int
start_char_index: int
minimum0
class CitationContentBlockLocation: type: "content_block_location"; cited_text; document_index; ... # 4 more
type: Literal["content_block_location"]
defaultcontent_block_location
cited_text: str

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.

document_index: int
minimum0
document_title: Optional[str]
end_block_index: int

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.

file_id: Optional[str]
start_block_index: int

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

minimum0
class CitationContentBlockLocationParam: type: "content_block_location"; cited_text; document_index; ... # 3 more
type: Literal["content_block_location"]
cited_text: str

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.

document_index: int
minimum0
document_title: Optional[str]
minLength1
maxLength500
end_block_index: int

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.

start_block_index: int

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

minimum0
class CitationPageLocation: type: "page_location"; cited_text; document_index; ... # 4 more
type: Literal["page_location"]
defaultpage_location
cited_text: str
document_index: int
minimum0
document_title: Optional[str]
end_page_number: int
file_id: Optional[str]
start_page_number: int
minimum1
class CitationPageLocationParam: type: "page_location"; cited_text; document_index; ... # 3 more
type: Literal["page_location"]
cited_text: str
document_index: int
minimum0
document_title: Optional[str]
minLength1
maxLength500
end_page_number: int
start_page_number: int
minimum1
class CitationSearchResultLocationParam: type: "search_result_location"; cited_text; end_block_index; ... # 4 more
type: Literal["search_result_location"]
cited_text: str

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.

end_block_index: int

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.

search_result_index: int

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: str
start_block_index: int

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

minimum0
title: Optional[str]
class CitationWebSearchResultLocationParam: type: "web_search_result_location"; cited_text; encrypted_index; ... # 2 more
type: Literal["web_search_result_location"]
cited_text: str
encrypted_index: str
title: Optional[str]
minLength1
maxLength512
url: str
minLength1
class CitationsConfig: enabled
enabled: bool
defaultfalse
class CitationsConfigParam: enabled
enabled: Optional[bool]
class CitationsDelta: type: "citations_delta"; citation
class CitationsSearchResultLocation: type: "search_result_location"; cited_text; end_block_index; ... # 4 more
type: Literal["search_result_location"]
defaultsearch_result_location
cited_text: str

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.

end_block_index: int

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.

search_result_index: int

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: str
start_block_index: int

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

minimum0
title: Optional[str]
class CitationsWebSearchResultLocation: type: "web_search_result_location"; cited_text; encrypted_index; ... # 2 more
type: Literal["web_search_result_location"]
defaultweb_search_result_location
cited_text: str
encrypted_index: str
title: Optional[str]
maxLength512
url: str
class CodeExecutionOutputBlock: type: "code_execution_output"; file_id
type: Literal["code_execution_output"]
defaultcode_execution_output
file_id: str
class CodeExecutionOutputBlockParam: type: "code_execution_output"; file_id
type: Literal["code_execution_output"]
file_id: str
class CodeExecutionResultBlock: type: "code_execution_result"; content; return_code; ... # 2 more
type: Literal["code_execution_result"]
defaultcode_execution_result
content: List[CodeExecutionOutputBlock]
type: Literal["code_execution_output"]
defaultcode_execution_output
file_id: str
return_code: int
stderr: str
stdout: str
class CodeExecutionResultBlockParam: type: "code_execution_result"; content; return_code; ... # 2 more
type: Literal["code_execution_result"]
type: Literal["code_execution_output"]
file_id: str
return_code: int
stderr: str
stdout: str
class CodeExecutionTool20250522: type: "code_execution_20250522"; name; allowed_callers; ... # 3 more
class CodeExecutionTool20250825: type: "code_execution_20250825"; name; allowed_callers; ... # 3 more
class CodeExecutionTool20260120: type: "code_execution_20260120"; name; allowed_callers; ... # 3 more

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

class CodeExecutionTool20260521: type: "code_execution_20260521"; name; allowed_callers; ... # 3 more

Code execution tool with REPL state persistence.

class CodeExecutionToolResultBlock: type: "code_execution_tool_result"; content; tool_use_id
type: Literal["code_execution_tool_result"]
defaultcode_execution_tool_result
One of the following:
tool_use_id: str
pattern^srvtoolu_[a-zA-Z0-9_]+$
type CodeExecutionToolResultBlockContent = ...
One of the following:
class CodeExecutionToolResultBlockParam: type: "code_execution_tool_result"; content; tool_use_id; cache_control
type: Literal["code_execution_tool_result"]
One of the following:
tool_use_id: str
pattern^srvtoolu_[a-zA-Z0-9_]+$
cache_control: Optional[CacheControlEphemeral]

Create a cache control breakpoint at this content block.

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

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

This may be one the following values:

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

Defaults to 5m. See prompt caching pricing for details.

One of the following:
"5m"
"1h"
type CodeExecutionToolResultBlockParamContent = ...
One of the following:
class CodeExecutionToolResultError: type: "code_execution_tool_result_error"; error_code
type: Literal["code_execution_tool_result_error"]
defaultcode_execution_tool_result_error
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
type CodeExecutionToolResultErrorCode = Literal["invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded"]
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
class CodeExecutionToolResultErrorParam: type: "code_execution_tool_result_error"; error_code
type: Literal["code_execution_tool_result_error"]
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
class ComputerCursorPositionConfig: defer_loading; enabled

cursor_position's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class ComputerCursorPositionInput: ...

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

class ComputerCursorPositionToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class ComputerDoubleClickConfig: defer_loading; enabled

double_click's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class ComputerDoubleClickInput: 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: Optional[List[int]]

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

minItems2
maxItems2
text: Optional[str]

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

class ComputerDoubleClickToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class ComputerHoldKeyConfig: defer_loading; enabled

hold_key's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class ComputerHoldKeyInput: duration; text

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

duration: int

Duration to hold the key, in seconds.

maximum300
text: str

The key or key-combination to hold.

class ComputerHoldKeyToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class ComputerKeyConfig: defer_loading; enabled

key's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class ComputerKeyInput: 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: str

The key or key-combination to press.

repeat: Optional[int]

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

minimum1
maximum100
class ComputerKeyToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class ComputerLeftClickConfig: defer_loading; enabled

left_click's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class ComputerLeftClickDragConfig: defer_loading; enabled

left_click_drag's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class ComputerLeftClickDragInput: coordinate; start_coordinate; text

Click and drag the cursor from start_coordinate to coordinate.

coordinate: List[int]

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

minItems2
maxItems2
start_coordinate: List[int]

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

minItems2
maxItems2
text: Optional[str]

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

class ComputerLeftClickDragToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class ComputerLeftClickInput: coordinate; text

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

coordinate: Optional[List[int]]

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

minItems2
maxItems2
text: Optional[str]

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

class ComputerLeftClickToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class ComputerLeftMouseDownConfig: defer_loading; enabled

left_mouse_down's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class ComputerLeftMouseDownInput: ...

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

class ComputerLeftMouseDownToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class ComputerLeftMouseUpConfig: defer_loading; enabled

left_mouse_up's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class ComputerLeftMouseUpInput: ...

Release the left mouse button.

class ComputerLeftMouseUpToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class ComputerMiddleClickConfig: defer_loading; enabled

middle_click's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class ComputerMiddleClickInput: coordinate; text

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

coordinate: Optional[List[int]]

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

minItems2
maxItems2
text: Optional[str]

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

class ComputerMiddleClickToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class ComputerMouseMoveConfig: defer_loading; enabled

mouse_move's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class ComputerMouseMoveInput: 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: List[int]

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

minItems2
maxItems2
class ComputerMouseMoveToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class ComputerRightClickConfig: defer_loading; enabled

right_click's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class ComputerRightClickInput: coordinate; text

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

coordinate: Optional[List[int]]

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

minItems2
maxItems2
text: Optional[str]

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

class ComputerRightClickToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class ComputerScreenshotConfig: defer_loading; enabled

screenshot's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class ComputerScreenshotInput: ...

Take a screenshot of the screen.

class ComputerScreenshotToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class ComputerScrollConfig: defer_loading; enabled

scroll's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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 = Literal["up", "down", "left", "right"]
One of the following:
"up"
"down"
"left"
"right"
class ComputerScrollInput: scroll_amount; scroll_direction; 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.

scroll_amount: int

Number of 'clicks' of the scroll wheel.

scroll_direction: ComputerScrollDirection
One of the following:
"up"
"down"
"left"
"right"
coordinate: Optional[List[int]]

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

minItems2
maxItems2
text: Optional[str]

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

class ComputerScrollToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
type ComputerToolUseBlock = ...
One of the following:
class ComputerToolset20260801: type: "computer_toolset_20260801"; cache_control; 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: Literal["computer_toolset_20260801"]
cache_control: Optional[CacheControlEphemeral]

Create a cache control breakpoint at this content block.

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

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

This may be one the following values:

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

Defaults to 5m. See prompt caching pricing for details.

One of the following:
"5m"
"1h"
configs: Optional[ComputerToolsetConfigs]

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

class ComputerToolsetConfigs: type; cursor_position; double_click; ... # 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.

class ComputerTripleClickConfig: defer_loading; enabled

triple_click's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class ComputerTripleClickInput: 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: Optional[List[int]]

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

minItems2
maxItems2
text: Optional[str]

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

class ComputerTripleClickToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class ComputerTypeConfig: defer_loading; enabled

type's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class ComputerTypeInput: text

Type a string of text on the keyboard.

text: str

The text to type.

class ComputerTypeToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class ComputerWaitConfig: defer_loading; enabled

wait's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class ComputerWaitInput: duration

Wait for a specified duration.

duration: int

Duration to wait, in seconds.

maximum300
class ComputerWaitToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class ComputerZoomConfig: defer_loading; enabled

zoom's config overrides.

defer_loading: Optional[bool]

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

enabled: Optional[bool]

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.

class ComputerZoomInput: 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: List[int]

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

minItems4
maxItems4
class ComputerZoomToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class Container: id; expires_at; skills

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

id: str

Identifier for the container used in this request

expires_at: datetime

The time at which the container will expire.

formatdate-time
skills: Optional[List[ContainerSkill]]

Skills loaded in the container

type: Literal["anthropic", "custom"]

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

One of the following:
"anthropic"
"custom"
skill_id: str

Skill ID

minLength1
maxLength64
version: str

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

minLength1
maxLength64
class ContainerParams: id; skills

Container parameters with skills to be loaded.

id: Optional[str]

Container id

skills: Optional[List[SkillParams]]

List of skills to load in the container

maxItems20
type: Literal["anthropic", "custom"]

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

One of the following:
"anthropic"
"custom"
skill_id: str

Skill ID

minLength1
maxLength64
version: Optional[str]

Skill version or 'latest' for most recent version

minLength1
maxLength64
class ContainerSkill: type; skill_id; version

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

type: Literal["anthropic", "custom"]

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

One of the following:
"anthropic"
"custom"
skill_id: str

Skill ID

minLength1
maxLength64
version: str

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

minLength1
maxLength64
class ContainerUploadBlock: type: "container_upload"; file_id

Response model for a file uploaded to the container.

type: Literal["container_upload"]
defaultcontainer_upload
file_id: str
class ContainerUploadBlockParam: type: "container_upload"; file_id; cache_control

A content block that represents a file to be uploaded to the container Files uploaded via this block will be available in the container's input directory.

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

Create a cache control breakpoint at this content block.

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

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

This may be one the following values:

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

Defaults to 5m. See prompt caching pricing for details.

One of the following:
"5m"
"1h"
type ContentBlock = ...
One of the following:
type ContentBlockParam = Union[TextBlockParam, ImageBlockParam, DocumentBlockParam, 13 more]
One of the following:
class ContentBlockSource: type: "content"; content
type: Literal["content"]
content: Union[str, List[ContentBlockSourceContent]]
One of the following:
str
One of the following:
class TextBlockParam: type: "text"; text; cache_control; citations
class ImageBlockParam: type: "image"; source; cache_control; transformations
type ContentBlockSourceContent = ...
One of the following:
class TextBlockParam: type: "text"; text; cache_control; citations
class ImageBlockParam: type: "image"; source; cache_control; transformations
class Diagnostics: cache_miss_reason

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

cache_miss_reason: Optional[CacheMissReason]

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:
class DiagnosticsParam: previous_message_id

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

previous_message_id: Optional[str]

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
class DirectCaller: type: "direct"

Tool invocation directly from the model.

type: Literal["direct"]
class DocumentBlock: type: "document"; citations; source; title
class DocumentBlockParam: type: "document"; source; cache_control; ... # 3 more
class EncryptedCodeExecutionResultBlock: type: "encrypted_code_execution_result"; content; encrypted_stdout; ... # 2 more

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

type: Literal["encrypted_code_execution_result"]
defaultencrypted_code_execution_result
content: List[CodeExecutionOutputBlock]
type: Literal["code_execution_output"]
defaultcode_execution_output
file_id: str
encrypted_stdout: str
return_code: int
stderr: str
class EncryptedCodeExecutionResultBlockParam: type: "encrypted_code_execution_result"; content; encrypted_stdout; ... # 2 more

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

type: Literal["encrypted_code_execution_result"]
type: Literal["code_execution_output"]
file_id: str
encrypted_stdout: str
return_code: int
stderr: str
class FileDocumentSource: type: "file"; file_id
type: Literal["file"]
file_id: str
class FileImageSource: type: "file"; file_id
type: Literal["file"]
file_id: str
class ImageBlockParam: type: "image"; source; cache_control; transformations
class ImageTransformationsParam: oversized_image

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.

oversized_image: Optional[Literal["downsize", "error"]]

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:
"downsize"
"error"
class InputJSONDelta: type: "input_json_delta"; partial_json
type: Literal["input_json_delta"]
defaultinput_json_delta
partial_json: str
class JSONOutputFormat: type: "json_schema"; schema
type: Literal["json_schema"]
schema: Dict[str, object]

The JSON schema of the format

class MemoryTool20250818: type: "memory_20250818"; name; allowed_callers; ... # 4 more
class Message: type: "message"; id; container; ... # 8 more
type MessageCountTokensTool = ...
One of the following:
type MessageCreateParamsContainer = Optional[MessageCreateParamsContainer]

Container identifier for reuse across requests.

One of the following:
class ContainerParams: id; skills

Container parameters with skills to be loaded.

id: Optional[str]

Container id

skills: Optional[List[SkillParams]]

List of skills to load in the container

maxItems20
type: Literal["anthropic", "custom"]

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

One of the following:
"anthropic"
"custom"
skill_id: str

Skill ID

minLength1
maxLength64
version: Optional[str]

Skill version or 'latest' for most recent version

minLength1
maxLength64
str
class MessageDeltaUsage: cache_creation_input_tokens; cache_read_input_tokens; input_tokens; ... # 3 more
class MessageParam: content; role
class MessageTokensCount: input_tokens
input_tokens: int

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

class Metadata: user_id
user_id: Optional[str]

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 = Union[Literal["claude-haiku-5-5", "claude-sonnet-5-5", "claude-fable-5-1", 17 more], str]

The model that will complete your prompt.

See models for additional details and options.

One of the following:
class OutputConfig: effort; format
effort: Optional[Literal["low", "medium", "high", 2 more]]

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:
"low"
"medium"
"high"
"xhigh"
"max"
format: Optional[JSONOutputFormat]

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

type: Literal["json_schema"]
schema: Dict[str, object]

The JSON schema of the format

class OutputTokensDetails: thinking_tokens
thinking_tokens: int

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
class PlainTextSource: type: "text"; data; media_type
type: Literal["text"]
data: str
media_type: Literal["text/plain"]
type RawContentBlockDelta = ...
One of the following:
class RawContentBlockDeltaEvent: type: "content_block_delta"; delta; index
type: Literal["content_block_delta"]
defaultcontent_block_delta
One of the following:
index: int
class RawContentBlockStartEvent: type: "content_block_start"; content_block; index
class RawContentBlockStopEvent: type: "content_block_stop"; index
type: Literal["content_block_stop"]
defaultcontent_block_stop
index: int
class RawMessageDeltaEvent: type: "message_delta"; delta; usage
class RawMessageStartEvent: type: "message_start"; message
type: Literal["message_start"]
defaultmessage_start
message: Message
class RawMessageStopEvent: type: "message_stop"
type: Literal["message_stop"]
defaultmessage_stop
type RawMessageStreamEvent = ...
One of the following:
class RedactedThinkingBlock: type: "redacted_thinking"; data
type: Literal["redacted_thinking"]
defaultredacted_thinking
data: str

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.

class RedactedThinkingBlockParam: type: "redacted_thinking"; data
type: Literal["redacted_thinking"]
data: str

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.

class RefusalStopDetails: type: "refusal"; category; explanation

Structured information about a refusal.

type: Literal["refusal"]
defaultrefusal
category: Optional[Literal["cyber", "bio", "frontier_llm", 2 more]]

The policy category that triggered the refusal.

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

One of the following:
"cyber"

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

"bio"

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

"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.

"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.

"general_harms"

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

explanation: Optional[str]

Human-readable explanation of the refusal.

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

class SearchResultBlockParam: type: "search_result"; content; source; ... # 3 more
class ServerToolCaller: type: "code_execution_20250825"; tool_id

Tool invocation generated by a server-side tool.

type: Literal["code_execution_20250825"]
tool_id: str
pattern^srvtoolu_[a-zA-Z0-9_]+$
class ServerToolCaller20260120: type: "code_execution_20260120"; tool_id
type: Literal["code_execution_20260120"]
tool_id: str
pattern^srvtoolu_[a-zA-Z0-9_]+$
class ServerToolUsage: web_fetch_requests; web_search_requests
web_fetch_requests: int

The number of web fetch tool requests.

default0
minimum0
web_search_requests: int

The number of web search tool requests.

default0
minimum0
class ServerToolUseBlock: type: "server_tool_use"; id; caller; ... # 2 more
class ServerToolUseBlockParam: type: "server_tool_use"; id; input; ... # 3 more
class SignatureDelta: type: "signature_delta"; signature
type: Literal["signature_delta"]
defaultsignature_delta
signature: str

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.

class SkillParams: type; skill_id; version

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

type: Literal["anthropic", "custom"]

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

One of the following:
"anthropic"
"custom"
skill_id: str

Skill ID

minLength1
maxLength64
version: Optional[str]

Skill version or 'latest' for most recent version

minLength1
maxLength64
type StopReason = Literal["end_turn", "max_tokens", "stop_sequence", 4 more]
One of the following:
"end_turn"
"max_tokens"
"stop_sequence"
"tool_use"
"pause_turn"
"refusal"
"model_context_window_exceeded"
class TextBlock: type: "text"; citations; text
class TextBlockParam: type: "text"; text; cache_control; citations
type TextCitation = ...
One of the following:
type TextCitationParam = ...
One of the following:
class TextDelta: type: "text_delta"; text
type: Literal["text_delta"]
defaulttext_delta
text: str
class TextEditorCodeExecutionCreateResultBlock: type: "text_editor_code_execution_create_result"; is_file_update
type: Literal["text_editor_code_execution_create_result"]
defaulttext_editor_code_execution_create_result
is_file_update: bool
class TextEditorCodeExecutionCreateResultBlockParam: type: "text_editor_code_execution_create_result"; is_file_update
type: Literal["text_editor_code_execution_create_result"]
is_file_update: bool
class TextEditorCodeExecutionStrReplaceResultBlock: type: "text_editor_code_execution_str_replace_result"; lines; new_lines; ... # 3 more
type: Literal["text_editor_code_execution_str_replace_result"]
defaulttext_editor_code_execution_str_replace_result
lines: Optional[List[str]]
new_lines: Optional[int]
new_start: Optional[int]
old_lines: Optional[int]
old_start: Optional[int]
class TextEditorCodeExecutionStrReplaceResultBlockParam: type: "text_editor_code_execution_str_replace_result"; lines; new_lines; ... # 3 more
type: Literal["text_editor_code_execution_str_replace_result"]
lines: Optional[List[str]]
new_lines: Optional[int]
new_start: Optional[int]
old_lines: Optional[int]
old_start: Optional[int]
class TextEditorCodeExecutionToolResultBlock: type: "text_editor_code_execution_tool_result"; content; tool_use_id
class TextEditorCodeExecutionToolResultBlockParam: type: "text_editor_code_execution_tool_result"; content; tool_use_id; cache_control
class TextEditorCodeExecutionToolResultError: type: "text_editor_code_execution_tool_result_error"; error_code; error_message
type: Literal["text_editor_code_execution_tool_result_error"]
defaulttext_editor_code_execution_tool_result_error
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
"file_not_found"
error_message: Optional[str]
type TextEditorCodeExecutionToolResultErrorCode = Literal["invalid_tool_input", "unavailable", "too_many_requests", 2 more]
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
"file_not_found"
class TextEditorCodeExecutionToolResultErrorParam: type: "text_editor_code_execution_tool_result_error"; error_code; error_message
type: Literal["text_editor_code_execution_tool_result_error"]
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
"file_not_found"
error_message: Optional[str]
class TextEditorCodeExecutionViewResultBlock: type: "text_editor_code_execution_view_result"; content; file_type; ... # 3 more
type: Literal["text_editor_code_execution_view_result"]
defaulttext_editor_code_execution_view_result
content: str
file_type: Literal["text", "image", "pdf"]
One of the following:
"text"
"image"
"pdf"
num_lines: Optional[int]
start_line: Optional[int]
total_lines: Optional[int]
class TextEditorCodeExecutionViewResultBlockParam: type: "text_editor_code_execution_view_result"; content; file_type; ... # 3 more
type: Literal["text_editor_code_execution_view_result"]
content: str
file_type: Literal["text", "image", "pdf"]
One of the following:
"text"
"image"
"pdf"
num_lines: Optional[int]
start_line: Optional[int]
total_lines: Optional[int]
class ThinkingBlock: type: "thinking"; signature; thinking
type: Literal["thinking"]
defaultthinking
signature: str

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: str

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

class ThinkingBlockParam: type: "thinking"; signature; thinking
type: Literal["thinking"]
signature: str

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: str

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

class ThinkingConfigAdaptive: type: "adaptive"; display
type: Literal["adaptive"]
display: Optional[Literal["summarized", "omitted"]]

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:
"summarized"
"omitted"
class ThinkingConfigBetweenTools: type: "between_tools"
type: Literal["between_tools"]
class ThinkingConfigDisabled: type: "disabled"
type: Literal["disabled"]
class ThinkingConfigEnabled: type: "enabled"; budget_tokens; display
type: Literal["enabled"]
budget_tokens: int

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: Optional[Literal["summarized", "omitted"]]

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:
"summarized"
"omitted"
type ThinkingConfigParam = ...

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:
class ThinkingDelta: type: "thinking_delta"; thinking
type: Literal["thinking_delta"]
defaultthinking_delta
thinking: str

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.

class Tool: type; input_schema; name; ... # 7 more
class ToolBash20250124: type: "bash_20250124"; name; allowed_callers; ... # 4 more
type ToolChoice = ...

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:
class ToolChoiceAny: type: "any"; disable_parallel_tool_use

The model will use any available tools.

type: Literal["any"]
disable_parallel_tool_use: Optional[bool]

Whether to disable parallel tool use.

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

class ToolChoiceAuto: type: "auto"; disable_parallel_tool_use

The model will automatically decide whether to use tools.

type: Literal["auto"]
disable_parallel_tool_use: Optional[bool]

Whether to disable parallel tool use.

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

class ToolChoiceNone: type: "none"

The model will not be allowed to use tools.

type: Literal["none"]
class ToolChoiceTool: type: "tool"; name; disable_parallel_tool_use

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

type: Literal["tool"]
name: str

The name of the tool to use.

disable_parallel_tool_use: Optional[bool]

Whether to disable parallel tool use.

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

class ToolReferenceBlock: type: "tool_reference"; tool_name
type: Literal["tool_reference"]
defaulttool_reference
tool_name: str
minLength1
maxLength256
pattern^[a-zA-Z0-9_-]{1,256}$
class ToolReferenceBlockParam: type: "tool_reference"; tool_name; cache_control

Tool reference block that can be included in tool_result content.

type: Literal["tool_reference"]
tool_name: str
minLength1
maxLength256
pattern^[a-zA-Z0-9_-]{1,256}$
cache_control: Optional[CacheControlEphemeral]

Create a cache control breakpoint at this content block.

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

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

This may be one the following values:

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

Defaults to 5m. See prompt caching pricing for details.

One of the following:
"5m"
"1h"
class ToolResultBlockParam: type: "tool_result"; tool_use_id; cache_control; ... # 3 more
class ToolSearchToolBm25_20251119: type; name; allowed_callers; ... # 3 more
class ToolSearchToolRegex20251119: type; name; allowed_callers; ... # 3 more
class ToolSearchToolResultBlock: type: "tool_search_tool_result"; content; tool_use_id
class ToolSearchToolResultBlockParam: type: "tool_search_tool_result"; content; tool_use_id; cache_control
class ToolSearchToolResultError: type: "tool_search_tool_result_error"; error_code; error_message
type: Literal["tool_search_tool_result_error"]
defaulttool_search_tool_result_error
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
error_message: Optional[str]
type ToolSearchToolResultErrorCode = Literal["invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded"]
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
class ToolSearchToolResultErrorParam: type: "tool_search_tool_result_error"; error_code; error_message
type: Literal["tool_search_tool_result_error"]
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
error_message: Optional[str]
class ToolSearchToolSearchResultBlock: type: "tool_search_tool_search_result"; tool_references
type: Literal["tool_search_tool_search_result"]
defaulttool_search_tool_search_result
tool_references: List[ToolReferenceBlock]
type: Literal["tool_reference"]
defaulttool_reference
tool_name: str
minLength1
maxLength256
pattern^[a-zA-Z0-9_-]{1,256}$
class ToolSearchToolSearchResultBlockParam: type: "tool_search_tool_search_result"; tool_references
type: Literal["tool_search_tool_search_result"]
tool_references: List[ToolReferenceBlockParam]
type: Literal["tool_reference"]
tool_name: str
minLength1
maxLength256
pattern^[a-zA-Z0-9_-]{1,256}$
cache_control: Optional[CacheControlEphemeral]

Create a cache control breakpoint at this content block.

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

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

This may be one the following values:

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

Defaults to 5m. See prompt caching pricing for details.

One of the following:
"5m"
"1h"
class ToolTextEditor20250124: type: "text_editor_20250124"; name; allowed_callers; ... # 4 more
class ToolTextEditor20250429: type: "text_editor_20250429"; name; allowed_callers; ... # 4 more
class ToolTextEditor20250728: type: "text_editor_20250728"; name; allowed_callers; ... # 5 more
type ToolUnion = ...
One of the following:
class ToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class ToolUseBlockParam: type: "tool_use"; id; input; ... # 4 more
type ToolUseCaller = ...

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

One of the following:
class DirectCaller: type: "direct"

Tool invocation directly from the model.

type: Literal["direct"]
class ServerToolCaller: type: "code_execution_20250825"; tool_id

Tool invocation generated by a server-side tool.

type: Literal["code_execution_20250825"]
tool_id: str
pattern^srvtoolu_[a-zA-Z0-9_]+$
class ServerToolCaller20260120: type: "code_execution_20260120"; tool_id
type: Literal["code_execution_20260120"]
tool_id: str
pattern^srvtoolu_[a-zA-Z0-9_]+$
type ToolsetToolUseBlock = ...
One of the following:
type BrowserToolUseBlock = ...
One of the following:
type ComputerToolUseBlock = ...
One of the following:
class ToolUseBlock: type: "tool_use"; id; caller; ... # 3 more
class URLImageSource: type: "url"; url
type: Literal["url"]
url: str
class URLPDFSource: type: "url"; url
type: Literal["url"]
url: str
class Usage: cache_creation; cache_creation_input_tokens; cache_read_input_tokens; ... # 6 more
class UserLocation: type: "approximate"; city; country; ... # 2 more
type: Literal["approximate"]
city: Optional[str]

The city of the user.

minLength1
maxLength255
country: Optional[str]

The two letter ISO country code of the user.

minLength2
maxLength2
region: Optional[str]

The region of the user.

minLength1
maxLength255
timezone: Optional[str]

The IANA timezone of the user.

minLength1
maxLength255
class WebFetchBlock: type: "web_fetch_result"; content; retrieved_at; url
type: Literal["web_fetch_result"]
defaultweb_fetch_result
content: DocumentBlock
retrieved_at: Optional[str]

ISO 8601 timestamp when the content was retrieved

url: str

Fetched content URL

class WebFetchBlockParam: type: "web_fetch_result"; content; url; retrieved_at
type: Literal["web_fetch_result"]
content: DocumentBlockParam
url: str

Fetched content URL

retrieved_at: Optional[str]

ISO 8601 timestamp when the content was retrieved

class WebFetchTool20250910: type: "web_fetch_20250910"; name; allowed_callers; ... # 9 more
class WebFetchTool20260209: type: "web_fetch_20260209"; name; allowed_callers; ... # 9 more
class WebFetchTool20260309: type: "web_fetch_20260309"; name; allowed_callers; ... # 10 more

Web fetch tool with use_cache parameter for bypassing cached content.

class WebFetchTool20260318: type: "web_fetch_20260318"; name; allowed_callers; ... # 11 more
class WebFetchToolResultBlock: type: "web_fetch_tool_result"; caller; content; tool_use_id
class WebFetchToolResultBlockParam: type: "web_fetch_tool_result"; content; tool_use_id; ... # 2 more
class WebFetchToolResultErrorBlock: type: "web_fetch_tool_result_error"; error_code
type: Literal["web_fetch_tool_result_error"]
defaultweb_fetch_tool_result_error
One of the following:
"invalid_tool_input"
"url_too_long"
"url_not_allowed"
"url_not_in_prior_context"
"url_not_accessible"
"unsupported_content_type"
"too_many_requests"
"max_uses_exceeded"
"unavailable"
"content_too_large"
class WebFetchToolResultErrorBlockParam: type: "web_fetch_tool_result_error"; error_code
type: Literal["web_fetch_tool_result_error"]
One of the following:
"invalid_tool_input"
"url_too_long"
"url_not_allowed"
"url_not_in_prior_context"
"url_not_accessible"
"unsupported_content_type"
"too_many_requests"
"max_uses_exceeded"
"unavailable"
"content_too_large"
type WebFetchToolResultErrorCode = Literal["invalid_tool_input", "url_too_long", "url_not_allowed", 7 more]
One of the following:
"invalid_tool_input"
"url_too_long"
"url_not_allowed"
"url_not_in_prior_context"
"url_not_accessible"
"unsupported_content_type"
"too_many_requests"
"max_uses_exceeded"
"unavailable"
"content_too_large"
class WebFetchURLSourceAll: 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: Literal["all"]
class WebFetchURLSourceExcept: type: "except"; tools

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

type: Literal["except"]
type: Literal["tool_reference"]
name: str
class WebFetchURLSourceNone: 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: Literal["none"]
class WebFetchURLSourceOnly: type: "only"; tools

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

type: Literal["only"]
type: Literal["tool_reference"]
name: str
class WebFetchURLSourceToolReference: type: "tool_reference"; name

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

type: Literal["tool_reference"]
name: str
class WebFetchURLSources: client_tool_results; server_tool_results; user_input

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[].

class WebSearchResultBlock: type: "web_search_result"; encrypted_content; page_age; ... # 2 more
type: Literal["web_search_result"]
defaultweb_search_result
encrypted_content: str
page_age: Optional[str]
title: str
url: str
class WebSearchResultBlockParam: type: "web_search_result"; encrypted_content; title; ... # 2 more
type: Literal["web_search_result"]
encrypted_content: str
title: str
url: str
page_age: Optional[str]
class WebSearchTool20250305: type: "web_search_20250305"; name; allowed_callers; ... # 7 more
class WebSearchTool20260209: type: "web_search_20260209"; name; allowed_callers; ... # 7 more
class WebSearchTool20260318: type: "web_search_20260318"; name; allowed_callers; ... # 8 more
class WebSearchToolRequestError: type: "web_search_tool_result_error"; error_code
type: Literal["web_search_tool_result_error"]
One of the following:
"invalid_tool_input"
"unavailable"
"max_uses_exceeded"
"too_many_requests"
"query_too_long"
"request_too_large"
class WebSearchToolResultBlock: type: "web_search_tool_result"; caller; content; tool_use_id
type WebSearchToolResultBlockContent = ...
One of the following:
class WebSearchToolResultBlockParam: type: "web_search_tool_result"; content; tool_use_id; ... # 2 more
type WebSearchToolResultBlockParamContent = ...
One of the following:
class WebSearchToolResultError: type: "web_search_tool_result_error"; error_code
type: Literal["web_search_tool_result_error"]
defaultweb_search_tool_result_error
One of the following:
"invalid_tool_input"
"unavailable"
"max_uses_exceeded"
"too_many_requests"
"query_too_long"
"request_too_large"
type WebSearchToolResultErrorCode = Literal["invalid_tool_input", "unavailable", "max_uses_exceeded", 3 more]
One of the following:
"invalid_tool_input"
"unavailable"
"max_uses_exceeded"
"too_many_requests"
"query_too_long"
"request_too_large"

消息批处理

创建消息批次
messages.batches.create(**kwargs) -> MessageBatch
POST/v1/messages/batches

发送一批消息创建请求。

检索消息批次
messages.batches.retrieve(message_batch_id, **kwargs) -> MessageBatch
GET/v1/messages/batches/{message_batch_id}

此端点是幂等的,可用于轮询消息批次是否完成。要访问消息批次的结果,请向响应中的 results_url 字段发起请求。

列出消息批次
messages.batches.list(**kwargs) -> SyncPage[MessageBatch]
GET/v1/messages/batches

列出工作区内的所有消息批次。最近创建的批次最先返回。

取消消息批次
messages.batches.cancel(message_batch_id, **kwargs) -> MessageBatch
POST/v1/messages/batches/{message_batch_id}/cancel

批次可在处理结束前的任何时间取消。一旦发起取消,批次将进入 canceling 状态,此时系统可能会先完成任何正在进行的、不可中断的请求,然后再最终完成取消。

删除消息批次
messages.batches.delete(message_batch_id, **kwargs) -> DeletedMessageBatch
DELETE/v1/messages/batches/{message_batch_id}

删除消息批次。

检索消息批次结果
messages.batches.results(message_batch_id, **kwargs) -> MessageBatchIndividualResponse
GET/v1/messages/batches/{message_batch_id}/results

以 .jsonl 文件的形式流式传输消息批次的结果。