Claude Platform Docs

Messages

Create a Message
client.beta.messages.create(MessageCreateParamsparams, RequestOptionsoptions?): BetaMessage | Stream<BetaRawMessageStreamEvent>
POST/v1/messages
Count tokens in a Message
client.beta.messages.countTokens(MessageCountTokensParamsparams, RequestOptionsoptions?): BetaMessageTokensCount
POST/v1/messages/count_tokens
Models
BetaAdvisorMessageIterationUsage { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more }

Token usage for an advisor sub-inference iteration.

BetaAdvisorRedactedResultBlock { encrypted_content, stop_reason, type }
encrypted_content: string

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

stop_reason: string | null

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

type: "advisor_redacted_result"
defaultadvisor_redacted_result
BetaAdvisorRedactedResultBlockParam { encrypted_content, type, stop_reason }
encrypted_content: string

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

type: "advisor_redacted_result"
stop_reason?: string | null
BetaAdvisorResultBlock { stop_reason, text, type }
stop_reason: string | null

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.

text: string
type: "advisor_result"
defaultadvisor_result
BetaAdvisorResultBlockParam { text, type, stop_reason }
text: string
type: "advisor_result"
stop_reason?: string | null
BetaAdvisorTool20260301 { model, name, type, 7 more }
BetaAdvisorToolResultBlock { content, tool_use_id, type }
BetaAdvisorToolResultBlockParam { content, tool_use_id, type, cache_control }
BetaAdvisorToolResultError { error_code, type }
error_code: "max_uses_exceeded" | "prompt_too_long" | "too_many_requests" | 4 more
One of the following:
"max_uses_exceeded"
"prompt_too_long"
"too_many_requests"
"overloaded"
"unavailable"
"execution_time_exceeded"
"model_not_found"
type: "advisor_tool_result_error"
defaultadvisor_tool_result_error
BetaAdvisorToolResultErrorParam { error_code, type }
error_code: "max_uses_exceeded" | "prompt_too_long" | "too_many_requests" | 4 more
One of the following:
"max_uses_exceeded"
"prompt_too_long"
"too_many_requests"
"overloaded"
"unavailable"
"execution_time_exceeded"
"model_not_found"
type: "advisor_tool_result_error"
BetaAllThinkingTurns { type }
type: "all"
BetaBase64ImageSource { data, media_type, type }
data: string
formatbyte
media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"
One of the following:
"image/jpeg"
"image/png"
"image/gif"
"image/webp"
type: "base64"
BetaBase64PDFSource { data, media_type, type }
data: string
formatbyte
media_type: "application/pdf"
type: "base64"
BetaBashCodeExecutionOutputBlock { file_id, type }
file_id: string
type: "bash_code_execution_output"
defaultbash_code_execution_output
BetaBashCodeExecutionOutputBlockParam { file_id, type }
file_id: string
type: "bash_code_execution_output"
BetaBashCodeExecutionResultBlock { content, return_code, stderr, 2 more }
content: Array<BetaBashCodeExecutionOutputBlock { file_id, type }>
file_id: string
type: "bash_code_execution_output"
defaultbash_code_execution_output
return_code: number
stderr: string
stdout: string
type: "bash_code_execution_result"
defaultbash_code_execution_result
BetaBashCodeExecutionResultBlockParam { content, return_code, stderr, 2 more }
content: Array<BetaBashCodeExecutionOutputBlockParam { file_id, type }>
file_id: string
type: "bash_code_execution_output"
return_code: number
stderr: string
stdout: string
type: "bash_code_execution_result"
BetaBashCodeExecutionToolResultBlock { content, tool_use_id, type }
BetaBashCodeExecutionToolResultBlockParam { content, tool_use_id, type, cache_control }
BetaBashCodeExecutionToolResultError { error_code, type }
error_code: "invalid_tool_input" | "unavailable" | "too_many_requests" | 2 more
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
"output_file_too_large"
type: "bash_code_execution_tool_result_error"
defaultbash_code_execution_tool_result_error
BetaBashCodeExecutionToolResultErrorParam { error_code, type }
error_code: "invalid_tool_input" | "unavailable" | "too_many_requests" | 2 more
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
"output_file_too_large"
type: "bash_code_execution_tool_result_error"
BetaBrowserCloseTabConfig { defer_loading, enabled }

close_tab's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserDoubleClickConfig { defer_loading, enabled }

double_click's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserFileUploadConfig { defer_loading, enabled }

file_upload's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserFindConfig { defer_loading, enabled }

find's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserFormInputConfig { defer_loading, enabled }

form_input's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserGetPageTextConfig { defer_loading, enabled }

get_page_text's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserHoldKeyConfig { defer_loading, enabled }

hold_key's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserHoverConfig { defer_loading, enabled }

hover's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserJavascriptExecConfig { defer_loading, enabled }

javascript_exec's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserKeyConfig { defer_loading, enabled }

key's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserLeftClickConfig { defer_loading, enabled }

left_click's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserLeftClickDragConfig { defer_loading, enabled }

left_click_drag's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserLeftMouseDownConfig { defer_loading, enabled }

left_mouse_down's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserLeftMouseUpConfig { defer_loading, enabled }

left_mouse_up's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserListTabsConfig { defer_loading, enabled }

list_tabs's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserMiddleClickConfig { defer_loading, enabled }

middle_click's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserMouseMoveConfig { defer_loading, enabled }

mouse_move's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserNavigateConfig { defer_loading, enabled }

navigate's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserNewTabConfig { defer_loading, enabled }

new_tab's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserReadConsoleConfig { defer_loading, enabled }

read_console's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserReadNetworkConfig { defer_loading, enabled }

read_network's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserReadPageConfig { defer_loading, enabled }

read_page's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserRightClickConfig { defer_loading, enabled }

right_click's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserScreenshotConfig { defer_loading, enabled }

screenshot's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserScrollConfig { defer_loading, enabled }

scroll's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserScrollToConfig { defer_loading, enabled }

scroll_to's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserStateBlockParam { tabs, type, cache_control, state_changes }

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

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

BetaBrowserStateChange = BetaBrowserStateChangeTabOpened { tab_id, type } | BetaBrowserStateChangeDownloadStarted { download_id, type, url } | BetaBrowserStateChangeDownloadCompleted { download_id, type, url, 2 more } | BetaBrowserStateChangeDownloadFailed { download_id, type, url, error }

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.

One of the following:
BetaBrowserStateChangeDownloadCompleted { download_id, type, 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).

