Claude Platform Docs

Messages

Create a Message
client.Beta.Messages.New(ctx, params) (*BetaMessage, error)
POST/v1/messages
Count tokens in a Message
client.Beta.Messages.CountTokens(ctx, params) (*BetaMessageTokensCount, error)
POST/v1/messages/count_tokens
Models
type BetaAdvisorMessageIterationUsage struct{…}

Token usage for an advisor sub-inference iteration.

CacheCreation BetaCacheCreation

Breakdown of cached tokens by TTL

Ephemeral1hInputTokens int64

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

default0
minimum0
Ephemeral5mInputTokens int64

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

default0
minimum0
CacheCreationInputTokens int64

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

default0
minimum0
CacheReadInputTokens int64

The number of input tokens read from the cache.

default0
minimum0
InputTokens int64

The number of input tokens which were used.

minimum0
Model Model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
OutputTokens int64

The number of output tokens which were used.

minimum0
Type AdvisorMessage

Usage for an advisor sub-inference iteration

defaultadvisor_message
type BetaAdvisorRedactedResultBlock struct{…}
EncryptedContent string

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

StopReason string

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

Type AdvisorRedactedResult
defaultadvisor_redacted_result
type BetaAdvisorRedactedResultBlockParamResp struct{…}
EncryptedContent string

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

Type AdvisorRedactedResult
StopReason string Optional
type BetaAdvisorResultBlock struct{…}
StopReason string

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

Text string
Type AdvisorResult
defaultadvisor_result
type BetaAdvisorResultBlockParamResp struct{…}
Text string
Type AdvisorResult
StopReason string Optional
type BetaAdvisorTool20260301 struct{…}
type BetaAdvisorToolResultBlock struct{…}
type BetaAdvisorToolResultBlockParamResp struct{…}
type BetaAdvisorToolResultError struct{…}
ErrorCode BetaAdvisorToolResultErrorErrorCode
One of the following:
const BetaAdvisorToolResultErrorErrorCodeMaxUsesExceeded BetaAdvisorToolResultErrorErrorCode = "max_uses_exceeded"
const BetaAdvisorToolResultErrorErrorCodePromptTooLong BetaAdvisorToolResultErrorErrorCode = "prompt_too_long"
const BetaAdvisorToolResultErrorErrorCodeTooManyRequests BetaAdvisorToolResultErrorErrorCode = "too_many_requests"
const BetaAdvisorToolResultErrorErrorCodeOverloaded BetaAdvisorToolResultErrorErrorCode = "overloaded"
const BetaAdvisorToolResultErrorErrorCodeUnavailable BetaAdvisorToolResultErrorErrorCode = "unavailable"
const BetaAdvisorToolResultErrorErrorCodeExecutionTimeExceeded BetaAdvisorToolResultErrorErrorCode = "execution_time_exceeded"
const BetaAdvisorToolResultErrorErrorCodeModelNotFound BetaAdvisorToolResultErrorErrorCode = "model_not_found"
Type AdvisorToolResultError
defaultadvisor_tool_result_error
type BetaAdvisorToolResultErrorParamResp struct{…}
ErrorCode BetaAdvisorToolResultErrorParamErrorCode
One of the following:
const BetaAdvisorToolResultErrorParamErrorCodeMaxUsesExceeded BetaAdvisorToolResultErrorParamErrorCode = "max_uses_exceeded"
const BetaAdvisorToolResultErrorParamErrorCodePromptTooLong BetaAdvisorToolResultErrorParamErrorCode = "prompt_too_long"
const BetaAdvisorToolResultErrorParamErrorCodeTooManyRequests BetaAdvisorToolResultErrorParamErrorCode = "too_many_requests"
const BetaAdvisorToolResultErrorParamErrorCodeOverloaded BetaAdvisorToolResultErrorParamErrorCode = "overloaded"
const BetaAdvisorToolResultErrorParamErrorCodeUnavailable BetaAdvisorToolResultErrorParamErrorCode = "unavailable"
const BetaAdvisorToolResultErrorParamErrorCodeExecutionTimeExceeded BetaAdvisorToolResultErrorParamErrorCode = "execution_time_exceeded"
const BetaAdvisorToolResultErrorParamErrorCodeModelNotFound BetaAdvisorToolResultErrorParamErrorCode = "model_not_found"
Type AdvisorToolResultError
type BetaAllThinkingTurns struct{…}
Type All
type BetaBase64ImageSource struct{…}
Data string
formatbyte
MediaType BetaBase64ImageSourceMediaType
One of the following:
const BetaBase64ImageSourceMediaTypeImageJPEG BetaBase64ImageSourceMediaType = "image/jpeg"
const BetaBase64ImageSourceMediaTypeImagePNG BetaBase64ImageSourceMediaType = "image/png"
const BetaBase64ImageSourceMediaTypeImageGIF BetaBase64ImageSourceMediaType = "image/gif"
const BetaBase64ImageSourceMediaTypeImageWebP BetaBase64ImageSourceMediaType = "image/webp"
Type Base64
type BetaBase64PDFSource struct{…}
Data string
formatbyte
MediaType ApplicationPDF
Type Base64
type BetaBashCodeExecutionOutputBlock struct{…}
FileID string
Type BashCodeExecutionOutput
defaultbash_code_execution_output
type BetaBashCodeExecutionOutputBlockParamResp struct{…}
FileID string
Type BashCodeExecutionOutput
type BetaBashCodeExecutionResultBlock struct{…}
FileID string
Type BashCodeExecutionOutput
defaultbash_code_execution_output
ReturnCode int64
Stderr string
Stdout string
Type BashCodeExecutionResult
defaultbash_code_execution_result
type BetaBashCodeExecutionResultBlockParamResp struct{…}
FileID string
Type BashCodeExecutionOutput
ReturnCode int64
Stderr string
Stdout string
Type BashCodeExecutionResult
type BetaBashCodeExecutionToolResultBlock struct{…}
type BetaBashCodeExecutionToolResultBlockParamResp struct{…}
type BetaBashCodeExecutionToolResultError struct{…}
ErrorCode BetaBashCodeExecutionToolResultErrorErrorCode
One of the following:
const BetaBashCodeExecutionToolResultErrorErrorCodeInvalidToolInput BetaBashCodeExecutionToolResultErrorErrorCode = "invalid_tool_input"
const BetaBashCodeExecutionToolResultErrorErrorCodeUnavailable BetaBashCodeExecutionToolResultErrorErrorCode = "unavailable"
const BetaBashCodeExecutionToolResultErrorErrorCodeTooManyRequests BetaBashCodeExecutionToolResultErrorErrorCode = "too_many_requests"
const BetaBashCodeExecutionToolResultErrorErrorCodeExecutionTimeExceeded BetaBashCodeExecutionToolResultErrorErrorCode = "execution_time_exceeded"
const BetaBashCodeExecutionToolResultErrorErrorCodeOutputFileTooLarge BetaBashCodeExecutionToolResultErrorErrorCode = "output_file_too_large"
Type BashCodeExecutionToolResultError
defaultbash_code_execution_tool_result_error
type BetaBashCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BetaBashCodeExecutionToolResultErrorParamErrorCode
One of the following:
const BetaBashCodeExecutionToolResultErrorParamErrorCodeInvalidToolInput BetaBashCodeExecutionToolResultErrorParamErrorCode = "invalid_tool_input"
const BetaBashCodeExecutionToolResultErrorParamErrorCodeUnavailable BetaBashCodeExecutionToolResultErrorParamErrorCode = "unavailable"
const BetaBashCodeExecutionToolResultErrorParamErrorCodeTooManyRequests BetaBashCodeExecutionToolResultErrorParamErrorCode = "too_many_requests"
const BetaBashCodeExecutionToolResultErrorParamErrorCodeExecutionTimeExceeded BetaBashCodeExecutionToolResultErrorParamErrorCode = "execution_time_exceeded"
const BetaBashCodeExecutionToolResultErrorParamErrorCodeOutputFileTooLarge BetaBashCodeExecutionToolResultErrorParamErrorCode = "output_file_too_large"
Type BashCodeExecutionToolResultError
type BetaBrowserCloseTabConfig struct{…}

close_tab's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserDoubleClickConfig struct{…}

double_click's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserFileUploadConfig struct{…}

file_upload's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserFindConfig struct{…}

find's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserFormInputConfig struct{…}

