Claude Platform Docs

メッセージ

メッセージを作成
BetaMessage Beta.Messages.Create(parameters, cancellationToken = default)
POST/v1/messages

テキストや画像コンテンツを含む入力メッセージの構造化されたリストを送信すると、モデルが会話内の次のメッセージを生成します。

メッセージ内のトークンをカウント
BetaMessageTokensCount Beta.Messages.CountTokens(parameters, cancellationToken = default)
POST/v1/messages/count_tokens

メッセージ内のトークン数をカウントします。

Models
class BetaAdvisorMessageIterationUsage { Type = "advisor_message"; CacheCreation; CacheCreationInputTokens; /* 4 more */ }

Token usage for an advisor sub-inference iteration.

JsonElement Type = "advisor_message"

Usage for an advisor sub-inference iteration

required BetaCacheCreation? CacheCreation

Breakdown of cached tokens by TTL

required long Ephemeral1hInputTokens

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

minimum0
required long Ephemeral5mInputTokens

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

minimum0
required long CacheCreationInputTokens

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

minimum0
required long CacheReadInputTokens

The number of input tokens read from the cache.

minimum0
required long InputTokens

The number of input tokens which were used.

minimum0
required Model Model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
required long OutputTokens

The number of output tokens which were used.

minimum0
class BetaAdvisorRedactedResultBlock { Type = "advisor_redacted_result"; EncryptedContent; StopReason; }
JsonElement Type = "advisor_redacted_result"
required string EncryptedContent

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

required string? StopReason

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

class BetaAdvisorRedactedResultBlockParam { Type = "advisor_redacted_result"; EncryptedContent; StopReason; }
JsonElement Type = "advisor_redacted_result"
required string EncryptedContent

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

string? StopReason
class BetaAdvisorResultBlock { Type = "advisor_result"; StopReason; Text; }
JsonElement Type = "advisor_result"
required string? StopReason

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

required string Text
class BetaAdvisorResultBlockParam { Type = "advisor_result"; Text; StopReason; }
JsonElement Type = "advisor_result"
required string Text
string? StopReason
class BetaAdvisorTool20260301 { Type = "advisor_20260301"; Model; Name; /* 7 more */ }
class BetaAdvisorToolResultBlock { Type = "advisor_tool_result"; Content; ToolUseID; }
class BetaAdvisorToolResultBlockParam { Type = "advisor_tool_result"; Content; ToolUseID; CacheControl; }
class BetaAdvisorToolResultError { Type = "advisor_tool_result_error"; ErrorCode; }
JsonElement Type = "advisor_tool_result_error"
required ErrorCode ErrorCode
One of the following:
MaxUsesExceeded("max_uses_exceeded")
PromptTooLong("prompt_too_long")
TooManyRequests("too_many_requests")
Overloaded("overloaded")
Unavailable("unavailable")
ExecutionTimeExceeded("execution_time_exceeded")
ModelNotFound("model_not_found")
class BetaAdvisorToolResultErrorParam { Type = "advisor_tool_result_error"; ErrorCode; }
JsonElement Type = "advisor_tool_result_error"
required ErrorCode ErrorCode
One of the following:
MaxUsesExceeded("max_uses_exceeded")
PromptTooLong("prompt_too_long")
TooManyRequests("too_many_requests")
Overloaded("overloaded")
Unavailable("unavailable")
ExecutionTimeExceeded("execution_time_exceeded")
ModelNotFound("model_not_found")
class BetaAllThinkingTurns { Type = "all"; }
JsonElement Type = "all"
class BetaBase64ImageSource { Type = "base64"; Data; MediaType; }
JsonElement Type = "base64"
required string Data
formatbyte
required MediaType MediaType
One of the following:
ImageJpeg("image/jpeg")
ImagePng("image/png")
ImageGif("image/gif")
ImageWebP("image/webp")
class BetaBase64PdfSource { Type = "base64"; Data; MediaType; }
JsonElement Type = "base64"
required string Data
formatbyte
JsonElement MediaType = "application/pdf"
class BetaBashCodeExecutionOutputBlock { Type = "bash_code_execution_output"; FileID; }
JsonElement Type = "bash_code_execution_output"
required string FileID
class BetaBashCodeExecutionOutputBlockParam { Type = "bash_code_execution_output"; FileID; }
JsonElement Type = "bash_code_execution_output"
required string FileID
class BetaBashCodeExecutionResultBlock { Type = "bash_code_execution_result"; Content; ReturnCode; /* 2 more */ }
JsonElement Type = "bash_code_execution_result"
required IReadOnlyList<BetaBashCodeExecutionOutputBlock> Content
JsonElement Type = "bash_code_execution_output"
required string FileID
required long ReturnCode
required string Stderr
required string Stdout
class BetaBashCodeExecutionResultBlockParam { Type = "bash_code_execution_result"; Content; ReturnCode; /* 2 more */ }
JsonElement Type = "bash_code_execution_result"
required IReadOnlyList<BetaBashCodeExecutionOutputBlockParam> Content
JsonElement Type = "bash_code_execution_output"
required string FileID
required long ReturnCode
required string Stderr
required string Stdout
class BetaBashCodeExecutionToolResultBlock { Type = "bash_code_execution_tool_result"; Content; ToolUseID; }
class BetaBashCodeExecutionToolResultBlockParam { Type = "bash_code_execution_tool_result"; Content; ToolUseID; CacheControl; }
class BetaBashCodeExecutionToolResultError { Type = "bash_code_execution_tool_result_error"; ErrorCode; }
JsonElement Type = "bash_code_execution_tool_result_error"
required ErrorCode ErrorCode
One of the following:
InvalidToolInput("invalid_tool_input")
Unavailable("unavailable")
TooManyRequests("too_many_requests")
ExecutionTimeExceeded("execution_time_exceeded")
OutputFileTooLarge("output_file_too_large")
class BetaBashCodeExecutionToolResultErrorParam { Type = "bash_code_execution_tool_result_error"; ErrorCode; }
JsonElement Type = "bash_code_execution_tool_result_error"
required ErrorCode ErrorCode
One of the following:
InvalidToolInput("invalid_tool_input")
Unavailable("unavailable")
TooManyRequests("too_many_requests")
ExecutionTimeExceeded("execution_time_exceeded")
OutputFileTooLarge("output_file_too_large")
class BetaBrowserCloseTabConfig { DeferLoading; Enabled; }

close_tab's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserDoubleClickConfig { DeferLoading; Enabled; }

double_click's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserFileUploadConfig { DeferLoading; Enabled; }

file_upload's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserFindConfig { DeferLoading; Enabled; }

find's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserFormInputConfig { DeferLoading; Enabled; }

form_input's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserGetPageTextConfig { DeferLoading; Enabled; }

get_page_text's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserHoldKeyConfig { DeferLoading; Enabled; }

hold_key's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserHoverConfig { DeferLoading; Enabled; }

hover's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserJavascriptExecConfig { DeferLoading; Enabled; }

javascript_exec's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserKeyConfig { DeferLoading; Enabled; }

key's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserLeftClickConfig { DeferLoading; Enabled; }

left_click's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserLeftClickDragConfig { DeferLoading; Enabled; }

left_click_drag's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserLeftMouseDownConfig { DeferLoading; Enabled; }

left_mouse_down's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserLeftMouseUpConfig { DeferLoading; Enabled; }

left_mouse_up's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserListTabsConfig { DeferLoading; Enabled; }

list_tabs's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserMiddleClickConfig { DeferLoading; Enabled; }

middle_click's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserMouseMoveConfig { DeferLoading; Enabled; }

mouse_move's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserNavigateConfig { DeferLoading; Enabled; }

navigate's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserNewTabConfig { DeferLoading; Enabled; }

new_tab's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserReadConsoleConfig { DeferLoading; Enabled; }

read_console's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserReadNetworkConfig { DeferLoading; Enabled; }

read_network's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserReadPageConfig { DeferLoading; Enabled; }

read_page's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserRightClickConfig { DeferLoading; Enabled; }

right_click's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserScreenshotConfig { DeferLoading; Enabled; }

screenshot's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserScrollConfig { DeferLoading; Enabled; }

