Claude Platform Docs

Mensagens

Criar uma mensagem
BetaMessage beta().messages().create(params, requestOptions = RequestOptions.none())
POST/v1/messages

Envie uma lista estruturada de mensagens de entrada com conteúdo de texto e/ou imagem, e o modelo gerará a próxima mensagem na conversa.

Contar tokens em uma mensagem
BetaMessageTokensCount beta().messages().countTokens(params, requestOptions = RequestOptions.none())
POST/v1/messages/count_tokens

Conte o número de tokens em uma mensagem.

Models
class BetaAdvisorMessageIterationUsage { type = "advisor_message"; cacheCreation; cacheCreationInputTokens; /* 4 more */ }

Token usage for an advisor sub-inference iteration.

JsonValue type = "advisor_message"

Usage for an advisor sub-inference iteration

Optional<BetaCacheCreation> cacheCreation

Breakdown of cached tokens by TTL

long ephemeral1hInputTokens

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

minimum0
long ephemeral5mInputTokens

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

minimum0
long cacheCreationInputTokens

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

minimum0
long cacheReadInputTokens

The number of input tokens read from the cache.

minimum0
long inputTokens

The number of input tokens which were used.

minimum0
Model model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
long outputTokens

The number of output tokens which were used.

minimum0
class BetaAdvisorRedactedResultBlock { type = "advisor_redacted_result"; encryptedContent; stopReason; }
JsonValue type = "advisor_redacted_result"
String encryptedContent

Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect or modify.

Optional<String> stopReason

The advisor sub-inference's stop reason (same values as the top-level message stop_reason).

class BetaAdvisorRedactedResultBlockParam { type = "advisor_redacted_result"; encryptedContent; stopReason; }
JsonValue type = "advisor_redacted_result"
String encryptedContent

Opaque blob produced by a prior response; must be round-tripped verbatim.

Optional<String> stopReason
class BetaAdvisorResultBlock { type = "advisor_result"; stopReason; text; }
JsonValue type = "advisor_result"
Optional<String> stopReason

The advisor sub-inference's stop reason (same values as the top-level message stop_reason). max_tokens indicates the advisor's output was truncated at the tool's max_tokens value or the advisor model's policy cap.

String text
class BetaAdvisorResultBlockParam { type = "advisor_result"; text; stopReason; }
JsonValue type = "advisor_result"
String text
Optional<String> stopReason
class BetaAdvisorTool20260301 { type = "advisor_20260301"; model; name; /* 7 more */ }
class BetaAdvisorToolResultBlock { type = "advisor_tool_result"; content; toolUseId; }
class BetaAdvisorToolResultBlockParam { type = "advisor_tool_result"; content; toolUseId; cacheControl; }
class BetaAdvisorToolResultError { type = "advisor_tool_result_error"; errorCode; }
JsonValue type = "advisor_tool_result_error"
ErrorCode errorCode
One of the following:
MAX_USES_EXCEEDED("max_uses_exceeded")
PROMPT_TOO_LONG("prompt_too_long")
TOO_MANY_REQUESTS("too_many_requests")
OVERLOADED("overloaded")
UNAVAILABLE("unavailable")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
MODEL_NOT_FOUND("model_not_found")
class BetaAdvisorToolResultErrorParam { type = "advisor_tool_result_error"; errorCode; }
JsonValue type = "advisor_tool_result_error"
ErrorCode errorCode
One of the following:
MAX_USES_EXCEEDED("max_uses_exceeded")
PROMPT_TOO_LONG("prompt_too_long")
TOO_MANY_REQUESTS("too_many_requests")
OVERLOADED("overloaded")
UNAVAILABLE("unavailable")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
MODEL_NOT_FOUND("model_not_found")
class BetaAllThinkingTurns { type = "all"; }
JsonValue type = "all"
class BetaBase64ImageSource { type = "base64"; data; mediaType; }
JsonValue type = "base64"
String data
formatbyte
MediaType mediaType
One of the following:
IMAGE_JPEG("image/jpeg")
IMAGE_PNG("image/png")
IMAGE_GIF("image/gif")
IMAGE_WEBP("image/webp")
class BetaBase64PdfSource { type = "base64"; data; mediaType; }
JsonValue type = "base64"
String data
formatbyte
JsonValue mediaType = "application/pdf"
class BetaBashCodeExecutionOutputBlock { type = "bash_code_execution_output"; fileId; }
JsonValue type = "bash_code_execution_output"
String fileId
class BetaBashCodeExecutionOutputBlockParam { type = "bash_code_execution_output"; fileId; }
JsonValue type = "bash_code_execution_output"
String fileId
class BetaBashCodeExecutionResultBlock { type = "bash_code_execution_result"; content; returnCode; /* 2 more */ }
JsonValue type = "bash_code_execution_result"
JsonValue type = "bash_code_execution_output"
String fileId
long returnCode
String stderr
String stdout
class BetaBashCodeExecutionResultBlockParam { type = "bash_code_execution_result"; content; returnCode; /* 2 more */ }
JsonValue type = "bash_code_execution_result"
JsonValue type = "bash_code_execution_output"
String fileId
long returnCode
String stderr
String stdout
class BetaBashCodeExecutionToolResultBlock { type = "bash_code_execution_tool_result"; content; toolUseId; }
class BetaBashCodeExecutionToolResultBlockParam { type = "bash_code_execution_tool_result"; content; toolUseId; cacheControl; }
class BetaBashCodeExecutionToolResultError { type = "bash_code_execution_tool_result_error"; errorCode; }
JsonValue type = "bash_code_execution_tool_result_error"
ErrorCode errorCode
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
OUTPUT_FILE_TOO_LARGE("output_file_too_large")
class BetaBashCodeExecutionToolResultErrorParam { type = "bash_code_execution_tool_result_error"; errorCode; }
JsonValue type = "bash_code_execution_tool_result_error"
ErrorCode errorCode
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
OUTPUT_FILE_TOO_LARGE("output_file_too_large")
class BetaBrowserClickTarget: union

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

class BetaBrowserCoordinateTarget { type = "coordinate"; x; y; }

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

JsonValue type = "coordinate"
long x

Pixels from the left edge of the viewport.

minimum0
long y

Pixels from the top edge of the viewport.