download_id: string

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

maxLength4096
minLength1
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
type: "download_completed"
url: string

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

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
path?: string | null

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.

pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
maxLength4096
size_bytes?: number | null

The completed download's size.

minimum0
BetaBrowserStateChangeDownloadFailed { download_id, type, url, error }

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

download_id: string

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

maxLength4096
minLength1
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
type: "download_failed"
url: string

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

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
error?: string | null

The failure or cancellation detail, when known.

pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
maxLength4096
BetaBrowserStateChangeDownloadStarted { download_id, type, url }

A file download that started during this call.

download_id: string

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

maxLength4096
minLength1
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
type: "download_started"
url: string

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

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
BetaBrowserStateChangeTabOpened { tab_id, type }

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.

tab_id: string

The tab_id of the opened tab, present in tabs.

maxLength4096
minLength1
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
type: "tab_opened"
BetaBrowserStateTabEntry { tab_id, title, url, active }

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

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

tab_id: string

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

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

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

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

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

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

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

BetaBrowserSwitchTabConfig { defer_loading, enabled }

switch_tab's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserToolset20260801 { type, allowed_callers, cache_control, configs }

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

BetaBrowserToolsetConfigs { close_tab, double_click, file_upload, 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.

BetaBrowserTripleClickConfig { defer_loading, enabled }

triple_click's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserTypeConfig { defer_loading, enabled }

type's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserWaitConfig { defer_loading, enabled }

wait's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaBrowserZoomConfig { defer_loading, enabled }

zoom's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaCacheControlEphemeral { type, ttl }
type: "ephemeral"
ttl?: "5m" | "1h"

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

This may be one the following values:

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

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

One of the following:
"5m"
"1h"
BetaCacheCreation { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }
ephemeral_1h_input_tokens: number

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

default0
minimum0
ephemeral_5m_input_tokens: number

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

default0
minimum0
BetaCacheMissMessagesChanged { cache_missed_input_tokens, type }
cache_missed_input_tokens: number

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

type: "messages_changed"
defaultmessages_changed
BetaCacheMissModelChanged { cache_missed_input_tokens, type }
cache_missed_input_tokens: number

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

type: "model_changed"
defaultmodel_changed
BetaCacheMissPreviousMessageNotFound { type }
type: "previous_message_not_found"
defaultprevious_message_not_found
BetaCacheMissSystemChanged { cache_missed_input_tokens, type }
cache_missed_input_tokens: number

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

type: "system_changed"
defaultsystem_changed
BetaCacheMissToolsChanged { cache_missed_input_tokens, type }
cache_missed_input_tokens: number

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

type: "tools_changed"
defaulttools_changed
BetaCacheMissUnavailable { type }
type: "unavailable"
defaultunavailable
BetaCitationCharLocation { cited_text, document_index, document_title, 4 more }
cited_text: string
document_index: number
minimum0
document_title: string | null
end_char_index: number
file_id: string | null
start_char_index: number
minimum0
type: "char_location"
defaultchar_location
BetaCitationCharLocationParam { cited_text, document_index, document_title, 3 more }
cited_text: string
document_index: number
minimum0
document_title: string | null
maxLength500
minLength1
end_char_index: number
start_char_index: number
minimum0
type: "char_location"
BetaCitationConfig { enabled }
enabled: boolean
defaultfalse
BetaCitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
cited_text: string

The full text of the cited block range, concatenated.

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

document_index: number
minimum0
document_title: string | null
end_block_index: number

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

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

file_id: string | null
start_block_index: number

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

minimum0
type: "content_block_location"
defaultcontent_block_location
BetaCitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
cited_text: string

The full text of the cited block range, concatenated.

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

document_index: number
minimum0
document_title: string | null
maxLength500
minLength1
end_block_index: number

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

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

start_block_index: number

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

minimum0
type: "content_block_location"
BetaCitationPageLocation { cited_text, document_index, document_title, 4 more }
cited_text: string
document_index: number
minimum0
document_title: string | null
end_page_number: number
file_id: string | null
start_page_number: number
minimum1
type: "page_location"
defaultpage_location
BetaCitationPageLocationParam { cited_text, document_index, document_title, 3 more }
cited_text: string
document_index: number
minimum0
document_title: string | null
maxLength500
minLength1
end_page_number: number
start_page_number: number
minimum1
type: "page_location"
BetaCitationSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
cited_text: string

The full text of the cited block range, concatenated.

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

end_block_index: number

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

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

search_result_index: number

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

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

minimum0
source: string
start_block_index: number

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

minimum0
title: string | null
type: "search_result_location"
defaultsearch_result_location
BetaCitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
cited_text: string

The full text of the cited block range, concatenated.

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

end_block_index: number

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

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

search_result_index: number

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

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

minimum0
source: string
start_block_index: number

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

minimum0
title: string | null
type: "search_result_location"
BetaCitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
cited_text: string
encrypted_index: string
title: string | null
maxLength512
minLength1
type: "web_search_result_location"
url: string
minLength1
BetaCitationsConfigParam { enabled }
enabled?: boolean
BetaCitationsDelta { citation, type }
BetaCitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
cited_text: string
encrypted_index: string
title: string | null
maxLength512
type: "web_search_result_location"
defaultweb_search_result_location
url: string
BetaClearThinking20251015Edit { type, keep }
type: "clear_thinking_20251015"
keep?: BetaThinkingTurns { type, value } | BetaAllThinkingTurns { type } | "all"

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

One of the following:
BetaThinkingTurns { type, value }
type: "thinking_turns"
value: number
minimum1
BetaAllThinkingTurns { type }
type: "all"
"all"
"all"
BetaClearThinking20251015EditResponse { cleared_input_tokens, cleared_thinking_turns, type }
cleared_input_tokens: number

Number of input tokens cleared by this edit.

minimum0
cleared_thinking_turns: number

Number of thinking turns that were cleared.

minimum0
type: "clear_thinking_20251015"

The type of context management edit applied.

defaultclear_thinking_20251015
BetaClearToolUses20250919Edit { type, clear_at_least, clear_tool_inputs, 3 more }
BetaClearToolUses20250919EditResponse { cleared_input_tokens, cleared_tool_uses, type }
cleared_input_tokens: number

Number of input tokens cleared by this edit.

minimum0
cleared_tool_uses: number

Number of tool uses that were cleared.

minimum0
type: "clear_tool_uses_20250919"

The type of context management edit applied.

defaultclear_tool_uses_20250919
BetaCodeExecutionOutputBlock { file_id, type }
file_id: string
type: "code_execution_output"
defaultcode_execution_output
BetaCodeExecutionOutputBlockParam { file_id, type }
file_id: string
type: "code_execution_output"
BetaCodeExecutionResultBlock { content, return_code, stderr, 2 more }
content: Array<BetaCodeExecutionOutputBlock { file_id, type }>
file_id: string
type: "code_execution_output"
defaultcode_execution_output
return_code: number
stderr: string
stdout: string
type: "code_execution_result"
defaultcode_execution_result
BetaCodeExecutionResultBlockParam { content, return_code, stderr, 2 more }
content: Array<BetaCodeExecutionOutputBlockParam { file_id, type }>
file_id: string
type: "code_execution_output"
return_code: number
stderr: string
stdout: string
type: "code_execution_result"
BetaCodeExecutionTool20250522 { name, type, allowed_callers, 3 more }
BetaCodeExecutionTool20250825 { name, type, allowed_callers, 3 more }
BetaCodeExecutionTool20260120 { name, type, allowed_callers, 3 more }

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

BetaCodeExecutionTool20260521 { name, type, allowed_callers, 3 more }

Code execution tool with REPL state persistence.

BetaCodeExecutionToolResultBlock { content, tool_use_id, type }

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

One of the following:
tool_use_id: string
pattern^srvtoolu_[a-zA-Z0-9_]+$
type: "code_execution_tool_result"
defaultcode_execution_tool_result
BetaCodeExecutionToolResultBlockContent = BetaCodeExecutionToolResultError { error_code, type } | BetaCodeExecutionResultBlock { content, return_code, stderr, 2 more } | BetaEncryptedCodeExecutionResultBlock { content, encrypted_stdout, return_code, 2 more }

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

One of the following:
BetaCodeExecutionToolResultBlockParam { content, tool_use_id, type, cache_control }

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

One of the following:
tool_use_id: string
pattern^srvtoolu_[a-zA-Z0-9_]+$
type: "code_execution_tool_result"
cache_control?: BetaCacheControlEphemeral { type, ttl } | null

Create a cache control breakpoint at this content block.

type: "ephemeral"
ttl?: "5m" | "1h"

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

This may be one the following values:

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

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

One of the following:
"5m"
"1h"
BetaCodeExecutionToolResultBlockParamContent = BetaCodeExecutionToolResultErrorParam { error_code, type } | BetaCodeExecutionResultBlockParam { content, return_code, stderr, 2 more } | BetaEncryptedCodeExecutionResultBlockParam { content, encrypted_stdout, return_code, 2 more }

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

One of the following:
BetaCodeExecutionToolResultError { error_code, type }
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
type: "code_execution_tool_result_error"
defaultcode_execution_tool_result_error
BetaCodeExecutionToolResultErrorCode = "invalid_tool_input" | "unavailable" | "too_many_requests" | "execution_time_exceeded"
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
BetaCodeExecutionToolResultErrorParam { error_code, type }
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
type: "code_execution_tool_result_error"
BetaCompact20260112Edit { type, instructions, pause_after_compaction, trigger }

Automatically compact older context when reaching the configured trigger threshold.

type: "compact_20260112"
instructions?: string | null

Additional instructions for summarization.

pause_after_compaction?: boolean

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

trigger?: BetaInputTokensTrigger { type, value } | null

When to trigger compaction. Defaults to 150000 input tokens.

type: "input_tokens"
value: number
minimum1
BetaCompactionBlock { content, encrypted_content, type }

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.

content: string | null

Summary of compacted content, or null if compaction failed

encrypted_content: string | null

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

type: "compaction"
defaultcompaction
BetaCompactionBlockParam { type, cache_control, content, encrypted_content }

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.

type: "compaction"
cache_control?: BetaCacheControlEphemeral { type, ttl } | null

Create a cache control breakpoint at this content block.

type: "ephemeral"
ttl?: "5m" | "1h"

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

This may be one the following values:

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

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

One of the following:
"5m"
"1h"
content?: string | null

Summary of previously compacted content, or null if compaction failed

encrypted_content?: string | null

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

BetaCompactionContentBlockDelta { content, encrypted_content, type }
content: string | null
encrypted_content: string | null

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

type: "compaction_delta"
defaultcompaction_delta
BetaCompactionIterationUsage { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }

Token usage for a compaction iteration.

cache_creation: BetaCacheCreation { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens } | null

Breakdown of cached tokens by TTL

ephemeral_1h_input_tokens: number

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

default0
minimum0
ephemeral_5m_input_tokens: number

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

default0
minimum0
cache_creation_input_tokens: number

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

default0
minimum0
cache_read_input_tokens: number

The number of input tokens read from the cache.

default0
minimum0
input_tokens: number

The number of input tokens which were used.

minimum0
output_tokens: number

The number of output tokens which were used.

minimum0
type: "compaction"

Usage for a compaction iteration

defaultcompaction
BetaComputerCursorPositionConfig { defer_loading, enabled }

cursor_position's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaComputerDoubleClickConfig { defer_loading, enabled }

double_click's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaComputerHoldKeyConfig { defer_loading, enabled }

hold_key's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaComputerKeyConfig { defer_loading, enabled }

key's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaComputerLeftClickConfig { defer_loading, enabled }

left_click's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaComputerLeftClickDragConfig { defer_loading, enabled }

left_click_drag's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaComputerLeftMouseDownConfig { defer_loading, enabled }

left_mouse_down's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaComputerLeftMouseUpConfig { defer_loading, enabled }

left_mouse_up's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaComputerMiddleClickConfig { defer_loading, enabled }

middle_click's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaComputerMouseMoveConfig { defer_loading, enabled }

mouse_move's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaComputerRightClickConfig { defer_loading, enabled }

right_click's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaComputerScreenshotConfig { defer_loading, enabled }

screenshot's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaComputerScrollConfig { defer_loading, enabled }

scroll's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaComputerToolset20260801 { type, allowed_callers, cache_control, configs }

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

BetaComputerToolsetConfigs { cursor_position, double_click, hold_key, 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.

BetaComputerTripleClickConfig { defer_loading, enabled }

triple_click's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaComputerTypeConfig { defer_loading, enabled }

type's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaComputerWaitConfig { defer_loading, enabled }

wait's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaComputerZoomConfig { defer_loading, enabled }

zoom's config overrides.

defer_loading?: boolean | null

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

enabled?: boolean | null

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.

BetaContainer { id, expires_at, skills }

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

id: string

Identifier for the container used in this request

expires_at: string

The time at which the container will expire.

formatdate-time
skills: Array<BetaSkill { skill_id, type, version }> | null

Skills loaded in the container

skill_id: string

Skill ID

maxLength64
minLength1
type: "anthropic" | "custom"

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

One of the following:
"anthropic"
"custom"
version: string

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

maxLength64
minLength1
BetaContainerParams { id, skills }

Container parameters with skills to be loaded.

id?: string | null

Container id

skills?: Array<BetaSkillParams { skill_id, type, version }> | null

List of skills to load in the container

maxItems20
skill_id: string

Skill ID

maxLength64
minLength1
type: "anthropic" | "custom"

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

One of the following:
"anthropic"
"custom"
version?: string

Skill version or 'latest' for most recent version

maxLength64
minLength1
BetaContainerUploadBlock { file_id, type }

Response model for a file uploaded to the container.

file_id: string
type: "container_upload"
defaultcontainer_upload
BetaContainerUploadBlockParam { file_id, type, cache_control }

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

file_id: string
type: "container_upload"
cache_control?: BetaCacheControlEphemeral { type, ttl } | null

Create a cache control breakpoint at this content block.

type: "ephemeral"
ttl?: "5m" | "1h"

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

This may be one the following values:

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

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

One of the following:
"5m"
"1h"
BetaContentBlock = BetaTextBlock { citations, text, type } | BetaThinkingBlock { signature, thinking, type } | BetaRedactedThinkingBlock { data, type } | 14 more

Response model for a file uploaded to the container.

One of the following:
BetaContentBlockParam = BetaTextBlockParam { text, type, cache_control, citations } | BetaImageBlockParam { source, type, cache_control, transformations } | BetaRequestDocumentBlock { source, type, cache_control, 3 more } | 20 more

Regular text content.

One of the following:
BetaContentBlockSource { content, type }
content: string | Array<BetaContentBlockSourceContent>
One of the following:
string
BetaTextBlockParam { text, type, cache_control, citations }
BetaImageBlockParam { source, type, cache_control, transformations }
type: "content"
BetaContentBlockSourceContent = BetaTextBlockParam { text, type, cache_control, citations } | BetaImageBlockParam { source, type, cache_control, transformations }
One of the following:
BetaTextBlockParam { text, type, cache_control, citations }
BetaImageBlockParam { source, type, cache_control, transformations }
BetaContextManagementConfig { edits }
BetaContextManagementResponse { applied_edits }
BetaCountTokensContextManagementResponse { original_input_tokens }
original_input_tokens: number

The original token count before context management was applied

BetaDiagnostics { cache_miss_reason }

Response envelope for request-level diagnostics. Present (possibly null) whenever the caller supplied diagnostics on the request.

BetaDiagnosticsParam { previous_message_id }

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

previous_message_id?: string | null

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
BetaDirectCaller { type }

Tool invocation directly from the model.

type: "direct"
BetaDocumentBlock { citations, source, title, type }
BetaEncryptedCodeExecutionResultBlock { content, encrypted_stdout, return_code, 2 more }

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

content: Array<BetaCodeExecutionOutputBlock { file_id, type }>
file_id: string
type: "code_execution_output"
defaultcode_execution_output
encrypted_stdout: string
return_code: number
stderr: string
type: "encrypted_code_execution_result"
defaultencrypted_code_execution_result
BetaEncryptedCodeExecutionResultBlockParam { content, encrypted_stdout, return_code, 2 more }

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

content: Array<BetaCodeExecutionOutputBlockParam { file_id, type }>
file_id: string
type: "code_execution_output"
encrypted_stdout: string
return_code: number
stderr: string
type: "encrypted_code_execution_result"
BetaFallbackBlock { from, to, trigger, type }

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.

BetaFallbackBlockParam { from, to, type, 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.

from: BetaFallbackInfoParam { model }

Identifies one hop of a fallback transition.

to: BetaFallbackInfoParam { model }

Identifies one hop of a fallback transition.

type: "fallback"
trigger?: unknown

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

BetaFallbackCreditNotApplied { reason, type, remove_to_redeem }

No reprice was applied; reason says why.

BetaFallbackCreditRedeemed { type }

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

type: "redeemed"
defaultredeemed
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.

token: string

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

maxLength2048
minLength1
mode?: "strict" | "best_effort"

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"
"best_effort"
BetaFallbackCreditUsage { status }

Outcome of the fallback_credit_token presented on this request.

status: BetaFallbackCreditRedeemed { type } | BetaFallbackCreditNotApplied { reason, type, remove_to_redeem }

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:
BetaFallbackCreditRedeemed { type }

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

type: "redeemed"
defaultredeemed
BetaFallbackCreditNotApplied { reason, type, remove_to_redeem }

No reprice was applied; reason says why.

BetaFallbackInfo { model }

Identifies one hop of a fallback transition.

BetaFallbackInfoParam { model }

Identifies one hop of a fallback transition.

BetaFallbackMessageIterationUsage { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more }

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

Produced in place of a message entry for whichever hop served the response. A declined hop produces the existing message entry. Whether a fallback model served the response is signalled by the presence of this entry in usage.iterations.

BetaFallbackParam { model, max_tokens, output_config, 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.

BetaFallbackRefusalTrigger { category, type }

The from model declined for policy reasons.

category: "cyber" | "bio" | "frontier_llm" | 2 more | null

The policy category that triggered a refusal.

One of the following:
"cyber"

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

"bio"

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

"frontier_llm"

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

"reasoning_extraction"

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

"general_harms"

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

type: "refusal"
defaultrefusal
BetaFallbacksParam = Array<BetaFallbackParam { model, max_tokens, output_config, 2 more }> | "default" | null

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. The string "default" requests the requested model's server-defined default fallback configuration.

One of the following:
BetaFileDocumentSource { file_id, type }
file_id: string
type: "file"
BetaFileImageSource { file_id, type }
file_id: string
type: "file"
BetaImageBlockParam { source, type, cache_control, transformations }
BetaImageTransformationsParam { oversized_image }

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

oversized_image?: "downsize" | "error"

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

One of the following:
"downsize"
"error"
BetaInputJSONDelta { partial_json, type }
partial_json: string
type: "input_json_delta"
defaultinput_json_delta
BetaInputTokensClearAtLeast { type, value }
type: "input_tokens"
value: number
minimum0
BetaInputTokensTrigger { type, value }
type: "input_tokens"
value: number
minimum1
BetaIterationsUsage = Array<BetaMessageIterationUsage { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more } | BetaCompactionIterationUsage { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more } | BetaAdvisorMessageIterationUsage { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more } | BetaFallbackMessageIterationUsage { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more }> | null

Per-iteration token usage breakdown.

Each entry represents one sampling iteration, with its own input/output token counts and cache statistics, discriminated by type. For message entries (model sampling iterations, such as the turns of a server-side tool use loop), this allows you to:

  • Determine which iterations exceeded long context thresholds (>=200k tokens)
  • Calculate the context window size from the last message entry
  • Understand token accumulation across server-side tool use loops

A compaction entry reports the token usage of the compaction operation itself — the server-side request that summarizes the context being closed — NOT the size of the context that was compacted away, and its token counts can be much smaller than that closed context (for example, a compaction that closes a ~200k-token context can report only a few thousand tokens). Do not derive the context window size from a compaction entry, even when it is the last entry. A compaction entry's tokens are not included in the top-level usage fields. When an input-token trigger is in effect (the default — 150,000 tokens unless configured otherwise), each compaction entry closes a context that had reached at least that threshold, though the context can exceed it by the final iteration's output and tool results.

One of the following:
BetaJSONOutputFormat { schema, type }
schema: Record<string, unknown>

The JSON schema of the format

type: "json_schema"
BetaMCPToolConfig { defer_loading, enabled }

Configuration for a specific tool in an MCP toolset.

defer_loading?: boolean
enabled?: boolean
BetaMCPToolDefaultConfig { defer_loading, enabled }

Default configuration for tools in an MCP toolset.

defer_loading?: boolean
enabled?: boolean
BetaMCPToolResultBlock { content, is_error, tool_use_id, type }
BetaMCPToolUseBlock { id, input, name, 2 more }
id: string
pattern^[a-zA-Z0-9_-]+$
input: Record<string, unknown>
name: string

The name of the MCP tool

server_name: string

The name of the MCP server

type: "mcp_tool_use"
defaultmcp_tool_use
BetaMCPToolUseBlockParam { id, input, name, 3 more }
id: string
pattern^[a-zA-Z0-9_-]+$
input: Record<string, unknown>
name: string
server_name: string

The name of the MCP server

type: "mcp_tool_use"
cache_control?: BetaCacheControlEphemeral { type, ttl } | null

Create a cache control breakpoint at this content block.

type: "ephemeral"
ttl?: "5m" | "1h"

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

This may be one the following values:

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

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

One of the following:
"5m"
"1h"
BetaMCPToolset { mcp_server_name, type, cache_control, 2 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.

BetaMemoryTool20250818 { name, type, allowed_callers, 4 more }
BetaMemoryTool20250818Command = BetaMemoryTool20250818ViewCommand { command, path, view_range } | BetaMemoryTool20250818CreateCommand { command, file_text, path } | BetaMemoryTool20250818StrReplaceCommand { command, new_str, old_str, path } | 3 more
One of the following:
BetaMemoryTool20250818CreateCommand { command, file_text, path }
command: "create"

Command type identifier

defaultcreate
file_text: string

Content to write to the file

path: string

Path where the file should be created

BetaMemoryTool20250818DeleteCommand { command, path }
command: "delete"

Command type identifier

defaultdelete
path: string

Path to the file or directory to delete

BetaMemoryTool20250818InsertCommand { command, insert_line, insert_text, path }
command: "insert"

Command type identifier

defaultinsert
insert_line: number

Line number where text should be inserted

minimum1
insert_text: string

Text to insert at the specified line

path: string

Path to the file where text should be inserted

BetaMemoryTool20250818RenameCommand { command, new_path, old_path }
command: "rename"

Command type identifier

defaultrename
new_path: string

New path for the file or directory

old_path: string

Current path of the file or directory

BetaMemoryTool20250818StrReplaceCommand { command, new_str, old_str, path }
command: "str_replace"

Command type identifier

defaultstr_replace
new_str: string

Text to replace with

old_str: string

Text to search for and replace

path: string

Path to the file where text should be replaced

BetaMemoryTool20250818ViewCommand { command, path, view_range }
command: "view"

Command type identifier

defaultview
path: string

Path to directory or file to view

view_range?: Array<number>

Optional line range for viewing specific lines

minItems2
maxItems2
BetaMessage { id, container, content, 9 more }
BetaMessageDeltaUsage { cache_creation_input_tokens, cache_read_input_tokens, fallback_credit, 5 more }
BetaMessageIterationUsage { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more }

Token usage for a sampling iteration.

BetaMessageParam { content, role }
BetaMessageTokensCount { context_management, input_tokens }
context_management: BetaCountTokensContextManagementResponse { original_input_tokens } | null

Information about context management applied to the message.

original_input_tokens: number

The original token count before context management was applied

input_tokens: number

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

BetaMetadata { user_id }
user_id?: string | null

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
BetaOutputConfig { effort, format, task_budget }
BetaOutputTokensDetails { thinking_tokens }
thinking_tokens: number

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

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

default0
minimum0
BetaPlainTextSource { data, media_type, type }
data: string
media_type: "text/plain"
type: "text"
BetaRawContentBlockDelta = BetaTextDelta { text, type } | BetaInputJSONDelta { partial_json, type } | BetaCitationsDelta { citation, type } | 3 more
One of the following:
BetaRawContentBlockDeltaEvent { delta, index, type }
One of the following:
index: number
type: "content_block_delta"
defaultcontent_block_delta
BetaRawContentBlockStartEvent { content_block, index, type }
BetaRawContentBlockStopEvent { index, type }
index: number
type: "content_block_stop"
defaultcontent_block_stop
BetaRawMessageDeltaEvent { context_management, delta, type, usage }
BetaRawMessageStartEvent { message, type }
message: BetaMessage { id, container, content, 9 more }
type: "message_start"
defaultmessage_start
BetaRawMessageStopEvent { type }
type: "message_stop"
defaultmessage_stop
BetaRawMessageStreamEvent = BetaRawMessageStartEvent { message, type } | BetaRawMessageDeltaEvent { context_management, delta, type, usage } | BetaRawMessageStopEvent { type } | 3 more
One of the following:
BetaRedactedThinkingBlock { data, type }
data: string

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

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

See extended thinking for details.

type: "redacted_thinking"
defaultredacted_thinking
BetaRedactedThinkingBlockParam { data, type }
data: string

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

type: "redacted_thinking"
BetaRefusalStopDetails { category, explanation, fallback_credit_token, 3 more }

Structured information about a refusal.

BetaRequestDocumentBlock { source, type, cache_control, 3 more }
BetaRequestMCPServerToolConfiguration { allowed_tools, enabled }
allowed_tools?: Array<string> | null
enabled?: boolean | null
BetaRequestMCPServerURLDefinition { name, type, url, 2 more }
name: string
type: "url"
url: string
authorization_token?: string | null
tool_configuration?: BetaRequestMCPServerToolConfiguration { allowed_tools, enabled } | null
allowed_tools?: Array<string> | null
enabled?: boolean | null
BetaRequestMCPToolResultBlockParam { tool_use_id, type, cache_control, 2 more }
BetaRequestToolAdditionBlock { tool, type, cache_control }

Mid-conversation directive to surface a declared tool.

tool references a tool (or MCP toolset) by name from the request's tools; it is offered to the model from this point in the conversation onward.

BetaRequestToolRemovalBlock { tool, type, cache_control }

Mid-conversation directive to withdraw a tool.

tool references a tool (or MCP toolset) by name from the request's tools; it is no longer offered to the model from this point in the conversation onward.

BetaSearchResultBlockParam { content, source, title, 3 more }
BetaServerToolCaller { tool_id, type }

Tool invocation generated by a server-side tool.

tool_id: string
pattern^srvtoolu_[a-zA-Z0-9_]+$
type: "code_execution_20250825"
BetaServerToolCaller20260120 { tool_id, type }
tool_id: string
pattern^srvtoolu_[a-zA-Z0-9_]+$
type: "code_execution_20260120"
BetaServerToolUsage { web_fetch_requests, web_search_requests }
web_fetch_requests: number

The number of web fetch tool requests.

default0
minimum0
web_search_requests: number

The number of web search tool requests.

default0
minimum0
BetaServerToolUseBlock { id, input, name, 2 more }
BetaServerToolUseBlockParam { id, input, name, 3 more }
BetaSignatureDelta { signature, type }
signature: string

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

type: "signature_delta"
defaultsignature_delta
BetaSkill { skill_id, type, version }

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

skill_id: string

Skill ID

maxLength64
minLength1
type: "anthropic" | "custom"

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

One of the following:
"anthropic"
"custom"
version: string

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

maxLength64
minLength1
BetaSkillParams { skill_id, type, version }

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

skill_id: string

Skill ID

maxLength64
minLength1
type: "anthropic" | "custom"

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

One of the following:
"anthropic"
"custom"
version?: string

Skill version or 'latest' for most recent version

maxLength64
minLength1
BetaStopReason = "end_turn" | "max_tokens" | "stop_sequence" | 5 more
One of the following:
"end_turn"
"max_tokens"
"stop_sequence"
"tool_use"
"pause_turn"
"compaction"
"refusal"
"model_context_window_exceeded"
BetaTextBlock { citations, text, type }
BetaTextBlockParam { text, type, cache_control, citations }
BetaTextCitation = BetaCitationCharLocation { cited_text, document_index, document_title, 4 more } | BetaCitationPageLocation { cited_text, document_index, document_title, 4 more } | BetaCitationContentBlockLocation { cited_text, document_index, document_title, 4 more } | 2 more
One of the following:
BetaTextCitationParam = BetaCitationCharLocationParam { cited_text, document_index, document_title, 3 more } | BetaCitationPageLocationParam { cited_text, document_index, document_title, 3 more } | BetaCitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more } | 2 more
One of the following:
BetaTextDelta { text, type }
text: string
type: "text_delta"
defaulttext_delta
BetaTextEditorCodeExecutionCreateResultBlock { is_file_update, type }
is_file_update: boolean
type: "text_editor_code_execution_create_result"
defaulttext_editor_code_execution_create_result
BetaTextEditorCodeExecutionCreateResultBlockParam { is_file_update, type }
is_file_update: boolean
type: "text_editor_code_execution_create_result"
BetaTextEditorCodeExecutionStrReplaceResultBlock { lines, new_lines, new_start, 3 more }
lines: Array<string> | null
new_lines: number | null
new_start: number | null
old_lines: number | null
old_start: number | null
type: "text_editor_code_execution_str_replace_result"
defaulttext_editor_code_execution_str_replace_result
BetaTextEditorCodeExecutionStrReplaceResultBlockParam { type, lines, new_lines, 3 more }
type: "text_editor_code_execution_str_replace_result"
lines?: Array<string> | null
new_lines?: number | null
new_start?: number | null
old_lines?: number | null
old_start?: number | null
BetaTextEditorCodeExecutionToolResultBlock { content, tool_use_id, type }
BetaTextEditorCodeExecutionToolResultBlockParam { content, tool_use_id, type, cache_control }
BetaTextEditorCodeExecutionToolResultError { error_code, error_message, type }
error_code: "invalid_tool_input" | "unavailable" | "too_many_requests" | 2 more
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
"file_not_found"
error_message: string | null
type: "text_editor_code_execution_tool_result_error"
defaulttext_editor_code_execution_tool_result_error
BetaTextEditorCodeExecutionToolResultErrorParam { error_code, type, error_message }
error_code: "invalid_tool_input" | "unavailable" | "too_many_requests" | 2 more
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
"file_not_found"
type: "text_editor_code_execution_tool_result_error"
error_message?: string | null
BetaTextEditorCodeExecutionViewResultBlock { content, file_type, num_lines, 3 more }
content: string
file_type: "text" | "image" | "pdf"
One of the following:
"text"
"image"
"pdf"
num_lines: number | null
start_line: number | null
total_lines: number | null
type: "text_editor_code_execution_view_result"
defaulttext_editor_code_execution_view_result
BetaTextEditorCodeExecutionViewResultBlockParam { content, file_type, type, 3 more }
content: string
file_type: "text" | "image" | "pdf"
One of the following:
"text"
"image"
"pdf"
type: "text_editor_code_execution_view_result"
num_lines?: number | null
start_line?: number | null
total_lines?: number | null
BetaThinkingBlock { signature, thinking, type }
signature: string

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

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

See extended thinking for details.

thinking: string

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

type: "thinking"
defaultthinking
BetaThinkingBlockParam { signature, thinking, type }
signature: string

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

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

thinking: string

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

type: "thinking"
BetaThinkingConfigAdaptive { type, display }
type: "adaptive"
display?: "summarized" | "omitted" | "updates" | null

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. Defaults to summarized.

One of the following:
"summarized"
"omitted"
"updates"
BetaThinkingConfigDisabled { type }
type: "disabled"
BetaThinkingConfigEnabled { budget_tokens, type, display }
budget_tokens: number

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
type: "enabled"
display?: "summarized" | "omitted" | "updates" | null

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. Defaults to summarized.

One of the following:
"summarized"
"omitted"
"updates"
BetaThinkingConfigParam = BetaThinkingConfigEnabled { budget_tokens, type, display } | BetaThinkingConfigDisabled { type } | BetaThinkingConfigAdaptive { type, display }

Configuration for enabling Claude's extended thinking.

When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your max_tokens limit.

See extended thinking for details.

One of the following:
BetaThinkingDelta { estimated_tokens, thinking, type }
estimated_tokens: number | null

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.

thinking: string

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

type: "thinking_delta"
defaultthinking_delta
BetaThinkingTurns { type, value }
type: "thinking_turns"
value: number
minimum1
BetaTokenTaskBudget { total, type, remaining }

User-configurable total token budget across contexts.

total: number

Total token budget across all contexts in the session.

minimum1024
type: "tokens"

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

remaining?: number | null

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

minimum0
BetaTool { input_schema, name, allowed_callers, 7 more }
BetaToolBash20241022 { name, type, allowed_callers, 4 more }
BetaToolBash20250124 { name, type, allowed_callers, 4 more }
BetaToolChangeMCPToolReference { name, server_name, type }

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

name: string
server_name: string
type: "mcp_tool_reference"
BetaToolChangeMCPToolsetReference { server_name, type }

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

server_name: string
type: "mcp_toolset_reference"
BetaToolChangeToolReference { name, type }

Reference to a single tool the caller declared directly in tools[]. 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.

name: string
pattern^[a-zA-Z0-9_-]{1,128}$
type: "tool_reference"
BetaToolChoice = BetaToolChoiceAuto { type, disable_parallel_tool_use } | BetaToolChoiceAny { type, disable_parallel_tool_use } | BetaToolChoiceTool { name, type, disable_parallel_tool_use } | BetaToolChoiceNone { type }

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

One of the following:
BetaToolChoiceAny { type, disable_parallel_tool_use }

The model will use any available tools.

type: "any"
disable_parallel_tool_use?: boolean

Whether to disable parallel tool use.

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

BetaToolChoiceAuto { type, disable_parallel_tool_use }

The model will automatically decide whether to use tools.

type: "auto"
disable_parallel_tool_use?: boolean

Whether to disable parallel tool use.

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

BetaToolChoiceNone { type }

The model will not be allowed to use tools.

type: "none"
BetaToolChoiceTool { name, type, disable_parallel_tool_use }

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

name: string

The name of the tool to use.

type: "tool"
disable_parallel_tool_use?: boolean

Whether to disable parallel tool use.

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

BetaToolComputerUse20241022 { display_height_px, display_width_px, name, 7 more }
BetaToolComputerUse20250124 { display_height_px, display_width_px, name, 7 more }
BetaToolComputerUse20251124 { display_height_px, display_width_px, name, 8 more }
BetaToolReferenceBlock { tool_name, type }
tool_name: string
maxLength256
minLength1
pattern^[a-zA-Z0-9_-]{1,256}$
type: "tool_reference"
defaulttool_reference
BetaToolReferenceBlockParam { tool_name, type, cache_control }

Tool reference block that can be included in tool_result content.

tool_name: string
maxLength256
minLength1
pattern^[a-zA-Z0-9_-]{1,256}$
type: "tool_reference"
cache_control?: BetaCacheControlEphemeral { type, ttl } | null

Create a cache control breakpoint at this content block.

type: "ephemeral"
ttl?: "5m" | "1h"

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

This may be one the following values:

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

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

One of the following:
"5m"
"1h"
BetaToolResultBlockParam { tool_use_id, type, cache_control, 3 more }
BetaToolSearchToolBm25_20251119 { name, type, allowed_callers, 3 more }
BetaToolSearchToolRegex20251119 { name, type, allowed_callers, 3 more }
BetaToolSearchToolResultBlock { content, tool_use_id, type }
BetaToolSearchToolResultBlockParam { content, tool_use_id, type, cache_control }
BetaToolSearchToolResultError { error_code, error_message, type }
error_code: "invalid_tool_input" | "unavailable" | "too_many_requests" | "execution_time_exceeded"
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
error_message: string | null
type: "tool_search_tool_result_error"
defaulttool_search_tool_result_error
BetaToolSearchToolResultErrorParam { error_code, type, error_message }
error_code: "invalid_tool_input" | "unavailable" | "too_many_requests" | "execution_time_exceeded"
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
type: "tool_search_tool_result_error"
error_message?: string | null
BetaToolSearchToolSearchResultBlock { tool_references, type }
tool_references: Array<BetaToolReferenceBlock { tool_name, type }>
tool_name: string
maxLength256
minLength1
pattern^[a-zA-Z0-9_-]{1,256}$
type: "tool_reference"
defaulttool_reference
type: "tool_search_tool_search_result"
defaulttool_search_tool_search_result
BetaToolSearchToolSearchResultBlockParam { tool_references, type }
tool_references: Array<BetaToolReferenceBlockParam { tool_name, type, cache_control }>
tool_name: string
maxLength256
minLength1
pattern^[a-zA-Z0-9_-]{1,256}$
type: "tool_reference"
cache_control?: BetaCacheControlEphemeral { type, ttl } | null

Create a cache control breakpoint at this content block.

type: "ephemeral"
ttl?: "5m" | "1h"

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

This may be one the following values:

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

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

One of the following:
"5m"
"1h"
type: "tool_search_tool_search_result"
BetaToolTextEditor20241022 { name, type, allowed_callers, 4 more }
BetaToolTextEditor20250124 { name, type, allowed_callers, 4 more }
BetaToolTextEditor20250429 { name, type, allowed_callers, 4 more }
BetaToolTextEditor20250728 { name, type, allowed_callers, 5 more }
BetaToolUnion = BetaTool { input_schema, name, allowed_callers, 7 more } | BetaToolBash20241022 { name, type, allowed_callers, 4 more } | BetaToolBash20250124 { name, type, allowed_callers, 4 more } | 25 more

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

One of the following:
BetaToolUseBlock { id, input, name, 3 more }
BetaToolUseBlockParam { id, input, name, 4 more }
BetaToolUsesKeep { type, value }
type: "tool_uses"
value: number
minimum0
BetaToolUsesTrigger { type, value }
type: "tool_uses"
value: number
minimum1
BetaURLImageSource { type, url }
type: "url"
url: string
BetaURLPDFSource { type, url }
type: "url"
url: string
BetaUsage { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 9 more }
BetaUserLocation { type, city, country, 2 more }
type: "approximate"
city?: string | null

The city of the user.

maxLength255
minLength1
country?: string | null

The two letter ISO country code of the user.

maxLength2
minLength2
region?: string | null

The region of the user.

maxLength255
minLength1
timezone?: string | null

The IANA timezone of the user.

maxLength255
minLength1
BetaWebFetchBlock { content, retrieved_at, type, url }
content: BetaDocumentBlock { citations, source, title, type }
retrieved_at: string | null

ISO 8601 timestamp when the content was retrieved

type: "web_fetch_result"
defaultweb_fetch_result
url: string

Fetched content URL

BetaWebFetchBlockParam { content, type, url, retrieved_at }
content: BetaRequestDocumentBlock { source, type, cache_control, 3 more }
type: "web_fetch_result"
url: string

Fetched content URL

retrieved_at?: string | null

ISO 8601 timestamp when the content was retrieved

BetaWebFetchTool20250910 { name, type, allowed_callers, 8 more }
BetaWebFetchTool20260209 { name, type, allowed_callers, 8 more }
BetaWebFetchTool20260309 { name, type, allowed_callers, 9 more }

Web fetch tool with use_cache parameter for bypassing cached content.

BetaWebFetchTool20260318 { name, type, allowed_callers, 10 more }
BetaWebFetchToolResultBlock { content, tool_use_id, type, caller }
BetaWebFetchToolResultBlockParam { content, tool_use_id, type, 2 more }
BetaWebFetchToolResultErrorBlock { error_code, type }
One of the following:
"invalid_tool_input"
"url_too_long"
"url_not_allowed"
"url_not_in_prior_context"
"url_not_accessible"
"unsupported_content_type"
"too_many_requests"
"max_uses_exceeded"
"unavailable"
type: "web_fetch_tool_result_error"
defaultweb_fetch_tool_result_error
BetaWebFetchToolResultErrorBlockParam { error_code, type }
One of the following:
"invalid_tool_input"
"url_too_long"
"url_not_allowed"
"url_not_in_prior_context"
"url_not_accessible"
"unsupported_content_type"
"too_many_requests"
"max_uses_exceeded"
"unavailable"
type: "web_fetch_tool_result_error"
BetaWebFetchToolResultErrorCode = "invalid_tool_input" | "url_too_long" | "url_not_allowed" | 6 more
One of the following:
"invalid_tool_input"
"url_too_long"
"url_not_allowed"
"url_not_in_prior_context"
"url_not_accessible"
"unsupported_content_type"
"too_many_requests"
"max_uses_exceeded"
"unavailable"
BetaWebSearchResultBlock { encrypted_content, page_age, title, 2 more }
encrypted_content: string
page_age: string | null
title: string
type: "web_search_result"
defaultweb_search_result
url: string
BetaWebSearchResultBlockParam { encrypted_content, title, type, 2 more }
encrypted_content: string
title: string
type: "web_search_result"
url: string
page_age?: string | null
BetaWebSearchTool20250305 { name, type, allowed_callers, 7 more }
BetaWebSearchTool20260209 { name, type, allowed_callers, 7 more }
BetaWebSearchTool20260318 { name, type, allowed_callers, 8 more }
BetaWebSearchToolRequestError { error_code, type }
One of the following:
"invalid_tool_input"
"unavailable"
"max_uses_exceeded"
"too_many_requests"
"query_too_long"
"request_too_large"
type: "web_search_tool_result_error"
BetaWebSearchToolResultBlock { content, tool_use_id, type, caller }
BetaWebSearchToolResultBlockContent = BetaWebSearchToolResultError { error_code, type } | Array<BetaWebSearchResultBlock { encrypted_content, page_age, title, 2 more }>
One of the following:
BetaWebSearchToolResultBlockParam { content, tool_use_id, type, 2 more }
BetaWebSearchToolResultBlockParamContent = Array<BetaWebSearchResultBlockParam { encrypted_content, title, type, 2 more }> | BetaWebSearchToolRequestError { error_code, type }
One of the following:
BetaWebSearchToolResultError { error_code, type }
One of the following:
"invalid_tool_input"
"unavailable"
"max_uses_exceeded"
"too_many_requests"
"query_too_long"
"request_too_large"
type: "web_search_tool_result_error"
defaultweb_search_tool_result_error
BetaWebSearchToolResultErrorCode = "invalid_tool_input" | "unavailable" | "max_uses_exceeded" | 3 more
One of the following:
"invalid_tool_input"
"unavailable"
"max_uses_exceeded"
"too_many_requests"
"query_too_long"
"request_too_large"

MessagesBatches

Create a Message Batch
client.beta.messages.batches.create(BatchCreateParamsparams, RequestOptionsoptions?): BetaMessageBatch
POST/v1/messages/batches
Retrieve a Message Batch
client.beta.messages.batches.retrieve(stringmessageBatchID, BatchRetrieveParamsparams?, RequestOptionsoptions?): BetaMessageBatch
GET/v1/messages/batches/{message_batch_id}
List Message Batches
client.beta.messages.batches.list(BatchListParamsparams?, RequestOptionsoptions?): Page<BetaMessageBatch>
GET/v1/messages/batches
Cancel a Message Batch
client.beta.messages.batches.cancel(stringmessageBatchID, BatchCancelParamsparams?, RequestOptionsoptions?): BetaMessageBatch
POST/v1/messages/batches/{message_batch_id}/cancel
Delete a Message Batch
client.beta.messages.batches.delete(stringmessageBatchID, BatchDeleteParamsparams?, RequestOptionsoptions?): BetaDeletedMessageBatch
DELETE/v1/messages/batches/{message_batch_id}
Retrieve Message Batch results
client.beta.messages.batches.results(stringmessageBatchID, BatchResultsParamsparams?, RequestOptionsoptions?): BetaMessageBatchIndividualResponse | Stream<BetaMessageBatchIndividualResponse>
GET/v1/messages/batches/{message_batch_id}/results