scroll's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserScrollToConfig { DeferLoading; Enabled; }

scroll_to's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserStateBlockParam { Type = "browser_state"; Tabs; CacheControl; StateChanges; }

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

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

class BetaBrowserStateChange: union
class BetaBrowserStateChangeDownloadCompleted { Type = "download_completed"; DownloadID; Url; /* 2 more */ }

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

JsonElement Type = "download_completed"
required string DownloadID

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

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

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

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

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

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

The completed download's size.

minimum0
class BetaBrowserStateChangeDownloadFailed { Type = "download_failed"; DownloadID; Url; Error; }

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

JsonElement Type = "download_failed"
required string DownloadID

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

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

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

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

The failure or cancellation detail, when known.

pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
maxLength4096
class BetaBrowserStateChangeDownloadStarted { Type = "download_started"; DownloadID; Url; }

A file download that started during this call.

JsonElement Type = "download_started"
required string DownloadID

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

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

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

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

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

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

JsonElement Type = "tab_opened"
required string TabID

The tab_id of the opened tab, present in tabs.

maxLength4096
minLength1
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
class BetaBrowserStateTabEntry { TabID; Title; Url; Active; }

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

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

required string TabID

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

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

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

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

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

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

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

class BetaBrowserSwitchTabConfig { DeferLoading; Enabled; }

switch_tab's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserToolset20260801 { Type = "browser_toolset_20260801"; CacheControl; Configs; }

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

JsonElement Type = "browser_toolset_20260801"
BetaCacheControlEphemeral? CacheControl

Create a cache control breakpoint at this content block.

JsonElement Type = "ephemeral"
Ttl Ttl

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

This may be one the following values:

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

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

One of the following:
Ttl5m("5m")
Ttl1h("1h")

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

class BetaBrowserToolsetConfigs { Type; CloseTab; DoubleClick; /* 28 more */ }

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

class BetaBrowserTripleClickConfig { DeferLoading; Enabled; }

triple_click's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserTypeConfig { DeferLoading; Enabled; }

type's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserWaitConfig { DeferLoading; Enabled; }

wait's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaBrowserZoomConfig { DeferLoading; Enabled; }

zoom's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaCacheControlEphemeral { Type = "ephemeral"; Ttl; }
JsonElement Type = "ephemeral"
Ttl Ttl

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

This may be one the following values:

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

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

One of the following:
Ttl5m("5m")
Ttl1h("1h")
class BetaCacheCreation { Ephemeral1hInputTokens; Ephemeral5mInputTokens; }
required long Ephemeral1hInputTokens

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

minimum0
required long Ephemeral5mInputTokens

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

minimum0
class BetaCacheMissMessagesChanged { Type = "messages_changed"; CacheMissedInputTokens; }
JsonElement Type = "messages_changed"
required long CacheMissedInputTokens

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

class BetaCacheMissModelChanged { Type = "model_changed"; CacheMissedInputTokens; }
JsonElement Type = "model_changed"
required long CacheMissedInputTokens

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

class BetaCacheMissPreviousMessageNotFound { Type = "previous_message_not_found"; }
JsonElement Type = "previous_message_not_found"
class BetaCacheMissSystemChanged { Type = "system_changed"; CacheMissedInputTokens; }
JsonElement Type = "system_changed"
required long CacheMissedInputTokens

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

class BetaCacheMissToolsChanged { Type = "tools_changed"; CacheMissedInputTokens; }
JsonElement Type = "tools_changed"
required long CacheMissedInputTokens

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

class BetaCacheMissUnavailable { Type = "unavailable"; }
JsonElement Type = "unavailable"
class BetaCitationCharLocation { Type = "char_location"; CitedText; DocumentIndex; /* 4 more */ }
JsonElement Type = "char_location"
required string CitedText
required long DocumentIndex
minimum0
required string? DocumentTitle
required long EndCharIndex
required string? FileID
required long StartCharIndex
minimum0
class BetaCitationCharLocationParam { Type = "char_location"; CitedText; DocumentIndex; /* 3 more */ }
JsonElement Type = "char_location"
required string CitedText
required long DocumentIndex
minimum0
required string? DocumentTitle
maxLength500
minLength1
required long EndCharIndex
required long StartCharIndex
minimum0
class BetaCitationConfig { Enabled; }
required bool Enabled
class BetaCitationContentBlockLocation { Type = "content_block_location"; CitedText; DocumentIndex; /* 4 more */ }
JsonElement Type = "content_block_location"
required string CitedText

The full text of the cited block range, concatenated.

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

required long DocumentIndex
minimum0
required string? DocumentTitle
required long EndBlockIndex

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

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

required string? FileID
required long StartBlockIndex

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

minimum0
class BetaCitationContentBlockLocationParam { Type = "content_block_location"; CitedText; DocumentIndex; /* 3 more */ }
JsonElement Type = "content_block_location"
required string CitedText

The full text of the cited block range, concatenated.

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

required long DocumentIndex
minimum0
required string? DocumentTitle
maxLength500
minLength1
required long EndBlockIndex

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

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

required long StartBlockIndex

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

minimum0
class BetaCitationPageLocation { Type = "page_location"; CitedText; DocumentIndex; /* 4 more */ }
JsonElement Type = "page_location"
required string CitedText
required long DocumentIndex
minimum0
required string? DocumentTitle
required long EndPageNumber
required string? FileID
required long StartPageNumber
minimum1
class BetaCitationPageLocationParam { Type = "page_location"; CitedText; DocumentIndex; /* 3 more */ }
JsonElement Type = "page_location"
required string CitedText
required long DocumentIndex
minimum0
required string? DocumentTitle
maxLength500
minLength1
required long EndPageNumber
required long StartPageNumber
minimum1
class BetaCitationSearchResultLocation { Type = "search_result_location"; CitedText; EndBlockIndex; /* 4 more */ }
JsonElement Type = "search_result_location"
required string CitedText

The full text of the cited block range, concatenated.

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

required long EndBlockIndex

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

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

required long SearchResultIndex

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

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

minimum0
required string Source
required long StartBlockIndex

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

minimum0
required string? Title
class BetaCitationSearchResultLocationParam { Type = "search_result_location"; CitedText; EndBlockIndex; /* 4 more */ }
JsonElement Type = "search_result_location"
required string CitedText

The full text of the cited block range, concatenated.

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

required long EndBlockIndex

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

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

required long SearchResultIndex

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

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

minimum0
required string Source
required long StartBlockIndex

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

minimum0
required string? Title
class BetaCitationWebSearchResultLocationParam { Type = "web_search_result_location"; CitedText; EncryptedIndex; /* 2 more */ }
JsonElement Type = "web_search_result_location"
required string CitedText
required string EncryptedIndex
required string? Title
maxLength512
minLength1
required string Url
minLength1
class BetaCitationsConfigParam { Enabled; }
bool Enabled
class BetaCitationsDelta { Type = "citations_delta"; Citation; }
class BetaCitationsWebSearchResultLocation { Type = "web_search_result_location"; CitedText; EncryptedIndex; /* 2 more */ }
JsonElement Type = "web_search_result_location"
required string CitedText
required string EncryptedIndex
required string? Title
maxLength512
required string Url
class BetaClearThinking20251015Edit { Type = "clear_thinking_20251015"; Keep; }
JsonElement Type = "clear_thinking_20251015"
Keep Keep

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

One of the following:
class BetaThinkingTurns { Type = "thinking_turns"; Value; }
JsonElement Type = "thinking_turns"
required long Value
minimum1
class BetaAllThinkingTurns { Type = "all"; }
JsonElement Type = "all"
class All:
class BetaClearThinking20251015EditResponse { Type = "clear_thinking_20251015"; ClearedInputTokens; ClearedThinkingTurns; }
JsonElement Type = "clear_thinking_20251015"

The type of context management edit applied.

required long ClearedInputTokens

Number of input tokens cleared by this edit.

minimum0
required long ClearedThinkingTurns

Number of thinking turns that were cleared.