form_input's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserGetPageTextConfig struct{…}

get_page_text's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserHoldKeyConfig struct{…}

hold_key's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserHoverConfig struct{…}

hover's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserJavascriptExecConfig struct{…}

javascript_exec's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserKeyConfig struct{…}

key's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserLeftClickConfig struct{…}

left_click's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserLeftClickDragConfig struct{…}

left_click_drag's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserLeftMouseDownConfig struct{…}

left_mouse_down's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserLeftMouseUpConfig struct{…}

left_mouse_up's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserListTabsConfig struct{…}

list_tabs's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserMiddleClickConfig struct{…}

middle_click's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserMouseMoveConfig struct{…}

mouse_move's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserNavigateConfig struct{…}

navigate's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserNewTabConfig struct{…}

new_tab's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserReadConsoleConfig struct{…}

read_console's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserReadNetworkConfig struct{…}

read_network's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserReadPageConfig struct{…}

read_page's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserRightClickConfig struct{…}

right_click's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserScreenshotConfig struct{…}

screenshot's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserScrollConfig struct{…}

scroll's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserScrollToConfig struct{…}

scroll_to's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserStateBlockParamResp struct{…}

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{…}

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

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

One of the following:
type BetaBrowserStateChangeDownloadCompleted struct{…}

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 string

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

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

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

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

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

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

The completed download's size.

minimum0
type BetaBrowserStateChangeDownloadFailed struct{…}

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

DownloadID string

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

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

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

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

The failure or cancellation detail, when known.

pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
maxLength4096
type BetaBrowserStateChangeDownloadStarted struct{…}

A file download that started during this call.

DownloadID string

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

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

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

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

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 string

The tab_id of the opened tab, present in tabs.

maxLength4096
minLength1
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
Type TabOpened
type BetaBrowserStateTabEntry struct{…}

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

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

TabID string

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

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

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

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

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

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

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

type BetaBrowserSwitchTabConfig struct{…}

switch_tab's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserToolset20260801 struct{…}

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

type BetaBrowserToolsetConfigs struct{…}

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{…}

triple_click's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserTypeConfig struct{…}

type's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserWaitConfig struct{…}

wait's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaBrowserZoomConfig struct{…}

zoom's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaCacheControlEphemeral struct{…}
Type Ephemeral
TTL BetaCacheControlEphemeralTTL Optional

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

This may be one the following values:

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

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

One of the following:
const BetaCacheControlEphemeralTTLTTL5m BetaCacheControlEphemeralTTL = "5m"
const BetaCacheControlEphemeralTTLTTL1h BetaCacheControlEphemeralTTL = "1h"
type BetaCacheCreation struct{…}
Ephemeral1hInputTokens int64

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

default0
minimum0
Ephemeral5mInputTokens int64

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

default0
minimum0
type BetaCacheMissMessagesChanged struct{…}
CacheMissedInputTokens int64

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

Type MessagesChanged
defaultmessages_changed
type BetaCacheMissModelChanged struct{…}
CacheMissedInputTokens int64

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

Type ModelChanged
defaultmodel_changed
type BetaCacheMissPreviousMessageNotFound struct{…}
Type PreviousMessageNotFound
defaultprevious_message_not_found
type BetaCacheMissSystemChanged struct{…}
CacheMissedInputTokens int64

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

Type SystemChanged
defaultsystem_changed
type BetaCacheMissToolsChanged struct{…}
CacheMissedInputTokens int64

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

Type ToolsChanged
defaulttools_changed
type BetaCacheMissUnavailable struct{…}
Type Unavailable
defaultunavailable
type BetaCitationCharLocation struct{…}
CitedText string
DocumentIndex int64
minimum0
DocumentTitle string
EndCharIndex int64
FileID string
StartCharIndex int64
minimum0
Type CharLocation
defaultchar_location
type BetaCitationCharLocationParamResp struct{…}
CitedText string
DocumentIndex int64
minimum0
DocumentTitle string
maxLength500
minLength1
EndCharIndex int64
StartCharIndex int64
minimum0
Type CharLocation
type BetaCitationConfig struct{…}
Enabled bool
defaultfalse
type BetaCitationContentBlockLocation struct{…}
CitedText string

The full text of the cited block range, concatenated.

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

DocumentIndex int64
minimum0
DocumentTitle string
EndBlockIndex int64

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

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

FileID string
StartBlockIndex int64

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

minimum0
Type ContentBlockLocation
defaultcontent_block_location
type BetaCitationContentBlockLocationParamResp struct{…}
CitedText string

The full text of the cited block range, concatenated.

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

DocumentIndex int64
minimum0
DocumentTitle string
maxLength500
minLength1
EndBlockIndex int64

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

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

StartBlockIndex int64

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

minimum0
Type ContentBlockLocation
type BetaCitationPageLocation struct{…}
CitedText string
DocumentIndex int64
minimum0
DocumentTitle string
EndPageNumber int64
FileID string
StartPageNumber int64
minimum1
Type PageLocation
defaultpage_location
type BetaCitationPageLocationParamResp struct{…}
CitedText string
DocumentIndex int64
minimum0
DocumentTitle string
maxLength500
minLength1
EndPageNumber int64
StartPageNumber int64
minimum1
Type PageLocation
type BetaCitationSearchResultLocation struct{…}
CitedText string

The full text of the cited block range, concatenated.

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

EndBlockIndex int64

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

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

SearchResultIndex int64

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

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

minimum0
Source string
StartBlockIndex int64

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

minimum0
Title string
Type SearchResultLocation
defaultsearch_result_location
type BetaCitationSearchResultLocationParamResp struct{…}
CitedText string

The full text of the cited block range, concatenated.

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

EndBlockIndex int64

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

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

SearchResultIndex int64

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

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

minimum0
Source string
StartBlockIndex int64

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

minimum0
Title string
Type SearchResultLocation
type BetaCitationWebSearchResultLocationParamResp struct{…}
CitedText string
EncryptedIndex string
Title string
maxLength512
minLength1
Type WebSearchResultLocation
URL string
minLength1
type BetaCitationsConfigParamResp struct{…}
Enabled bool Optional
type BetaCitationsDelta struct{…}
type BetaCitationsWebSearchResultLocation struct{…}
CitedText string
EncryptedIndex string
Title string
maxLength512
Type WebSearchResultLocation
defaultweb_search_result_location
URL string
type BetaClearThinking20251015Edit struct{…}
Type ClearThinking20251015
Keep BetaClearThinking20251015EditKeepUnion Optional

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

One of the following:
type BetaThinkingTurns struct{…}
Type ThinkingTurns
Value int64
minimum1
type BetaAllThinkingTurns struct{…}
Type All
All
type BetaClearThinking20251015EditResponse struct{…}
ClearedInputTokens int64

Number of input tokens cleared by this edit.

minimum0
ClearedThinkingTurns int64

Number of thinking turns that were cleared.

minimum0
Type ClearThinking20251015

The type of context management edit applied.

defaultclear_thinking_20251015
type BetaClearToolUses20250919Edit struct{…}
type BetaClearToolUses20250919EditResponse struct{…}
ClearedInputTokens int64

Number of input tokens cleared by this edit.

minimum0
ClearedToolUses int64

Number of tool uses that were cleared.

minimum0
Type ClearToolUses20250919

The type of context management edit applied.

defaultclear_tool_uses_20250919
type BetaCodeExecutionOutputBlock struct{…}
FileID string
Type CodeExecutionOutput
defaultcode_execution_output
type BetaCodeExecutionOutputBlockParamResp struct{…}
FileID string
Type CodeExecutionOutput
type BetaCodeExecutionResultBlock struct{…}
FileID string
Type CodeExecutionOutput
defaultcode_execution_output
ReturnCode int64
Stderr string
Stdout string
Type CodeExecutionResult
defaultcode_execution_result
type BetaCodeExecutionResultBlockParamResp struct{…}
FileID string
Type CodeExecutionOutput
ReturnCode int64
Stderr string
Stdout string
Type CodeExecutionResult
type BetaCodeExecutionTool20250522 struct{…}
type BetaCodeExecutionTool20250825 struct{…}
type BetaCodeExecutionTool20260120 struct{…}

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

type BetaCodeExecutionTool20260521 struct{…}

Code execution tool with REPL state persistence.

type BetaCodeExecutionToolResultBlock struct{…}

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