minimum0
class BetaBrowserRefTarget { 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.

JsonValue type = "ref"
String ref

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

class BetaBrowserCloseTabConfig { deferLoading; enabled; }

close_tab's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserCloseTabInput { tabId; }

Close the tab with the given tab_id.

String tabId

The tab to close.

class BetaBrowserCloseTabToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserCoordinateTarget { type = "coordinate"; x; y; }

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

JsonValue type = "coordinate"
long x

Pixels from the left edge of the viewport.

minimum0
long y

Pixels from the top edge of the viewport.

minimum0
class BetaBrowserDoubleClickConfig { deferLoading; enabled; }

double_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserDoubleClickInput { target; modifiers; tabId; }

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

class BetaBrowserDoubleClickToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserFileUploadConfig { deferLoading; enabled; }

file_upload's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserFileUploadInput { target; documentIds; paths; tabId; }

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

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

JsonValue type = "ref"
String ref

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

Optional<List<String>> documentIds

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

minItems1
Optional<List<String>> paths

File paths on the browser executor's filesystem.

minItems1
Optional<String> tabId

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

class BetaBrowserFileUploadToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserFindConfig { deferLoading; enabled; }

find's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserFindInput { query; tabId; }

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

String query

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

Optional<String> tabId

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

class BetaBrowserFindToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserFormInputConfig { deferLoading; enabled; }

form_input's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserFormInputInput { target; value; tabId; }

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

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

JsonValue type = "ref"
String ref

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

The value to set.

One of the following:
String
double
boolean
Optional<String> tabId

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

class BetaBrowserFormInputToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserFormInputValue: union
String
double
boolean
class BetaBrowserGetPageTextConfig { deferLoading; enabled; }

get_page_text's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserGetPageTextInput { tabId; }

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

Optional<String> tabId

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

class BetaBrowserGetPageTextToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserHoldKeyConfig { deferLoading; enabled; }

hold_key's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserHoldKeyInput { duration; text; tabId; }

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

double duration

Seconds to hold the key down (maximum 30).

minimum0
maximum30
String text

The key or chord to hold.

Optional<String> tabId

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

class BetaBrowserHoldKeyToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserHoverConfig { deferLoading; enabled; }

hover's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserHoverInput { target; tabId; }

Move the cursor to a coordinate or element without clicking.

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

One of the following:
class BetaBrowserCoordinateTarget { type = "coordinate"; x; y; }

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

JsonValue type = "coordinate"
long x

Pixels from the left edge of the viewport.

minimum0
long y

Pixels from the top edge of the viewport.

minimum0
class BetaBrowserRefTarget { 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.

JsonValue type = "ref"
String ref

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

Optional<String> tabId

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

class BetaBrowserHoverToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserJavascriptExecConfig { deferLoading; enabled; }

javascript_exec's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserJavascriptExecInput { text; tabId; }

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

String text

JavaScript to execute in the page context.

Optional<String> tabId

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

class BetaBrowserJavascriptExecToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserKeyConfig { deferLoading; enabled; }

key's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserKeyInput { text; repeat; tabId; }

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

String text

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

Optional<Long> repeat

Number of times to repeat. Default 1.

minimum1
maximum100
Optional<String> tabId

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

class BetaBrowserKeyToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserLeftClickConfig { deferLoading; enabled; }

left_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserLeftClickDragConfig { deferLoading; enabled; }

left_click_drag's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserLeftClickDragInput { from; target; tabId; }

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

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

JsonValue type = "coordinate"
long x

Pixels from the left edge of the viewport.

minimum0
long y

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

JsonValue type = "coordinate"
long x

Pixels from the left edge of the viewport.

minimum0
long y

Pixels from the top edge of the viewport.

minimum0
Optional<String> tabId

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

class BetaBrowserLeftClickDragToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserLeftClickInput { target; modifiers; tabId; }

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

class BetaBrowserLeftClickToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserLeftMouseDownConfig { deferLoading; enabled; }

left_mouse_down's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserLeftMouseDownInput { target; tabId; }

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

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

JsonValue type = "coordinate"
long x

Pixels from the left edge of the viewport.

minimum0
long y

Pixels from the top edge of the viewport.

minimum0
Optional<String> tabId

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

class BetaBrowserLeftMouseDownToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserLeftMouseUpConfig { deferLoading; enabled; }

left_mouse_up's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserLeftMouseUpInput { target; tabId; }

Release the left mouse button at a viewport coordinate.

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

JsonValue type = "coordinate"
long x

Pixels from the left edge of the viewport.

minimum0
long y

Pixels from the top edge of the viewport.

minimum0
Optional<String> tabId

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

class BetaBrowserLeftMouseUpToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserListTabsConfig { deferLoading; enabled; }

list_tabs's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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

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

class BetaBrowserListTabsToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserMiddleClickConfig { deferLoading; enabled; }

middle_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserMiddleClickInput { target; modifiers; tabId; }

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

class BetaBrowserMiddleClickToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserMouseMoveConfig { deferLoading; enabled; }

mouse_move's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserMouseMoveInput { target; tabId; }

Move the pointer to a viewport coordinate without clicking.

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

JsonValue type = "coordinate"
long x

Pixels from the left edge of the viewport.

minimum0
long y

Pixels from the top edge of the viewport.

minimum0
Optional<String> tabId

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

class BetaBrowserMouseMoveToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserNavigateConfig { deferLoading; enabled; }

navigate's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserNavigateInput { url; tabId; }

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

String url

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

Optional<String> tabId

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

class BetaBrowserNavigateToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserNewTabConfig { deferLoading; enabled; }

new_tab's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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

Open a new empty tab and return its tab_id.

class BetaBrowserNewTabToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserReadConsoleConfig { deferLoading; enabled; }

read_console's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserReadConsoleInput { tabId; }

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

Optional<String> tabId

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

class BetaBrowserReadConsoleToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserReadNetworkConfig { deferLoading; enabled; }

read_network's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserReadNetworkInput { tabId; }

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

Optional<String> tabId

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

class BetaBrowserReadNetworkToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserReadPageConfig { deferLoading; enabled; }

read_page's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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.

enum BetaBrowserReadPageFilter
ALL("all")
INTERACTIVE("interactive")
class BetaBrowserReadPageInput { depth; filter; ref; tabId; }

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

Optional<Long> depth

Maximum tree depth. Default 15.

minimum1
Optional<BetaBrowserReadPageFilter> filter

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

One of the following:
ALL("all")
INTERACTIVE("interactive")
Optional<String> ref

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

Optional<String> tabId

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

class BetaBrowserReadPageToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserRefTarget { 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.

JsonValue type = "ref"
String ref

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

class BetaBrowserRightClickConfig { deferLoading; enabled; }

right_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserRightClickInput { target; modifiers; tabId; }

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

class BetaBrowserRightClickToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserScreenshotConfig { deferLoading; enabled; }

screenshot's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserScreenshotInput { tabId; }

Capture the current browser viewport.

Optional<String> tabId

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

class BetaBrowserScreenshotToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserScrollConfig { deferLoading; enabled; }

scroll's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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.

enum BetaBrowserScrollDirection
UP("up")
DOWN("down")
LEFT("left")
RIGHT("right")
class BetaBrowserScrollInput { scrollDirection; target; scrollAmount; tabId; }

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

BetaBrowserScrollDirection scrollDirection
One of the following:
UP("up")
DOWN("down")
LEFT("left")
RIGHT("right")

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

JsonValue type = "coordinate"
long x

Pixels from the left edge of the viewport.

minimum0
long y

Pixels from the top edge of the viewport.

minimum0
Optional<Long> scrollAmount

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

minimum1
maximum10
Optional<String> tabId

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

class BetaBrowserScrollToConfig { deferLoading; enabled; }

scroll_to's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserScrollToInput { target; tabId; }

Scroll an element into view.

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

JsonValue type = "ref"
String ref

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

Optional<String> tabId

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

class BetaBrowserScrollToToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserScrollToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserStateBlockParam { type = "browser_state"; tabs; cacheControl; stateChanges; }

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

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

class BetaBrowserStateChange: union
class BetaBrowserStateChangeDownloadCompleted { type = "download_completed"; downloadId; url; /* 2 more */ }

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

JsonValue type = "download_completed"
String downloadId

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

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

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

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
Optional<String> path

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]*$
Optional<Long> sizeBytes

The completed download's size.

minimum0
class BetaBrowserStateChangeDownloadFailed { type = "download_failed"; downloadId; url; error; }

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

JsonValue type = "download_failed"
String downloadId

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

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

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

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
Optional<String> error

The failure or cancellation detail, when known.

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
class BetaBrowserStateChangeDownloadStarted { type = "download_started"; downloadId; url; }

A file download that started during this call.

JsonValue type = "download_started"
String downloadId

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

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

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

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
class BetaBrowserStateChangeTabOpened { type = "tab_opened"; tabId; }

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

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

JsonValue type = "tab_opened"
String tabId

The tab_id of the opened tab, present in tabs.

minLength1
maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
class BetaBrowserStateTabEntry { tabId; title; url; active; }

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

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

String tabId

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

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

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

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

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

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
Optional<Boolean> active

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

class BetaBrowserSwitchTabConfig { deferLoading; enabled; }

switch_tab's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserSwitchTabInput { tabId; }

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

String tabId

The tab to switch to.

class BetaBrowserSwitchTabToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserToolUseBlock: union
class BetaBrowserToolset20260801 { type = "browser_toolset_20260801"; cacheControl; configs; }

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

JsonValue type = "browser_toolset_20260801"
Optional<BetaCacheControlEphemeral> cacheControl

Create a cache control breakpoint at this content block.

JsonValue type = "ephemeral"
Optional<Ttl> ttl

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:
TTL_5M("5m")
TTL_1H("1h")
Optional<BetaBrowserToolsetConfigs> configs

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

class BetaBrowserToolsetConfigs { type; closeTab; doubleClick; /* 28 more */ }

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

class BetaBrowserTripleClickConfig { deferLoading; enabled; }

triple_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserTripleClickInput { target; modifiers; tabId; }

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

class BetaBrowserTripleClickToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserTypeConfig { deferLoading; enabled; }

type's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserTypeInput { text; tabId; }

Type a literal string at the current focus.

String text

The text to type.

Optional<String> tabId

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

class BetaBrowserTypeToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserWaitConfig { deferLoading; enabled; }

wait's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserWaitInput { duration; tabId; }

Pause for the given duration.

double duration

Seconds to wait (maximum 30).

minimum0
maximum30
Optional<String> tabId

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

class BetaBrowserWaitToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaBrowserZoomConfig { deferLoading; enabled; }

zoom's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaBrowserZoomInput { region; tabId; }

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

List<long> region

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

minItems4
maxItems4
Optional<String> tabId

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

class BetaBrowserZoomToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaCacheControlEphemeral { type = "ephemeral"; ttl; }
JsonValue type = "ephemeral"
Optional<Ttl> ttl

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:
TTL_5M("5m")
TTL_1H("1h")
class BetaCacheCreation { ephemeral1hInputTokens; ephemeral5mInputTokens; }
long ephemeral1hInputTokens

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

minimum0
long ephemeral5mInputTokens

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

minimum0
class BetaCacheMissMessagesChanged { type = "messages_changed"; cacheMissedInputTokens; }
JsonValue type = "messages_changed"
long cacheMissedInputTokens

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

class BetaCacheMissModelChanged { type = "model_changed"; cacheMissedInputTokens; }
JsonValue type = "model_changed"
long cacheMissedInputTokens

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

class BetaCacheMissPreviousMessageNotFound { type = "previous_message_not_found"; }
JsonValue type = "previous_message_not_found"
class BetaCacheMissReason: union
class BetaCacheMissSystemChanged { type = "system_changed"; cacheMissedInputTokens; }
JsonValue type = "system_changed"
long cacheMissedInputTokens

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

class BetaCacheMissToolsChanged { type = "tools_changed"; cacheMissedInputTokens; }
JsonValue type = "tools_changed"
long cacheMissedInputTokens

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

class BetaCacheMissUnavailable { type = "unavailable"; }
JsonValue type = "unavailable"
class BetaCitationCharLocation { type = "char_location"; citedText; documentIndex; /* 4 more */ }
JsonValue type = "char_location"
String citedText
long documentIndex
minimum0
Optional<String> documentTitle
long endCharIndex
Optional<String> fileId
long startCharIndex
minimum0
class BetaCitationCharLocationParam { type = "char_location"; citedText; documentIndex; /* 3 more */ }
JsonValue type = "char_location"
String citedText
long documentIndex
minimum0
Optional<String> documentTitle
minLength1
maxLength500
long endCharIndex
long startCharIndex
minimum0
class BetaCitationConfig { enabled; }
boolean enabled
class BetaCitationContentBlockLocation { type = "content_block_location"; citedText; documentIndex; /* 4 more */ }
JsonValue type = "content_block_location"
String citedText

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.

long documentIndex
minimum0
Optional<String> documentTitle
long endBlockIndex

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.

Optional<String> fileId
long startBlockIndex

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

minimum0
class BetaCitationContentBlockLocationParam { type = "content_block_location"; citedText; documentIndex; /* 3 more */ }
JsonValue type = "content_block_location"
String citedText

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.

long documentIndex
minimum0
Optional<String> documentTitle
minLength1
maxLength500
long endBlockIndex

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.

long startBlockIndex

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

minimum0
class BetaCitationPageLocation { type = "page_location"; citedText; documentIndex; /* 4 more */ }
JsonValue type = "page_location"
String citedText
long documentIndex
minimum0
Optional<String> documentTitle
long endPageNumber
Optional<String> fileId
long startPageNumber
minimum1
class BetaCitationPageLocationParam { type = "page_location"; citedText; documentIndex; /* 3 more */ }
JsonValue type = "page_location"
String citedText
long documentIndex
minimum0
Optional<String> documentTitle
minLength1
maxLength500
long endPageNumber
long startPageNumber
minimum1
class BetaCitationSearchResultLocation { type = "search_result_location"; citedText; endBlockIndex; /* 4 more */ }
JsonValue type = "search_result_location"
String citedText

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.

long endBlockIndex

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.

long searchResultIndex

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
String source
long startBlockIndex

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

minimum0
Optional<String> title
class BetaCitationSearchResultLocationParam { type = "search_result_location"; citedText; endBlockIndex; /* 4 more */ }
JsonValue type = "search_result_location"
String citedText

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.

long endBlockIndex

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.

long searchResultIndex

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
String source
long startBlockIndex

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

minimum0
Optional<String> title
class BetaCitationWebSearchResultLocationParam { type = "web_search_result_location"; citedText; encryptedIndex; /* 2 more */ }
JsonValue type = "web_search_result_location"
String citedText
String encryptedIndex
Optional<String> title
minLength1
maxLength512
String url
minLength1
class BetaCitationsConfigParam { enabled; }
Optional<Boolean> enabled
class BetaCitationsDelta { type = "citations_delta"; citation; }
class BetaCitationsWebSearchResultLocation { type = "web_search_result_location"; citedText; encryptedIndex; /* 2 more */ }
JsonValue type = "web_search_result_location"
String citedText
String encryptedIndex
Optional<String> title
maxLength512
String url
class BetaClearThinking20251015Edit { type = "clear_thinking_20251015"; keep; }
JsonValue type = "clear_thinking_20251015"
Optional<Keep> keep

Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed.

One of the following:
class BetaThinkingTurns { type = "thinking_turns"; value; }
JsonValue type = "thinking_turns"
long value
minimum1
class BetaAllThinkingTurns { type = "all"; }
JsonValue type = "all"
JsonValue
class BetaClearThinking20251015EditResponse { type = "clear_thinking_20251015"; clearedInputTokens; clearedThinkingTurns; }
JsonValue type = "clear_thinking_20251015"

The type of context management edit applied.

long clearedInputTokens

Number of input tokens cleared by this edit.

minimum0
long clearedThinkingTurns

Number of thinking turns that were cleared.

minimum0
class BetaClearToolUses20250919Edit { type = "clear_tool_uses_20250919"; clearAtLeast; clearToolInputs; /* 3 more */ }
class BetaClearToolUses20250919EditResponse { type = "clear_tool_uses_20250919"; clearedInputTokens; clearedToolUses; }
JsonValue type = "clear_tool_uses_20250919"

The type of context management edit applied.

long clearedInputTokens

Number of input tokens cleared by this edit.

minimum0
long clearedToolUses

Number of tool uses that were cleared.

minimum0
class BetaCodeExecutionOutputBlock { type = "code_execution_output"; fileId; }
JsonValue type = "code_execution_output"
String fileId
class BetaCodeExecutionOutputBlockParam { type = "code_execution_output"; fileId; }
JsonValue type = "code_execution_output"
String fileId
class BetaCodeExecutionResultBlock { type = "code_execution_result"; content; returnCode; /* 2 more */ }
JsonValue type = "code_execution_result"
JsonValue type = "code_execution_output"
String fileId
long returnCode
String stderr
String stdout
class BetaCodeExecutionResultBlockParam { type = "code_execution_result"; content; returnCode; /* 2 more */ }
JsonValue type = "code_execution_result"
JsonValue type = "code_execution_output"
String fileId
long returnCode
String stderr
String stdout
class BetaCodeExecutionTool20250522 { type = "code_execution_20250522"; name; allowedCallers; /* 3 more */ }
class BetaCodeExecutionTool20250825 { type = "code_execution_20250825"; name; allowedCallers; /* 3 more */ }
class BetaCodeExecutionTool20260120 { type = "code_execution_20260120"; name; allowedCallers; /* 3 more */ }

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

class BetaCodeExecutionTool20260521 { type = "code_execution_20260521"; name; allowedCallers; /* 3 more */ }

Code execution tool with REPL state persistence.

class BetaCodeExecutionToolResultBlock { type = "code_execution_tool_result"; content; toolUseId; }
JsonValue type = "code_execution_tool_result"
One of the following:
String toolUseId
pattern^srvtoolu_[a-zA-Z0-9_]+$
class BetaCodeExecutionToolResultBlockContent: union
class BetaCodeExecutionToolResultBlockParam { type = "code_execution_tool_result"; content; toolUseId; cacheControl; }
JsonValue type = "code_execution_tool_result"
One of the following:
String toolUseId
pattern^srvtoolu_[a-zA-Z0-9_]+$
Optional<BetaCacheControlEphemeral> cacheControl

Create a cache control breakpoint at this content block.

JsonValue type = "ephemeral"
Optional<Ttl> ttl

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:
TTL_5M("5m")
TTL_1H("1h")
class BetaCodeExecutionToolResultBlockParamContent: union
class BetaCodeExecutionToolResultError { type = "code_execution_tool_result_error"; errorCode; }
JsonValue type = "code_execution_tool_result_error"
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
enum BetaCodeExecutionToolResultErrorCode
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
class BetaCodeExecutionToolResultErrorParam { type = "code_execution_tool_result_error"; errorCode; }
JsonValue type = "code_execution_tool_result_error"
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
class BetaCompact20260112Edit { type = "compact_20260112"; instructions; pauseAfterCompaction; trigger; }

Automatically compact older context when reaching the configured trigger threshold.

JsonValue type = "compact_20260112"
Optional<String> instructions

Additional instructions for summarization.

Optional<Boolean> pauseAfterCompaction

Whether to pause after compaction and return the compaction block to the user.

Optional<BetaInputTokensTrigger> trigger

When to trigger compaction. Defaults to 150000 input tokens.

JsonValue type = "input_tokens"
long value
minimum1
class BetaCompactionBlock { type = "compaction"; content; encryptedContent; /* 2 more */ }

A compaction block returned when autocompact is triggered.

When content is None, it indicates the compaction failed to produce a valid summary (e.g., malformed output from the model). Clients may round-trip compaction blocks with null content; the server treats them as no-ops.

JsonValue type = "compaction"
Optional<String> content

Summary of compacted content, or null if compaction failed

Optional<String> encryptedContent

Opaque metadata from prior compaction, to be round-tripped verbatim

Optional<String> signature

Signature over the summary, to be sent back with the block verbatim

Optional<List<ToolChange>> toolChanges

The tool changes of the compacted range: the tool_addition and tool_removal blocks that take the request's tools to the tool set in effect at the end of the range, or [] when the range changed no tool. Absent when the server did not compute them. Send the block back unchanged.

One of the following:
class BetaResponseToolAdditionBlock { type = "tool_addition"; tool; }

An entry of a compaction block's tool_changes: a tool the compacted range made available, as a reference to a tools entry or MCP toolset, or as the tool definition in effect at the end of the range, by value. Send it back unchanged.

class BetaResponseToolRemovalBlock { type = "tool_removal"; tool; }

An entry of a compaction block's tool_changes: a tool of the request's tools (or an MCP tool or toolset) that the compacted range withdrew. Send it back unchanged.

class BetaCompactionBlockParam { type = "compaction"; cacheControl; content; /* 3 more */ }

A compaction block containing summary of previous context.

Users should round-trip these blocks from responses to subsequent requests to maintain context across compaction boundaries.

When content is None, the block represents a failed compaction. The server treats these as no-ops. Empty string content is not allowed.

class BetaCompactionConfig { type = "summarize"; instructions; }

Compact the whole conversation and return a signed compaction block, alone, that a later request sends back first in messages, in place of the messages it summarizes. There is no trigger and no pause flag: sending the parameter compacts, and nothing is sampled after the block.

The summarization prompt is the server's own unless instructions are given, which then replace it for this request; a value that is empty or only whitespace counts as absent.

JsonValue type = "summarize"
Optional<String> instructions

Replaces the server's default summarization prompt for this request. An empty or whitespace-only value counts as absent.

maxLength16384
class BetaCompactionContentBlockDelta { type = "compaction_delta"; content; encryptedContent; }
JsonValue type = "compaction_delta"
Optional<String> content
Optional<String> encryptedContent

Opaque metadata from prior compaction, to be round-tripped verbatim

class BetaCompactionIterationUsage { type = "compaction"; cacheCreation; cacheCreationInputTokens; /* 3 more */ }

Token usage for a compaction iteration.

JsonValue type = "compaction"

Usage for a compaction iteration

Optional<BetaCacheCreation> cacheCreation

Breakdown of cached tokens by TTL

long ephemeral1hInputTokens

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

minimum0
long ephemeral5mInputTokens

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

minimum0
long cacheCreationInputTokens

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

minimum0
long cacheReadInputTokens

The number of input tokens read from the cache.

minimum0
long inputTokens

The number of input tokens which were used.

minimum0
long outputTokens

The number of output tokens which were used.

minimum0
class BetaComputerCursorPositionConfig { deferLoading; enabled; }

cursor_position's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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

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

class BetaComputerCursorPositionToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaComputerDoubleClickConfig { deferLoading; enabled; }

double_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaComputerDoubleClickInput { coordinate; text; }

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

Optional<List<Long>> coordinate

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

minItems2
maxItems2
Optional<String> text

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

class BetaComputerDoubleClickToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaComputerHoldKeyConfig { deferLoading; enabled; }

hold_key's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaComputerHoldKeyInput { duration; text; }

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

long duration

Duration to hold the key, in seconds.

maximum300
String text

The key or key-combination to hold.

class BetaComputerHoldKeyToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaComputerKeyConfig { deferLoading; enabled; }

key's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaComputerKeyInput { 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.

String text

The key or key-combination to press.

Optional<Long> repeat

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

minimum1
maximum100
class BetaComputerKeyToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaComputerLeftClickConfig { deferLoading; enabled; }

left_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaComputerLeftClickDragConfig { deferLoading; enabled; }

left_click_drag's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaComputerLeftClickDragInput { coordinate; startCoordinate; text; }

Click and drag the cursor from start_coordinate to coordinate.

List<long> coordinate

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

minItems2
maxItems2
List<long> startCoordinate

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

minItems2
maxItems2
Optional<String> text

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

class BetaComputerLeftClickDragToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaComputerLeftClickInput { coordinate; text; }

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

Optional<List<Long>> coordinate

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

minItems2
maxItems2
Optional<String> text

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

class BetaComputerLeftClickToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaComputerLeftMouseDownConfig { deferLoading; enabled; }

left_mouse_down's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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

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

class BetaComputerLeftMouseDownToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaComputerLeftMouseUpConfig { deferLoading; enabled; }

left_mouse_up's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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

Release the left mouse button.

class BetaComputerLeftMouseUpToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaComputerMiddleClickConfig { deferLoading; enabled; }

middle_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaComputerMiddleClickInput { coordinate; text; }

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

Optional<List<Long>> coordinate

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

minItems2
maxItems2
Optional<String> text

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

class BetaComputerMiddleClickToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaComputerMouseMoveConfig { deferLoading; enabled; }

mouse_move's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaComputerMouseMoveInput { coordinate; }

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

List<long> coordinate

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

minItems2
maxItems2
class BetaComputerMouseMoveToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaComputerRightClickConfig { deferLoading; enabled; }

right_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaComputerRightClickInput { coordinate; text; }

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

Optional<List<Long>> coordinate

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

minItems2
maxItems2
Optional<String> text

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

class BetaComputerRightClickToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaComputerScreenshotConfig { deferLoading; enabled; }

screenshot's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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

Take a screenshot of the screen.

class BetaComputerScreenshotToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaComputerScrollConfig { deferLoading; enabled; }

scroll's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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.

enum BetaComputerScrollDirection
UP("up")
DOWN("down")
LEFT("left")
RIGHT("right")
class BetaComputerScrollInput { scrollAmount; scrollDirection; coordinate; text; }

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

long scrollAmount

Number of 'clicks' of the scroll wheel.

BetaComputerScrollDirection scrollDirection
One of the following:
UP("up")
DOWN("down")
LEFT("left")
RIGHT("right")
Optional<List<Long>> coordinate

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

minItems2
maxItems2
Optional<String> text

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

class BetaComputerScrollToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaComputerToolUseBlock: union
class BetaComputerToolset20260801 { type = "computer_toolset_20260801"; cacheControl; configs; }

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

JsonValue type = "computer_toolset_20260801"
Optional<BetaCacheControlEphemeral> cacheControl

Create a cache control breakpoint at this content block.

JsonValue type = "ephemeral"
Optional<Ttl> ttl

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:
TTL_5M("5m")
TTL_1H("1h")
Optional<BetaComputerToolsetConfigs> configs

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

class BetaComputerToolsetConfigs { type; cursorPosition; doubleClick; /* 14 more */ }

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

class BetaComputerTripleClickConfig { deferLoading; enabled; }

triple_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaComputerTripleClickInput { coordinate; text; }

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

Optional<List<Long>> coordinate

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

minItems2
maxItems2
Optional<String> text

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

class BetaComputerTripleClickToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaComputerTypeConfig { deferLoading; enabled; }

type's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaComputerTypeInput { text; }

Type a string of text on the keyboard.

String text

The text to type.

class BetaComputerTypeToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaComputerWaitConfig { deferLoading; enabled; }

wait's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaComputerWaitInput { duration; }

Wait for a specified duration.

long duration

Duration to wait, in seconds.

maximum300
class BetaComputerWaitToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaComputerZoomConfig { deferLoading; enabled; }

zoom's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> enabled

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 BetaComputerZoomInput { 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.

List<long> region

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

minItems4
maxItems4
class BetaComputerZoomToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaContainer { id; expiresAt; skills; }

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

String id

Identifier for the container used in this request

LocalDateTime expiresAt

The time at which the container will expire.

formatdate-time
Optional<List<BetaContainerSkill>> skills

Skills loaded in the container

Type type

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

One of the following:
ANTHROPIC("anthropic")
CUSTOM("custom")
String skillId

Skill ID

minLength1
maxLength64
String version

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

minLength1
maxLength64
class BetaContainerParams { id; skills; }

Container parameters with skills to be loaded.

Optional<String> id

Container id

Optional<List<BetaSkillParams>> skills

List of skills to load in the container

maxItems20
Type type

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

One of the following:
ANTHROPIC("anthropic")
CUSTOM("custom")
String skillId

Skill ID

minLength1
maxLength64
Optional<String> version

Skill version or 'latest' for most recent version

minLength1
maxLength64
class BetaContainerSkill { type; skillId; version; }

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

Type type

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

One of the following:
ANTHROPIC("anthropic")
CUSTOM("custom")
String skillId

Skill ID

minLength1
maxLength64
String version

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

minLength1
maxLength64
class BetaContainerUploadBlock { type = "container_upload"; fileId; }

Response model for a file uploaded to the container.

JsonValue type = "container_upload"
String fileId
class BetaContainerUploadBlockParam { type = "container_upload"; fileId; cacheControl; }

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

JsonValue type = "container_upload"
String fileId
Optional<BetaCacheControlEphemeral> cacheControl

Create a cache control breakpoint at this content block.

JsonValue type = "ephemeral"
Optional<Ttl> ttl

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:
TTL_5M("5m")
TTL_1H("1h")
class BetaContentBlock: union
class BetaContentBlockParam: union
class BetaContentBlockSource { type = "content"; content; }
JsonValue type = "content"
Content content
One of the following:
String
One of the following:
class BetaTextBlockParam { type = "text"; text; cacheControl; citations; }
class BetaImageBlockParam { type = "image"; source; cacheControl; transformations; }
class BetaContentBlockSourceContent: union
class BetaTextBlockParam { type = "text"; text; cacheControl; citations; }
class BetaImageBlockParam { type = "image"; source; cacheControl; transformations; }
class BetaContextManagementConfig { edits; }
class BetaContextManagementResponse { appliedEdits; }
List<AppliedEdit> appliedEdits

List of context management edits that were applied.

One of the following:
class BetaClearToolUses20250919EditResponse { type = "clear_tool_uses_20250919"; clearedInputTokens; clearedToolUses; }
JsonValue type = "clear_tool_uses_20250919"

The type of context management edit applied.

long clearedInputTokens

Number of input tokens cleared by this edit.

minimum0
long clearedToolUses

Number of tool uses that were cleared.

minimum0
class BetaClearThinking20251015EditResponse { type = "clear_thinking_20251015"; clearedInputTokens; clearedThinkingTurns; }
JsonValue type = "clear_thinking_20251015"

The type of context management edit applied.

long clearedInputTokens

Number of input tokens cleared by this edit.

minimum0
long clearedThinkingTurns

Number of thinking turns that were cleared.

minimum0
class BetaCountTokensContextManagementResponse { originalInputTokens; }
long originalInputTokens

The original token count before context management was applied

class BetaDiagnostics { cacheMissReason; }

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

Optional<BetaCacheMissReason> 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 BetaDiagnosticsParam { previousMessageId; }

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

Optional<String> previousMessageId

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 BetaDirectCaller { type = "direct"; }

Tool invocation directly from the model.

JsonValue type = "direct"
class BetaDocumentBlock { type = "document"; citations; source; title; }
class BetaEncryptedCodeExecutionResultBlock { type = "encrypted_code_execution_result"; content; encryptedStdout; /* 2 more */ }

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

JsonValue type = "encrypted_code_execution_result"
JsonValue type = "code_execution_output"
String fileId
String encryptedStdout
long returnCode
String stderr
class BetaEncryptedCodeExecutionResultBlockParam { type = "encrypted_code_execution_result"; content; encryptedStdout; /* 2 more */ }

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

JsonValue type = "encrypted_code_execution_result"
JsonValue type = "code_execution_output"
String fileId
String encryptedStdout
long returnCode
String stderr
class BetaFallbackBlock { type = "fallback"; from; to; trigger; }

Marks the point in content where one model's output gives way to the next.

One block appears per hop where a preceding model actually ran this turn and declined. A turn where no preceding model ran and declined has no such boundary and carries no block — the signal for whether a fallback model served the response is the presence of a fallback_message entry in usage.iterations, not this block.

The block is treated like a server-tool content block for streaming: it arrives via the standard content_block_start / content_block_stop pair and carries no deltas.

class BetaFallbackBlockParam { type = "fallback"; from; to; trigger; }

A fallback block echoed back from a prior response.

Accepted in messages[].content and not rendered into the prompt; not validated against the request's fallbacks chain or top-level model.

Echo the assistant turn back verbatim, including this block in its original position. The block marks the boundary between content produced before and after a fallback hop, and the server relies on that boundary to validate the turn: when thinking runs flank the boundary, omitting the block merges them into one span the server cannot validate (the request is rejected), and moving it into the middle of a single run is likewise rejected; between non-thinking blocks the block's placement has no validation effect.

JsonValue type = "fallback"

Identifies one hop of a fallback transition.

Model model

The model that will complete your prompt.

See models for additional details and options.

One of the following:

Identifies one hop of a fallback transition.

Model model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
Optional<JsonValue> trigger

The response block's trigger, echoed verbatim. Accepted and ignored by the server; any object or null is allowed.

class BetaFallbackCreditNotApplied { type = "not_applied"; reason; removeToRedeem; }

No reprice was applied; reason says why.

class BetaFallbackCreditRedeemed { type = "redeemed"; }

The reprice was applied: the retry is billed as if the conversation had been on the retry model all along.

JsonValue type = "redeemed"
class BetaFallbackCreditTokenParam { token; mode; }

Object form of fallback_credit_token: the token plus a redemption mode.

Requires anthropic-beta: fallback-credit-2026-07-01; without that header the field accepts the bare string only. The bare string and the mode-less object are equivalent (both select strict), so wrapping an existing token changes nothing by itself.

String token

The opaque fallback_credit_token from a prior refusal's stop_details — the same string the bare-string form carries.

minLength1
maxLength2048
Optional<Mode> mode

How a failing token affects the retry. strict (the default, and the bare-string behavior): a failing redemption is a 400 and the retry is not served. best_effort: the retry is served either way — a token-layer failure no longer rejects the request; the retry proceeds at normal price and the outcome is reported on the response's usage.fallback_credit. Two failures stay hard in both modes: a malformed token, and combining fallback_credit_token with fallbacks.

One of the following:
STRICT("strict")
BEST_EFFORT("best_effort")
class BetaFallbackCreditUsage { status; }

Outcome of the fallback_credit_token presented on this request.

Status status

Whether the fallback-credit reprice was applied to this response's billing.

A union discriminated on type. redeemed: the retry is billed as if the conversation had been on the retry model all along — including when the resulting shift is zero because there was nothing to move. not_applied: no reprice was applied; the arm's reason says why.

One of the following:
class BetaFallbackCreditRedeemed { type = "redeemed"; }

The reprice was applied: the retry is billed as if the conversation had been on the retry model all along.

JsonValue type = "redeemed"
class BetaFallbackCreditNotApplied { type = "not_applied"; reason; removeToRedeem; }

No reprice was applied; reason says why.

class BetaFallbackInfo { model; }

Identifies one hop of a fallback transition.

Model model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
class BetaFallbackInfoParam { model; }

Identifies one hop of a fallback transition.

Model model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
class BetaFallbackMessageIterationUsage { type = "fallback_message"; cacheCreation; cacheCreationInputTokens; /* 4 more */ }

Token usage for the fallback-model attempt of a server-side fallback request.

The terminal entry of a fallback-served turn: when a fallback hop's output is the returned message, the entry for the iteration that completed it carries this type in place of message. A declined hop and the serving hop's earlier tool-loop iterations produce message entries. Whether a fallback model served the response is signalled by the presence of this entry in usage.iterations.

JsonValue type = "fallback_message"

Usage for the fallback-model attempt that served the response

Optional<BetaCacheCreation> cacheCreation

Breakdown of cached tokens by TTL

long ephemeral1hInputTokens

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

minimum0
long ephemeral5mInputTokens

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

minimum0
long cacheCreationInputTokens

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

minimum0
long cacheReadInputTokens

The number of input tokens read from the cache.

minimum0
long inputTokens

The number of input tokens which were used.

minimum0
Model model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
long outputTokens

The number of output tokens which were used.

minimum0
class BetaFallbackParam { model; maxTokens; outputConfig; /* 2 more */ }

One entry in the fallbacks chain on a /v1/messages request.

model is required. The override fields (max_tokens, thinking, output_config, and speed) set the corresponding parameter for this attempt only and are validated as if the request were made to model. Any other key is rejected at parse time.

class BetaFallbackRefusalTrigger { type = "refusal"; category; }

The from model declined for policy reasons.

JsonValue type = "refusal"
Optional<Category> category

The policy category that triggered the from model's refusal at this hop. null when the refusal doesn't map to a named category. Same vocabulary as stop_details.category.

One of the following:
CYBER("cyber")

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

BIO("bio")

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

FRONTIER_LLM("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("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("general_harms")

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

class BetaFallbacksParam: union

Opt-in server-side retry on one or more substitute models when the requested model declines for policy reasons. Tried in order: if the first entry also declines, the second is tried, and so on. Some models don't support fallbacks; on those models, a list of fallback models returns a 400 error. See Server-side fallback. The string "default" requests the requested model's server-defined default fallback configuration. On a model that doesn't support fallbacks, the request runs on the requested model alone, so a declined request stays declined.

class BetaFileDocumentSource { type = "file"; fileId; }
JsonValue type = "file"
String fileId
class BetaFileImageSource { type = "file"; fileId; }
JsonValue type = "file"
String fileId
class BetaImageBlockParam { type = "image"; source; cacheControl; transformations; }
class BetaImageTransformationsParam { oversizedImage; }

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

Optional<OversizedImage> oversizedImage

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("downsize")
ERROR("error")
class BetaInputJsonDelta { type = "input_json_delta"; partialJson; }
JsonValue type = "input_json_delta"
String partialJson
class BetaInputTokensClearAtLeast { type = "input_tokens"; value; }
JsonValue type = "input_tokens"
long value
minimum0
class BetaInputTokensTrigger { type = "input_tokens"; value; }
JsonValue type = "input_tokens"
long value
minimum1
class BetaInputTransformation: union

One entry of input_transformations: either a change the API made to the request's input before showing it to the model, or a block that failed a binding check and was still shown to the model unchanged. The type field says which.

class BetaJsonOutputFormat { type = "json_schema"; schema; }
JsonValue type = "json_schema"
Schema schema

The JSON schema of the format

class BetaMcpTool { inputSchema; name; description; }

A tool as an MCP server lists it: its name on that server, its description, and its input schema.

InputSchema inputSchema
String name
Optional<String> description
class BetaMcpToolConfig { deferLoading; enabled; }

Configuration for a specific tool in an MCP toolset.

Optional<Boolean> deferLoading
Optional<Boolean> enabled
class BetaMcpToolDefaultConfig { deferLoading; enabled; }

Default configuration for tools in an MCP toolset.

Optional<Boolean> deferLoading
Optional<Boolean> enabled
class BetaMcpToolListingBlock { type = "mcp_tool_listing"; mcpServerName; tools; }

The tool listing the server fetched from an MCP server while producing this response. Send the assistant message back unchanged, this block included, so later requests use this listing instead of asking the MCP server again.

JsonValue type = "mcp_tool_listing"
String mcpServerName
List<BetaMcpTool> tools
InputSchema inputSchema
String name
Optional<String> description
class BetaMcpToolListingBlockParam { type = "mcp_tool_listing"; mcpServerName; tools; }

The tool listing an MCP server returned while an earlier response was produced, as that response carried it. Send the assistant message back unchanged, this block included, and the server uses this listing for the matching mcp_toolset instead of asking the MCP server again.

JsonValue type = "mcp_tool_listing"
String mcpServerName

The name of the MCP server this listing came from, as mcp_servers declares it.

minLength1
maxLength255
List<BetaMcpToolParam> tools

The server's tools, exactly as the response listed them.

InputSchema inputSchema

The tool's input schema as the MCP server lists it, verbatim.

String name

The tool's name as the MCP server lists it (not prefixed with the server name).

minLength1
Optional<String> description

The tool's description as the MCP server lists it.

class BetaMcpToolParam { inputSchema; name; description; }

A tool as an MCP server lists it: its name on that server, its description, and its input schema.

InputSchema inputSchema

The tool's input schema as the MCP server lists it, verbatim.

String name

The tool's name as the MCP server lists it (not prefixed with the server name).

minLength1
Optional<String> description

The tool's description as the MCP server lists it.

class BetaMcpToolResultBlock { type = "mcp_tool_result"; content; isError; toolUseId; }
class BetaMcpToolUseBlock { type = "mcp_tool_use"; id; input; /* 2 more */ }
JsonValue type = "mcp_tool_use"
String id
pattern^[a-zA-Z0-9_-]+$
Input input
String name

The name of the MCP tool

String serverName

The name of the MCP server

class BetaMcpToolUseBlockParam { type = "mcp_tool_use"; id; input; /* 3 more */ }
JsonValue type = "mcp_tool_use"
String id
pattern^[a-zA-Z0-9_-]+$
Input input
String name
String serverName

The name of the MCP server

Optional<BetaCacheControlEphemeral> cacheControl

Create a cache control breakpoint at this content block.

JsonValue type = "ephemeral"
Optional<Ttl> ttl

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:
TTL_5M("5m")
TTL_1H("1h")
class BetaMcpToolset { type = "mcp_toolset"; mcpServerName; cacheControl; /* 3 more */ }

Configuration for a group of tools from an MCP server.

Allows configuring enabled status and defer_loading for all tools from an MCP server, with optional per-tool overrides.

class BetaMemoryTool20250818 { type = "memory_20250818"; name; allowedCallers; /* 4 more */ }
class BetaMemoryTool20250818Command: union
class BetaMemoryTool20250818CreateCommand { command; fileText; path; }
JsonValue command = "create"

Command type identifier

String fileText

Content to write to the file

String path

Path where the file should be created

class BetaMemoryTool20250818DeleteCommand { command; path; }
JsonValue command = "delete"

Command type identifier

String path

Path to the file or directory to delete

class BetaMemoryTool20250818InsertCommand { command; insertLine; insertText; path; }
JsonValue command = "insert"

Command type identifier

long insertLine

Line number where text should be inserted

minimum1
String insertText

Text to insert at the specified line

String path

Path to the file where text should be inserted

class BetaMemoryTool20250818RenameCommand { command; newPath; oldPath; }
JsonValue command = "rename"

Command type identifier

String newPath

New path for the file or directory

String oldPath

Current path of the file or directory

class BetaMemoryTool20250818StrReplaceCommand { command; newStr; oldStr; path; }
JsonValue command = "str_replace"

Command type identifier

String newStr

Text to replace with

String oldStr

Text to search for and replace

String path

Path to the file where text should be replaced

class BetaMemoryTool20250818ViewCommand { command; path; viewRange; }
JsonValue command = "view"

Command type identifier

String path

Path to directory or file to view

Optional<List<Long>> viewRange

Optional line range for viewing specific lines

minItems2
maxItems2
class BetaMessage { type = "message"; id; container; /* 10 more */ }
class BetaMessageDeltaUsage { cacheCreationInputTokens; cacheReadInputTokens; fallbackCredit; /* 5 more */ }
class BetaMessageIterationUsage { type = "message"; cacheCreation; cacheCreationInputTokens; /* 4 more */ }

Token usage for a sampling iteration.

JsonValue type = "message"

Usage for a sampling iteration

Optional<BetaCacheCreation> cacheCreation

Breakdown of cached tokens by TTL

long ephemeral1hInputTokens

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

minimum0
long ephemeral5mInputTokens

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

minimum0
long cacheCreationInputTokens

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

minimum0
long cacheReadInputTokens

The number of input tokens read from the cache.

minimum0
long inputTokens

The number of input tokens which were used.

minimum0
Optional<Model> model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
long outputTokens

The number of output tokens which were used.

minimum0
class BetaMessageParam { content; role; clearAt; outputConfig; }
class BetaMessageTokensCount { contextManagement; inputTokens; }
Optional<BetaCountTokensContextManagementResponse> contextManagement

Information about context management applied to the message.

long originalInputTokens

The original token count before context management was applied

long inputTokens

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

class BetaMetadata { userId; }
Optional<String> userId

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
class BetaOutputConfig { effort; format; taskBudget; }
class BetaOutputTokensDetails { thinkingTokens; }
long thinkingTokens

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.

minimum0
class BetaPlainTextSource { type = "text"; data; mediaType; }
JsonValue type = "text"
String data
JsonValue mediaType = "text/plain"
class BetaRawContentBlockDelta: union
class BetaRawContentBlockDeltaEvent { type = "content_block_delta"; delta; index; }
JsonValue type = "content_block_delta"
One of the following:
long index
class BetaRawContentBlockStartEvent { type = "content_block_start"; contentBlock; index; }
class BetaRawContentBlockStopEvent { type = "content_block_stop"; index; }
JsonValue type = "content_block_stop"
long index
class BetaRawMessageDeltaEvent { type = "message_delta"; contextManagement; delta; /* 2 more */ }
class BetaRawMessageStartEvent { type = "message_start"; message; }
JsonValue type = "message_start"
BetaMessage message
class BetaRawMessageStopEvent { type = "message_stop"; }
JsonValue type = "message_stop"
class BetaRawMessageStreamEvent: union
class BetaRedactedThinkingBlock { type = "redacted_thinking"; data; }
JsonValue type = "redacted_thinking"
String data

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 BetaRedactedThinkingBlockParam { type = "redacted_thinking"; data; }
JsonValue type = "redacted_thinking"
String data

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 BetaRefusalStopDetails { type = "refusal"; category; explanation; /* 3 more */ }

Structured information about a refusal.

class BetaRequestDocumentBlock { type = "document"; source; cacheControl; /* 3 more */ }
class BetaRequestMcpServerToolConfiguration { allowedTools; enabled; }
Optional<List<String>> allowedTools
Optional<Boolean> enabled
class BetaRequestMcpServerUrlDefinition { type = "url"; name; url; /* 2 more */ }
JsonValue type = "url"
String name
String url
Optional<String> authorizationToken
Optional<BetaRequestMcpServerToolConfiguration> toolConfiguration
Optional<List<String>> allowedTools
Optional<Boolean> enabled
class BetaRequestMcpToolResultBlockParam { type = "mcp_tool_result"; toolUseId; cacheControl; /* 2 more */ }
class BetaRequestToolAdditionBlock { type = "tool_addition"; tool; cacheControl; }

Mid-conversation directive to make a tool available.

tool is a reference to a tool (or MCP toolset) declared in the request's tools. Under the inline-tools-2026-09-15 beta it may instead be a reference to a tool defined earlier in messages, or a tool_definition object that carries an inline tool definition in definition (the same object a tools entry holds). An mcp_toolset definition also requires the mcp-client-2026-09-15 beta. The tool is offered to the model from this point in the conversation onward.

class BetaRequestToolRemovalBlock { type = "tool_removal"; tool; cacheControl; }

Mid-conversation directive to withdraw a tool.

tool references a tool (or MCP toolset) by name: one declared in the request's tools or defined earlier in messages. It is no longer offered to the model from this point in the conversation onward.

class BetaResponseTool { type; inputSchema; name; /* 6 more */ }

A custom tool definition, as sent.

class BetaResponseToolAdditionBlock { type = "tool_addition"; tool; }

An entry of a compaction block's tool_changes: a tool the compacted range made available, as a reference to a tools entry or MCP toolset, or as the tool definition in effect at the end of the range, by value. Send it back unchanged.

class BetaResponseToolChangeMcpToolReference { type = "mcp_tool_reference"; name; serverName; }

Reference to a single MCP tool, by its server and its name on that server, as a compaction block's tool_changes entry reports it. Send it back unchanged with the block.

JsonValue type = "mcp_tool_reference"
String name
String serverName
class BetaResponseToolChangeMcpToolsetReference { type = "mcp_toolset_reference"; serverName; }

Reference to every tool in the named MCP server's toolset, as a compaction block's tool_changes entry reports it. Send it back unchanged with the block.

JsonValue type = "mcp_toolset_reference"
String serverName
class BetaResponseToolChangeToolReference { type = "tool_reference"; name; }

Reference to a single tool, by the name the model uses to call it, as a compaction block's tool_changes entry reports it: a tool declared in tools or defined by an earlier tool_addition block. Send it back unchanged with the block.

JsonValue type = "tool_reference"
String name
class BetaResponseToolInputSchema { type = "object"; properties; required; }

JSON schema for this tool's input.

This defines the shape of the input that your tool accepts and that the model will produce.

JsonValue type = "object"
Optional<Properties> properties
Optional<List<String>> required
class BetaResponseToolRemovalBlock { type = "tool_removal"; tool; }

An entry of a compaction block's tool_changes: a tool of the request's tools (or an MCP tool or toolset) that the compacted range withdrew. Send it back unchanged.

class BetaResponseToolUnion: union
class BetaSearchResultBlockParam { type = "search_result"; content; source; /* 3 more */ }
class BetaServerToolCaller { type = "code_execution_20250825"; toolId; }

Tool invocation generated by a server-side tool.

JsonValue type = "code_execution_20250825"
String toolId
pattern^srvtoolu_[a-zA-Z0-9_]+$
class BetaServerToolCaller20260120 { type = "code_execution_20260120"; toolId; }
JsonValue type = "code_execution_20260120"
String toolId
pattern^srvtoolu_[a-zA-Z0-9_]+$
class BetaServerToolUsage { webFetchRequests; webSearchRequests; }
long webFetchRequests

The number of web fetch tool requests.

minimum0
long webSearchRequests

The number of web search tool requests.

minimum0
class BetaServerToolUseBlock { type = "server_tool_use"; id; input; /* 2 more */ }
class BetaServerToolUseBlockParam { type = "server_tool_use"; id; input; /* 3 more */ }
class BetaSignatureDelta { type = "signature_delta"; signature; }
JsonValue type = "signature_delta"
String signature

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 BetaSkillParams { type; skillId; version; }

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

Type type

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

One of the following:
ANTHROPIC("anthropic")
CUSTOM("custom")
String skillId

Skill ID

minLength1
maxLength64
Optional<String> version

Skill version or 'latest' for most recent version

minLength1
maxLength64
enum BetaStopReason
END_TURN("end_turn")
MAX_TOKENS("max_tokens")
STOP_SEQUENCE("stop_sequence")
TOOL_USE("tool_use")
PAUSE_TURN("pause_turn")
COMPACTION("compaction")
REFUSAL("refusal")
MODEL_CONTEXT_WINDOW_EXCEEDED("model_context_window_exceeded")
class BetaSummarizeCompaction { type = "summarize"; instructions; }

Compact the whole conversation and return a signed compaction block, alone, that a later request sends back first in messages, in place of the messages it summarizes. There is no trigger and no pause flag: sending the parameter compacts, and nothing is sampled after the block.

The summarization prompt is the server's own unless instructions are given, which then replace it for this request; a value that is empty or only whitespace counts as absent.

JsonValue type = "summarize"
Optional<String> instructions

Replaces the server's default summarization prompt for this request. An empty or whitespace-only value counts as absent.

maxLength16384
class BetaSystemMessageOutputConfig { effort; }

Per-message output configuration on a role:"system" input message.

Fields here apply per-turn; format remains top-level only. An empty {} is accepted on a message that carries content; a message with neither content nor output_config fields is rejected.

Optional<Effort> effort

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("low")
MEDIUM("medium")
HIGH("high")
XHIGH("xhigh")
MAX("max")
class BetaTextBlock { type = "text"; citations; text; }
class BetaTextBlockParam { type = "text"; text; cacheControl; citations; }
class BetaTextCitation: union
class BetaTextCitationParam: union
class BetaTextDelta { type = "text_delta"; text; }
JsonValue type = "text_delta"
String text
class BetaTextEditorCodeExecutionCreateResultBlock { type = "text_editor_code_execution_create_result"; isFileUpdate; }
JsonValue type = "text_editor_code_execution_create_result"
boolean isFileUpdate
class BetaTextEditorCodeExecutionCreateResultBlockParam { type = "text_editor_code_execution_create_result"; isFileUpdate; }
JsonValue type = "text_editor_code_execution_create_result"
boolean isFileUpdate
class BetaTextEditorCodeExecutionStrReplaceResultBlock { type = "text_editor_code_execution_str_replace_result"; lines; newLines; /* 3 more */ }
JsonValue type = "text_editor_code_execution_str_replace_result"
Optional<List<String>> lines
Optional<Long> newLines
Optional<Long> newStart
Optional<Long> oldLines
Optional<Long> oldStart
class BetaTextEditorCodeExecutionStrReplaceResultBlockParam { type = "text_editor_code_execution_str_replace_result"; lines; newLines; /* 3 more */ }
JsonValue type = "text_editor_code_execution_str_replace_result"
Optional<List<String>> lines
Optional<Long> newLines
Optional<Long> newStart
Optional<Long> oldLines
Optional<Long> oldStart
class BetaTextEditorCodeExecutionToolResultBlock { type = "text_editor_code_execution_tool_result"; content; toolUseId; }
class BetaTextEditorCodeExecutionToolResultBlockParam { type = "text_editor_code_execution_tool_result"; content; toolUseId; cacheControl; }
class BetaTextEditorCodeExecutionToolResultError { type = "text_editor_code_execution_tool_result_error"; errorCode; errorMessage; }
JsonValue type = "text_editor_code_execution_tool_result_error"
ErrorCode errorCode
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
FILE_NOT_FOUND("file_not_found")
Optional<String> errorMessage
class BetaTextEditorCodeExecutionToolResultErrorParam { type = "text_editor_code_execution_tool_result_error"; errorCode; errorMessage; }
JsonValue type = "text_editor_code_execution_tool_result_error"
ErrorCode errorCode
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
FILE_NOT_FOUND("file_not_found")
Optional<String> errorMessage
class BetaTextEditorCodeExecutionViewResultBlock { type = "text_editor_code_execution_view_result"; content; fileType; /* 3 more */ }
JsonValue type = "text_editor_code_execution_view_result"
String content
FileType fileType
One of the following:
TEXT("text")
IMAGE("image")
PDF("pdf")
Optional<Long> numLines
Optional<Long> startLine
Optional<Long> totalLines
class BetaTextEditorCodeExecutionViewResultBlockParam { type = "text_editor_code_execution_view_result"; content; fileType; /* 3 more */ }
JsonValue type = "text_editor_code_execution_view_result"
String content
FileType fileType
One of the following:
TEXT("text")
IMAGE("image")
PDF("pdf")
Optional<Long> numLines
Optional<Long> startLine
Optional<Long> totalLines
class BetaThinkingBlock { type = "thinking"; signature; thinking; }
JsonValue type = "thinking"
String signature

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.

String thinking

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

class BetaThinkingBlockBinding { prefixMismatchBehavior; }

Controls for block binding: what happens when a thinking block this request sends back fails the conversation check. Every field is optional; an empty object means every default.

Optional<BetaThinkingPrefixMismatchBehavior> prefixMismatchBehavior

"error" (default) | "drop_block". What happens when a thinking block in messages fails the conversation check (it was created in a different conversation, or the messages before it have changed since). "error" fails the request with a 400 error. "drop_block" removes the failing blocks and the request proceeds; each removal is reported in input_transformations.

One of the following:
ERROR("error")
DROP_BLOCK("drop_block")
class BetaThinkingBlockParam { type = "thinking"; signature; thinking; }
JsonValue type = "thinking"
String signature

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.

String thinking

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

class BetaThinkingConfigAdaptive { type = "adaptive"; blockBinding; display; }
JsonValue type = "adaptive"
Optional<BetaThinkingBlockBinding> blockBinding

Controls for block binding: what happens when a thinking block this request sends back fails the conversation check. null, absent or an empty object means every default.

Optional<BetaThinkingPrefixMismatchBehavior> prefixMismatchBehavior

"error" (default) | "drop_block". What happens when a thinking block in messages fails the conversation check (it was created in a different conversation, or the messages before it have changed since). "error" fails the request with a 400 error. "drop_block" removes the failing blocks and the request proceeds; each removal is reported in input_transformations.

One of the following:
ERROR("error")
DROP_BLOCK("drop_block")
Optional<Display> display

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("summarized")
OMITTED("omitted")
UPDATES("updates")
class BetaThinkingConfigBetweenTools { type = "between_tools"; }
JsonValue type = "between_tools"
class BetaThinkingConfigDisabled { type = "disabled"; }
JsonValue type = "disabled"
class BetaThinkingConfigEnabled { type = "enabled"; budgetTokens; blockBinding; display; }
JsonValue type = "enabled"
long budgetTokens

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
Optional<BetaThinkingBlockBinding> blockBinding

Controls for block binding: what happens when a thinking block this request sends back fails the conversation check. null, absent or an empty object means every default.

Optional<BetaThinkingPrefixMismatchBehavior> prefixMismatchBehavior

"error" (default) | "drop_block". What happens when a thinking block in messages fails the conversation check (it was created in a different conversation, or the messages before it have changed since). "error" fails the request with a 400 error. "drop_block" removes the failing blocks and the request proceeds; each removal is reported in input_transformations.

One of the following:
ERROR("error")
DROP_BLOCK("drop_block")
Optional<Display> display

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("summarized")
OMITTED("omitted")
UPDATES("updates")
class BetaThinkingConfigParam: union

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.

class BetaThinkingDelta { type = "thinking_delta"; estimatedTokens; thinking; }
JsonValue type = "thinking_delta"
Optional<Long> estimatedTokens

Per-frame increment of a coarse, running estimate of the tokens this thinking block has produced so far. Present whenever the thinking-token-count-2026-05-13 beta is set; null unless thinking.display resolves to "omitted" and a count is due this frame. Sum the increments across thinking_delta frames on this block for a progress indicator. Each increment is a non-negative multiple of a fixed quantum and the cadence is rate-limited, so this is a deliberately lossy display hint, not a billable count; usage.output_tokens remains authoritative.

String thinking

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 BetaThinkingDroppedInputTransformation { type = "thinking_dropped"; path; reason; }
JsonValue type = "thinking_dropped"

Always thinking_dropped for this entry type.

String path

Where the removed block was in your request, as messages.{i}.content.{j}: i indexes the messages array you sent and j that message's content array — the same form error messages use.

Reason reason

Which binding check removed the block: model_binding_mismatch — it was created by a model whose reasoning the requested model may not read; prefix_binding_mismatch — the conversation before it differs from the conversation it was created in (the rest of that turn's consecutive thinking blocks are removed with it, each with this reason); organization_binding_mismatch — it was created under a different organization (an Anthropic organization, AWS account or Google Cloud project) and this organization is not one of its additional organizations; end_user_binding_mismatch — it was created for a different end user, or was removed by the consumer-organization binding. A block that would fail several checks reports one reason, in this order of precedence: organization_binding_mismatch, end_user_binding_mismatch, model_binding_mismatch, prefix_binding_mismatch.

One of the following:
MODEL_BINDING_MISMATCH("model_binding_mismatch")
PREFIX_BINDING_MISMATCH("prefix_binding_mismatch")
ORGANIZATION_BINDING_MISMATCH("organization_binding_mismatch")
END_USER_BINDING_MISMATCH("end_user_binding_mismatch")
class BetaThinkingMismatchAllowedInputTransformation { type = "thinking_mismatch_allowed"; path; reason; }
JsonValue type = "thinking_mismatch_allowed"

Always thinking_mismatch_allowed for this entry type.

String path

Where the block is in your request, as messages.{i}.content.{j}: i indexes the messages array you sent and j that message's content array — the same form error messages use.

Reason reason

Which binding check the block failed; the block was shown to the model all the same. Always prefix_binding_mismatch today — the conversation before the block differs from the conversation it was created in, or the block carries no record of one on a model that requires it. Were the check enforced for this request, the block would have been removed or the request rejected (thinking.block_binding.prefix_mismatch_behavior). A removal also takes the rest of that turn's consecutive thinking blocks, whereas here each block is checked on its own, so thinking_mismatch_allowed entries are a lower bound on what enforcement would remove.

One of the following:
MODEL_BINDING_MISMATCH("model_binding_mismatch")
PREFIX_BINDING_MISMATCH("prefix_binding_mismatch")
ORGANIZATION_BINDING_MISMATCH("organization_binding_mismatch")
END_USER_BINDING_MISMATCH("end_user_binding_mismatch")
enum BetaThinkingPrefixMismatchBehavior

What happens when a thinking block in messages fails the conversation check: it was created in a different conversation, or the messages before it have changed since. "error" (the default) fails the request with a 400 error. "drop_block" removes the failing blocks and the request proceeds; the model no longer sees the dropped reasoning.

ERROR("error")
DROP_BLOCK("drop_block")
class BetaThinkingTurns { type = "thinking_turns"; value; }
JsonValue type = "thinking_turns"
long value
minimum1
class BetaTokenTaskBudget { type = "tokens"; total; remaining; }

User-configurable total token budget across contexts.

JsonValue type = "tokens"

The budget type. Currently only 'tokens' is supported.

long total

Total token budget across all contexts in the session.

minimum1024
Optional<Long> remaining

Remaining tokens in the budget. Use this to track usage across contexts when implementing compaction client-side. Defaults to total if not provided.

minimum0
class BetaTool { type; inputSchema; name; /* 7 more */ }
class BetaToolBash20241022 { type = "bash_20241022"; name; allowedCallers; /* 4 more */ }
class BetaToolBash20250124 { type = "bash_20250124"; name; allowedCallers; /* 4 more */ }
class BetaToolChangeMcpToolReference { type = "mcp_tool_reference"; name; serverName; }

Reference to a single MCP tool by its server and remote name; the same server_name/name pair mcp_tool_use carries.

JsonValue type = "mcp_tool_reference"
String name
String serverName
class BetaToolChangeMcpToolsetReference { type = "mcp_toolset_reference"; serverName; }

Reference to every tool in the named MCP server's toolset.

JsonValue type = "mcp_toolset_reference"
String serverName
class BetaToolChangeToolDefinition { type = "tool_definition"; definition; }

A tool defined by value, as a compaction block's tool_changes entry reports it: definition is the tool's definition as it was sent, in the form of a tools entry, without cache_control. Send it back unchanged with the block.

JsonValue type = "tool_definition"
BetaResponseToolUnion definition
One of the following:
class BetaToolChangeToolDefinitionParam { type = "tool_definition"; definition; }

A tool defined by value: definition is a tools entry (any kind tools accepts, an MCP toolset included). An mcp_toolset given here also requires the mcp-client-2026-09-15 beta.

JsonValue type = "tool_definition"
BetaToolUnion definition
One of the following:
class BetaToolChangeToolReference { type = "tool_reference"; name; }

Reference to a single tool, by the name the model uses to call it: a tool declared in tools or defined by an earlier tool_addition block. Does not accept the composed {server}_{name} form the server assigns to MCP-resolved tools; use mcp_tool_reference or mcp_toolset_reference for those.

JsonValue type = "tool_reference"
String name
pattern^[a-zA-Z0-9_-]{1,128}$
class BetaToolChoice: union

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.

class BetaToolChoiceAny { type = "any"; disableParallelToolUse; }

The model will use any available tools.

JsonValue type = "any"
Optional<Boolean> disableParallelToolUse

Whether to disable parallel tool use.

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

class BetaToolChoiceAuto { type = "auto"; disableParallelToolUse; }

The model will automatically decide whether to use tools.

JsonValue type = "auto"
Optional<Boolean> disableParallelToolUse

Whether to disable parallel tool use.

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

class BetaToolChoiceNone { type = "none"; }

The model will not be allowed to use tools.

JsonValue type = "none"
class BetaToolChoiceTool { type = "tool"; name; disableParallelToolUse; }

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

JsonValue type = "tool"
String name

The name of the tool to use.

Optional<Boolean> disableParallelToolUse

Whether to disable parallel tool use.

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

class BetaToolComputerUse20241022 { type = "computer_20241022"; displayHeightPx; displayWidthPx; /* 7 more */ }
class BetaToolComputerUse20250124 { type = "computer_20250124"; displayHeightPx; displayWidthPx; /* 7 more */ }
class BetaToolComputerUse20251124 { type = "computer_20251124"; displayHeightPx; displayWidthPx; /* 8 more */ }
class BetaToolReferenceBlock { type = "tool_reference"; toolName; }
JsonValue type = "tool_reference"
String toolName
minLength1
maxLength256
pattern^[a-zA-Z0-9_-]{1,256}$
class BetaToolReferenceBlockParam { type = "tool_reference"; toolName; cacheControl; }

Tool reference block that can be included in tool_result content.

JsonValue type = "tool_reference"
String toolName
minLength1
maxLength256
pattern^[a-zA-Z0-9_-]{1,256}$
Optional<BetaCacheControlEphemeral> cacheControl

Create a cache control breakpoint at this content block.

JsonValue type = "ephemeral"
Optional<Ttl> ttl

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:
TTL_5M("5m")
TTL_1H("1h")
class BetaToolResultBlockParam { type = "tool_result"; toolUseId; cacheControl; /* 3 more */ }
class BetaToolSearchToolBm25_20251119 { type; name; allowedCallers; /* 3 more */ }
class BetaToolSearchToolRegex20251119 { type; name; allowedCallers; /* 3 more */ }
class BetaToolSearchToolResultBlock { type = "tool_search_tool_result"; content; toolUseId; }
class BetaToolSearchToolResultBlockParam { type = "tool_search_tool_result"; content; toolUseId; cacheControl; }
class BetaToolSearchToolResultError { type = "tool_search_tool_result_error"; errorCode; errorMessage; }
JsonValue type = "tool_search_tool_result_error"
ErrorCode errorCode
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
Optional<String> errorMessage
class BetaToolSearchToolResultErrorParam { type = "tool_search_tool_result_error"; errorCode; errorMessage; }
JsonValue type = "tool_search_tool_result_error"
ErrorCode errorCode
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
Optional<String> errorMessage
class BetaToolSearchToolSearchResultBlock { type = "tool_search_tool_search_result"; toolReferences; }
JsonValue type = "tool_search_tool_search_result"
List<BetaToolReferenceBlock> toolReferences
JsonValue type = "tool_reference"
String toolName
minLength1
maxLength256
pattern^[a-zA-Z0-9_-]{1,256}$
class BetaToolSearchToolSearchResultBlockParam { type = "tool_search_tool_search_result"; toolReferences; }
JsonValue type = "tool_search_tool_search_result"
List<BetaToolReferenceBlockParam> toolReferences
JsonValue type = "tool_reference"
String toolName
minLength1
maxLength256
pattern^[a-zA-Z0-9_-]{1,256}$
Optional<BetaCacheControlEphemeral> cacheControl

Create a cache control breakpoint at this content block.

JsonValue type = "ephemeral"
Optional<Ttl> ttl

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:
TTL_5M("5m")
TTL_1H("1h")
class BetaToolTextEditor20241022 { type = "text_editor_20241022"; name; allowedCallers; /* 4 more */ }
class BetaToolTextEditor20250124 { type = "text_editor_20250124"; name; allowedCallers; /* 4 more */ }
class BetaToolTextEditor20250429 { type = "text_editor_20250429"; name; allowedCallers; /* 4 more */ }
class BetaToolTextEditor20250728 { type = "text_editor_20250728"; name; allowedCallers; /* 5 more */ }
class BetaToolUnion: union
class BetaToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaToolUseBlockParam { type = "tool_use"; id; input; /* 4 more */ }
class BetaToolUseCaller: union

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

class BetaDirectCaller { type = "direct"; }

Tool invocation directly from the model.

JsonValue type = "direct"
class BetaServerToolCaller { type = "code_execution_20250825"; toolId; }

Tool invocation generated by a server-side tool.

JsonValue type = "code_execution_20250825"
String toolId
pattern^srvtoolu_[a-zA-Z0-9_]+$
class BetaServerToolCaller20260120 { type = "code_execution_20260120"; toolId; }
JsonValue type = "code_execution_20260120"
String toolId
pattern^srvtoolu_[a-zA-Z0-9_]+$
class BetaToolUsesKeep { type = "tool_uses"; value; }
JsonValue type = "tool_uses"
long value
minimum0
class BetaToolUsesTrigger { type = "tool_uses"; value; }
JsonValue type = "tool_uses"
long value
minimum1
class BetaToolsetToolUseBlock: union
class BetaBrowserToolUseBlock: union
class BetaComputerToolUseBlock: union
class BetaToolUseBlock { type = "tool_use"; id; input; /* 3 more */ }
class BetaUrlImageSource { type = "url"; url; }
JsonValue type = "url"
String url
class BetaUrlPdfSource { type = "url"; url; }
JsonValue type = "url"
String url
class BetaUsage { cacheCreation; cacheCreationInputTokens; cacheReadInputTokens; /* 9 more */ }
class BetaUserLocation { type = "approximate"; city; country; /* 2 more */ }
JsonValue type = "approximate"
Optional<String> city

The city of the user.

minLength1
maxLength255
Optional<String> country

The two letter ISO country code of the user.

minLength2
maxLength2
Optional<String> region

The region of the user.

minLength1
maxLength255
Optional<String> timezone

The IANA timezone of the user.

minLength1
maxLength255
class BetaWebFetchBlock { type = "web_fetch_result"; content; retrievedAt; url; }
JsonValue type = "web_fetch_result"
Optional<String> retrievedAt

ISO 8601 timestamp when the content was retrieved

String url

Fetched content URL

class BetaWebFetchBlockParam { type = "web_fetch_result"; content; url; retrievedAt; }
JsonValue type = "web_fetch_result"
String url

Fetched content URL

Optional<String> retrievedAt

ISO 8601 timestamp when the content was retrieved

class BetaWebFetchTool20250910 { type = "web_fetch_20250910"; name; allowedCallers; /* 9 more */ }
class BetaWebFetchTool20260209 { type = "web_fetch_20260209"; name; allowedCallers; /* 9 more */ }
class BetaWebFetchTool20260309 { type = "web_fetch_20260309"; name; allowedCallers; /* 10 more */ }

Web fetch tool with use_cache parameter for bypassing cached content.

class BetaWebFetchTool20260318 { type = "web_fetch_20260318"; name; allowedCallers; /* 11 more */ }
class BetaWebFetchToolResultBlock { type = "web_fetch_tool_result"; content; toolUseId; caller; }
class BetaWebFetchToolResultBlockParam { type = "web_fetch_tool_result"; content; toolUseId; /* 2 more */ }
class BetaWebFetchToolResultErrorBlock { type = "web_fetch_tool_result_error"; errorCode; }
JsonValue type = "web_fetch_tool_result_error"
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
URL_TOO_LONG("url_too_long")
URL_NOT_ALLOWED("url_not_allowed")
URL_NOT_IN_PRIOR_CONTEXT("url_not_in_prior_context")
URL_NOT_ACCESSIBLE("url_not_accessible")
UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")
TOO_MANY_REQUESTS("too_many_requests")
MAX_USES_EXCEEDED("max_uses_exceeded")
UNAVAILABLE("unavailable")
CONTENT_TOO_LARGE("content_too_large")
class BetaWebFetchToolResultErrorBlockParam { type = "web_fetch_tool_result_error"; errorCode; }
JsonValue type = "web_fetch_tool_result_error"
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
URL_TOO_LONG("url_too_long")
URL_NOT_ALLOWED("url_not_allowed")
URL_NOT_IN_PRIOR_CONTEXT("url_not_in_prior_context")
URL_NOT_ACCESSIBLE("url_not_accessible")
UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")
TOO_MANY_REQUESTS("too_many_requests")
MAX_USES_EXCEEDED("max_uses_exceeded")
UNAVAILABLE("unavailable")
CONTENT_TOO_LARGE("content_too_large")
enum BetaWebFetchToolResultErrorCode
INVALID_TOOL_INPUT("invalid_tool_input")
URL_TOO_LONG("url_too_long")
URL_NOT_ALLOWED("url_not_allowed")
URL_NOT_IN_PRIOR_CONTEXT("url_not_in_prior_context")
URL_NOT_ACCESSIBLE("url_not_accessible")
UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")
TOO_MANY_REQUESTS("too_many_requests")
MAX_USES_EXCEEDED("max_uses_exceeded")
UNAVAILABLE("unavailable")
CONTENT_TOO_LARGE("content_too_large")
class BetaWebFetchUrlSourceAll { 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.

JsonValue type = "all"
class BetaWebFetchUrlSourceExcept { type = "except"; tools; }

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

JsonValue type = "except"
JsonValue type = "tool_reference"
String name
class BetaWebFetchUrlSourceNone { type = "none"; }

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

JsonValue type = "none"
class BetaWebFetchUrlSourceOnly { type = "only"; tools; }

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

JsonValue type = "only"
JsonValue type = "tool_reference"
String name
class BetaWebFetchUrlSourceToolReference { type = "tool_reference"; name; }

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

JsonValue type = "tool_reference"
String name
class BetaWebFetchUrlSources { clientToolResults; serverToolResults; userInput; }

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

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

class BetaWebSearchResultBlock { type = "web_search_result"; encryptedContent; pageAge; /* 2 more */ }
JsonValue type = "web_search_result"
String encryptedContent
Optional<String> pageAge
String title
String url
class BetaWebSearchResultBlockParam { type = "web_search_result"; encryptedContent; title; /* 2 more */ }
JsonValue type = "web_search_result"
String encryptedContent
String title
String url
Optional<String> pageAge
class BetaWebSearchTool20250305 { type = "web_search_20250305"; name; allowedCallers; /* 7 more */ }
class BetaWebSearchTool20260209 { type = "web_search_20260209"; name; allowedCallers; /* 7 more */ }
class BetaWebSearchTool20260318 { type = "web_search_20260318"; name; allowedCallers; /* 8 more */ }
class BetaWebSearchToolRequestError { type = "web_search_tool_result_error"; errorCode; }
JsonValue type = "web_search_tool_result_error"
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
MAX_USES_EXCEEDED("max_uses_exceeded")
TOO_MANY_REQUESTS("too_many_requests")
QUERY_TOO_LONG("query_too_long")
REQUEST_TOO_LARGE("request_too_large")
class BetaWebSearchToolResultBlock { type = "web_search_tool_result"; content; toolUseId; caller; }
class BetaWebSearchToolResultBlockContent: union
class BetaWebSearchToolResultBlockParam { type = "web_search_tool_result"; content; toolUseId; /* 2 more */ }
class BetaWebSearchToolResultBlockParamContent: union
class BetaWebSearchToolResultError { type = "web_search_tool_result_error"; errorCode; }
JsonValue type = "web_search_tool_result_error"
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
MAX_USES_EXCEEDED("max_uses_exceeded")
TOO_MANY_REQUESTS("too_many_requests")
QUERY_TOO_LONG("query_too_long")
REQUEST_TOO_LARGE("request_too_large")
enum BetaWebSearchToolResultErrorCode
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
MAX_USES_EXCEEDED("max_uses_exceeded")
TOO_MANY_REQUESTS("too_many_requests")
QUERY_TOO_LONG("query_too_long")
REQUEST_TOO_LARGE("request_too_large")

MensagensLotes

Criar um lote de mensagens
BetaMessageBatch beta().messages().batches().create(params, requestOptions = RequestOptions.none())
POST/v1/messages/batches

Envie um lote de solicitações de criação de mensagens.

Recuperar um lote de mensagens
BetaMessageBatch beta().messages().batches().retrieve(params = BatchRetrieveParams.none(), requestOptions = RequestOptions.none())
GET/v1/messages/batches/{message_batch_id}

Este endpoint é idempotente e pode ser usado para fazer polling da conclusão de um lote de mensagens. Para acessar os resultados de um lote de mensagens, faça uma solicitação para o campo results_url na resposta.

Listar lotes de mensagens
BatchListPage beta().messages().batches().list(params = BatchListParams.none(), requestOptions = RequestOptions.none())
GET/v1/messages/batches

Liste todos os lotes de mensagens em um Workspace. Os lotes criados mais recentemente são retornados primeiro.

Cancelar um lote de mensagens
BetaMessageBatch beta().messages().batches().cancel(params = BatchCancelParams.none(), requestOptions = RequestOptions.none())
POST/v1/messages/batches/{message_batch_id}/cancel

Os lotes podem ser cancelados a qualquer momento antes do término do processamento. Depois que o cancelamento é iniciado, o lote entra em um estado canceling, momento em que o sistema pode concluir quaisquer solicitações em andamento e não interrompíveis antes de finalizar o cancelamento.

Excluir um lote de mensagens
BetaDeletedMessageBatch beta().messages().batches().delete(params = BatchDeleteParams.none(), requestOptions = RequestOptions.none())
DELETE/v1/messages/batches/{message_batch_id}

Exclua um lote de mensagens.

Recuperar resultados de um lote de mensagens
StreamResponse<BetaMessageBatchIndividualResponse> beta().messages().batches().resultsStreaming(params = BatchResultsParams.none(), requestOptions = RequestOptions.none())
GET/v1/messages/batches/{message_batch_id}/results

Faz streaming dos resultados de um lote de mensagens como um arquivo .jsonl.