minimum0
class BetaClearToolUses20250919Edit { Type = "clear_tool_uses_20250919"; ClearAtLeast; ClearToolInputs; /* 3 more */ }
class BetaClearToolUses20250919EditResponse { Type = "clear_tool_uses_20250919"; ClearedInputTokens; ClearedToolUses; }
JsonElement Type = "clear_tool_uses_20250919"

The type of context management edit applied.

required long ClearedInputTokens

Number of input tokens cleared by this edit.

minimum0
required long ClearedToolUses

Number of tool uses that were cleared.

minimum0
class BetaCodeExecutionOutputBlock { Type = "code_execution_output"; FileID; }
JsonElement Type = "code_execution_output"
required string FileID
class BetaCodeExecutionOutputBlockParam { Type = "code_execution_output"; FileID; }
JsonElement Type = "code_execution_output"
required string FileID
class BetaCodeExecutionResultBlock { Type = "code_execution_result"; Content; ReturnCode; /* 2 more */ }
JsonElement Type = "code_execution_result"
required IReadOnlyList<BetaCodeExecutionOutputBlock> Content
JsonElement Type = "code_execution_output"
required string FileID
required long ReturnCode
required string Stderr
required string Stdout
class BetaCodeExecutionResultBlockParam { Type = "code_execution_result"; Content; ReturnCode; /* 2 more */ }
JsonElement Type = "code_execution_result"
required IReadOnlyList<BetaCodeExecutionOutputBlockParam> Content
JsonElement Type = "code_execution_output"
required string FileID
required long ReturnCode
required string Stderr
required string Stdout
class BetaCodeExecutionTool20250522 { Type = "code_execution_20250522"; Name; AllowedCallers; /* 3 more */ }
class BetaCodeExecutionTool20250825 { Type = "code_execution_20250825"; Name; AllowedCallers; /* 3 more */ }
class BetaCodeExecutionTool20260120 { Type = "code_execution_20260120"; Name; AllowedCallers; /* 3 more */ }

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

class BetaCodeExecutionTool20260521 { Type = "code_execution_20260521"; Name; AllowedCallers; /* 3 more */ }

Code execution tool with REPL state persistence.

class BetaCodeExecutionToolResultBlock { Type = "code_execution_tool_result"; Content; ToolUseID; }
JsonElement Type = "code_execution_tool_result"
One of the following:
required string ToolUseID
pattern^srvtoolu_[a-zA-Z0-9_]+$
class BetaCodeExecutionToolResultBlockContent: union
class BetaCodeExecutionToolResultBlockParam { Type = "code_execution_tool_result"; Content; ToolUseID; CacheControl; }
JsonElement Type = "code_execution_tool_result"
One of the following:
required string ToolUseID
pattern^srvtoolu_[a-zA-Z0-9_]+$
BetaCacheControlEphemeral? CacheControl

Create a cache control breakpoint at this content block.

JsonElement Type = "ephemeral"
Ttl Ttl

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

This may be one the following values:

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

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

One of the following:
Ttl5m("5m")
Ttl1h("1h")
class BetaCodeExecutionToolResultBlockParamContent: union
class BetaCodeExecutionToolResultError { Type = "code_execution_tool_result_error"; ErrorCode; }
JsonElement Type = "code_execution_tool_result_error"
One of the following:
InvalidToolInput("invalid_tool_input")
Unavailable("unavailable")
TooManyRequests("too_many_requests")
ExecutionTimeExceeded("execution_time_exceeded")
enum BetaCodeExecutionToolResultErrorCode
InvalidToolInput("invalid_tool_input")
Unavailable("unavailable")
TooManyRequests("too_many_requests")
ExecutionTimeExceeded("execution_time_exceeded")
class BetaCodeExecutionToolResultErrorParam { Type = "code_execution_tool_result_error"; ErrorCode; }
JsonElement Type = "code_execution_tool_result_error"
One of the following:
InvalidToolInput("invalid_tool_input")
Unavailable("unavailable")
TooManyRequests("too_many_requests")
ExecutionTimeExceeded("execution_time_exceeded")
class BetaCompact20260112Edit { Type = "compact_20260112"; Instructions; PauseAfterCompaction; Trigger; }

Automatically compact older context when reaching the configured trigger threshold.

JsonElement Type = "compact_20260112"
string? Instructions

Additional instructions for summarization.

bool PauseAfterCompaction

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

When to trigger compaction. Defaults to 150000 input tokens.

JsonElement Type = "input_tokens"
required long Value
minimum1
class BetaCompactionBlock { Type = "compaction"; Content; EncryptedContent; Signature; }

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.

JsonElement Type = "compaction"
required string? Content

Summary of compacted content, or null if compaction failed

required string? EncryptedContent

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

string? Signature

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

class BetaCompactionBlockParam { Type = "compaction"; CacheControl; Content; /* 2 more */ }

A compaction block containing summary of previous context.

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

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

JsonElement Type = "compaction"
BetaCacheControlEphemeral? CacheControl

Create a cache control breakpoint at this content block.

JsonElement Type = "ephemeral"
Ttl Ttl

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

This may be one the following values:

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

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

One of the following:
Ttl5m("5m")
Ttl1h("1h")
string? Content

Summary of previously compacted content, or null if compaction failed

string? EncryptedContent

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

string? Signature

The block's signature as returned, to be sent back verbatim

class BetaCompactionConfig { Type = "summarize"; Instructions; }

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

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

JsonElement Type = "summarize"
string? Instructions

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

maxLength16384
class BetaCompactionContentBlockDelta { Type = "compaction_delta"; Content; EncryptedContent; }
JsonElement Type = "compaction_delta"
required string? Content
required string? EncryptedContent

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

class BetaCompactionIterationUsage { Type = "compaction"; CacheCreation; CacheCreationInputTokens; /* 3 more */ }

Token usage for a compaction iteration.

JsonElement Type = "compaction"

Usage for a compaction iteration

required BetaCacheCreation? CacheCreation

Breakdown of cached tokens by TTL

required long Ephemeral1hInputTokens

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

minimum0
required long Ephemeral5mInputTokens

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

minimum0
required long CacheCreationInputTokens

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

minimum0
required long CacheReadInputTokens

The number of input tokens read from the cache.

minimum0
required long InputTokens

The number of input tokens which were used.

minimum0
required long OutputTokens

The number of output tokens which were used.

minimum0
class BetaComputerCursorPositionConfig { DeferLoading; Enabled; }

cursor_position's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaComputerDoubleClickConfig { DeferLoading; Enabled; }

double_click's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaComputerHoldKeyConfig { DeferLoading; Enabled; }

hold_key's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaComputerKeyConfig { DeferLoading; Enabled; }

key's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaComputerLeftClickConfig { DeferLoading; Enabled; }

left_click's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaComputerLeftClickDragConfig { DeferLoading; Enabled; }

left_click_drag's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaComputerLeftMouseDownConfig { DeferLoading; Enabled; }

left_mouse_down's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaComputerLeftMouseUpConfig { DeferLoading; Enabled; }

left_mouse_up's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaComputerMiddleClickConfig { DeferLoading; Enabled; }

middle_click's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaComputerMouseMoveConfig { DeferLoading; Enabled; }

mouse_move's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaComputerRightClickConfig { DeferLoading; Enabled; }

right_click's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaComputerScreenshotConfig { DeferLoading; Enabled; }

screenshot's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaComputerScrollConfig { DeferLoading; Enabled; }

scroll's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaComputerToolset20260801 { Type = "computer_toolset_20260801"; CacheControl; Configs; }

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

JsonElement Type = "computer_toolset_20260801"
BetaCacheControlEphemeral? CacheControl

Create a cache control breakpoint at this content block.

JsonElement Type = "ephemeral"
Ttl Ttl

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

This may be one the following values:

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

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

One of the following:
Ttl5m("5m")
Ttl1h("1h")

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

class BetaComputerToolsetConfigs { Type; CursorPosition; DoubleClick; /* 14 more */ }

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

class BetaComputerTripleClickConfig { DeferLoading; Enabled; }

triple_click's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaComputerTypeConfig { DeferLoading; Enabled; }

type's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaComputerWaitConfig { DeferLoading; Enabled; }

wait's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaComputerZoomConfig { DeferLoading; Enabled; }