One of the following:
ToolUseID string
pattern^srvtoolu_[a-zA-Z0-9_]+$
Type CodeExecutionToolResult
defaultcode_execution_tool_result
type BetaCodeExecutionToolResultBlockContentUnion interface{…}

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

One of the following:
type BetaCodeExecutionToolResultBlockParamResp struct{…}

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

One of the following:
ToolUseID string
pattern^srvtoolu_[a-zA-Z0-9_]+$
Type CodeExecutionToolResult
CacheControl BetaCacheControlEphemeral Optional

Create a cache control breakpoint at this content block.

Type Ephemeral
TTL BetaCacheControlEphemeralTTL Optional

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

This may be one the following values:

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

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

One of the following:
const BetaCacheControlEphemeralTTLTTL5m BetaCacheControlEphemeralTTL = "5m"
const BetaCacheControlEphemeralTTLTTL1h BetaCacheControlEphemeralTTL = "1h"
type BetaCodeExecutionToolResultBlockParamContentUnionResp interface{…}

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

One of the following:
type BetaCodeExecutionToolResultError struct{…}
One of the following:
const BetaCodeExecutionToolResultErrorCodeInvalidToolInput BetaCodeExecutionToolResultErrorCode = "invalid_tool_input"
const BetaCodeExecutionToolResultErrorCodeUnavailable BetaCodeExecutionToolResultErrorCode = "unavailable"
const BetaCodeExecutionToolResultErrorCodeTooManyRequests BetaCodeExecutionToolResultErrorCode = "too_many_requests"
const BetaCodeExecutionToolResultErrorCodeExecutionTimeExceeded BetaCodeExecutionToolResultErrorCode = "execution_time_exceeded"
Type CodeExecutionToolResultError
defaultcode_execution_tool_result_error
type BetaCodeExecutionToolResultErrorCode string
One of the following:
const BetaCodeExecutionToolResultErrorCodeInvalidToolInput BetaCodeExecutionToolResultErrorCode = "invalid_tool_input"
const BetaCodeExecutionToolResultErrorCodeUnavailable BetaCodeExecutionToolResultErrorCode = "unavailable"
const BetaCodeExecutionToolResultErrorCodeTooManyRequests BetaCodeExecutionToolResultErrorCode = "too_many_requests"
const BetaCodeExecutionToolResultErrorCodeExecutionTimeExceeded BetaCodeExecutionToolResultErrorCode = "execution_time_exceeded"
type BetaCodeExecutionToolResultErrorParamResp struct{…}
One of the following:
const BetaCodeExecutionToolResultErrorCodeInvalidToolInput BetaCodeExecutionToolResultErrorCode = "invalid_tool_input"
const BetaCodeExecutionToolResultErrorCodeUnavailable BetaCodeExecutionToolResultErrorCode = "unavailable"
const BetaCodeExecutionToolResultErrorCodeTooManyRequests BetaCodeExecutionToolResultErrorCode = "too_many_requests"
const BetaCodeExecutionToolResultErrorCodeExecutionTimeExceeded BetaCodeExecutionToolResultErrorCode = "execution_time_exceeded"
Type CodeExecutionToolResultError
type BetaCompact20260112Edit struct{…}

Automatically compact older context when reaching the configured trigger threshold.

Type Compact20260112
Instructions string Optional

Additional instructions for summarization.

PauseAfterCompaction bool Optional

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

Trigger BetaInputTokensTrigger Optional

When to trigger compaction. Defaults to 150000 input tokens.

Type InputTokens
Value int64
minimum1
type BetaCompactionBlock struct{…}

A compaction block returned when autocompact is triggered.

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

Content string

Summary of compacted content, or null if compaction failed

EncryptedContent string

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

Type Compaction
defaultcompaction
type BetaCompactionBlockParamResp struct{…}

A compaction block containing summary of previous context.

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

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

Type Compaction
CacheControl BetaCacheControlEphemeral Optional

Create a cache control breakpoint at this content block.

Type Ephemeral
TTL BetaCacheControlEphemeralTTL Optional

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

This may be one the following values:

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

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

One of the following:
const BetaCacheControlEphemeralTTLTTL5m BetaCacheControlEphemeralTTL = "5m"
const BetaCacheControlEphemeralTTLTTL1h BetaCacheControlEphemeralTTL = "1h"
Content string Optional

Summary of previously compacted content, or null if compaction failed

EncryptedContent string Optional

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

type BetaCompactionContentBlockDelta struct{…}
Content string
EncryptedContent string

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

Type CompactionDelta
defaultcompaction_delta
type BetaCompactionIterationUsage struct{…}

Token usage for a compaction iteration.

CacheCreation BetaCacheCreation

Breakdown of cached tokens by TTL

Ephemeral1hInputTokens int64

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

default0
minimum0
Ephemeral5mInputTokens int64

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

default0
minimum0
CacheCreationInputTokens int64

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

default0
minimum0
CacheReadInputTokens int64

The number of input tokens read from the cache.

default0
minimum0
InputTokens int64

The number of input tokens which were used.

minimum0
OutputTokens int64

The number of output tokens which were used.

minimum0
Type Compaction

Usage for a compaction iteration

defaultcompaction
type BetaComputerCursorPositionConfig struct{…}

cursor_position's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaComputerDoubleClickConfig struct{…}

double_click's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaComputerHoldKeyConfig struct{…}

hold_key's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaComputerKeyConfig struct{…}

key's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaComputerLeftClickConfig struct{…}

left_click's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaComputerLeftClickDragConfig struct{…}

left_click_drag's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaComputerLeftMouseDownConfig struct{…}

left_mouse_down's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaComputerLeftMouseUpConfig struct{…}

left_mouse_up's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaComputerMiddleClickConfig struct{…}

middle_click's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaComputerMouseMoveConfig struct{…}

mouse_move's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaComputerRightClickConfig struct{…}

right_click's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaComputerScreenshotConfig struct{…}

screenshot's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaComputerScrollConfig struct{…}

scroll's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaComputerToolset20260801 struct{…}

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

type BetaComputerToolsetConfigs struct{…}

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{…}

triple_click's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaComputerTypeConfig struct{…}

type's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaComputerWaitConfig struct{…}

wait's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaComputerZoomConfig struct{…}

zoom's config overrides.

DeferLoading bool Optional

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

Enabled bool Optional

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

type BetaContainer struct{…}

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

ID string

Identifier for the container used in this request

ExpiresAt Time

The time at which the container will expire.

formatdate-time

Skills loaded in the container

SkillID string

Skill ID

maxLength64
minLength1
Type BetaContainerSkillType

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

One of the following:
const BetaContainerSkillTypeAnthropic BetaContainerSkillType = "anthropic"
const BetaContainerSkillTypeCustom BetaContainerSkillType = "custom"
Version string

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

maxLength64
minLength1
type BetaContainerParamsResp struct{…}

Container parameters with skills to be loaded.

ID string Optional

Container id

Skills []BetaSkillParamsResp Optional

List of skills to load in the container

maxItems20
SkillID string

Skill ID

maxLength64
minLength1
Type BetaSkillParamsType

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

One of the following:
const BetaSkillParamsTypeAnthropic BetaSkillParamsType = "anthropic"
const BetaSkillParamsTypeCustom BetaSkillParamsType = "custom"
Version string Optional

Skill version or 'latest' for most recent version

maxLength64
minLength1
type BetaContainerSkill struct{…}

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

SkillID string

Skill ID

maxLength64
minLength1
Type BetaContainerSkillType

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

One of the following:
const BetaContainerSkillTypeAnthropic BetaContainerSkillType = "anthropic"
const BetaContainerSkillTypeCustom BetaContainerSkillType = "custom"
Version string

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

maxLength64
minLength1
type BetaContainerUploadBlock struct{…}

Response model for a file uploaded to the container.

FileID string
Type ContainerUpload
defaultcontainer_upload
type BetaContainerUploadBlockParamResp struct{…}

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.

FileID string
Type ContainerUpload
CacheControl BetaCacheControlEphemeral Optional

Create a cache control breakpoint at this content block.

Type Ephemeral
TTL BetaCacheControlEphemeralTTL Optional

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

This may be one the following values:

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

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

