Messages
Create a Message
client.Beta.Messages.New(ctx, params) (*BetaMessage, error)Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
Count tokens in a Message
client.Beta.Messages.CountTokens(ctx, params) (*BetaMessageTokensCount, error)Count the number of tokens in a Message.
Models
type BetaAdvisorMessageIterationUsage struct { Type: "advisor_message"; CacheCreation; CacheCreationInputTokens; /* 4 more */ }Token usage for an advisor sub-inference iteration.
Token usage for an advisor sub-inference iteration.
Type AdvisorMessageUsage for an advisor sub-inference iteration
Usage for an advisor sub-inference iteration
CacheCreation BetaCacheCreationBreakdown of cached tokens by TTL
Breakdown of cached tokens by TTL
Ephemeral1hInputTokens int64The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 1 hour cache entry.
Ephemeral5mInputTokens int64The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the 5 minute cache entry.
CacheCreationInputTokens int64The number of input tokens used to create the cache entry.
The number of input tokens used to create the cache entry.
CacheReadInputTokens int64The number of input tokens read from the cache.
The number of input tokens read from the cache.
InputTokens int64The number of input tokens which were used.
The number of input tokens which were used.
OutputTokens int64The number of output tokens which were used.
The number of output tokens which were used.
type BetaAdvisorRedactedResultBlock struct { Type: "advisor_redacted_result"; EncryptedContent; StopReason }
Type AdvisorRedactedResult
Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect or modify.
The advisor sub-inference's stop reason (same values as the top-level message stop_reason).
type BetaAdvisorRedactedResultBlockParamResp struct { Type: "advisor_redacted_result"; EncryptedContent; StopReason }
Opaque blob produced by a prior response; must be round-tripped verbatim.
type BetaAdvisorResultBlock struct { Type: "advisor_result"; StopReason; Text }
Type AdvisorResult
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.
type BetaAdvisorResultBlockParamResp struct { Type: "advisor_result"; Text; StopReason }
type BetaAdvisorTool20260301 struct { Type: "advisor_20260301"; Model; Name; /* 7 more */ }
type BetaAdvisorToolResultBlock struct { Type: "advisor_tool_result"; Content; ToolUseID }
type BetaAdvisorToolResultBlockParamResp struct { Type: "advisor_tool_result"; Content; ToolUseID; CacheControl }
type BetaAdvisorToolResultError struct { Type: "advisor_tool_result_error"; ErrorCode }
Type AdvisorToolResultError
ErrorCode BetaAdvisorToolResultErrorErrorCode
type BetaAdvisorToolResultErrorParamResp struct { Type: "advisor_tool_result_error"; ErrorCode }
ErrorCode BetaAdvisorToolResultErrorParamErrorCode
type BetaAllThinkingTurns struct { Type: "all" }
type BetaBase64ImageSource struct { Type: "base64"; Data; MediaType }
Data string
MediaType BetaBase64ImageSourceMediaType
type BetaBase64PDFSource struct { Type: "base64"; Data; MediaType }
Data string
type BetaBashCodeExecutionOutputBlock struct { Type: "bash_code_execution_output"; FileID }
Type BashCodeExecutionOutput
type BetaBashCodeExecutionOutputBlockParamResp struct { Type: "bash_code_execution_output"; FileID }
type BetaBashCodeExecutionResultBlock struct { Type: "bash_code_execution_result"; Content; ReturnCode; /* 2 more */ }
Type BashCodeExecutionResult
Content []BetaBashCodeExecutionOutputBlock
Type BashCodeExecutionOutput
type BetaBashCodeExecutionResultBlockParamResp struct { Type: "bash_code_execution_result"; Content; ReturnCode; /* 2 more */ }
type BetaBashCodeExecutionToolResultBlock struct { Type: "bash_code_execution_tool_result"; Content; ToolUseID }
type BetaBashCodeExecutionToolResultBlockParamResp struct { Type: "bash_code_execution_tool_result"; Content; ToolUseID; CacheControl }
type BetaBashCodeExecutionToolResultError struct { Type: "bash_code_execution_tool_result_error"; ErrorCode }
Type BashCodeExecutionToolResultError
ErrorCode BetaBashCodeExecutionToolResultErrorErrorCode
type BetaBashCodeExecutionToolResultErrorParamResp struct { Type: "bash_code_execution_tool_result_error"; ErrorCode }
ErrorCode BetaBashCodeExecutionToolResultErrorParamErrorCode
type BetaBrowserCloseTabConfig struct { DeferLoading; Enabled }close_tab's config overrides.
close_tab's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserDoubleClickConfig struct { DeferLoading; Enabled }double_click's config overrides.
double_click's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserFileUploadConfig struct { DeferLoading; Enabled }file_upload's config overrides.
file_upload's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserFindConfig struct { DeferLoading; Enabled }find's config overrides.
find's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserFormInputConfig struct { DeferLoading; Enabled }form_input's config overrides.
form_input's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserGetPageTextConfig struct { DeferLoading; Enabled }get_page_text's config overrides.
get_page_text's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserHoldKeyConfig struct { DeferLoading; Enabled }hold_key's config overrides.
hold_key's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserHoverConfig struct { DeferLoading; Enabled }hover's config overrides.
hover's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserJavascriptExecConfig struct { DeferLoading; Enabled }javascript_exec's config overrides.
javascript_exec's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserKeyConfig struct { DeferLoading; Enabled }key's config overrides.
key's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserLeftClickConfig struct { DeferLoading; Enabled }left_click's config overrides.
left_click's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserLeftClickDragConfig struct { DeferLoading; Enabled }left_click_drag's config overrides.
left_click_drag's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserLeftMouseDownConfig struct { DeferLoading; Enabled }left_mouse_down's config overrides.
left_mouse_down's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserLeftMouseUpConfig struct { DeferLoading; Enabled }left_mouse_up's config overrides.
left_mouse_up's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserListTabsConfig struct { DeferLoading; Enabled }list_tabs's config overrides.
list_tabs's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserMiddleClickConfig struct { DeferLoading; Enabled }middle_click's config overrides.
middle_click's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserMouseMoveConfig struct { DeferLoading; Enabled }mouse_move's config overrides.
mouse_move's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserNavigateConfig struct { DeferLoading; Enabled }navigate's config overrides.
navigate's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserNewTabConfig struct { DeferLoading; Enabled }new_tab's config overrides.
new_tab's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserReadConsoleConfig struct { DeferLoading; Enabled }read_console's config overrides.
read_console's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserReadNetworkConfig struct { DeferLoading; Enabled }read_network's config overrides.
read_network's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserReadPageConfig struct { DeferLoading; Enabled }read_page's config overrides.
read_page's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserRightClickConfig struct { DeferLoading; Enabled }right_click's config overrides.
right_click's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserScreenshotConfig struct { DeferLoading; Enabled }screenshot's config overrides.
screenshot's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserScrollConfig struct { DeferLoading; Enabled }scroll's config overrides.
scroll's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserScrollToConfig struct { DeferLoading; Enabled }scroll_to's config overrides.
scroll_to's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserStateBlockParamResp struct { Type: "browser_state"; Tabs; CacheControl; StateChanges }The caller's browser state after a browser toolset member call —
the full inventory of open tabs, which tab is active, and any side
effects (tabs opened, download state changes) the call produced.
The caller's browser state after a browser toolset member call — the full inventory of open tabs, which tab is active, and any side effects (tabs opened, download state changes) the call produced.
At most one per tool_result, only on a non-error result answering a
browser toolset member tool_use. The server renders the
model-visible text from it; the model never sees the raw fields.
type BetaBrowserStateChangeUnion interface{…}
type BetaBrowserStateChangeDownloadCompleted struct { Type: "download_completed"; DownloadID; URL; /* 2 more */ }A file download that finished during this call, reported with the
same download_id as its download_started — or without a prior
download_started, when the download finished during the call that
started it (at most one state change per download_id per result).
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).
DownloadID stringThe caller-assigned identifier for this download, stable across the state changes reporting it.
The caller-assigned identifier for this download, stable across the state changes reporting it.
URL stringThe final post-redirect URL the download was served from.
The final post-redirect URL the download was served from.
Path string OptionalWhere 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.
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.
SizeBytes int64 OptionalThe completed download's size.
The completed download's size.
type BetaBrowserStateChangeDownloadFailed struct { Type: "download_failed"; DownloadID; URL; Error }A file download that failed — or was cancelled — during this call.
A file download that failed — or was cancelled — during this call.
DownloadID stringThe caller-assigned identifier for this download, stable across the state changes reporting it.
The caller-assigned identifier for this download, stable across the state changes reporting it.
URL stringThe final post-redirect URL the download was served from.
The final post-redirect URL the download was served from.
Error string OptionalThe failure or cancellation detail, when known.
The failure or cancellation detail, when known.
type BetaBrowserStateChangeDownloadStarted struct { Type: "download_started"; DownloadID; URL }A file download that started during this call.
A file download that started during this call.
DownloadID stringThe caller-assigned identifier for this download, stable across the state changes reporting it.
The caller-assigned identifier for this download, stable across the state changes reporting it.
URL stringThe final post-redirect URL the download was served from.
The final post-redirect URL the download was served from.
type BetaBrowserStateChangeTabOpened struct { Type: "tab_opened"; TabID }A tab this call's execution opened that remains open at its end —
the creation delta of the tabs inventory, not an event log.
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.
TabID stringThe tab_id of the opened tab, present in tabs.
The tab_id of the opened tab, present in tabs.
type BetaBrowserStateTabEntry struct { TabID; Title; URL; Active }One open browser tab reported in a browser_state block's tabs
inventory.
One open browser tab reported in a browser_state block's tabs
inventory.
tab_id is the caller-assigned identifier for the tab; title and
url describe the page the tab is currently showing and may be empty
strings (a blank tab legitimately has both empty). active marks the
tab that is active after this call; whenever tabs is non-empty,
exactly one entry is marked.
TabID stringThe caller-assigned identifier for this tab, unique within the inventory.
The caller-assigned identifier for this tab, unique within the inventory.
Title stringThe title of the page the tab is showing. May be empty.
The title of the page the tab is showing. May be empty.
URL stringThe URL of the page the tab is showing. May be empty.
The URL of the page the tab is showing. May be empty.
Whether this tab is the active tab after this call. Whenever tabs is non-empty, exactly one entry is marked active: true.
type BetaBrowserSwitchTabConfig struct { DeferLoading; Enabled }switch_tab's config overrides.
switch_tab's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserToolset20260801 struct { Type: "browser_toolset_20260801"; CacheControl; Configs }The browser toolset: a single tools[] entry (carrying no
name) that declares the browser tool family. The model is served
the family's tool with any members disabled via configs removed
from its schema.
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.
CacheControl BetaCacheControlEphemeral OptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTL OptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m. See prompt caching pricing for details.
Configs BetaBrowserToolsetConfigs OptionalSparse per-member overrides, keyed by member name. Absent, null, and {} are equivalent; a member's defaults apply wherever its key is absent.
Sparse per-member overrides, keyed by member name. Absent, null, and {} are equivalent; a member's defaults apply wherever its key is absent.
type BetaBrowserToolsetConfigs struct { Type; CloseTab; DoubleClick; /* 28 more */ }Per-member configuration for browser_toolset_20260801: one
optional field per member tool, keyed by the member name — the same
name the member's tool_use blocks carry. Every member is an
accepted key, and a member's defaults apply wherever its key is
absent. Unknown keys are rejected: the field set is this toolset
version's complete member set.
Per-member configuration for browser_toolset_20260801: one
optional field per member tool, keyed by the member name — the same
name the member's tool_use blocks carry. Every member is an
accepted key, and a member's defaults apply wherever its key is
absent. Unknown keys are rejected: the field set is this toolset
version's complete member set.
type BetaBrowserTripleClickConfig struct { DeferLoading; Enabled }triple_click's config overrides.
triple_click's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserTypeConfig struct { DeferLoading; Enabled }type's config overrides.
type's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserWaitConfig struct { DeferLoading; Enabled }wait's config overrides.
wait's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaBrowserZoomConfig struct { DeferLoading; Enabled }zoom's config overrides.
zoom's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaCacheControlEphemeral struct { Type: "ephemeral"; TTL }
TTL BetaCacheControlEphemeralTTL OptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m. See prompt caching pricing for details.
type BetaCacheCreation struct { Ephemeral1hInputTokens; Ephemeral5mInputTokens }
Ephemeral1hInputTokens int64The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 1 hour cache entry.
Ephemeral5mInputTokens int64The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the 5 minute cache entry.
type BetaCacheMissMessagesChanged struct { Type: "messages_changed"; CacheMissedInputTokens }
Type MessagesChanged
Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.
type BetaCacheMissModelChanged struct { Type: "model_changed"; CacheMissedInputTokens }
Type ModelChanged
Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.
type BetaCacheMissPreviousMessageNotFound struct { Type: "previous_message_not_found" }
Type PreviousMessageNotFound
type BetaCacheMissReasonUnion interface{…}
type BetaCacheMissSystemChanged struct { Type: "system_changed"; CacheMissedInputTokens }
Type SystemChanged
Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.
type BetaCacheMissToolsChanged struct { Type: "tools_changed"; CacheMissedInputTokens }
Type ToolsChanged
Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.
type BetaCacheMissUnavailable struct { Type: "unavailable" }
Type Unavailable
type BetaCitationCharLocation struct { Type: "char_location"; CitedText; DocumentIndex; /* 4 more */ }
Type CharLocation
DocumentIndex int64
StartCharIndex int64
type BetaCitationCharLocationParamResp struct { Type: "char_location"; CitedText; DocumentIndex; /* 3 more */ }
DocumentIndex int64
DocumentTitle string
StartCharIndex int64
type BetaCitationConfig struct { Enabled }
Enabled bool
type BetaCitationContentBlockLocation struct { Type: "content_block_location"; CitedText; DocumentIndex; /* 4 more */ }
Type ContentBlockLocation
CitedText stringThe full text of the cited block range, concatenated.
The full text of the cited block range, concatenated.
Always equals the contents of content[start_block_index:end_block_index] joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.
DocumentIndex int64
EndBlockIndex int64Exclusive 0-based end index of the cited block range in the source's content array.
Exclusive 0-based end index of the cited block range in the source's content array.
Always greater than start_block_index; a single-block citation has end_block_index = start_block_index + 1.
StartBlockIndex int640-based index of the first cited block in the source's content array.
0-based index of the first cited block in the source's content array.
type BetaCitationContentBlockLocationParamResp struct { Type: "content_block_location"; CitedText; DocumentIndex; /* 3 more */ }
CitedText stringThe full text of the cited block range, concatenated.
The full text of the cited block range, concatenated.
Always equals the contents of content[start_block_index:end_block_index] joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.
DocumentIndex int64
DocumentTitle string
EndBlockIndex int64Exclusive 0-based end index of the cited block range in the source's content array.
Exclusive 0-based end index of the cited block range in the source's content array.
Always greater than start_block_index; a single-block citation has end_block_index = start_block_index + 1.
StartBlockIndex int640-based index of the first cited block in the source's content array.
0-based index of the first cited block in the source's content array.
type BetaCitationPageLocation struct { Type: "page_location"; CitedText; DocumentIndex; /* 4 more */ }
Type PageLocation
DocumentIndex int64
StartPageNumber int64
type BetaCitationPageLocationParamResp struct { Type: "page_location"; CitedText; DocumentIndex; /* 3 more */ }
DocumentIndex int64
DocumentTitle string
StartPageNumber int64
type BetaCitationSearchResultLocation struct { Type: "search_result_location"; CitedText; EndBlockIndex; /* 4 more */ }
Type SearchResultLocation
CitedText stringThe full text of the cited block range, concatenated.
The full text of the cited block range, concatenated.
Always equals the contents of content[start_block_index:end_block_index] joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.
EndBlockIndex int64Exclusive 0-based end index of the cited block range in the source's content array.
Exclusive 0-based end index of the cited block range in the source's content array.
Always greater than start_block_index; a single-block citation has end_block_index = start_block_index + 1.
SearchResultIndex int640-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.
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.
StartBlockIndex int640-based index of the first cited block in the source's content array.
0-based index of the first cited block in the source's content array.
type BetaCitationSearchResultLocationParamResp struct { Type: "search_result_location"; CitedText; EndBlockIndex; /* 4 more */ }
CitedText stringThe full text of the cited block range, concatenated.
The full text of the cited block range, concatenated.
Always equals the contents of content[start_block_index:end_block_index] joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.
EndBlockIndex int64Exclusive 0-based end index of the cited block range in the source's content array.
Exclusive 0-based end index of the cited block range in the source's content array.
Always greater than start_block_index; a single-block citation has end_block_index = start_block_index + 1.
SearchResultIndex int640-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.
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.
StartBlockIndex int640-based index of the first cited block in the source's content array.
0-based index of the first cited block in the source's content array.
type BetaCitationWebSearchResultLocationParamResp struct { Type: "web_search_result_location"; CitedText; EncryptedIndex; /* 2 more */ }
Title string
URL string
type BetaCitationsConfigParamResp struct { Enabled }
type BetaCitationsDelta struct { Type: "citations_delta"; Citation }
type BetaCitationsWebSearchResultLocation struct { Type: "web_search_result_location"; CitedText; EncryptedIndex; /* 2 more */ }
Type WebSearchResultLocation
Title string
type BetaClearThinking20251015Edit struct { Type: "clear_thinking_20251015"; Keep }
Keep BetaClearThinking20251015EditKeepUnion OptionalNumber of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed.
Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed.
type BetaThinkingTurns struct { Type: "thinking_turns"; Value }
Value int64
type BetaAllThinkingTurns struct { Type: "all" }
type BetaClearThinking20251015EditResponse struct { Type: "clear_thinking_20251015"; ClearedInputTokens; ClearedThinkingTurns }
Type ClearThinking20251015The type of context management edit applied.
The type of context management edit applied.
ClearedInputTokens int64Number of input tokens cleared by this edit.
Number of input tokens cleared by this edit.
ClearedThinkingTurns int64Number of thinking turns that were cleared.
Number of thinking turns that were cleared.
type BetaClearToolUses20250919Edit struct { Type: "clear_tool_uses_20250919"; ClearAtLeast; ClearToolInputs; /* 3 more */ }
type BetaClearToolUses20250919EditResponse struct { Type: "clear_tool_uses_20250919"; ClearedInputTokens; ClearedToolUses }
Type ClearToolUses20250919The type of context management edit applied.
The type of context management edit applied.
ClearedInputTokens int64Number of input tokens cleared by this edit.
Number of input tokens cleared by this edit.
ClearedToolUses int64Number of tool uses that were cleared.
Number of tool uses that were cleared.
type BetaCodeExecutionOutputBlock struct { Type: "code_execution_output"; FileID }
Type CodeExecutionOutput
type BetaCodeExecutionOutputBlockParamResp struct { Type: "code_execution_output"; FileID }
type BetaCodeExecutionResultBlock struct { Type: "code_execution_result"; Content; ReturnCode; /* 2 more */ }
Type CodeExecutionResult
Content []BetaCodeExecutionOutputBlock
Type CodeExecutionOutput
type BetaCodeExecutionResultBlockParamResp struct { Type: "code_execution_result"; Content; ReturnCode; /* 2 more */ }
Content []BetaCodeExecutionOutputBlockParamResp
type BetaCodeExecutionTool20250522 struct { Type: "code_execution_20250522"; Name; AllowedCallers; /* 3 more */ }
type BetaCodeExecutionTool20250825 struct { Type: "code_execution_20250825"; Name; AllowedCallers; /* 3 more */ }
type BetaCodeExecutionTool20260120 struct { Type: "code_execution_20260120"; Name; AllowedCallers; /* 3 more */ }Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
type BetaCodeExecutionTool20260521 struct { Type: "code_execution_20260521"; Name; AllowedCallers; /* 3 more */ }Code execution tool with REPL state persistence.
Code execution tool with REPL state persistence.
type BetaCodeExecutionToolResultBlock struct { Type: "code_execution_tool_result"; Content; ToolUseID }
Type CodeExecutionToolResult
ToolUseID string
type BetaCodeExecutionToolResultBlockContentUnion interface{…}
type BetaCodeExecutionToolResultBlockParamResp struct { Type: "code_execution_tool_result"; Content; ToolUseID; CacheControl }
ToolUseID string
CacheControl BetaCacheControlEphemeral OptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTL OptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m. See prompt caching pricing for details.
type BetaCodeExecutionToolResultBlockParamContentUnionResp interface{…}
type BetaCodeExecutionToolResultError struct { Type: "code_execution_tool_result_error"; ErrorCode }
Type CodeExecutionToolResultError
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCodeExecutionToolResultErrorCode string
type BetaCodeExecutionToolResultErrorParamResp struct { Type: "code_execution_tool_result_error"; ErrorCode }
ErrorCode BetaCodeExecutionToolResultErrorCode
type BetaCompact20260112Edit struct { Type: "compact_20260112"; Instructions; PauseAfterCompaction; Trigger }Automatically compact older context when reaching the configured trigger threshold.
Automatically compact older context when reaching the configured trigger threshold.
Additional instructions for summarization.
Whether to pause after compaction and return the compaction block to the user.
Trigger BetaInputTokensTrigger OptionalWhen to trigger compaction. Defaults to 150000 input tokens.
When to trigger compaction. Defaults to 150000 input tokens.
Value int64
type BetaCompactionBlock struct { Type: "compaction"; Content; EncryptedContent; /* 2 more */ }A compaction block returned when autocompact is triggered.
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.
Type Compaction
Summary of compacted content, or null if compaction failed
Opaque metadata from prior compaction, to be round-tripped verbatim
Signature over the summary, to be sent back with the block verbatim
ToolChanges []BetaCompactionBlockToolChangeUnion OptionalThe 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.
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.
type BetaResponseToolAdditionBlock struct { 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.
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.
type BetaResponseToolRemovalBlock struct { 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.
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.
type BetaCompactionBlockParamResp struct { Type: "compaction"; CacheControl; Content; /* 3 more */ }A compaction block containing summary of previous context.
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 BetaCompactionConfig struct { 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.
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.
Instructions string OptionalReplaces the server's default summarization prompt for this request. An empty or whitespace-only value counts as absent.
Replaces the server's default summarization prompt for this request. An empty or whitespace-only value counts as absent.
type BetaCompactionContentBlockDelta struct { Type: "compaction_delta"; Content; EncryptedContent }
Type CompactionDelta
Opaque metadata from prior compaction, to be round-tripped verbatim
type BetaCompactionIterationUsage struct { Type: "compaction"; CacheCreation; CacheCreationInputTokens; /* 3 more */ }Token usage for a compaction iteration.
Token usage for a compaction iteration.
Type CompactionUsage for a compaction iteration
Usage for a compaction iteration
CacheCreation BetaCacheCreationBreakdown of cached tokens by TTL
Breakdown of cached tokens by TTL
Ephemeral1hInputTokens int64The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 1 hour cache entry.
Ephemeral5mInputTokens int64The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the 5 minute cache entry.
CacheCreationInputTokens int64The number of input tokens used to create the cache entry.
The number of input tokens used to create the cache entry.
CacheReadInputTokens int64The number of input tokens read from the cache.
The number of input tokens read from the cache.
InputTokens int64The number of input tokens which were used.
The number of input tokens which were used.
OutputTokens int64The number of output tokens which were used.
The number of output tokens which were used.
type BetaComputerCursorPositionConfig struct { DeferLoading; Enabled }cursor_position's config overrides.
cursor_position's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaComputerDoubleClickConfig struct { DeferLoading; Enabled }double_click's config overrides.
double_click's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaComputerHoldKeyConfig struct { DeferLoading; Enabled }hold_key's config overrides.
hold_key's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaComputerKeyConfig struct { DeferLoading; Enabled }key's config overrides.
key's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaComputerLeftClickConfig struct { DeferLoading; Enabled }left_click's config overrides.
left_click's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaComputerLeftClickDragConfig struct { DeferLoading; Enabled }left_click_drag's config overrides.
left_click_drag's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaComputerLeftMouseDownConfig struct { DeferLoading; Enabled }left_mouse_down's config overrides.
left_mouse_down's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaComputerLeftMouseUpConfig struct { DeferLoading; Enabled }left_mouse_up's config overrides.
left_mouse_up's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaComputerMiddleClickConfig struct { DeferLoading; Enabled }middle_click's config overrides.
middle_click's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaComputerMouseMoveConfig struct { DeferLoading; Enabled }mouse_move's config overrides.
mouse_move's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaComputerRightClickConfig struct { DeferLoading; Enabled }right_click's config overrides.
right_click's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaComputerScreenshotConfig struct { DeferLoading; Enabled }screenshot's config overrides.
screenshot's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaComputerScrollConfig struct { DeferLoading; Enabled }scroll's config overrides.
scroll's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaComputerToolset20260801 struct { Type: "computer_toolset_20260801"; CacheControl; Configs }The computer toolset: a single tools[] entry (carrying no
name) that declares the computer tool family. The model is
served the family's tool with any members disabled via configs
removed from its schema. Every member is enabled by default, zoom
included. The single-tool options display_number and
enable_zoom are not fields of a toolset entry — it carries only
type, configs, and cache_control; zoom is controlled
via configs.zoom.enabled.
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.
CacheControl BetaCacheControlEphemeral OptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTL OptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m. See prompt caching pricing for details.
Configs BetaComputerToolsetConfigs OptionalSparse per-member overrides, keyed by member name. Absent, null, and {} are equivalent; a member's defaults apply wherever its key is absent.
Sparse per-member overrides, keyed by member name. Absent, null, and {} are equivalent; a member's defaults apply wherever its key is absent.
type BetaComputerToolsetConfigs struct { Type; CursorPosition; DoubleClick; /* 14 more */ }Per-member configuration for computer_toolset_20260801: one
optional field per member tool, keyed by the member name — the same
name the member's tool_use blocks carry. Every member is an
accepted key, and a member's defaults apply wherever its key is
absent. Unknown keys are rejected: the field set is this toolset
version's complete member set.
Per-member configuration for computer_toolset_20260801: one
optional field per member tool, keyed by the member name — the same
name the member's tool_use blocks carry. Every member is an
accepted key, and a member's defaults apply wherever its key is
absent. Unknown keys are rejected: the field set is this toolset
version's complete member set.
type BetaComputerTripleClickConfig struct { DeferLoading; Enabled }triple_click's config overrides.
triple_click's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaComputerTypeConfig struct { DeferLoading; Enabled }type's config overrides.
type's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaComputerWaitConfig struct { DeferLoading; Enabled }wait's config overrides.
wait's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaComputerZoomConfig struct { DeferLoading; Enabled }zoom's config overrides.
zoom's config overrides.
Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
type BetaContainer struct { ID; ExpiresAt; Skills }Information about the container used in the request (for the code execution tool)
Information about the container used in the request (for the code execution tool)
Identifier for the container used in this request
ExpiresAt TimeThe time at which the container will expire.
The time at which the container will expire.
Skills []BetaContainerSkillSkills loaded in the container
Skills loaded in the container
Type BetaContainerSkillTypeType of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
SkillID stringSkill ID
Skill ID
Version stringThe resolved version: a skill version ID for custom skills.
The resolved version: a skill version ID for custom skills.
type BetaContainerParamsResp struct { ID; Skills }Container parameters with skills to be loaded.
Container parameters with skills to be loaded.
Container id
Skills []BetaSkillParamsResp OptionalList of skills to load in the container
List of skills to load in the container
Type BetaSkillParamsTypeType of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
SkillID stringSkill ID
Skill ID
Version string OptionalSkill version or 'latest' for most recent version
Skill version or 'latest' for most recent version
type BetaContainerSkill struct { Type; SkillID; Version }A skill that was loaded in a container (response model).
A skill that was loaded in a container (response model).
Type BetaContainerSkillTypeType of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
SkillID stringSkill ID
Skill ID
Version stringThe resolved version: a skill version ID for custom skills.
The resolved version: a skill version ID for custom skills.
type BetaContainerUploadBlock struct { Type: "container_upload"; FileID }Response model for a file uploaded to the container.
Response model for a file uploaded to the container.
Type ContainerUpload
type BetaContainerUploadBlockParamResp struct { Type: "container_upload"; FileID; CacheControl }A content block that represents a file to be uploaded to the container
Files uploaded via this block will be available in the container's input directory.
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.
CacheControl BetaCacheControlEphemeral OptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTL OptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m. See prompt caching pricing for details.
type BetaContentBlockUnion interface{…}
type BetaContentBlockParamUnionResp interface{…}
type BetaContentBlockSource struct { Type: "content"; Content }
Content BetaContentBlockSourceContentUnion
type BetaTextBlockParamResp struct { Type: "text"; Text; CacheControl; Citations }
type BetaImageBlockParamResp struct { Type: "image"; Source; CacheControl; Transformations }
type BetaContentBlockSourceContentUnion interface{…}
type BetaTextBlockParamResp struct { Type: "text"; Text; CacheControl; Citations }
type BetaImageBlockParamResp struct { Type: "image"; Source; CacheControl; Transformations }
type BetaContextManagementConfig struct { Edits }
type BetaContextManagementResponse struct { AppliedEdits }
AppliedEdits []BetaContextManagementResponseAppliedEditUnionList of context management edits that were applied.
List of context management edits that were applied.
type BetaClearToolUses20250919EditResponse struct { Type: "clear_tool_uses_20250919"; ClearedInputTokens; ClearedToolUses }
Type ClearToolUses20250919The type of context management edit applied.
The type of context management edit applied.
ClearedInputTokens int64Number of input tokens cleared by this edit.
Number of input tokens cleared by this edit.
ClearedToolUses int64Number of tool uses that were cleared.
Number of tool uses that were cleared.
type BetaClearThinking20251015EditResponse struct { Type: "clear_thinking_20251015"; ClearedInputTokens; ClearedThinkingTurns }
Type ClearThinking20251015The type of context management edit applied.
The type of context management edit applied.
ClearedInputTokens int64Number of input tokens cleared by this edit.
Number of input tokens cleared by this edit.
ClearedThinkingTurns int64Number of thinking turns that were cleared.
Number of thinking turns that were cleared.
type BetaCountTokensContextManagementResponse struct { OriginalInputTokens }
The original token count before context management was applied
type BetaDiagnostics struct { CacheMissReason }Request-level diagnostics: why the prompt cache could not fully reuse
the prefix of the request named by diagnostics.previous_message_id.
Request-level diagnostics: why the prompt cache could not fully reuse
the prefix of the request named by diagnostics.previous_message_id.
CacheMissReason BetaCacheMissReasonUnionExplains 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.
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.
type BetaDiagnosticsParamResp struct { PreviousMessageID }Request-level diagnostics. Currently carries the previous response
id for prompt-cache divergence reporting.
Request-level diagnostics. Currently carries the previous response id for prompt-cache divergence reporting.
PreviousMessageID string OptionalThe 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.
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.
type BetaDirectCaller struct { Type: "direct" }Tool invocation directly from the model.
Tool invocation directly from the model.
type BetaDocumentBlock struct { Type: "document"; Citations; Source; Title }
type BetaEncryptedCodeExecutionResultBlock struct { Type: "encrypted_code_execution_result"; Content; EncryptedStdout; /* 2 more */ }Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Type EncryptedCodeExecutionResult
Content []BetaCodeExecutionOutputBlock
Type CodeExecutionOutput
type BetaEncryptedCodeExecutionResultBlockParamResp struct { Type: "encrypted_code_execution_result"; Content; EncryptedStdout; /* 2 more */ }Code execution result with encrypted stdout for PFC + web_search results.
Code execution result with encrypted stdout for PFC + web_search results.
Content []BetaCodeExecutionOutputBlockParamResp
type BetaFallbackBlock struct { Type: "fallback"; From; To; Trigger }Marks the point in content where one model's output gives way to the next.
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.
type BetaFallbackBlockParamResp struct { Type: "fallback"; From; To; Trigger }A fallback block echoed back from a prior response.
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.
Identifies one hop of a fallback transition.
Identifies one hop of a fallback transition.
Identifies one hop of a fallback transition.
Identifies one hop of a fallback transition.
The response block's trigger, echoed verbatim. Accepted and ignored by the server; any object or null is allowed.
type BetaFallbackCreditNotApplied struct { Type: "not_applied"; Reason; RemoveToRedeem }No reprice was applied; reason says why.
No reprice was applied; reason says why.
type BetaFallbackCreditRedeemed struct { Type: "redeemed" }The reprice was applied: the retry is billed as if the conversation
had been on the retry model all along.
The reprice was applied: the retry is billed as if the conversation had been on the retry model all along.
Type Redeemed
type BetaFallbackCreditTokenParamResp struct { Token; Mode }Object form of fallback_credit_token: the token plus a redemption
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 stringThe opaque fallback_credit_token from a prior refusal's stop_details — the same string the bare-string form carries.
The opaque fallback_credit_token from a prior refusal's stop_details — the same string the bare-string form carries.
Mode BetaFallbackCreditTokenParamMode OptionalHow 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.
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.
type BetaFallbackCreditUsage struct { Status }Outcome of the fallback_credit_token presented on this request.
Outcome of the fallback_credit_token presented on this request.
Status BetaFallbackCreditUsageStatusUnionWhether the fallback-credit reprice was applied to this response's billing.
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.
type BetaFallbackCreditRedeemed struct { Type: "redeemed" }The reprice was applied: the retry is billed as if the conversation
had been on the retry model all along.
The reprice was applied: the retry is billed as if the conversation had been on the retry model all along.
Type Redeemed
type BetaFallbackCreditNotApplied struct { Type: "not_applied"; Reason; RemoveToRedeem }No reprice was applied; reason says why.
No reprice was applied; reason says why.
type BetaFallbackMessageIterationUsage struct { Type: "fallback_message"; CacheCreation; CacheCreationInputTokens; /* 4 more */ }Token usage for the fallback-model attempt of a server-side fallback request.
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.
Type FallbackMessageUsage for the fallback-model attempt that served the response
Usage for the fallback-model attempt that served the response
CacheCreation BetaCacheCreationBreakdown of cached tokens by TTL
Breakdown of cached tokens by TTL
Ephemeral1hInputTokens int64The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 1 hour cache entry.
Ephemeral5mInputTokens int64The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the 5 minute cache entry.
CacheCreationInputTokens int64The number of input tokens used to create the cache entry.
The number of input tokens used to create the cache entry.
CacheReadInputTokens int64The number of input tokens read from the cache.
The number of input tokens read from the cache.
InputTokens int64The number of input tokens which were used.
The number of input tokens which were used.
OutputTokens int64The number of output tokens which were used.
The number of output tokens which were used.
type BetaFallbackParamResp struct { Model; MaxTokens; OutputConfig; /* 2 more */ }One entry in the fallbacks chain on a /v1/messages request.
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.
type BetaFallbackRefusalTrigger struct { Type: "refusal"; Category }The from model declined for policy reasons.
The from model declined for policy reasons.
Type Refusal
Category BetaFallbackRefusalTriggerCategoryThe 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.
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.
The request could enable cyber harm, such as malware or exploit development. Benign cybersecurity work can also trigger this category.
The request could enable biological harm, such as dangerous lab methods. Beneficial life sciences work can also trigger this category.
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.
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.
The request could be related to an area that was determined as harmful. Benign work might sometimes trigger this category.
type BetaFallbacksParamUnionResp interface{…}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.
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.
type BetaFileDocumentSource struct { Type: "file"; FileID }
type BetaFileImageSource struct { Type: "file"; FileID }
type BetaImageBlockParamResp struct { Type: "image"; Source; CacheControl; Transformations }
type BetaImageTransformationsParamResp struct { OversizedImage }Configures the transformations the server applies to this image before the model observes it. Each key names a condition the server transforms images for; its value selects the transformation applied. Omitted keys keep their default behavior, and an empty object is equivalent to omitting the field.
Configures the transformations the server applies to this image before the model observes it. Each key names a condition the server transforms images for; its value selects the transformation applied. Omitted keys keep their default behavior, and an empty object is equivalent to omitting the field.
OversizedImage BetaImageTransformationsParamOversizedImage OptionalWhat 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.
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.
type BetaInputJSONDelta struct { Type: "input_json_delta"; PartialJSON }
Type InputJSONDelta
type BetaInputTokensClearAtLeast struct { Type: "input_tokens"; Value }
Value int64
type BetaInputTokensTrigger struct { Type: "input_tokens"; Value }
Value int64
type BetaInputTransformationUnion interface{…}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.
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.
type BetaIterationsUsage []BetaIterationsUsageItemUnionPer-iteration token usage breakdown.
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
messageentry - 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.
type BetaJSONOutputFormat struct { Type: "json_schema"; Schema }
The JSON schema of the format
type BetaMCPTool struct { InputSchema; Name; Description }A tool as an MCP server lists it: its name on that server, its
description, and its input schema.
A tool as an MCP server lists it: its name on that server, its description, and its input schema.
type BetaMCPToolConfig struct { DeferLoading; Enabled }Configuration for a specific tool in an MCP toolset.
Configuration for a specific tool in an MCP toolset.
type BetaMCPToolDefaultConfig struct { DeferLoading; Enabled }Default configuration for tools in an MCP toolset.
Default configuration for tools in an MCP toolset.
type BetaMCPToolListingBlock struct { 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.
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.
Type MCPToolListing
Tools []BetaMCPTool
type BetaMCPToolListingBlockParamResp struct { 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.
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.
MCPServerName stringThe name of the MCP server this listing came from, as mcp_servers declares it.
The name of the MCP server this listing came from, as mcp_servers declares it.
Tools []BetaMCPToolParamRespThe server's tools, exactly as the response listed them.
The server's tools, exactly as the response listed them.
The tool's input schema as the MCP server lists it, verbatim.
Name stringThe tool's name as the MCP server lists it (not prefixed with the server name).
The tool's name as the MCP server lists it (not prefixed with the server name).
The tool's description as the MCP server lists it.
type BetaMCPToolParamResp struct { InputSchema; Name; Description }A tool as an MCP server lists it: its name on that server, its
description, and its input schema.
A tool as an MCP server lists it: its name on that server, its description, and its input schema.
The tool's input schema as the MCP server lists it, verbatim.
Name stringThe tool's name as the MCP server lists it (not prefixed with the server name).
The tool's name as the MCP server lists it (not prefixed with the server name).
The tool's description as the MCP server lists it.
type BetaMCPToolResultBlock struct { Type: "mcp_tool_result"; Content; IsError; ToolUseID }
type BetaMCPToolUseBlock struct { Type: "mcp_tool_use"; ID; Input; /* 2 more */ }
Type MCPToolUse
ID string
The name of the MCP tool
The name of the MCP server
type BetaMCPToolUseBlockParamResp struct { Type: "mcp_tool_use"; ID; Input; /* 3 more */ }
ID string
The name of the MCP server
CacheControl BetaCacheControlEphemeral OptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTL OptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m. See prompt caching pricing for details.
type BetaMCPToolset struct { Type: "mcp_toolset"; MCPServerName; CacheControl; /* 3 more */ }Configuration for a group of tools from an MCP server.
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.
type BetaMemoryTool20250818 struct { Type: "memory_20250818"; Name; AllowedCallers; /* 4 more */ }
type BetaMemoryTool20250818CommandUnion interface{…}
type BetaMemoryTool20250818CreateCommand struct { Command; FileText; Path }
Command CreateCommand type identifier
Command type identifier
Content to write to the file
Path where the file should be created
type BetaMemoryTool20250818DeleteCommand struct { Command; Path }
Command DeleteCommand type identifier
Command type identifier
Path to the file or directory to delete
type BetaMemoryTool20250818InsertCommand struct { Command; InsertLine; InsertText; Path }
Command InsertCommand type identifier
Command type identifier
InsertLine int64Line number where text should be inserted
Line number where text should be inserted
Text to insert at the specified line
Path to the file where text should be inserted
type BetaMemoryTool20250818RenameCommand struct { Command; NewPath; OldPath }
Command RenameCommand type identifier
Command type identifier
New path for the file or directory
Current path of the file or directory
type BetaMemoryTool20250818StrReplaceCommand struct { Command; NewStr; OldStr; Path }
Command StrReplaceCommand type identifier
Command type identifier
Text to replace with
Text to search for and replace
Path to the file where text should be replaced
type BetaMemoryTool20250818ViewCommand struct { Command; Path; ViewRange }
Command ViewCommand type identifier
Command type identifier
Path to directory or file to view
ViewRange []int64 OptionalOptional line range for viewing specific lines
Optional line range for viewing specific lines
type BetaMessage struct { Type: "message"; ID; Container; /* 10 more */ }
type BetaMessageDeltaUsage struct { CacheCreationInputTokens; CacheReadInputTokens; FallbackCredit; /* 5 more */ }
type BetaMessageIterationUsage struct { Type: "message"; CacheCreation; CacheCreationInputTokens; /* 4 more */ }Token usage for a sampling iteration.
Token usage for a sampling iteration.
Type MessageUsage for a sampling iteration
Usage for a sampling iteration
CacheCreation BetaCacheCreationBreakdown of cached tokens by TTL
Breakdown of cached tokens by TTL
Ephemeral1hInputTokens int64The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 1 hour cache entry.
Ephemeral5mInputTokens int64The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the 5 minute cache entry.
CacheCreationInputTokens int64The number of input tokens used to create the cache entry.
The number of input tokens used to create the cache entry.
CacheReadInputTokens int64The number of input tokens read from the cache.
The number of input tokens read from the cache.
InputTokens int64The number of input tokens which were used.
The number of input tokens which were used.
OutputTokens int64The number of output tokens which were used.
The number of output tokens which were used.
type BetaMessageParamResp struct { Content; Role; ClearAt; OutputConfig }
type BetaMessageTokensCount struct { ContextManagement; InputTokens }
ContextManagement BetaCountTokensContextManagementResponseInformation about context management applied to the message.
Information about context management applied to the message.
The original token count before context management was applied
The total number of tokens across the provided list of messages, system prompt, and tools.
type BetaMetadata struct { UserID }
UserID string OptionalAn external identifier for the user who is associated with the request.
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.
type BetaOutputConfig struct { Effort; Format; TaskBudget }
type BetaOutputTokensDetails struct { ThinkingTokens }
ThinkingTokens int64Number of output tokens the model generated as internal reasoning, including
the thinking-block delimiter tokens.
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.
type BetaPlainTextSource struct { Type: "text"; Data; MediaType }
type BetaRawContentBlockDeltaUnion interface{…}
type BetaRawContentBlockDeltaEvent struct { Type: "content_block_delta"; Delta; Index }
Type ContentBlockDelta
type BetaRawContentBlockStartEvent struct { Type: "content_block_start"; ContentBlock; Index }
type BetaRawContentBlockStopEvent struct { Type: "content_block_stop"; Index }
Type ContentBlockStop
type BetaRawMessageDeltaEvent struct { Type: "message_delta"; ContextManagement; Delta; /* 2 more */ }
type BetaRawMessageStartEvent struct { Type: "message_start"; Message }
Type MessageStart
Message BetaMessage
type BetaRawMessageStopEvent struct { Type: "message_stop" }
Type MessageStop
type BetaRawMessageStreamEventUnion interface{…}
type BetaRedactedThinkingBlock struct { Type: "redacted_thinking"; Data }
Type RedactedThinking
Data stringThe 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.
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 BetaRedactedThinkingBlockParamResp struct { Type: "redacted_thinking"; 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.
type BetaRefusalStopDetails struct { Type: "refusal"; Category; Explanation; /* 3 more */ }Structured information about a refusal.
Structured information about a refusal.
type BetaRequestDocumentBlock struct { Type: "document"; Source; CacheControl; /* 3 more */ }
type BetaRequestMCPServerToolConfiguration struct { AllowedTools; Enabled }
type BetaRequestMCPServerURLDefinition struct { Type: "url"; Name; URL; /* 2 more */ }
ToolConfiguration BetaRequestMCPServerToolConfiguration Optional
type BetaRequestMCPToolResultBlockParamResp struct { Type: "mcp_tool_result"; ToolUseID; CacheControl; /* 2 more */ }
type BetaRequestToolAdditionBlock struct { Type: "tool_addition"; Tool; CacheControl }Mid-conversation directive to make a tool available.
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.
type BetaRequestToolRemovalBlock struct { Type: "tool_removal"; Tool; CacheControl }Mid-conversation directive to withdraw a tool.
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.
type BetaResponseTool struct { Type: "custom"; InputSchema; Name; /* 6 more */ }A custom tool definition, as sent.
A custom tool definition, as sent.
type BetaResponseToolAdditionBlock struct { 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.
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.
type BetaResponseToolChangeMCPToolReference struct { 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.
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.
Type MCPToolReference
type BetaResponseToolChangeMCPToolsetReference struct { 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.
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.
Type MCPToolsetReference
type BetaResponseToolChangeToolReference struct { 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.
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.
Type ToolReference
type BetaResponseToolInputSchema struct { Type: "object"; Properties; Required }JSON schema for this tool's input.
JSON schema for this tool's input.
This defines the shape of the input that your tool accepts and that the model will produce.
type BetaResponseToolRemovalBlock struct { 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.
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.
type BetaResponseToolUnion interface{…}
type BetaSearchResultBlockParamResp struct { Type: "search_result"; Content; Source; /* 3 more */ }
type BetaServerToolCaller struct { Type: "code_execution_20250825"; ToolID }Tool invocation generated by a server-side tool.
Tool invocation generated by a server-side tool.
ToolID string
type BetaServerToolCaller20260120 struct { Type: "code_execution_20260120"; ToolID }
ToolID string
type BetaServerToolUsage struct { WebFetchRequests; WebSearchRequests }
WebFetchRequests int64The number of web fetch tool requests.
The number of web fetch tool requests.
WebSearchRequests int64The number of web search tool requests.
The number of web search tool requests.
type BetaServerToolUseBlock struct { Type: "server_tool_use"; ID; Input; /* 2 more */ }
type BetaServerToolUseBlockParamResp struct { Type: "server_tool_use"; ID; Input; /* 3 more */ }
type BetaSignatureDelta struct { Type: "signature_delta"; Signature }
Type SignatureDelta
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 BetaSkillParamsResp struct { Type; SkillID; Version }Specification for a skill to be loaded in a container (request model).
Specification for a skill to be loaded in a container (request model).
Type BetaSkillParamsTypeType of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
SkillID stringSkill ID
Skill ID
Version string OptionalSkill version or 'latest' for most recent version
Skill version or 'latest' for most recent version
type BetaStopReason string
type BetaSummarizeCompaction struct { 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.
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.
Instructions string OptionalReplaces the server's default summarization prompt for this request. An empty or whitespace-only value counts as absent.
Replaces the server's default summarization prompt for this request. An empty or whitespace-only value counts as absent.
type BetaSystemMessageOutputConfig struct { Effort }Per-message output configuration on a role:"system" input message.
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.
Effort BetaSystemMessageOutputConfigEffort OptionalHow much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.
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.
type BetaTextBlock struct { Type: "text"; Citations; Text }
type BetaTextBlockParamResp struct { Type: "text"; Text; CacheControl; Citations }
type BetaTextCitationUnion interface{…}
type BetaTextCitationParamUnionResp interface{…}
type BetaTextDelta struct { Type: "text_delta"; Text }
Type TextDelta
type BetaTextEditorCodeExecutionCreateResultBlock struct { Type: "text_editor_code_execution_create_result"; IsFileUpdate }
Type TextEditorCodeExecutionCreateResult
type BetaTextEditorCodeExecutionCreateResultBlockParamResp struct { Type: "text_editor_code_execution_create_result"; IsFileUpdate }
type BetaTextEditorCodeExecutionStrReplaceResultBlock struct { Type: "text_editor_code_execution_str_replace_result"; Lines; NewLines; /* 3 more */ }
Type TextEditorCodeExecutionStrReplaceResult
type BetaTextEditorCodeExecutionStrReplaceResultBlockParamResp struct { Type: "text_editor_code_execution_str_replace_result"; Lines; NewLines; /* 3 more */ }
type BetaTextEditorCodeExecutionToolResultBlock struct { Type: "text_editor_code_execution_tool_result"; Content; ToolUseID }
type BetaTextEditorCodeExecutionToolResultBlockParamResp struct { Type: "text_editor_code_execution_tool_result"; Content; ToolUseID; CacheControl }
type BetaTextEditorCodeExecutionToolResultError struct { Type: "text_editor_code_execution_tool_result_error"; ErrorCode; ErrorMessage }
Type TextEditorCodeExecutionToolResultError
ErrorCode BetaTextEditorCodeExecutionToolResultErrorErrorCode
type BetaTextEditorCodeExecutionToolResultErrorParamResp struct { Type: "text_editor_code_execution_tool_result_error"; ErrorCode; ErrorMessage }
ErrorCode BetaTextEditorCodeExecutionToolResultErrorParamErrorCode
type BetaTextEditorCodeExecutionViewResultBlock struct { Type: "text_editor_code_execution_view_result"; Content; FileType; /* 3 more */ }
Type TextEditorCodeExecutionViewResult
FileType BetaTextEditorCodeExecutionViewResultBlockFileType
type BetaTextEditorCodeExecutionViewResultBlockParamResp struct { Type: "text_editor_code_execution_view_result"; Content; FileType; /* 3 more */ }
FileType BetaTextEditorCodeExecutionViewResultBlockParamFileType
type BetaThinkingBlock struct { Type: "thinking"; Signature; Thinking }
Type Thinking
Signature stringA value used to verify that this thinking block was generated by Claude when it is passed back to the API.
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.
The text of Claude's thinking process for this block.
type BetaThinkingBlockBinding struct { 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.
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.
PrefixMismatchBehavior BetaThinkingPrefixMismatchBehavior Optional"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.
"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.
type BetaThinkingBlockParamResp struct { Type: "thinking"; Signature; Thinking }
Signature stringThe 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.
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.
The thinking text of this block as returned by the API.
type BetaThinkingConfigAdaptive struct { Type: "adaptive"; BlockBinding; Display }
BlockBinding BetaThinkingBlockBinding OptionalControls 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.
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.
PrefixMismatchBehavior BetaThinkingPrefixMismatchBehavior Optional"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.
"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.
Display BetaThinkingConfigAdaptiveDisplay OptionalControls 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.
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.
type BetaThinkingConfigBetweenTools struct { Type: "between_tools" }
type BetaThinkingConfigDisabled struct { Type: "disabled" }
type BetaThinkingConfigEnabled struct { Type: "enabled"; BudgetTokens; BlockBinding; Display }
type BetaThinkingConfigParamUnionResp interface{…}Configuration for enabling Claude's extended thinking.
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.
type BetaThinkingDelta struct { Type: "thinking_delta"; EstimatedTokens; Thinking }
Type ThinkingDelta
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.
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 BetaThinkingDroppedInputTransformation struct { Type: "thinking_dropped"; Path; Reason }
Type ThinkingDroppedAlways thinking_dropped for this entry type.
Always thinking_dropped for this entry type.
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 BetaThinkingDroppedInputTransformationReasonWhich 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.
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.
type BetaThinkingMismatchAllowedInputTransformation struct { Type: "thinking_mismatch_allowed"; Path; Reason }
Type ThinkingMismatchAllowedAlways thinking_mismatch_allowed for this entry type.
Always thinking_mismatch_allowed for this entry type.
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 BetaThinkingMismatchAllowedInputTransformationReasonWhich 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.
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.
type BetaThinkingPrefixMismatchBehavior stringWhat 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.
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.
type BetaThinkingTurns struct { Type: "thinking_turns"; Value }
Value int64
type BetaTokenTaskBudget struct { Type: "tokens"; Total; Remaining }User-configurable total token budget across contexts.
User-configurable total token budget across contexts.
The budget type. Currently only 'tokens' is supported.
Total int64Total token budget across all contexts in the session.
Total token budget across all contexts in the session.
Remaining int64 OptionalRemaining tokens in the budget. Use this to track usage across contexts when implementing compaction client-side. Defaults to total if not provided.
Remaining tokens in the budget. Use this to track usage across contexts when implementing compaction client-side. Defaults to total if not provided.
type BetaTool struct { Type: "custom"; InputSchema; Name; /* 7 more */ }
type BetaToolBash20241022 struct { Type: "bash_20241022"; Name; AllowedCallers; /* 4 more */ }
type BetaToolBash20250124 struct { Type: "bash_20250124"; Name; AllowedCallers; /* 4 more */ }
type BetaToolChangeMCPToolReference struct { 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.
Reference to a single MCP tool by its server and remote name; the
same server_name/name pair mcp_tool_use carries.
type BetaToolChangeMCPToolsetReference struct { Type: "mcp_toolset_reference"; ServerName }Reference to every tool in the named MCP server's toolset.
Reference to every tool in the named MCP server's toolset.
type BetaToolChangeToolDefinition struct { 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.
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.
Type ToolDefinition
Definition BetaResponseToolUnion
type BetaToolChangeToolDefinitionParamResp struct { 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.
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.
Definition BetaToolUnion
type BetaToolChangeToolReference struct { 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.
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.
Name string
type BetaToolChoiceUnion interface{…}How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.
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.
type BetaToolChoiceAny struct { Type: "any"; DisableParallelToolUse }The model will use any available tools.
The model will use any available tools.
DisableParallelToolUse bool OptionalWhether to disable parallel tool use.
Whether to disable parallel tool use.
Defaults to false. If set to true, the model will output exactly one tool use.
type BetaToolChoiceAuto struct { Type: "auto"; DisableParallelToolUse }The model will automatically decide whether to use tools.
The model will automatically decide whether to use tools.
DisableParallelToolUse bool OptionalWhether to disable parallel tool use.
Whether to disable parallel tool use.
Defaults to false. If set to true, the model will output at most one tool use.
type BetaToolChoiceNone struct { Type: "none" }The model will not be allowed to use tools.
The model will not be allowed to use tools.
type BetaToolChoiceTool struct { Type: "tool"; Name; DisableParallelToolUse }The model will use the specified tool with tool_choice.name.
The model will use the specified tool with tool_choice.name.
The name of the tool to use.
DisableParallelToolUse bool OptionalWhether to disable parallel tool use.
Whether to disable parallel tool use.
Defaults to false. If set to true, the model will output exactly one tool use.
type BetaToolComputerUse20241022 struct { Type: "computer_20241022"; DisplayHeightPx; DisplayWidthPx; /* 7 more */ }
type BetaToolComputerUse20250124 struct { Type: "computer_20250124"; DisplayHeightPx; DisplayWidthPx; /* 7 more */ }
type BetaToolComputerUse20251124 struct { Type: "computer_20251124"; DisplayHeightPx; DisplayWidthPx; /* 8 more */ }
type BetaToolReferenceBlock struct { Type: "tool_reference"; ToolName }
Type ToolReference
ToolName string
type BetaToolReferenceBlockParamResp struct { Type: "tool_reference"; ToolName; CacheControl }Tool reference block that can be included in tool_result content.
Tool reference block that can be included in tool_result content.
ToolName string
CacheControl BetaCacheControlEphemeral OptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTL OptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m. See prompt caching pricing for details.
type BetaToolResultBlockParamResp struct { Type: "tool_result"; ToolUseID; CacheControl; /* 3 more */ }
type BetaToolSearchToolBm25_20251119 struct { Type; Name; AllowedCallers; /* 3 more */ }
type BetaToolSearchToolRegex20251119 struct { Type; Name; AllowedCallers; /* 3 more */ }
type BetaToolSearchToolResultBlock struct { Type: "tool_search_tool_result"; Content; ToolUseID }
type BetaToolSearchToolResultBlockParamResp struct { Type: "tool_search_tool_result"; Content; ToolUseID; CacheControl }
type BetaToolSearchToolResultError struct { Type: "tool_search_tool_result_error"; ErrorCode; ErrorMessage }
Type ToolSearchToolResultError
ErrorCode BetaToolSearchToolResultErrorErrorCode
type BetaToolSearchToolResultErrorParamResp struct { Type: "tool_search_tool_result_error"; ErrorCode; ErrorMessage }
ErrorCode BetaToolSearchToolResultErrorParamErrorCode
type BetaToolSearchToolSearchResultBlock struct { Type: "tool_search_tool_search_result"; ToolReferences }
Type ToolSearchToolSearchResult
ToolReferences []BetaToolReferenceBlock
Type ToolReference
ToolName string
type BetaToolSearchToolSearchResultBlockParamResp struct { Type: "tool_search_tool_search_result"; ToolReferences }
ToolReferences []BetaToolReferenceBlockParamResp
ToolName string
CacheControl BetaCacheControlEphemeral OptionalCreate a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
TTL BetaCacheControlEphemeralTTL OptionalThe time-to-live for the cache control breakpoint.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m. See prompt caching pricing for details.
type BetaToolTextEditor20241022 struct { Type: "text_editor_20241022"; Name; AllowedCallers; /* 4 more */ }
type BetaToolTextEditor20250124 struct { Type: "text_editor_20250124"; Name; AllowedCallers; /* 4 more */ }
type BetaToolTextEditor20250429 struct { Type: "text_editor_20250429"; Name; AllowedCallers; /* 4 more */ }
type BetaToolTextEditor20250728 struct { Type: "text_editor_20250728"; Name; AllowedCallers; /* 5 more */ }
type BetaToolUnion interface{…}
type BetaToolUseBlock struct { Type: "tool_use"; ID; Input; /* 3 more */ }
type BetaToolUseBlockParamResp struct { Type: "tool_use"; ID; Input; /* 4 more */ }
type BetaToolUsesKeep struct { Type: "tool_uses"; Value }
Value int64
type BetaToolUsesTrigger struct { Type: "tool_uses"; Value }
Value int64
type BetaURLImageSource struct { Type: "url"; URL }
type BetaURLPDFSource struct { Type: "url"; URL }
type BetaUsage struct { CacheCreation; CacheCreationInputTokens; CacheReadInputTokens; /* 9 more */ }
type BetaUserLocation struct { Type: "approximate"; City; Country; /* 2 more */ }
City string OptionalThe city of the user.
The city of the user.
Country string OptionalThe two letter ISO country code of the user.
The two letter ISO country code of the user.
Region string OptionalThe region of the user.
The region of the user.
Timezone string OptionalThe IANA timezone of the user.
The IANA timezone of the user.
type BetaWebFetchBlock struct { Type: "web_fetch_result"; Content; RetrievedAt; URL }
type BetaWebFetchBlockParamResp struct { Type: "web_fetch_result"; Content; URL; RetrievedAt }
Content BetaRequestDocumentBlock
Fetched content URL
ISO 8601 timestamp when the content was retrieved
type BetaWebFetchTool20250910 struct { Type: "web_fetch_20250910"; Name; AllowedCallers; /* 9 more */ }
type BetaWebFetchTool20260209 struct { Type: "web_fetch_20260209"; Name; AllowedCallers; /* 9 more */ }
type BetaWebFetchTool20260309 struct { Type: "web_fetch_20260309"; Name; AllowedCallers; /* 10 more */ }Web fetch tool with use_cache parameter for bypassing cached content.
Web fetch tool with use_cache parameter for bypassing cached content.
type BetaWebFetchTool20260318 struct { Type: "web_fetch_20260318"; Name; AllowedCallers; /* 11 more */ }
type BetaWebFetchToolResultBlock struct { Type: "web_fetch_tool_result"; Content; ToolUseID; Caller }
type BetaWebFetchToolResultBlockParamResp struct { Type: "web_fetch_tool_result"; Content; ToolUseID; /* 2 more */ }
type BetaWebFetchToolResultErrorBlock struct { Type: "web_fetch_tool_result_error"; ErrorCode }
type BetaWebFetchToolResultErrorBlockParamResp struct { Type: "web_fetch_tool_result_error"; ErrorCode }
type BetaWebFetchToolResultErrorCode string
type BetaWebFetchURLSourceAll struct { Type: "all" }The url_sources variant under which a source contributes in
full: every result of the tool filter's source, or all user input.
The url_sources variant under which a source contributes in
full: every result of the tool filter's source, or all user input.
type BetaWebFetchURLSourceExcept struct { Type: "except"; Tools }The tool filter variant under which every result but the named
tools' contributes.
The tool filter variant under which every result but the named tools' contributes.
type BetaWebFetchURLSourceNone struct { Type: "none" }The url_sources variant under which a source contributes nothing:
no result of the tool filter's source, or no user input.
The url_sources variant under which a source contributes nothing:
no result of the tool filter's source, or no user input.
type BetaWebFetchURLSourceOnly struct { Type: "only"; Tools }The tool filter variant under which only the named tools' results
contribute.
The tool filter variant under which only the named tools' results contribute.
type BetaWebFetchURLSourceToolReference struct { Type: "tool_reference"; Name }One entry of a tool filter's tools: it must name a tool declared
in this request's tools[].
One entry of a tool filter's tools: it must name a tool declared
in this request's tools[].
type BetaWebFetchURLSources struct { ClientToolResults; ServerToolResults; UserInput }Which sources contribute to the set of URLs web fetch may fetch.
Which sources contribute to the set of URLs web fetch may fetch.
Each key is a tagged variant: user_input is all or none; the
two tool filters are all, none, only (only the named tools'
results) or except (every result but the named tools'). A named tool
must be declared in this request's tools[].
type BetaWebSearchResultBlock struct { Type: "web_search_result"; EncryptedContent; PageAge; /* 2 more */ }
Type WebSearchResult
type BetaWebSearchResultBlockParamResp struct { Type: "web_search_result"; EncryptedContent; Title; /* 2 more */ }
type BetaWebSearchTool20250305 struct { Type: "web_search_20250305"; Name; AllowedCallers; /* 7 more */ }
type BetaWebSearchTool20260209 struct { Type: "web_search_20260209"; Name; AllowedCallers; /* 7 more */ }
type BetaWebSearchTool20260318 struct { Type: "web_search_20260318"; Name; AllowedCallers; /* 8 more */ }
type BetaWebSearchToolRequestError struct { Type: "web_search_tool_result_error"; ErrorCode }
ErrorCode BetaWebSearchToolResultErrorCode
type BetaWebSearchToolResultBlock struct { Type: "web_search_tool_result"; Content; ToolUseID; Caller }
type BetaWebSearchToolResultBlockContentUnion interface{…}
type BetaWebSearchToolResultBlockParamResp struct { Type: "web_search_tool_result"; Content; ToolUseID; /* 2 more */ }
type BetaWebSearchToolResultBlockParamContentUnionResp interface{…}
type BetaWebSearchToolResultError struct { Type: "web_search_tool_result_error"; ErrorCode }
Type WebSearchToolResultError
ErrorCode BetaWebSearchToolResultErrorCode
type BetaWebSearchToolResultErrorCode string
MessagesBatches
Create a Message Batch
client.Beta.Messages.Batches.New(ctx, params) (*BetaMessageBatch, error)Send a batch of Message creation requests.
Retrieve a Message Batch
client.Beta.Messages.Batches.Get(ctx, messageBatchID, query) (*BetaMessageBatch, error)This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the results_url field in the response.
List Message Batches
client.Beta.Messages.Batches.List(ctx, params) (*Page[BetaMessageBatch], error)List all Message Batches within a Workspace. Most recently created batches are returned first.
Cancel a Message Batch
client.Beta.Messages.Batches.Cancel(ctx, messageBatchID, body) (*BetaMessageBatch, error)Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a canceling state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation.
Delete a Message Batch
client.Beta.Messages.Batches.Delete(ctx, messageBatchID, body) (*BetaDeletedMessageBatch, error)Retrieve Message Batch results
client.Beta.Messages.Batches.Results(ctx, messageBatchID, query) (*BetaMessageBatchIndividualResponse, error)Streams the results of a Message Batch as a .jsonl file.