zoom's config overrides.

bool? DeferLoading

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

bool? Enabled

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

class BetaContainer { ID; ExpiresAt; Skills; }

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

required string ID

Identifier for the container used in this request

required DateTimeOffset ExpiresAt

The time at which the container will expire.

formatdate-time
required IReadOnlyList<BetaContainerSkill>? Skills

Skills loaded in the container

required Type Type

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

One of the following:
Anthropic("anthropic")
Custom("custom")
required string SkillID

Skill ID

maxLength64
minLength1
required string Version

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

maxLength64
minLength1
class BetaContainerParams { ID; Skills; }

Container parameters with skills to be loaded.

string? ID

Container id

IReadOnlyList<BetaSkillParams>? Skills

List of skills to load in the container

maxItems20
required Type Type

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

One of the following:
Anthropic("anthropic")
Custom("custom")
required string SkillID

Skill ID

maxLength64
minLength1
string Version

Skill version or 'latest' for most recent version

maxLength64
minLength1
class BetaContainerSkill { Type; SkillID; Version; }

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

required Type Type

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

One of the following:
Anthropic("anthropic")
Custom("custom")
required string SkillID

Skill ID

maxLength64
minLength1
required string Version

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

maxLength64
minLength1
class BetaContainerUploadBlock { Type = "container_upload"; FileID; }

Response model for a file uploaded to the container.

JsonElement Type = "container_upload"
required string FileID
class BetaContainerUploadBlockParam { Type = "container_upload"; FileID; CacheControl; }

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

JsonElement Type = "container_upload"
required string FileID
BetaCacheControlEphemeral? CacheControl

Create a cache control breakpoint at this content block.

JsonElement Type = "ephemeral"
Ttl Ttl

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

This may be one the following values:

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

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

One of the following:
Ttl5m("5m")
Ttl1h("1h")
class BetaContentBlock: union
class BetaContentBlockParam: union
class BetaContentBlockSource { Type = "content"; Content; }
JsonElement Type = "content"
required Content Content
One of the following:
string
One of the following:
class BetaTextBlockParam { Type = "text"; Text; CacheControl; Citations; }
class BetaImageBlockParam { Type = "image"; Source; CacheControl; Transformations; }
class BetaContentBlockSourceContent: union
class BetaTextBlockParam { Type = "text"; Text; CacheControl; Citations; }
class BetaImageBlockParam { Type = "image"; Source; CacheControl; Transformations; }
class BetaContextManagementConfig { Edits; }
class BetaContextManagementResponse { AppliedEdits; }
required IReadOnlyList<AppliedEdit> AppliedEdits

List of context management edits that were applied.

One of the following:
class BetaClearToolUses20250919EditResponse { Type = "clear_tool_uses_20250919"; ClearedInputTokens; ClearedToolUses; }
JsonElement Type = "clear_tool_uses_20250919"

The type of context management edit applied.

required long ClearedInputTokens

Number of input tokens cleared by this edit.

minimum0
required long ClearedToolUses

Number of tool uses that were cleared.

minimum0
class BetaClearThinking20251015EditResponse { Type = "clear_thinking_20251015"; ClearedInputTokens; ClearedThinkingTurns; }
JsonElement Type = "clear_thinking_20251015"

The type of context management edit applied.

required long ClearedInputTokens

Number of input tokens cleared by this edit.

minimum0
required long ClearedThinkingTurns

Number of thinking turns that were cleared.

minimum0
class BetaCountTokensContextManagementResponse { OriginalInputTokens; }
required long OriginalInputTokens

The original token count before context management was applied

class BetaDiagnostics { CacheMissReason; }

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

class BetaDiagnosticsParam { PreviousMessageID; }

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

string? PreviousMessageID

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

maxLength256
class BetaDirectCaller { Type = "direct"; }

Tool invocation directly from the model.

JsonElement Type = "direct"
class BetaDocumentBlock { Type = "document"; Citations; Source; Title; }
class BetaEncryptedCodeExecutionResultBlock { Type = "encrypted_code_execution_result"; Content; EncryptedStdout; /* 2 more */ }

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

JsonElement Type = "encrypted_code_execution_result"
required IReadOnlyList<BetaCodeExecutionOutputBlock> Content
JsonElement Type = "code_execution_output"
required string FileID
required string EncryptedStdout
required long ReturnCode
required string Stderr
class BetaEncryptedCodeExecutionResultBlockParam { Type = "encrypted_code_execution_result"; Content; EncryptedStdout; /* 2 more */ }

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

JsonElement Type = "encrypted_code_execution_result"
required IReadOnlyList<BetaCodeExecutionOutputBlockParam> Content
JsonElement Type = "code_execution_output"
required string FileID
required string EncryptedStdout
required long ReturnCode
required string Stderr
class BetaFallbackBlock { Type = "fallback"; From; To; Trigger; }

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

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

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

class BetaFallbackBlockParam { Type = "fallback"; From; To; Trigger; }

A fallback block echoed back from a prior response.

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

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

JsonElement Type = "fallback"
required BetaFallbackInfoParam From

Identifies one hop of a fallback transition.

required Model Model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
required BetaFallbackInfoParam To

Identifies one hop of a fallback transition.

required Model Model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
JsonElement Trigger

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

class BetaFallbackCreditNotApplied { Type = "not_applied"; Reason; RemoveToRedeem; }

No reprice was applied; reason says why.

class BetaFallbackCreditRedeemed { Type = "redeemed"; }

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

JsonElement Type = "redeemed"
class BetaFallbackCreditTokenParam { Token; Mode; }

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

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

required string Token

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

maxLength2048
minLength1
Mode Mode

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

One of the following:
Strict("strict")
BestEffort("best_effort")
class BetaFallbackCreditUsage { Status; }

Outcome of the fallback_credit_token presented on this request.

required Status Status

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

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

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

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

JsonElement Type = "redeemed"
class BetaFallbackCreditNotApplied { Type = "not_applied"; Reason; RemoveToRedeem; }

No reprice was applied; reason says why.

class BetaFallbackInfo { Model; }

Identifies one hop of a fallback transition.

required Model Model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
class BetaFallbackInfoParam { Model; }

Identifies one hop of a fallback transition.

required Model Model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
class BetaFallbackMessageIterationUsage { Type = "fallback_message"; CacheCreation; CacheCreationInputTokens; /* 4 more */ }

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

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

JsonElement Type = "fallback_message"

Usage for the fallback-model attempt that served the response

required BetaCacheCreation? CacheCreation

Breakdown of cached tokens by TTL

required long Ephemeral1hInputTokens

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

minimum0
required long Ephemeral5mInputTokens

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

minimum0
required long CacheCreationInputTokens

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

minimum0
required long CacheReadInputTokens

The number of input tokens read from the cache.

minimum0
required long InputTokens

The number of input tokens which were used.

minimum0
required Model Model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
required long OutputTokens

The number of output tokens which were used.

minimum0
class BetaFallbackParam { Model; MaxTokens; OutputConfig; /* 2 more */ }

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

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

class BetaFallbackRefusalTrigger { Type = "refusal"; Category; }

The from model declined for policy reasons.

JsonElement Type = "refusal"
required BetaFallbackRefusalTriggerCategory? Category

The policy category that triggered a refusal.

One of the following:
Cyber("cyber")

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

Bio("bio")

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

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

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

GeneralHarms("general_harms")

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

class BetaFallbacksParam: union

Opt-in server-side retry on one or more substitute models when the requested model declines for policy reasons. Tried in order: if the first entry also declines, the second is tried, and so on. The string "default" requests the requested model's server-defined default fallback configuration.

class BetaFileDocumentSource { Type = "file"; FileID; }
JsonElement Type = "file"
required string FileID
class BetaFileImageSource { Type = "file"; FileID; }
JsonElement Type = "file"
required string FileID
class BetaImageBlockParam { Type = "image"; Source; CacheControl; Transformations; }
class BetaImageTransformationsParam { OversizedImage; }

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

OversizedImage OversizedImage

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