One of the following:
const BetaCacheControlEphemeralTTLTTL5m BetaCacheControlEphemeralTTL = "5m"
const BetaCacheControlEphemeralTTLTTL1h BetaCacheControlEphemeralTTL = "1h"
type BetaContentBlockUnion interface{…}

Response model for a file uploaded to the container.

One of the following:
type BetaContentBlockParamUnionResp interface{…}

Regular text content.

One of the following:
type BetaContentBlockSource struct{…}
Content BetaContentBlockSourceContentUnion
One of the following:
string
One of the following:
type BetaTextBlockParamResp struct{…}
type BetaImageBlockParamResp struct{…}
Type Content
type BetaContentBlockSourceContentUnion interface{…}
One of the following:
type BetaTextBlockParamResp struct{…}
type BetaImageBlockParamResp struct{…}
type BetaContextManagementConfig struct{…}
type BetaContextManagementResponse struct{…}
AppliedEdits []BetaContextManagementResponseAppliedEditUnion

List of context management edits that were applied.

One of the following:
type BetaClearToolUses20250919EditResponse struct{…}
ClearedInputTokens int64

Number of input tokens cleared by this edit.

minimum0
ClearedToolUses int64

Number of tool uses that were cleared.

minimum0
Type ClearToolUses20250919

The type of context management edit applied.

defaultclear_tool_uses_20250919
type BetaClearThinking20251015EditResponse struct{…}
ClearedInputTokens int64

Number of input tokens cleared by this edit.

minimum0
ClearedThinkingTurns int64

Number of thinking turns that were cleared.

minimum0
Type ClearThinking20251015

The type of context management edit applied.

defaultclear_thinking_20251015
type BetaCountTokensContextManagementResponse struct{…}
OriginalInputTokens int64

The original token count before context management was applied

type BetaDiagnostics struct{…}

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

type BetaDiagnosticsParamResp struct{…}

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

PreviousMessageID string Optional

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

maxLength256
type BetaDirectCaller struct{…}

Tool invocation directly from the model.

Type Direct
type BetaDocumentBlock struct{…}

Citation configuration for the document

Enabled bool
defaultfalse
Source BetaDocumentBlockSourceUnion
One of the following:
type BetaBase64PDFSource struct{…}
Data string
formatbyte
MediaType ApplicationPDF
Type Base64
type BetaPlainTextSource struct{…}
Data string
MediaType TextPlain
Type Text
Title string

The title of the document

Type Document
defaultdocument
type BetaEncryptedCodeExecutionResultBlock struct{…}

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

FileID string
Type CodeExecutionOutput
defaultcode_execution_output
EncryptedStdout string
ReturnCode int64
Stderr string
Type EncryptedCodeExecutionResult
defaultencrypted_code_execution_result
type BetaEncryptedCodeExecutionResultBlockParamResp struct{…}

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

FileID string
Type CodeExecutionOutput
EncryptedStdout string
ReturnCode int64
Stderr string
Type EncryptedCodeExecutionResult
type BetaFallbackBlock struct{…}

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{…}

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.

Model Model

The model that will complete your prompt.

See models for additional details and options.

One of the following:

Identifies one hop of a fallback transition.

Model Model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
Type Fallback
Trigger any Optional

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

type BetaFallbackCreditNotApplied struct{…}

No reprice was applied; reason says why.

type BetaFallbackCreditRedeemed struct{…}

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

Type Redeemed
defaultredeemed
type BetaFallbackCreditTokenParamResp struct{…}

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

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

Token string

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

maxLength2048
minLength1
Mode BetaFallbackCreditTokenParamMode Optional

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

One of the following:
const BetaFallbackCreditTokenParamModeStrict BetaFallbackCreditTokenParamMode = "strict"
const BetaFallbackCreditTokenParamModeBestEffort BetaFallbackCreditTokenParamMode = "best_effort"
type BetaFallbackCreditUsage struct{…}

Outcome of the fallback_credit_token presented on this request.

Status BetaFallbackCreditUsageStatusUnion

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

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

One of the following:
type BetaFallbackCreditRedeemed struct{…}

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

Type Redeemed
defaultredeemed
type BetaFallbackCreditNotApplied struct{…}

No reprice was applied; reason says why.

type BetaFallbackInfo struct{…}

Identifies one hop of a fallback transition.

Model Model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
type BetaFallbackInfoParamResp struct{…}

Identifies one hop of a fallback transition.

Model Model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
type BetaFallbackMessageIterationUsage struct{…}

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

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

CacheCreation BetaCacheCreation

Breakdown of cached tokens by TTL

Ephemeral1hInputTokens int64

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

default0
minimum0
Ephemeral5mInputTokens int64

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

default0
minimum0
CacheCreationInputTokens int64

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

default0
minimum0
CacheReadInputTokens int64

The number of input tokens read from the cache.

default0
minimum0
InputTokens int64

The number of input tokens which were used.

minimum0
Model Model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
OutputTokens int64

The number of output tokens which were used.

minimum0
Type FallbackMessage

Usage for the fallback-model attempt that served the response

defaultfallback_message
type BetaFallbackParamResp struct{…}

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{…}

The from model declined for policy reasons.

Category BetaFallbackRefusalTriggerCategory

The policy category that triggered a refusal.

One of the following:
const BetaFallbackRefusalTriggerCategoryCyber BetaFallbackRefusalTriggerCategory = "cyber"

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

const BetaFallbackRefusalTriggerCategoryBio BetaFallbackRefusalTriggerCategory = "bio"

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

const BetaFallbackRefusalTriggerCategoryFrontierLLM BetaFallbackRefusalTriggerCategory = "frontier_llm"

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

const BetaFallbackRefusalTriggerCategoryReasoningExtraction BetaFallbackRefusalTriggerCategory = "reasoning_extraction"

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

const BetaFallbackRefusalTriggerCategoryGeneralHarms BetaFallbackRefusalTriggerCategory = "general_harms"

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

Type Refusal
defaultrefusal
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.

One of the following:
type BetaFileDocumentSource struct{…}
FileID string
Type File
type BetaFileImageSource struct{…}
FileID string
Type File
type BetaImageBlockParamResp struct{…}
type BetaImageTransformationsParamResp struct{…}

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 Optional

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

One of the following:
const BetaImageTransformationsParamOversizedImageDownsize BetaImageTransformationsParamOversizedImage = "downsize"
const BetaImageTransformationsParamOversizedImageError BetaImageTransformationsParamOversizedImage = "error"
type BetaInputJSONDelta struct{…}
PartialJSON string
Type InputJSONDelta
defaultinput_json_delta
type BetaInputTokensClearAtLeast struct{…}
Type InputTokens
Value int64
minimum0
type BetaInputTokensTrigger struct{…}
Type InputTokens
Value int64
minimum1
type BetaIterationsUsage []BetaIterationsUsageItemUnion

Per-iteration token usage breakdown.

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

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

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

One of the following:
type BetaJSONOutputFormat struct{…}
Schema map[string, any]

The JSON schema of the format

Type JSONSchema
type BetaMCPToolConfig struct{…}

Configuration for a specific tool in an MCP toolset.

DeferLoading bool Optional
Enabled bool Optional
type BetaMCPToolDefaultConfig struct{…}

Default configuration for tools in an MCP toolset.

DeferLoading bool Optional
Enabled bool Optional
type BetaMCPToolResultBlock struct{…}
type BetaMCPToolUseBlock struct{…}
ID string
pattern^[a-zA-Z0-9_-]+$
Input map[string, any]
Name string

The name of the MCP tool

ServerName string

The name of the MCP server

Type MCPToolUse
defaultmcp_tool_use
type BetaMCPToolUseBlockParamResp struct{…}
ID string
pattern^[a-zA-Z0-9_-]+$
Input map[string, any]
Name string
ServerName string

The name of the MCP server

Type MCPToolUse
CacheControl BetaCacheControlEphemeral Optional

Create a cache control breakpoint at this content block.

Type Ephemeral
TTL BetaCacheControlEphemeralTTL Optional

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

This may be one the following values:

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

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

One of the following:
const BetaCacheControlEphemeralTTLTTL5m BetaCacheControlEphemeralTTL = "5m"
const BetaCacheControlEphemeralTTLTTL1h BetaCacheControlEphemeralTTL = "1h"
type BetaMCPToolset struct{…}

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 BetaMemoryTool20250818CommandUnion interface{…}
One of the following:
type BetaMemoryTool20250818CreateCommand struct{…}
Command Create