One of the following:
Downsize("downsize")
Error("error")
class BetaInputJsonDelta { Type = "input_json_delta"; PartialJson; }
JsonElement Type = "input_json_delta"
required string PartialJson
class BetaInputTokensClearAtLeast { Type = "input_tokens"; Value; }
JsonElement Type = "input_tokens"
required long Value
minimum0
class BetaInputTokensTrigger { Type = "input_tokens"; Value; }
JsonElement Type = "input_tokens"
required long Value
minimum1
class BetaInputTransformation: union

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

class BetaJsonOutputFormat { Type = "json_schema"; Schema; }
JsonElement Type = "json_schema"
required IReadOnlyDictionary<string, JsonElement> Schema

The JSON schema of the format

class BetaMcpToolConfig { DeferLoading; Enabled; }

Configuration for a specific tool in an MCP toolset.

bool DeferLoading
bool Enabled
class BetaMcpToolDefaultConfig { DeferLoading; Enabled; }

Default configuration for tools in an MCP toolset.

bool DeferLoading
bool Enabled
class BetaMcpToolResultBlock { Type = "mcp_tool_result"; Content; IsError; ToolUseID; }
class BetaMcpToolUseBlock { Type = "mcp_tool_use"; ID; Input; /* 2 more */ }
JsonElement Type = "mcp_tool_use"
required string ID
pattern^[a-zA-Z0-9_-]+$
required IReadOnlyDictionary<string, JsonElement> Input
required string Name

The name of the MCP tool

required string ServerName

The name of the MCP server

class BetaMcpToolUseBlockParam { Type = "mcp_tool_use"; ID; Input; /* 3 more */ }
JsonElement Type = "mcp_tool_use"
required string ID
pattern^[a-zA-Z0-9_-]+$
required IReadOnlyDictionary<string, JsonElement> Input
required string Name
required string ServerName

The name of the MCP server

BetaCacheControlEphemeral? CacheControl

Create a cache control breakpoint at this content block.

JsonElement Type = "ephemeral"
Ttl Ttl

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

This may be one the following values:

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

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

One of the following:
Ttl5m("5m")
Ttl1h("1h")
class BetaMcpToolset { Type = "mcp_toolset"; McpServerName; CacheControl; /* 2 more */ }

Configuration for a group of tools from an MCP server.

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

class BetaMemoryTool20250818 { Type = "memory_20250818"; Name; AllowedCallers; /* 4 more */ }
class BetaMemoryTool20250818Command: union
class BetaMemoryTool20250818CreateCommand { Command; FileText; Path; }
JsonElement Command = "create"

Command type identifier

required string FileText

Content to write to the file

required string Path

Path where the file should be created

class BetaMemoryTool20250818DeleteCommand { Command; Path; }
JsonElement Command = "delete"

Command type identifier

required string Path

Path to the file or directory to delete

class BetaMemoryTool20250818InsertCommand { Command; InsertLine; InsertText; Path; }
JsonElement Command = "insert"

Command type identifier

required long InsertLine

Line number where text should be inserted

minimum1
required string InsertText

Text to insert at the specified line

required string Path

Path to the file where text should be inserted

class BetaMemoryTool20250818RenameCommand { Command; NewPath; OldPath; }
JsonElement Command = "rename"

Command type identifier

required string NewPath

New path for the file or directory

required string OldPath

Current path of the file or directory

class BetaMemoryTool20250818StrReplaceCommand { Command; NewStr; OldStr; Path; }
JsonElement Command = "str_replace"

Command type identifier

required string NewStr

Text to replace with

required string OldStr

Text to search for and replace

required string Path

Path to the file where text should be replaced

class BetaMemoryTool20250818ViewCommand { Command; Path; ViewRange; }
JsonElement Command = "view"

Command type identifier

required string Path

Path to directory or file to view

IReadOnlyList<long> ViewRange

Optional line range for viewing specific lines

minItems2
maxItems2
class BetaMessage { Type = "message"; ID; Container; /* 10 more */ }
class BetaMessageDeltaUsage { CacheCreationInputTokens; CacheReadInputTokens; FallbackCredit; /* 5 more */ }
class BetaMessageIterationUsage { Type = "message"; CacheCreation; CacheCreationInputTokens; /* 4 more */ }

Token usage for a sampling iteration.

JsonElement Type = "message"

Usage for a sampling iteration

required BetaCacheCreation? CacheCreation

Breakdown of cached tokens by TTL

required long Ephemeral1hInputTokens

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

minimum0
required long Ephemeral5mInputTokens

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

minimum0
required long CacheCreationInputTokens

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

minimum0
required long CacheReadInputTokens

The number of input tokens read from the cache.

minimum0
required long InputTokens

The number of input tokens which were used.

minimum0
required Model? Model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
required long OutputTokens

The number of output tokens which were used.

minimum0
class BetaMessageParam { Content; Role; ClearAt; OutputConfig; }
class BetaMessageTokensCount { ContextManagement; InputTokens; }
required BetaCountTokensContextManagementResponse? ContextManagement

Information about context management applied to the message.

required long OriginalInputTokens

The original token count before context management was applied

required long InputTokens

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

class BetaMetadata { UserID; }
string? UserID

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

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

maxLength512
class BetaOutputConfig { Effort; Format; TaskBudget; }
class BetaOutputTokensDetails { ThinkingTokens; }
required long ThinkingTokens

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

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

minimum0
class BetaPlainTextSource { Type = "text"; Data; MediaType; }
JsonElement Type = "text"
required string Data
JsonElement MediaType = "text/plain"
class BetaRawContentBlockDelta: union
class BetaRawContentBlockDeltaEvent { Type = "content_block_delta"; Delta; Index; }
JsonElement Type = "content_block_delta"
required BetaRawContentBlockDelta Delta
One of the following:
required long Index
class BetaRawContentBlockStartEvent { Type = "content_block_start"; ContentBlock; Index; }
class BetaRawContentBlockStopEvent { Type = "content_block_stop"; Index; }
JsonElement Type = "content_block_stop"
required long Index
class BetaRawMessageDeltaEvent { Type = "message_delta"; ContextManagement; Delta; /* 2 more */ }
class BetaRawMessageStartEvent { Type = "message_start"; Message; }
JsonElement Type = "message_start"
required BetaMessage Message
class BetaRawMessageStopEvent { Type = "message_stop"; }
JsonElement Type = "message_stop"
class BetaRawMessageStreamEvent: union
class BetaRedactedThinkingBlock { Type = "redacted_thinking"; Data; }
JsonElement Type = "redacted_thinking"
required string Data

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

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

See extended thinking for details.

class BetaRedactedThinkingBlockParam { Type = "redacted_thinking"; Data; }
JsonElement Type = "redacted_thinking"
required string Data

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

class BetaRefusalStopDetails { Type = "refusal"; Category; Explanation; /* 3 more */ }

Structured information about a refusal.

class BetaRequestDocumentBlock { Type = "document"; Source; CacheControl; /* 3 more */ }
class BetaRequestMcpServerToolConfiguration { AllowedTools; Enabled; }
IReadOnlyList<string>? AllowedTools
bool? Enabled
class BetaRequestMcpServerUrlDefinition { Type = "url"; Name; Url; /* 2 more */ }
JsonElement Type = "url"
required string Name
required string Url
string? AuthorizationToken
IReadOnlyList<string>? AllowedTools
bool? Enabled
class BetaRequestMcpToolResultBlockParam { Type = "mcp_tool_result"; ToolUseID; CacheControl; /* 2 more */ }
class BetaRequestToolAdditionBlock { Type = "tool_addition"; Tool; CacheControl; }

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.

class BetaRequestToolRemovalBlock { Type = "tool_removal"; Tool; CacheControl; }

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.

class BetaSearchResultBlockParam { Type = "search_result"; Content; Source; /* 3 more */ }
class BetaServerToolCaller { Type = "code_execution_20250825"; ToolID; }

Tool invocation generated by a server-side tool.

JsonElement Type = "code_execution_20250825"
required string ToolID
pattern^srvtoolu_[a-zA-Z0-9_]+$
class BetaServerToolCaller20260120 { Type = "code_execution_20260120"; ToolID; }
JsonElement Type = "code_execution_20260120"
required string ToolID
pattern^srvtoolu_[a-zA-Z0-9_]+$
class BetaServerToolUsage { WebFetchRequests; WebSearchRequests; }
required long WebFetchRequests

The number of web fetch tool requests.

minimum0
required long WebSearchRequests

The number of web search tool requests.

minimum0
class BetaServerToolUseBlock { Type = "server_tool_use"; ID; Input; /* 2 more */ }
class BetaServerToolUseBlockParam { Type = "server_tool_use"; ID; Input; /* 3 more */ }
class BetaSignatureDelta { Type = "signature_delta"; Signature; }
JsonElement Type = "signature_delta"
required string Signature

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

class BetaSkillParams { Type; SkillID; Version; }

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

required Type Type

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

One of the following:
Anthropic("anthropic")
Custom("custom")
required string SkillID

Skill ID

maxLength64
minLength1
string Version

Skill version or 'latest' for most recent version

maxLength64
minLength1
enum BetaStopReason
EndTurn("end_turn")
MaxTokens("max_tokens")
StopSequence("stop_sequence")
ToolUse("tool_use")
PauseTurn("pause_turn")
Compaction("compaction")
Refusal("refusal")
ModelContextWindowExceeded("model_context_window_exceeded")
class BetaSummarizeCompaction { Type = "summarize"; Instructions; }

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

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

JsonElement Type = "summarize"
string? Instructions

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

maxLength16384
class BetaSystemMessageOutputConfig { Effort; }

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

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

Effort? Effort

All possible effort levels.

One of the following:
Low("low")
Medium("medium")
High("high")
Xhigh("xhigh")
Max("max")
class BetaTextBlock { Type = "text"; Citations; Text; }
class BetaTextBlockParam { Type = "text"; Text; CacheControl; Citations; }
class BetaTextCitation: union
class BetaTextCitationParam: union
class BetaTextDelta { Type = "text_delta"; Text; }
JsonElement Type = "text_delta"
required string Text
class BetaTextEditorCodeExecutionCreateResultBlock { Type = "text_editor_code_execution_create_result"; IsFileUpdate; }
JsonElement Type = "text_editor_code_execution_create_result"
required bool IsFileUpdate
class BetaTextEditorCodeExecutionCreateResultBlockParam { Type = "text_editor_code_execution_create_result"; IsFileUpdate; }
JsonElement Type = "text_editor_code_execution_create_result"
required bool IsFileUpdate
class BetaTextEditorCodeExecutionStrReplaceResultBlock { Type = "text_editor_code_execution_str_replace_result"; Lines; NewLines; /* 3 more */ }
JsonElement Type = "text_editor_code_execution_str_replace_result"
required IReadOnlyList<string>? Lines
required long? NewLines
required long? NewStart
required long? OldLines
required long? OldStart
class BetaTextEditorCodeExecutionStrReplaceResultBlockParam { Type = "text_editor_code_execution_str_replace_result"; Lines; NewLines; /* 3 more */ }
JsonElement Type = "text_editor_code_execution_str_replace_result"
IReadOnlyList<string>? Lines
long? NewLines
long? NewStart
long? OldLines
long? OldStart
class BetaTextEditorCodeExecutionToolResultBlock { Type = "text_editor_code_execution_tool_result"; Content; ToolUseID; }
class BetaTextEditorCodeExecutionToolResultBlockParam { Type = "text_editor_code_execution_tool_result"; Content; ToolUseID; CacheControl; }
class BetaTextEditorCodeExecutionToolResultError { Type = "text_editor_code_execution_tool_result_error"; ErrorCode; ErrorMessage; }
JsonElement Type = "text_editor_code_execution_tool_result_error"
required ErrorCode ErrorCode
One of the following:
InvalidToolInput("invalid_tool_input")
Unavailable("unavailable")
TooManyRequests("too_many_requests")
ExecutionTimeExceeded("execution_time_exceeded")
FileNotFound("file_not_found")
required string? ErrorMessage
class BetaTextEditorCodeExecutionToolResultErrorParam { Type = "text_editor_code_execution_tool_result_error"; ErrorCode; ErrorMessage; }
JsonElement Type = "text_editor_code_execution_tool_result_error"
required ErrorCode ErrorCode
One of the following:
InvalidToolInput("invalid_tool_input")
Unavailable("unavailable")
TooManyRequests("too_many_requests")
ExecutionTimeExceeded("execution_time_exceeded")
FileNotFound("file_not_found")
string? ErrorMessage
class BetaTextEditorCodeExecutionViewResultBlock { Type = "text_editor_code_execution_view_result"; Content; FileType; /* 3 more */ }
JsonElement Type = "text_editor_code_execution_view_result"
required string Content
required FileType FileType
One of the following:
Text("text")
Image("image")
Pdf("pdf")
required long? NumLines
required long? StartLine
required long? TotalLines
class BetaTextEditorCodeExecutionViewResultBlockParam { Type = "text_editor_code_execution_view_result"; Content; FileType; /* 3 more */ }
JsonElement Type = "text_editor_code_execution_view_result"
required string Content
required FileType FileType
One of the following:
Text("text")
Image("image")
Pdf("pdf")
long? NumLines
long? StartLine
long? TotalLines
class BetaThinkingBlock { Type = "thinking"; Signature; Thinking; }
JsonElement Type = "thinking"
required string Signature

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

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

See extended thinking for details.

required string Thinking

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

class BetaThinkingBlockBinding { PrefixMismatchBehavior; }

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

BetaThinkingPrefixMismatchBehavior? PrefixMismatchBehavior

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

One of the following:
Error("error")
DropBlock("drop_block")
class BetaThinkingBlockParam { Type = "thinking"; Signature; Thinking; }
JsonElement Type = "thinking"
required string Signature

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

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

required string Thinking

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

class BetaThinkingConfigAdaptive { Type = "adaptive"; BlockBinding; Display; }
JsonElement Type = "adaptive"
BetaThinkingBlockBinding? BlockBinding

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

BetaThinkingPrefixMismatchBehavior? PrefixMismatchBehavior

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

One of the following:
Error("error")
DropBlock("drop_block")
Display? Display

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

One of the following:
Summarized("summarized")
Omitted("omitted")
Updates("updates")
class BetaThinkingConfigDisabled { Type = "disabled"; }
JsonElement Type = "disabled"
class BetaThinkingConfigEnabled { Type = "enabled"; BudgetTokens; BlockBinding; Display; }
JsonElement Type = "enabled"
required long BudgetTokens

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

Must be ≥1024 and less than max_tokens.

See extended thinking for details.

minimum1024
BetaThinkingBlockBinding? BlockBinding

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

BetaThinkingPrefixMismatchBehavior? PrefixMismatchBehavior

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

One of the following:
Error("error")
DropBlock("drop_block")
Display? Display

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

One of the following:
Summarized("summarized")
Omitted("omitted")
Updates("updates")
class BetaThinkingConfigParam: union

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.

class BetaThinkingDelta { Type = "thinking_delta"; EstimatedTokens; Thinking; }
JsonElement Type = "thinking_delta"
required long? EstimatedTokens

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

required string Thinking

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

class BetaThinkingDroppedInputTransformation { Type = "thinking_dropped"; Path; Reason; }
JsonElement Type = "thinking_dropped"

Always thinking_dropped for this entry type.

required string Path

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

required Reason Reason

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

One of the following:
ModelBindingMismatch("model_binding_mismatch")
PrefixBindingMismatch("prefix_binding_mismatch")
OrganizationBindingMismatch("organization_binding_mismatch")
EndUserBindingMismatch("end_user_binding_mismatch")
class BetaThinkingMismatchAllowedInputTransformation { Type = "thinking_mismatch_allowed"; Path; Reason; }
JsonElement Type = "thinking_mismatch_allowed"

Always thinking_mismatch_allowed for this entry type.

required string Path

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

required Reason Reason

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

One of the following:
ModelBindingMismatch("model_binding_mismatch")
PrefixBindingMismatch("prefix_binding_mismatch")
OrganizationBindingMismatch("organization_binding_mismatch")
EndUserBindingMismatch("end_user_binding_mismatch")
enum BetaThinkingPrefixMismatchBehavior

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