Command type identifier

defaultcreate
FileText string

Content to write to the file

Path string

Path where the file should be created

type BetaMemoryTool20250818DeleteCommand struct{…}
Command Delete

Command type identifier

defaultdelete
Path string

Path to the file or directory to delete

type BetaMemoryTool20250818InsertCommand struct{…}
Command Insert

Command type identifier

defaultinsert
InsertLine int64

Line number where text should be inserted

minimum1
InsertText string

Text to insert at the specified line

Path string

Path to the file where text should be inserted

type BetaMemoryTool20250818RenameCommand struct{…}
Command Rename

Command type identifier

defaultrename
NewPath string

New path for the file or directory

OldPath string

Current path of the file or directory

type BetaMemoryTool20250818StrReplaceCommand struct{…}
Command StrReplace

Command type identifier

defaultstr_replace
NewStr string

Text to replace with

OldStr string

Text to search for and replace

Path string

Path to the file where text should be replaced

type BetaMemoryTool20250818ViewCommand struct{…}
Command View

Command type identifier

defaultview
Path string

Path to directory or file to view

ViewRange []int64 Optional

Optional line range for viewing specific lines

minItems2
maxItems2
type BetaMessage struct{…}
type BetaMessageDeltaUsage struct{…}
type BetaMessageIterationUsage struct{…}

Token usage for a sampling iteration.

CacheCreation BetaCacheCreation

Breakdown of cached tokens by TTL

Ephemeral1hInputTokens int64

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

default0
minimum0
Ephemeral5mInputTokens int64

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

default0
minimum0
CacheCreationInputTokens int64

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

default0
minimum0
CacheReadInputTokens int64

The number of input tokens read from the cache.

default0
minimum0
InputTokens int64

The number of input tokens which were used.

minimum0
Model Model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
OutputTokens int64

The number of output tokens which were used.

minimum0
Type Message

Usage for a sampling iteration

defaultmessage
type BetaMessageParamResp struct{…}
type BetaMessageTokensCount struct{…}

Information about context management applied to the message.

OriginalInputTokens int64

The original token count before context management was applied

InputTokens int64

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

type BetaMetadata struct{…}
UserID string Optional

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

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

maxLength512
type BetaOutputConfig struct{…}
Effort BetaOutputConfigEffort Optional

All possible effort levels.

One of the following:
const BetaOutputConfigEffortLow BetaOutputConfigEffort = "low"
const BetaOutputConfigEffortMedium BetaOutputConfigEffort = "medium"
const BetaOutputConfigEffortHigh BetaOutputConfigEffort = "high"
const BetaOutputConfigEffortXhigh BetaOutputConfigEffort = "xhigh"
const BetaOutputConfigEffortMax BetaOutputConfigEffort = "max"
Format BetaJSONOutputFormat Optional

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

Schema map[string, any]

The JSON schema of the format

Type JSONSchema
TaskBudget BetaTokenTaskBudget Optional

User-configurable total token budget across contexts.

Total int64

Total token budget across all contexts in the session.

minimum1024
Type Tokens

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

Remaining int64 Optional

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

minimum0
type BetaOutputTokensDetails struct{…}
ThinkingTokens int64

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

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

default0
minimum0
type BetaPlainTextSource struct{…}
Data string
MediaType TextPlain
Type Text
type BetaRawContentBlockDeltaUnion interface{…}
One of the following:
type BetaRawContentBlockDeltaEvent struct{…}
One of the following:
Index int64
Type ContentBlockDelta
defaultcontent_block_delta
type BetaRawContentBlockStartEvent struct{…}
type BetaRawContentBlockStopEvent struct{…}
Index int64
Type ContentBlockStop
defaultcontent_block_stop
type BetaRawMessageDeltaEvent struct{…}
type BetaRawMessageStartEvent struct{…}
Message BetaMessage
Type MessageStart
defaultmessage_start
type BetaRawMessageStopEvent struct{…}
Type MessageStop
defaultmessage_stop
type BetaRawMessageStreamEventUnion interface{…}
One of the following:
type BetaRawMessageStartEvent struct{…}
Message BetaMessage
Type MessageStart
defaultmessage_start
type BetaRawMessageDeltaEvent struct{…}
type BetaRawMessageStopEvent struct{…}
Type MessageStop
defaultmessage_stop
type BetaRawContentBlockStartEvent struct{…}
type BetaRawContentBlockDeltaEvent struct{…}
One of the following:
Index int64
Type ContentBlockDelta
defaultcontent_block_delta
type BetaRawContentBlockStopEvent struct{…}
Index int64
Type ContentBlockStop
defaultcontent_block_stop
type BetaRedactedThinkingBlock struct{…}
Data string

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

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

See extended thinking for details.

Type RedactedThinking
defaultredacted_thinking
type BetaRedactedThinkingBlockParamResp struct{…}
Data string

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

Type RedactedThinking
type BetaRefusalStopDetails struct{…}

Structured information about a refusal.

type BetaRequestDocumentBlock struct{…}
type BetaRequestMCPServerToolConfiguration struct{…}
AllowedTools []string Optional
Enabled bool Optional
type BetaRequestMCPServerURLDefinition struct{…}
Name string
Type URL
URL string
AuthorizationToken string Optional
ToolConfiguration BetaRequestMCPServerToolConfiguration Optional
AllowedTools []string Optional
Enabled bool Optional
type BetaRequestMCPToolResultBlockParamResp struct{…}
type BetaRequestToolAdditionBlock struct{…}

Mid-conversation directive to surface a declared tool.

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

type BetaRequestToolRemovalBlock struct{…}

Mid-conversation directive to withdraw a tool.

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

type BetaSearchResultBlockParamResp struct{…}
type BetaServerToolCaller struct{…}

Tool invocation generated by a server-side tool.

ToolID string
pattern^srvtoolu_[a-zA-Z0-9_]+$
Type CodeExecution20250825
type BetaServerToolCaller20260120 struct{…}
ToolID string
pattern^srvtoolu_[a-zA-Z0-9_]+$
Type CodeExecution20260120
type BetaServerToolUsage struct{…}
WebFetchRequests int64

The number of web fetch tool requests.

default0
minimum0
WebSearchRequests int64

The number of web search tool requests.

default0
minimum0
type BetaServerToolUseBlock struct{…}
type BetaServerToolUseBlockParamResp struct{…}
type BetaSignatureDelta struct{…}
Signature string

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

Type SignatureDelta
defaultsignature_delta
type BetaSkillParamsResp struct{…}

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

SkillID string

Skill ID

maxLength64
minLength1
Type BetaSkillParamsType

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

One of the following:
const BetaSkillParamsTypeAnthropic BetaSkillParamsType = "anthropic"
const BetaSkillParamsTypeCustom BetaSkillParamsType = "custom"
Version string Optional

Skill version or 'latest' for most recent version

maxLength64
minLength1
type BetaStopReason string
One of the following:
const BetaStopReasonEndTurn BetaStopReason = "end_turn"
const BetaStopReasonMaxTokens BetaStopReason = "max_tokens"
const BetaStopReasonStopSequence BetaStopReason = "stop_sequence"
const BetaStopReasonToolUse BetaStopReason = "tool_use"
const BetaStopReasonPauseTurn BetaStopReason = "pause_turn"
const BetaStopReasonCompaction BetaStopReason = "compaction"
const BetaStopReasonRefusal BetaStopReason = "refusal"
const BetaStopReasonModelContextWindowExceeded BetaStopReason = "model_context_window_exceeded"
type BetaTextBlock struct{…}
type BetaTextBlockParamResp struct{…}
type BetaTextCitationUnion interface{…}
One of the following:
type BetaTextCitationParamUnionResp interface{…}
One of the following:
type BetaTextDelta struct{…}
Text string
Type TextDelta
defaulttext_delta
type BetaTextEditorCodeExecutionCreateResultBlock struct{…}
IsFileUpdate bool
Type TextEditorCodeExecutionCreateResult
defaulttext_editor_code_execution_create_result
type BetaTextEditorCodeExecutionCreateResultBlockParamResp struct{…}
IsFileUpdate bool
Type TextEditorCodeExecutionCreateResult
type BetaTextEditorCodeExecutionStrReplaceResultBlock struct{…}
Lines []string
NewLines int64
NewStart int64
OldLines int64
OldStart int64
Type TextEditorCodeExecutionStrReplaceResult
defaulttext_editor_code_execution_str_replace_result
type BetaTextEditorCodeExecutionStrReplaceResultBlockParamResp struct{…}
Type TextEditorCodeExecutionStrReplaceResult
Lines []string Optional
NewLines int64 Optional
NewStart int64 Optional
OldLines int64 Optional
OldStart int64 Optional
type BetaTextEditorCodeExecutionToolResultBlock struct{…}
type BetaTextEditorCodeExecutionToolResultBlockParamResp struct{…}
type BetaTextEditorCodeExecutionToolResultError struct{…}
ErrorCode BetaTextEditorCodeExecutionToolResultErrorErrorCode
One of the following:
const BetaTextEditorCodeExecutionToolResultErrorErrorCodeInvalidToolInput BetaTextEditorCodeExecutionToolResultErrorErrorCode = "invalid_tool_input"
const BetaTextEditorCodeExecutionToolResultErrorErrorCodeUnavailable BetaTextEditorCodeExecutionToolResultErrorErrorCode = "unavailable"
const BetaTextEditorCodeExecutionToolResultErrorErrorCodeTooManyRequests BetaTextEditorCodeExecutionToolResultErrorErrorCode = "too_many_requests"
const BetaTextEditorCodeExecutionToolResultErrorErrorCodeExecutionTimeExceeded BetaTextEditorCodeExecutionToolResultErrorErrorCode = "execution_time_exceeded"
const BetaTextEditorCodeExecutionToolResultErrorErrorCodeFileNotFound BetaTextEditorCodeExecutionToolResultErrorErrorCode = "file_not_found"
ErrorMessage string
Type TextEditorCodeExecutionToolResultError
defaulttext_editor_code_execution_tool_result_error
type BetaTextEditorCodeExecutionToolResultErrorParamResp struct{…}
ErrorCode BetaTextEditorCodeExecutionToolResultErrorParamErrorCode
One of the following:
const BetaTextEditorCodeExecutionToolResultErrorParamErrorCodeInvalidToolInput BetaTextEditorCodeExecutionToolResultErrorParamErrorCode = "invalid_tool_input"
const BetaTextEditorCodeExecutionToolResultErrorParamErrorCodeUnavailable BetaTextEditorCodeExecutionToolResultErrorParamErrorCode = "unavailable"
const BetaTextEditorCodeExecutionToolResultErrorParamErrorCodeTooManyRequests BetaTextEditorCodeExecutionToolResultErrorParamErrorCode = "too_many_requests"
const BetaTextEditorCodeExecutionToolResultErrorParamErrorCodeExecutionTimeExceeded BetaTextEditorCodeExecutionToolResultErrorParamErrorCode = "execution_time_exceeded"
const BetaTextEditorCodeExecutionToolResultErrorParamErrorCodeFileNotFound BetaTextEditorCodeExecutionToolResultErrorParamErrorCode = "file_not_found"
Type TextEditorCodeExecutionToolResultError
ErrorMessage string Optional
type BetaTextEditorCodeExecutionViewResultBlock struct{…}
Content string
FileType BetaTextEditorCodeExecutionViewResultBlockFileType
One of the following:
const BetaTextEditorCodeExecutionViewResultBlockFileTypeText BetaTextEditorCodeExecutionViewResultBlockFileType = "text"
const BetaTextEditorCodeExecutionViewResultBlockFileTypeImage BetaTextEditorCodeExecutionViewResultBlockFileType = "image"
const BetaTextEditorCodeExecutionViewResultBlockFileTypePDF BetaTextEditorCodeExecutionViewResultBlockFileType = "pdf"
NumLines int64
StartLine int64
TotalLines int64
Type TextEditorCodeExecutionViewResult
defaulttext_editor_code_execution_view_result
type BetaTextEditorCodeExecutionViewResultBlockParamResp struct{…}
Content string
FileType BetaTextEditorCodeExecutionViewResultBlockParamFileType
One of the following:
const BetaTextEditorCodeExecutionViewResultBlockParamFileTypeText BetaTextEditorCodeExecutionViewResultBlockParamFileType = "text"
const BetaTextEditorCodeExecutionViewResultBlockParamFileTypeImage BetaTextEditorCodeExecutionViewResultBlockParamFileType = "image"
const BetaTextEditorCodeExecutionViewResultBlockParamFileTypePDF BetaTextEditorCodeExecutionViewResultBlockParamFileType = "pdf"
Type TextEditorCodeExecutionViewResult
NumLines int64 Optional
StartLine int64 Optional
TotalLines int64 Optional
type BetaThinkingBlock struct{…}
Signature string

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

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

See extended thinking for details.

Thinking string

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

Type Thinking
defaultthinking
type BetaThinkingBlockParamResp struct{…}
Signature string

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

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

Thinking string

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

Type Thinking
type BetaThinkingConfigAdaptive struct{…}
Type Adaptive
Display BetaThinkingConfigAdaptiveDisplay Optional

Controls how thinking content appears in the response. When set to summarized, thinking is returned normally. When set to omitted, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to summarized.

One of the following:
const BetaThinkingConfigAdaptiveDisplaySummarized BetaThinkingConfigAdaptiveDisplay = "summarized"
const BetaThinkingConfigAdaptiveDisplayOmitted BetaThinkingConfigAdaptiveDisplay = "omitted"
const BetaThinkingConfigAdaptiveDisplayUpdates BetaThinkingConfigAdaptiveDisplay = "updates"
type BetaThinkingConfigDisabled struct{…}
Type Disabled
type BetaThinkingConfigEnabled struct{…}
BudgetTokens int64

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

Must be ≥1024 and less than max_tokens.

See extended thinking for details.

minimum1024
Type Enabled
Display BetaThinkingConfigEnabledDisplay Optional

Controls how thinking content appears in the response. When set to summarized, thinking is returned normally. When set to omitted, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to summarized.

One of the following:
const BetaThinkingConfigEnabledDisplaySummarized BetaThinkingConfigEnabledDisplay = "summarized"
const BetaThinkingConfigEnabledDisplayOmitted BetaThinkingConfigEnabledDisplay = "omitted"
const BetaThinkingConfigEnabledDisplayUpdates BetaThinkingConfigEnabledDisplay = "updates"
type BetaThinkingConfigParamUnionResp interface{…}

Configuration for enabling Claude's extended thinking.

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

See extended thinking for details.

One of the following:
type BetaThinkingDelta struct{…}
EstimatedTokens int64

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

Thinking string

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

Type ThinkingDelta
defaultthinking_delta
type BetaThinkingTurns struct{…}
Type ThinkingTurns
Value int64
minimum1
type BetaTokenTaskBudget struct{…}

User-configurable total token budget across contexts.

Total int64

Total token budget across all contexts in the session.

minimum1024
Type Tokens

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

Remaining int64 Optional

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

minimum0
type BetaTool struct{…}
type BetaToolBash20241022 struct{…}
type BetaToolBash20250124 struct{…}
type BetaToolChangeMCPToolReference struct{…}

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

Name string
ServerName string
Type MCPToolReference
type BetaToolChangeMCPToolsetReference struct{…}

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

ServerName string
Type MCPToolsetReference
type BetaToolChangeToolReference struct{…}

Reference to a single tool the caller declared directly in tools[]. Does not accept the composed {server}_{name} form the server assigns to MCP-resolved tools — use mcp_tool_reference or mcp_toolset_reference for those.

Name string
pattern^[a-zA-Z0-9_-]{1,128}$
Type ToolReference
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.

One of the following:
type BetaToolChoiceAuto struct{…}

The model will automatically decide whether to use tools.

Type Auto
DisableParallelToolUse bool Optional

Whether to disable parallel tool use.

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

type BetaToolChoiceAny struct{…}

The model will use any available tools.

Type Any
DisableParallelToolUse bool Optional

Whether to disable parallel tool use.

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

type BetaToolChoiceTool struct{…}

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

Name string

The name of the tool to use.

Type Tool
DisableParallelToolUse bool Optional

Whether to disable parallel tool use.

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

type BetaToolChoiceNone struct{…}

The model will not be allowed to use tools.

Type None
type BetaToolChoiceAny struct{…}

The model will use any available tools.

Type Any
DisableParallelToolUse bool Optional

Whether to disable parallel tool use.

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