Error("error")
DropBlock("drop_block")
class BetaThinkingTurns { Type = "thinking_turns"; Value; }
JsonElement Type = "thinking_turns"
required long Value
minimum1
class BetaTokenTaskBudget { Type = "tokens"; Total; Remaining; }

User-configurable total token budget across contexts.

JsonElement Type = "tokens"

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

required long Total

Total token budget across all contexts in the session.

minimum1024
long? Remaining

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

minimum0
class BetaTool { Type; InputSchema; Name; /* 7 more */ }
class BetaToolBash20241022 { Type = "bash_20241022"; Name; AllowedCallers; /* 4 more */ }
class BetaToolBash20250124 { Type = "bash_20250124"; Name; AllowedCallers; /* 4 more */ }
class BetaToolChangeMcpToolReference { Type = "mcp_tool_reference"; Name; ServerName; }

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

JsonElement Type = "mcp_tool_reference"
required string Name
required string ServerName
class BetaToolChangeMcpToolsetReference { Type = "mcp_toolset_reference"; ServerName; }

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

JsonElement Type = "mcp_toolset_reference"
required string ServerName
class BetaToolChangeToolReference { Type = "tool_reference"; Name; }

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.

JsonElement Type = "tool_reference"
required string Name
pattern^[a-zA-Z0-9_-]{1,128}$
class BetaToolChoice: union

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

class BetaToolChoiceAny { Type = "any"; DisableParallelToolUse; }

The model will use any available tools.

JsonElement Type = "any"
bool DisableParallelToolUse

Whether to disable parallel tool use.

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

class BetaToolChoiceAuto { Type = "auto"; DisableParallelToolUse; }

The model will automatically decide whether to use tools.

JsonElement Type = "auto"
bool DisableParallelToolUse

Whether to disable parallel tool use.

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

class BetaToolChoiceNone { Type = "none"; }

The model will not be allowed to use tools.

JsonElement Type = "none"
class BetaToolChoiceTool { Type = "tool"; Name; DisableParallelToolUse; }

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

JsonElement Type = "tool"
required string Name

The name of the tool to use.

bool DisableParallelToolUse

Whether to disable parallel tool use.

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

class BetaToolComputerUse20241022 { Type = "computer_20241022"; DisplayHeightPx; DisplayWidthPx; /* 7 more */ }
class BetaToolComputerUse20250124 { Type = "computer_20250124"; DisplayHeightPx; DisplayWidthPx; /* 7 more */ }
class BetaToolComputerUse20251124 { Type = "computer_20251124"; DisplayHeightPx; DisplayWidthPx; /* 8 more */ }
class BetaToolReferenceBlock { Type = "tool_reference"; ToolName; }
JsonElement Type = "tool_reference"
required string ToolName
maxLength256
minLength1
pattern^[a-zA-Z0-9_-]{1,256}$
class BetaToolReferenceBlockParam { Type = "tool_reference"; ToolName; CacheControl; }

Tool reference block that can be included in tool_result content.

JsonElement Type = "tool_reference"
required string ToolName
maxLength256
minLength1
pattern^[a-zA-Z0-9_-]{1,256}$
BetaCacheControlEphemeral? CacheControl

Create a cache control breakpoint at this content block.

JsonElement Type = "ephemeral"
Ttl Ttl

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

This may be one the following values:

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

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

One of the following:
Ttl5m("5m")
Ttl1h("1h")
class BetaToolResultBlockParam { Type = "tool_result"; ToolUseID; CacheControl; /* 3 more */ }
class BetaToolSearchToolBm25_20251119 { Type; Name; AllowedCallers; /* 3 more */ }
class BetaToolSearchToolRegex20251119 { Type; Name; AllowedCallers; /* 3 more */ }
class BetaToolSearchToolResultBlock { Type = "tool_search_tool_result"; Content; ToolUseID; }
class BetaToolSearchToolResultBlockParam { Type = "tool_search_tool_result"; Content; ToolUseID; CacheControl; }
class BetaToolSearchToolResultError { Type = "tool_search_tool_result_error"; ErrorCode; ErrorMessage; }
JsonElement Type = "tool_search_tool_result_error"
required ErrorCode ErrorCode
One of the following:
InvalidToolInput("invalid_tool_input")
Unavailable("unavailable")
TooManyRequests("too_many_requests")
ExecutionTimeExceeded("execution_time_exceeded")
required string? ErrorMessage
class BetaToolSearchToolResultErrorParam { Type = "tool_search_tool_result_error"; ErrorCode; ErrorMessage; }
JsonElement Type = "tool_search_tool_result_error"
required ErrorCode ErrorCode
One of the following:
InvalidToolInput("invalid_tool_input")
Unavailable("unavailable")
TooManyRequests("too_many_requests")
ExecutionTimeExceeded("execution_time_exceeded")
string? ErrorMessage
class BetaToolSearchToolSearchResultBlock { Type = "tool_search_tool_search_result"; ToolReferences; }
JsonElement Type = "tool_search_tool_search_result"
required IReadOnlyList<BetaToolReferenceBlock> ToolReferences
JsonElement Type = "tool_reference"
required string ToolName
maxLength256
minLength1
pattern^[a-zA-Z0-9_-]{1,256}$
class BetaToolSearchToolSearchResultBlockParam { Type = "tool_search_tool_search_result"; ToolReferences; }
JsonElement Type = "tool_search_tool_search_result"
required IReadOnlyList<BetaToolReferenceBlockParam> ToolReferences
JsonElement Type = "tool_reference"
required string ToolName
maxLength256
minLength1
pattern^[a-zA-Z0-9_-]{1,256}$
BetaCacheControlEphemeral? CacheControl

Create a cache control breakpoint at this content block.

JsonElement Type = "ephemeral"
Ttl Ttl

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

This may be one the following values:

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

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

One of the following:
Ttl5m("5m")
Ttl1h("1h")
class BetaToolTextEditor20241022 { Type = "text_editor_20241022"; Name; AllowedCallers; /* 4 more */ }
class BetaToolTextEditor20250124 { Type = "text_editor_20250124"; Name; AllowedCallers; /* 4 more */ }
class BetaToolTextEditor20250429 { Type = "text_editor_20250429"; Name; AllowedCallers; /* 4 more */ }
class BetaToolTextEditor20250728 { Type = "text_editor_20250728"; Name; AllowedCallers; /* 5 more */ }
class BetaToolUnion: union
class BetaToolUseBlock { Type = "tool_use"; ID; Input; /* 3 more */ }
class BetaToolUseBlockParam { Type = "tool_use"; ID; Input; /* 4 more */ }
class BetaToolUsesKeep { Type = "tool_uses"; Value; }
JsonElement Type = "tool_uses"
required long Value
minimum0
class BetaToolUsesTrigger { Type = "tool_uses"; Value; }
JsonElement Type = "tool_uses"
required long Value
minimum1
class BetaUrlImageSource { Type = "url"; Url; }
JsonElement Type = "url"
required string Url
class BetaUrlPdfSource { Type = "url"; Url; }
JsonElement Type = "url"
required string Url
class BetaUsage { CacheCreation; CacheCreationInputTokens; CacheReadInputTokens; /* 9 more */ }
class BetaUserLocation { Type = "approximate"; City; Country; /* 2 more */ }
JsonElement Type = "approximate"
string? City

The city of the user.

maxLength255
minLength1
string? Country

The two letter ISO country code of the user.

maxLength2
minLength2
string? Region

The region of the user.

maxLength255
minLength1
string? Timezone

The IANA timezone of the user.

maxLength255
minLength1
class BetaWebFetchBlock { Type = "web_fetch_result"; Content; RetrievedAt; Url; }
JsonElement Type = "web_fetch_result"
required BetaDocumentBlock Content
required string? RetrievedAt

ISO 8601 timestamp when the content was retrieved

required string Url

Fetched content URL

class BetaWebFetchBlockParam { Type = "web_fetch_result"; Content; Url; RetrievedAt; }
JsonElement Type = "web_fetch_result"
required BetaRequestDocumentBlock Content
required string Url

Fetched content URL