type BetaToolChoiceAuto struct{…}

The model will automatically decide whether to use tools.

Type Auto
DisableParallelToolUse bool Optional

Whether to disable parallel tool use.

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

type BetaToolChoiceNone struct{…}

The model will not be allowed to use tools.

Type None
type BetaToolChoiceTool struct{…}

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

Name string

The name of the tool to use.

Type Tool
DisableParallelToolUse bool Optional

Whether to disable parallel tool use.

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

type BetaToolComputerUse20241022 struct{…}
type BetaToolComputerUse20250124 struct{…}
type BetaToolComputerUse20251124 struct{…}
type BetaToolReferenceBlock struct{…}
ToolName string
maxLength256
minLength1
pattern^[a-zA-Z0-9_-]{1,256}$
Type ToolReference
defaulttool_reference
type BetaToolReferenceBlockParamResp struct{…}

Tool reference block that can be included in tool_result content.

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

Create a cache control breakpoint at this content block.

Type Ephemeral
TTL BetaCacheControlEphemeralTTL Optional

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

This may be one the following values:

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

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

One of the following:
const BetaCacheControlEphemeralTTLTTL5m BetaCacheControlEphemeralTTL = "5m"
const BetaCacheControlEphemeralTTLTTL1h BetaCacheControlEphemeralTTL = "1h"
type BetaToolResultBlockParamResp struct{…}
type BetaToolSearchToolBm25_20251119 struct{…}
type BetaToolSearchToolRegex20251119 struct{…}
type BetaToolSearchToolResultBlock struct{…}
type BetaToolSearchToolResultBlockParamResp struct{…}
type BetaToolSearchToolResultError struct{…}
ErrorCode BetaToolSearchToolResultErrorErrorCode
One of the following:
const BetaToolSearchToolResultErrorErrorCodeInvalidToolInput BetaToolSearchToolResultErrorErrorCode = "invalid_tool_input"
const BetaToolSearchToolResultErrorErrorCodeUnavailable BetaToolSearchToolResultErrorErrorCode = "unavailable"
const BetaToolSearchToolResultErrorErrorCodeTooManyRequests BetaToolSearchToolResultErrorErrorCode = "too_many_requests"
const BetaToolSearchToolResultErrorErrorCodeExecutionTimeExceeded BetaToolSearchToolResultErrorErrorCode = "execution_time_exceeded"
ErrorMessage string
Type ToolSearchToolResultError
defaulttool_search_tool_result_error
type BetaToolSearchToolResultErrorParamResp struct{…}
ErrorCode BetaToolSearchToolResultErrorParamErrorCode
One of the following:
const BetaToolSearchToolResultErrorParamErrorCodeInvalidToolInput BetaToolSearchToolResultErrorParamErrorCode = "invalid_tool_input"
const BetaToolSearchToolResultErrorParamErrorCodeUnavailable BetaToolSearchToolResultErrorParamErrorCode = "unavailable"
const BetaToolSearchToolResultErrorParamErrorCodeTooManyRequests BetaToolSearchToolResultErrorParamErrorCode = "too_many_requests"
const BetaToolSearchToolResultErrorParamErrorCodeExecutionTimeExceeded BetaToolSearchToolResultErrorParamErrorCode = "execution_time_exceeded"
Type ToolSearchToolResultError
ErrorMessage string Optional
type BetaToolSearchToolSearchResultBlock struct{…}
ToolReferences []BetaToolReferenceBlock
ToolName string
maxLength256
minLength1
pattern^[a-zA-Z0-9_-]{1,256}$
Type ToolReference
defaulttool_reference
Type ToolSearchToolSearchResult
defaulttool_search_tool_search_result
type BetaToolSearchToolSearchResultBlockParamResp struct{…}
ToolName string
maxLength256
minLength1
pattern^[a-zA-Z0-9_-]{1,256}$
Type ToolReference
CacheControl BetaCacheControlEphemeral Optional

Create a cache control breakpoint at this content block.

Type Ephemeral
TTL BetaCacheControlEphemeralTTL Optional

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

This may be one the following values:

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

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

One of the following:
const BetaCacheControlEphemeralTTLTTL5m BetaCacheControlEphemeralTTL = "5m"
const BetaCacheControlEphemeralTTLTTL1h BetaCacheControlEphemeralTTL = "1h"
Type ToolSearchToolSearchResult
type BetaToolTextEditor20241022 struct{…}
type BetaToolTextEditor20250124 struct{…}
type BetaToolTextEditor20250429 struct{…}
type BetaToolTextEditor20250728 struct{…}
type BetaToolUnion interface{…}

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

One of the following:
type BetaToolUseBlock struct{…}
ID string
pattern^[a-zA-Z0-9_-]+$
Input map[string, any]
Name string
minLength1
Type ToolUse
defaulttool_use
Caller BetaToolUseBlockCallerUnion Optional

Tool invocation directly from the model.

One of the following:
type BetaDirectCaller struct{…}

Tool invocation directly from the model.

Type Direct
type BetaServerToolCaller struct{…}

Tool invocation generated by a server-side tool.

ToolID string
pattern^srvtoolu_[a-zA-Z0-9_]+$
Type CodeExecution20250825
type BetaServerToolCaller20260120 struct{…}
ToolID string
pattern^srvtoolu_[a-zA-Z0-9_]+$
Type CodeExecution20260120
ToolsetName string Optional

For a toolset member tool_use, the toolset family.

maxLength64
minLength1
pattern^[a-zA-Z0-9_-]+$
type BetaToolUseBlockParamResp struct{…}
type BetaToolUsesKeep struct{…}
Type ToolUses
Value int64
minimum0
type BetaToolUsesTrigger struct{…}
Type ToolUses
Value int64
minimum1
type BetaURLImageSource struct{…}
Type URL
URL string
type BetaURLPDFSource struct{…}
Type URL
URL string
type BetaUsage struct{…}
type BetaUserLocation struct{…}
Type Approximate
City string Optional

The city of the user.

maxLength255
minLength1
Country string Optional

The two letter ISO country code of the user.

maxLength2
minLength2
Region string Optional

The region of the user.

maxLength255
minLength1
Timezone string Optional

The IANA timezone of the user.

maxLength255
minLength1
type BetaWebFetchBlock struct{…}

Citation configuration for the document

Enabled bool
defaultfalse
Source BetaDocumentBlockSourceUnion
One of the following:
type BetaBase64PDFSource struct{…}
Data string
formatbyte
MediaType ApplicationPDF
Type Base64
type BetaPlainTextSource struct{…}
Data string
MediaType TextPlain
Type Text
Title string

The title of the document

Type Document
defaultdocument
RetrievedAt string

ISO 8601 timestamp when the content was retrieved

Type WebFetchResult
defaultweb_fetch_result
URL string

Fetched content URL

type BetaWebFetchBlockParamResp struct{…}
Type WebFetchResult
URL string

Fetched content URL

RetrievedAt string Optional

ISO 8601 timestamp when the content was retrieved

type BetaWebFetchTool20250910 struct{…}
type BetaWebFetchTool20260209 struct{…}
type BetaWebFetchTool20260309 struct{…}

Web fetch tool with use_cache parameter for bypassing cached content.

type BetaWebFetchTool20260318 struct{…}
type BetaWebFetchToolResultBlock struct{…}
type BetaWebFetchToolResultBlockParamResp struct{…}
type BetaWebFetchToolResultErrorBlock struct{…}
One of the following:
const BetaWebFetchToolResultErrorCodeInvalidToolInput BetaWebFetchToolResultErrorCode = "invalid_tool_input"
const BetaWebFetchToolResultErrorCodeURLTooLong BetaWebFetchToolResultErrorCode = "url_too_long"
const BetaWebFetchToolResultErrorCodeURLNotAllowed BetaWebFetchToolResultErrorCode = "url_not_allowed"
const BetaWebFetchToolResultErrorCodeURLNotInPriorContext BetaWebFetchToolResultErrorCode = "url_not_in_prior_context"
const BetaWebFetchToolResultErrorCodeURLNotAccessible BetaWebFetchToolResultErrorCode = "url_not_accessible"
const BetaWebFetchToolResultErrorCodeUnsupportedContentType BetaWebFetchToolResultErrorCode = "unsupported_content_type"
const BetaWebFetchToolResultErrorCodeTooManyRequests BetaWebFetchToolResultErrorCode = "too_many_requests"
const BetaWebFetchToolResultErrorCodeMaxUsesExceeded BetaWebFetchToolResultErrorCode = "max_uses_exceeded"
const BetaWebFetchToolResultErrorCodeUnavailable BetaWebFetchToolResultErrorCode = "unavailable"
Type WebFetchToolResultError
defaultweb_fetch_tool_result_error
type BetaWebFetchToolResultErrorBlockParamResp struct{…}
One of the following:
const BetaWebFetchToolResultErrorCodeInvalidToolInput BetaWebFetchToolResultErrorCode = "invalid_tool_input"
const BetaWebFetchToolResultErrorCodeURLTooLong BetaWebFetchToolResultErrorCode = "url_too_long"
const BetaWebFetchToolResultErrorCodeURLNotAllowed BetaWebFetchToolResultErrorCode = "url_not_allowed"
const BetaWebFetchToolResultErrorCodeURLNotInPriorContext BetaWebFetchToolResultErrorCode = "url_not_in_prior_context"
const BetaWebFetchToolResultErrorCodeURLNotAccessible BetaWebFetchToolResultErrorCode = "url_not_accessible"
const BetaWebFetchToolResultErrorCodeUnsupportedContentType BetaWebFetchToolResultErrorCode = "unsupported_content_type"
const BetaWebFetchToolResultErrorCodeTooManyRequests BetaWebFetchToolResultErrorCode = "too_many_requests"
const BetaWebFetchToolResultErrorCodeMaxUsesExceeded BetaWebFetchToolResultErrorCode = "max_uses_exceeded"
const BetaWebFetchToolResultErrorCodeUnavailable BetaWebFetchToolResultErrorCode = "unavailable"
Type WebFetchToolResultError
type BetaWebFetchToolResultErrorCode string
One of the following:
const BetaWebFetchToolResultErrorCodeInvalidToolInput BetaWebFetchToolResultErrorCode = "invalid_tool_input"
const BetaWebFetchToolResultErrorCodeURLTooLong BetaWebFetchToolResultErrorCode = "url_too_long"
const BetaWebFetchToolResultErrorCodeURLNotAllowed BetaWebFetchToolResultErrorCode = "url_not_allowed"
const BetaWebFetchToolResultErrorCodeURLNotInPriorContext BetaWebFetchToolResultErrorCode = "url_not_in_prior_context"
const BetaWebFetchToolResultErrorCodeURLNotAccessible BetaWebFetchToolResultErrorCode = "url_not_accessible"
const BetaWebFetchToolResultErrorCodeUnsupportedContentType BetaWebFetchToolResultErrorCode = "unsupported_content_type"
const BetaWebFetchToolResultErrorCodeTooManyRequests BetaWebFetchToolResultErrorCode = "too_many_requests"
const BetaWebFetchToolResultErrorCodeMaxUsesExceeded BetaWebFetchToolResultErrorCode = "max_uses_exceeded"
const BetaWebFetchToolResultErrorCodeUnavailable BetaWebFetchToolResultErrorCode = "unavailable"
type BetaWebSearchResultBlock struct{…}
EncryptedContent string
PageAge string
Title string
Type WebSearchResult
defaultweb_search_result
URL string
type BetaWebSearchResultBlockParamResp struct{…}
EncryptedContent string
Title string
Type WebSearchResult
URL string
PageAge string Optional
type BetaWebSearchTool20250305 struct{…}
type BetaWebSearchTool20260209 struct{…}
type BetaWebSearchTool20260318 struct{…}
type BetaWebSearchToolRequestError struct{…}
One of the following:
const BetaWebSearchToolResultErrorCodeInvalidToolInput BetaWebSearchToolResultErrorCode = "invalid_tool_input"
const BetaWebSearchToolResultErrorCodeUnavailable BetaWebSearchToolResultErrorCode = "unavailable"
const BetaWebSearchToolResultErrorCodeMaxUsesExceeded BetaWebSearchToolResultErrorCode = "max_uses_exceeded"
const BetaWebSearchToolResultErrorCodeTooManyRequests BetaWebSearchToolResultErrorCode = "too_many_requests"
const BetaWebSearchToolResultErrorCodeQueryTooLong BetaWebSearchToolResultErrorCode = "query_too_long"
const BetaWebSearchToolResultErrorCodeRequestTooLarge BetaWebSearchToolResultErrorCode = "request_too_large"
Type WebSearchToolResultError
type BetaWebSearchToolResultBlock struct{…}
One of the following:
ToolUseID string
pattern^srvtoolu_[a-zA-Z0-9_]+$
Type WebSearchToolResult
defaultweb_search_tool_result
Caller BetaWebSearchToolResultBlockCallerUnion Optional

Tool invocation directly from the model.

One of the following:
type BetaDirectCaller struct{…}

Tool invocation directly from the model.

Type Direct
type BetaServerToolCaller struct{…}

Tool invocation generated by a server-side tool.

ToolID string
pattern^srvtoolu_[a-zA-Z0-9_]+$
Type CodeExecution20250825
type BetaServerToolCaller20260120 struct{…}
ToolID string
pattern^srvtoolu_[a-zA-Z0-9_]+$
Type CodeExecution20260120
type BetaWebSearchToolResultBlockContentUnion interface{…}
One of the following:
type BetaWebSearchToolResultBlockParamResp struct{…}
type BetaWebSearchToolResultBlockParamContentUnionResp interface{…}
One of the following:
type BetaWebSearchToolResultError struct{…}
One of the following:
const BetaWebSearchToolResultErrorCodeInvalidToolInput BetaWebSearchToolResultErrorCode = "invalid_tool_input"
const BetaWebSearchToolResultErrorCodeUnavailable BetaWebSearchToolResultErrorCode = "unavailable"
const BetaWebSearchToolResultErrorCodeMaxUsesExceeded BetaWebSearchToolResultErrorCode = "max_uses_exceeded"
const BetaWebSearchToolResultErrorCodeTooManyRequests BetaWebSearchToolResultErrorCode = "too_many_requests"
const BetaWebSearchToolResultErrorCodeQueryTooLong BetaWebSearchToolResultErrorCode = "query_too_long"
const BetaWebSearchToolResultErrorCodeRequestTooLarge BetaWebSearchToolResultErrorCode = "request_too_large"
Type WebSearchToolResultError
defaultweb_search_tool_result_error
type BetaWebSearchToolResultErrorCode string
One of the following:
const BetaWebSearchToolResultErrorCodeInvalidToolInput BetaWebSearchToolResultErrorCode = "invalid_tool_input"
const BetaWebSearchToolResultErrorCodeUnavailable BetaWebSearchToolResultErrorCode = "unavailable"
const BetaWebSearchToolResultErrorCodeMaxUsesExceeded BetaWebSearchToolResultErrorCode = "max_uses_exceeded"
const BetaWebSearchToolResultErrorCodeTooManyRequests BetaWebSearchToolResultErrorCode = "too_many_requests"
const BetaWebSearchToolResultErrorCodeQueryTooLong BetaWebSearchToolResultErrorCode = "query_too_long"
const BetaWebSearchToolResultErrorCodeRequestTooLarge BetaWebSearchToolResultErrorCode = "request_too_large"

MessagesBatches

Create a Message Batch
client.Beta.Messages.Batches.New(ctx, params) (*BetaMessageBatch, error)
POST/v1/messages/batches
Retrieve a Message Batch
client.Beta.Messages.Batches.Get(ctx, messageBatchID, query) (*BetaMessageBatch, error)
GET/v1/messages/batches/{message_batch_id}
List Message Batches
client.Beta.Messages.Batches.List(ctx, params) (*Page[BetaMessageBatch], error)
GET/v1/messages/batches
Cancel a Message Batch
client.Beta.Messages.Batches.Cancel(ctx, messageBatchID, body) (*BetaMessageBatch, error)
POST/v1/messages/batches/{message_batch_id}/cancel
Delete a Message Batch
client.Beta.Messages.Batches.Delete(ctx, messageBatchID, body) (*BetaDeletedMessageBatch, error)
DELETE/v1/messages/batches/{message_batch_id}
Retrieve Message Batch results
client.Beta.Messages.Batches.Results(ctx, messageBatchID, query) (*BetaMessageBatchIndividualResponse, error)
GET/v1/messages/batches/{message_batch_id}/results