string? RetrievedAt

ISO 8601 timestamp when the content was retrieved

class BetaWebFetchTool20250910 { Type = "web_fetch_20250910"; Name; AllowedCallers; /* 9 more */ }
class BetaWebFetchTool20260209 { Type = "web_fetch_20260209"; Name; AllowedCallers; /* 9 more */ }
class BetaWebFetchTool20260309 { Type = "web_fetch_20260309"; Name; AllowedCallers; /* 10 more */ }

Web fetch tool with use_cache parameter for bypassing cached content.

class BetaWebFetchTool20260318 { Type = "web_fetch_20260318"; Name; AllowedCallers; /* 11 more */ }
class BetaWebFetchToolResultBlock { Type = "web_fetch_tool_result"; Content; ToolUseID; Caller; }
class BetaWebFetchToolResultBlockParam { Type = "web_fetch_tool_result"; Content; ToolUseID; /* 2 more */ }
class BetaWebFetchToolResultErrorBlock { Type = "web_fetch_tool_result_error"; ErrorCode; }
JsonElement Type = "web_fetch_tool_result_error"
required BetaWebFetchToolResultErrorCode ErrorCode
One of the following:
InvalidToolInput("invalid_tool_input")
UrlTooLong("url_too_long")
UrlNotAllowed("url_not_allowed")
UrlNotInPriorContext("url_not_in_prior_context")
UrlNotAccessible("url_not_accessible")
UnsupportedContentType("unsupported_content_type")
TooManyRequests("too_many_requests")
MaxUsesExceeded("max_uses_exceeded")
Unavailable("unavailable")
ContentTooLarge("content_too_large")
class BetaWebFetchToolResultErrorBlockParam { Type = "web_fetch_tool_result_error"; ErrorCode; }
JsonElement Type = "web_fetch_tool_result_error"
required BetaWebFetchToolResultErrorCode ErrorCode
One of the following:
InvalidToolInput("invalid_tool_input")
UrlTooLong("url_too_long")
UrlNotAllowed("url_not_allowed")
UrlNotInPriorContext("url_not_in_prior_context")
UrlNotAccessible("url_not_accessible")
UnsupportedContentType("unsupported_content_type")
TooManyRequests("too_many_requests")
MaxUsesExceeded("max_uses_exceeded")
Unavailable("unavailable")
ContentTooLarge("content_too_large")
enum BetaWebFetchToolResultErrorCode
InvalidToolInput("invalid_tool_input")
UrlTooLong("url_too_long")
UrlNotAllowed("url_not_allowed")
UrlNotInPriorContext("url_not_in_prior_context")
UrlNotAccessible("url_not_accessible")
UnsupportedContentType("unsupported_content_type")
TooManyRequests("too_many_requests")
MaxUsesExceeded("max_uses_exceeded")
Unavailable("unavailable")
ContentTooLarge("content_too_large")
class BetaWebFetchUrlSourceAll { Type = "all"; }

The url_sources variant under which a source contributes in full: every result of the tool filter's source, or all user input.

JsonElement Type = "all"
class BetaWebFetchUrlSourceExcept { Type = "except"; Tools; }

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

JsonElement Type = "except"
required IReadOnlyList<BetaWebFetchUrlSourceToolReference> Tools
JsonElement Type = "tool_reference"
required string Name
class BetaWebFetchUrlSourceNone { Type = "none"; }

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

JsonElement Type = "none"
class BetaWebFetchUrlSourceOnly { Type = "only"; Tools; }

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

JsonElement Type = "only"
required IReadOnlyList<BetaWebFetchUrlSourceToolReference> Tools
JsonElement Type = "tool_reference"
required string Name
class BetaWebFetchUrlSourceToolReference { Type = "tool_reference"; Name; }

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

JsonElement Type = "tool_reference"
required string Name
class BetaWebFetchUrlSources { ClientToolResults; ServerToolResults; UserInput; }

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

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

class BetaWebSearchResultBlock { Type = "web_search_result"; EncryptedContent; PageAge; /* 2 more */ }
JsonElement Type = "web_search_result"
required string EncryptedContent
required string? PageAge
required string Title
required string Url
class BetaWebSearchResultBlockParam { Type = "web_search_result"; EncryptedContent; Title; /* 2 more */ }
JsonElement Type = "web_search_result"
required string EncryptedContent
required string Title
required string Url
string? PageAge
class BetaWebSearchTool20250305 { Type = "web_search_20250305"; Name; AllowedCallers; /* 7 more */ }
class BetaWebSearchTool20260209 { Type = "web_search_20260209"; Name; AllowedCallers; /* 7 more */ }
class BetaWebSearchTool20260318 { Type = "web_search_20260318"; Name; AllowedCallers; /* 8 more */ }
class BetaWebSearchToolRequestError { Type = "web_search_tool_result_error"; ErrorCode; }
JsonElement Type = "web_search_tool_result_error"
required BetaWebSearchToolResultErrorCode ErrorCode
One of the following:
InvalidToolInput("invalid_tool_input")
Unavailable("unavailable")
MaxUsesExceeded("max_uses_exceeded")
TooManyRequests("too_many_requests")
QueryTooLong("query_too_long")
RequestTooLarge("request_too_large")
class BetaWebSearchToolResultBlock { Type = "web_search_tool_result"; Content; ToolUseID; Caller; }
class BetaWebSearchToolResultBlockContent: union
class BetaWebSearchToolResultBlockParam { Type = "web_search_tool_result"; Content; ToolUseID; /* 2 more */ }
class BetaWebSearchToolResultBlockParamContent: union
class BetaWebSearchToolResultError { Type = "web_search_tool_result_error"; ErrorCode; }
JsonElement Type = "web_search_tool_result_error"
required BetaWebSearchToolResultErrorCode ErrorCode
One of the following:
InvalidToolInput("invalid_tool_input")
Unavailable("unavailable")
MaxUsesExceeded("max_uses_exceeded")
TooManyRequests("too_many_requests")
QueryTooLong("query_too_long")
RequestTooLarge("request_too_large")
enum BetaWebSearchToolResultErrorCode
InvalidToolInput("invalid_tool_input")
Unavailable("unavailable")
MaxUsesExceeded("max_uses_exceeded")
TooManyRequests("too_many_requests")
QueryTooLong("query_too_long")
RequestTooLarge("request_too_large")

メッセージバッチ

メッセージバッチを作成
BetaMessageBatch Beta.Messages.Batches.Create(parameters, cancellationToken = default)
POST/v1/messages/batches

メッセージ作成リクエストのバッチを送信します。

メッセージバッチを取得
BetaMessageBatch Beta.Messages.Batches.Retrieve(parameters, cancellationToken = default)
GET/v1/messages/batches/{message_batch_id}

このエンドポイントはべき等であり、メッセージバッチの完了をポーリングするために使用できます。メッセージバッチの結果にアクセスするには、レスポンス内のresults_urlフィールドに対してリクエストを行ってください。

メッセージバッチの一覧
BatchListPage Beta.Messages.Batches.List(parameters, cancellationToken = default)
GET/v1/messages/batches

ワークスペース内のすべてのメッセージバッチを一覧表示します。最も新しく作成されたバッチが最初に返されます。

メッセージバッチをキャンセル
BetaMessageBatch Beta.Messages.Batches.Cancel(parameters, cancellationToken = default)
POST/v1/messages/batches/{message_batch_id}/cancel

バッチは処理が終了する前であればいつでもキャンセルできます。キャンセルが開始されると、バッチはcanceling状態になり、この間にシステムはキャンセルを確定する前に、進行中の中断不可能なリクエストを完了させる場合があります。

メッセージバッチを削除
BetaDeletedMessageBatch Beta.Messages.Batches.Delete(parameters, cancellationToken = default)
DELETE/v1/messages/batches/{message_batch_id}

メッセージバッチを削除します。

メッセージバッチの結果を取得
BetaMessageBatchIndividualResponse Beta.Messages.Batches.ResultsStreaming(parameters, cancellationToken = default)
GET/v1/messages/batches/{message_batch_id}/results

メッセージバッチの結果を.jsonlファイルとしてストリーミングします。