Claude Platform Docs

Nachrichten

Eine Nachricht erstellen
$client->beta->messages->create(int maxTokens, list<BetaMessageParam> messages, Model model, ?BetaCacheControlEphemeral cacheControl, ?BetaCompactionConfig compaction, ?Container container, ?BetaContextManagementConfig contextManagement, ?BetaDiagnosticsParam diagnostics, ?FallbackCreditToken fallbackCreditToken, ?BetaFallbacksParam fallbacks, ?string inferenceGeo, ?list<BetaRequestMCPServerURLDefinition> mcpServers, ?BetaMetadata metadata, ?BetaOutputConfig outputConfig, ?BetaJSONOutputFormat outputFormat, ?ServiceTier serviceTier, ?Speed speed, ?list<string> stopSequences, ?System system, ?float temperature, ?BetaThinkingConfigParam thinking, ?BetaToolChoice toolChoice, ?list<BetaToolUnion> tools, ?int topK, ?float topP, ?list<AnthropicBeta> betas, ?string userProfileID, ?string workspaceID): BetaMessage
POST/v1/messages

Sende eine strukturierte Liste von Eingabenachrichten mit Text- und/oder Bildinhalten, und das Modell generiert die nächste Nachricht in der Konversation.

Tokens in einer Nachricht zählen
$client->beta->messages->countTokens(list<BetaMessageParam> messages, Model model, ?BetaCacheControlEphemeral cacheControl, ?BetaCompactionConfig compaction, ?BetaContextManagementConfig contextManagement, ?list<BetaRequestMCPServerURLDefinition> mcpServers, ?BetaOutputConfig outputConfig, ?BetaJSONOutputFormat outputFormat, ?Speed speed, ?System system, ?BetaThinkingConfigParam thinking, ?BetaToolChoice toolChoice, ?list<Tool> tools, ?list<AnthropicBeta> betas, ?string userProfileID, ?string workspaceID): BetaMessageTokensCount
POST/v1/messages/count_tokens

Zähle die Anzahl der Tokens in einer Nachricht.

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

Usage for an advisor sub-inference iteration

?BetaCacheCreation cacheCreation

Breakdown of cached tokens by TTL

int cacheCreationInputTokens

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

int cacheReadInputTokens

The number of input tokens read from the cache.

int inputTokens

The number of input tokens which were used.

Model model

The model that will complete your prompt.

See models for additional details and options.

int outputTokens

The number of output tokens which were used.

class BetaAdvisorRedactedResultBlock { $type = 'advisor_redacted_result'; $encryptedContent; $stopReason; }
"advisor_redacted_result" type
string encryptedContent

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

?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; }
"advisor_redacted_result" type
string encryptedContent

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

?string stopReason
class BetaAdvisorResultBlock { $type = 'advisor_result'; $stopReason; $text; }
"advisor_result" type
?string stopReason

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

string text
class BetaAdvisorResultBlockParam { $type = 'advisor_result'; $text; $stopReason; }
"advisor_result" type
string text
?string stopReason
class BetaAdvisorTool20260301 { $type = 'advisor_20260301'; $model; $name; /* 7 more */ }
class BetaAdvisorToolResultBlock { $type = 'advisor_tool_result'; $content; $toolUseID; }
"advisor_tool_result" type
Content content
string toolUseID
class BetaAdvisorToolResultBlockParam { $type = 'advisor_tool_result'; $content; $toolUseID; $cacheControl; }
"advisor_tool_result" type
Content content
string toolUseID
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

class BetaAdvisorToolResultError { $type = 'advisor_tool_result_error'; $errorCode; }
"advisor_tool_result_error" type
ErrorCode errorCode
class BetaAdvisorToolResultErrorParam { $type = 'advisor_tool_result_error'; $errorCode; }
"advisor_tool_result_error" type
ErrorCode errorCode
class BetaAllThinkingTurns { $type = 'all'; }
"all" type
class BetaBase64ImageSource { $type = 'base64'; $data; $mediaType; }
"base64" type
string data
MediaType mediaType
class BetaBase64PDFSource { $type = 'base64'; $data; $mediaType; }
"base64" type
string data
"application/pdf" mediaType
class BetaBashCodeExecutionOutputBlock { $type = 'bash_code_execution_output'; $fileID; }
"bash_code_execution_output" type
string fileID
class BetaBashCodeExecutionOutputBlockParam { $type = 'bash_code_execution_output'; $fileID; }
"bash_code_execution_output" type
string fileID
class BetaBashCodeExecutionResultBlock { $type = 'bash_code_execution_result'; $content; $returnCode; /* 2 more */ }
"bash_code_execution_result" type
int returnCode
string stderr
string stdout
class BetaBashCodeExecutionResultBlockParam { $type = 'bash_code_execution_result'; $content; $returnCode; /* 2 more */ }
"bash_code_execution_result" type
int returnCode
string stderr
string stdout
class BetaBashCodeExecutionToolResultBlock { $type = 'bash_code_execution_tool_result'; $content; $toolUseID; }
"bash_code_execution_tool_result" type
Content content
string toolUseID
class BetaBashCodeExecutionToolResultBlockParam { $type = 'bash_code_execution_tool_result'; $content; $toolUseID; $cacheControl; }
"bash_code_execution_tool_result" type
Content content
string toolUseID
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

class BetaBashCodeExecutionToolResultError { $type = 'bash_code_execution_tool_result_error'; $errorCode; }
"bash_code_execution_tool_result_error" type
ErrorCode errorCode
class BetaBashCodeExecutionToolResultErrorParam { $type = 'bash_code_execution_tool_result_error'; $errorCode; }
"bash_code_execution_tool_result_error" type
ErrorCode errorCode
class BetaBrowserCloseTabConfig { $deferLoading; $enabled; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
"browser_state" type

All tabs open in the browser after this call — the full inventory, not a delta. May be empty. Whenever non-empty, exactly one entry carries active: true.

?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?list<BetaBrowserStateChange> stateChanges

Tabs opened and download state changes during this call. "Nothing to report" is expressed by omitting the field, never by an empty list.

One of the following:
class BetaBrowserStateChangeDownloadCompleted { $type = 'download_completed'; $downloadID; $url; /* 2 more */ }
"download_completed" type
string downloadID

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

string url

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

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

?int sizeBytes

The completed download's size.

class BetaBrowserStateChangeDownloadFailed { $type = 'download_failed'; $downloadID; $url; $error; }
"download_failed" type
string downloadID

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

string url

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

?string error

The failure or cancellation detail, when known.

class BetaBrowserStateChangeDownloadStarted { $type = 'download_started'; $downloadID; $url; }
"download_started" type
string downloadID

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

string url

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

class BetaBrowserStateChangeTabOpened { $type = 'tab_opened'; $tabID; }
"tab_opened" type
string tabID

The tab_id of the opened tab, present in tabs.

class BetaBrowserStateTabEntry { $tabID; $title; $url; $active; }
string tabID

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

string title

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

string url

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

?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; }
?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; }
"browser_toolset_20260801" type
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

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 */ }
class BetaBrowserTripleClickConfig { $deferLoading; $enabled; }
?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; }
?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; }
?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; }
?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; }
"ephemeral" type
?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.

class BetaCacheCreation { $ephemeral1hInputTokens; $ephemeral5mInputTokens; }
int ephemeral1hInputTokens

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

int ephemeral5mInputTokens

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

class BetaCacheMissMessagesChanged { $type = 'messages_changed'; $cacheMissedInputTokens; }
"messages_changed" type
int 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; }
"model_changed" type
int 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'; }
"previous_message_not_found" type
class BetaCacheMissSystemChanged { $type = 'system_changed'; $cacheMissedInputTokens; }
"system_changed" type
int 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; }
"tools_changed" type
int cacheMissedInputTokens

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

class BetaCacheMissUnavailable { $type = 'unavailable'; }
"unavailable" type
class BetaCitationCharLocation { $type = 'char_location'; $citedText; $documentIndex; /* 4 more */ }
"char_location" type
string citedText
int documentIndex
?string documentTitle
int endCharIndex
?string fileID
int startCharIndex
class BetaCitationCharLocationParam { $type = 'char_location'; $citedText; $documentIndex; /* 3 more */ }
"char_location" type
string citedText
int documentIndex
?string documentTitle
int endCharIndex
int startCharIndex
class BetaCitationConfig { $enabled; }
bool enabled
class BetaCitationContentBlockLocation { $type = 'content_block_location'; $citedText; $documentIndex; /* 4 more */ }
"content_block_location" type
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.

int documentIndex
?string documentTitle
int 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.

?string fileID
int startBlockIndex

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

class BetaCitationContentBlockLocationParam { $type = 'content_block_location'; $citedText; $documentIndex; /* 3 more */ }
"content_block_location" type
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.

int documentIndex
?string documentTitle
int 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.

int startBlockIndex

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

class BetaCitationPageLocation { $type = 'page_location'; $citedText; $documentIndex; /* 4 more */ }
"page_location" type
string citedText
int documentIndex
?string documentTitle
int endPageNumber
?string fileID
int startPageNumber
class BetaCitationPageLocationParam { $type = 'page_location'; $citedText; $documentIndex; /* 3 more */ }
"page_location" type
string citedText
int documentIndex
?string documentTitle
int endPageNumber
int startPageNumber
class BetaCitationSearchResultLocation { $type = 'search_result_location'; $citedText; $endBlockIndex; /* 4 more */ }
"search_result_location" type
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.

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

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

string source
int startBlockIndex

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

?string title
class BetaCitationSearchResultLocationParam { $type = 'search_result_location'; $citedText; $endBlockIndex; /* 4 more */ }
"search_result_location" type
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.

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

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

string source
int startBlockIndex

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

?string title
class BetaCitationWebSearchResultLocationParam { $type = 'web_search_result_location'; $citedText; $encryptedIndex; /* 2 more */ }
"web_search_result_location" type
string citedText
string encryptedIndex
?string title
string url
class BetaCitationsConfigParam { $enabled; }
?bool enabled
class BetaCitationsDelta { $type = 'citations_delta'; $citation; }
"citations_delta" type
Citation citation
class BetaCitationsWebSearchResultLocation { $type = 'web_search_result_location'; $citedText; $encryptedIndex; /* 2 more */ }
"web_search_result_location" type
string citedText
string encryptedIndex
?string title
string url
class BetaClearThinking20251015Edit { $type = 'clear_thinking_20251015'; $keep; }
"clear_thinking_20251015" type
?Keep keep

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

class BetaClearThinking20251015EditResponse { $type = 'clear_thinking_20251015'; $clearedInputTokens; $clearedThinkingTurns; }
"clear_thinking_20251015" type

The type of context management edit applied.

int clearedInputTokens

Number of input tokens cleared by this edit.

int clearedThinkingTurns

Number of thinking turns that were cleared.

class BetaClearToolUses20250919Edit { $type = 'clear_tool_uses_20250919'; $clearAtLeast; $clearToolInputs; /* 3 more */ }
"clear_tool_uses_20250919" type

Minimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed.

?ClearToolInputs clearToolInputs

Whether to clear all tool inputs (bool) or specific tool inputs to clear (list)

?list<string> excludeTools

Tool names whose uses are preserved from clearing

Number of tool uses to retain in the conversation

?Trigger trigger

Condition that triggers the context management strategy

class BetaClearToolUses20250919EditResponse { $type = 'clear_tool_uses_20250919'; $clearedInputTokens; $clearedToolUses; }
"clear_tool_uses_20250919" type

The type of context management edit applied.

int clearedInputTokens

Number of input tokens cleared by this edit.

int clearedToolUses

Number of tool uses that were cleared.

class BetaCodeExecutionOutputBlock { $type = 'code_execution_output'; $fileID; }
"code_execution_output" type
string fileID
class BetaCodeExecutionOutputBlockParam { $type = 'code_execution_output'; $fileID; }
"code_execution_output" type
string fileID
class BetaCodeExecutionResultBlock { $type = 'code_execution_result'; $content; $returnCode; /* 2 more */ }
"code_execution_result" type
int returnCode
string stderr
string stdout
class BetaCodeExecutionResultBlockParam { $type = 'code_execution_result'; $content; $returnCode; /* 2 more */ }
"code_execution_result" type
int returnCode
string stderr
string stdout
class BetaCodeExecutionTool20250522 { $type = 'code_execution_20250522'; $name; $allowedCallers; /* 3 more */ }
"code_execution_20250522" type
"code_execution" name

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?bool strict

When true, guarantees schema validation on tool names and inputs

class BetaCodeExecutionTool20250825 { $type = 'code_execution_20250825'; $name; $allowedCallers; /* 3 more */ }
"code_execution_20250825" type
"code_execution" name

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?bool strict

When true, guarantees schema validation on tool names and inputs

class BetaCodeExecutionTool20260120 { $type = 'code_execution_20260120'; $name; $allowedCallers; /* 3 more */ }
"code_execution_20260120" type
"code_execution" name

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?bool strict

When true, guarantees schema validation on tool names and inputs

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

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?bool strict

When true, guarantees schema validation on tool names and inputs

class BetaCodeExecutionToolResultBlock { $type = 'code_execution_tool_result'; $content; $toolUseID; }
"code_execution_tool_result" type
string toolUseID
One of the following:
class BetaCodeExecutionToolResultBlockParam { $type = 'code_execution_tool_result'; $content; $toolUseID; $cacheControl; }
"code_execution_tool_result" type
string toolUseID
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

One of the following:
class BetaCodeExecutionToolResultError { $type = 'code_execution_tool_result_error'; $errorCode; }
"code_execution_tool_result_error" type
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
class BetaCodeExecutionToolResultErrorParam { $type = 'code_execution_tool_result_error'; $errorCode; }
"code_execution_tool_result_error" type
class BetaCompact20260112Edit { $type = 'compact_20260112'; $instructions; $pauseAfterCompaction; $trigger; }
"compact_20260112" type
?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.

class BetaCompactionBlock { $type = 'compaction'; $content; $encryptedContent; $signature; }
"compaction" type
?string content

Summary of compacted content, or null if compaction failed

?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 */ }
"compaction" type
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?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; }
"summarize" type
?string instructions

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

class BetaCompactionContentBlockDelta { $type = 'compaction_delta'; $content; $encryptedContent; }
"compaction_delta" type
?string content
?string encryptedContent

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

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

Usage for a compaction iteration

?BetaCacheCreation cacheCreation

Breakdown of cached tokens by TTL

int cacheCreationInputTokens

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

int cacheReadInputTokens

The number of input tokens read from the cache.

int inputTokens

The number of input tokens which were used.

int outputTokens

The number of output tokens which were used.

class BetaComputerCursorPositionConfig { $deferLoading; $enabled; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
?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; }
"computer_toolset_20260801" type
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

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 */ }
class BetaComputerTripleClickConfig { $deferLoading; $enabled; }
?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; }
?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; }
?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; }
?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; }
string id

Identifier for the container used in this request

\Datetime expiresAt

The time at which the container will expire.

?list<BetaContainerSkill> skills

Skills loaded in the container

class BetaContainerParams { $id; $skills; }
?string id

Container id

?list<BetaSkillParams> skills

List of skills to load in the container

class BetaContainerSkill { $type; $skillID; $version; }
Type type

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

string skillID

Skill ID

string version

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

class BetaContainerUploadBlock { $type = 'container_upload'; $fileID; }
"container_upload" type
string fileID
class BetaContainerUploadBlockParam { $type = 'container_upload'; $fileID; $cacheControl; }
"container_upload" type
string fileID
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

One of the following:
One of the following:
class BetaContentBlockSource { $type = 'content'; $content; }
"content" type
Content content
One of the following:
class BetaContextManagementConfig { $edits; }
?list<Edit> edits

List of context management edits to apply

class BetaContextManagementResponse { $appliedEdits; }
list<AppliedEdit> appliedEdits

List of context management edits that were applied.

class BetaCountTokensContextManagementResponse { $originalInputTokens; }
int originalInputTokens

The original token count before context management was applied

class BetaDiagnostics { $cacheMissReason; }
?CacheMissReason cacheMissReason

Explains why the prompt cache could not fully reuse the prefix from the request identified by diagnostics.previous_message_id. null means diagnosis is still pending — the response was serialized before the background comparison completed.

class BetaDiagnosticsParam { $previousMessageID; }
?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.

class BetaDirectCaller { $type = 'direct'; }
"direct" type
class BetaDocumentBlock { $type = 'document'; $citations; $source; $title; }
"document" type
?BetaCitationConfig citations

Citation configuration for the document

Source source
?string title

The title of the document

class BetaEncryptedCodeExecutionResultBlock { $type = 'encrypted_code_execution_result'; $content; $encryptedStdout; /* 2 more */ }
"encrypted_code_execution_result" type
string encryptedStdout
int returnCode
string stderr
class BetaEncryptedCodeExecutionResultBlockParam { $type = 'encrypted_code_execution_result'; $content; $encryptedStdout; /* 2 more */ }
"encrypted_code_execution_result" type
string encryptedStdout
int returnCode
string stderr
class BetaFallbackBlock { $type = 'fallback'; $from; $to; $trigger; }
"fallback" type

The model whose output ends at this point — the model that declined at this hop. When the declining hop is the requested model, its model echoes the top-level model string the caller sent (alias or canonical); when the declining hop is a fallback model, its model is that model's canonical id.

The fallback model producing the content that follows this block. Its model is always the canonical id.

What caused the from model to hand over at this hop.

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

Identifies one hop of a fallback transition.

Identifies one hop of a fallback transition.

?mixed 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; }
"not_applied" type
Reason reason

Why the reprice was not applied.

A closed enum; additions to the redemption-check vocabulary arrive as deliberate schema updates.

?list<string> removeToRedeem

Request fields to remove before retrying, so the retry can redeem this token.

Present exactly when reason is variant_fields_present — never null, never an empty array; absent otherwise. Fields are named only from your own request, and only after the sealed variant hash matched. A served best-effort retry has already been billed at normal price; nothing redeems retroactively, but a corrected re-send inside the token's five-minute window can still redeem.

class BetaFallbackCreditRedeemed { $type = 'redeemed'; }
"redeemed" type
class BetaFallbackCreditTokenParam { $token; $mode; }
string token

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

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

class BetaFallbackCreditUsage { $status; }
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.

class BetaFallbackInfo { $model; }
Model model

The model that will complete your prompt.

See models for additional details and options.

class BetaFallbackInfoParam { $model; }
Model model

The model that will complete your prompt.

See models for additional details and options.

class BetaFallbackMessageIterationUsage { $type = 'fallback_message'; $cacheCreation; $cacheCreationInputTokens; /* 4 more */ }
"fallback_message" type

Usage for the fallback-model attempt that served the response

?BetaCacheCreation cacheCreation

Breakdown of cached tokens by TTL

int cacheCreationInputTokens

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

int cacheReadInputTokens

The number of input tokens read from the cache.

int inputTokens

The number of input tokens which were used.

Model model

The model that will complete your prompt.

See models for additional details and options.

int outputTokens

The number of output tokens which were used.

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

The model that will complete your prompt.

See models for additional details and options.

?int maxTokens
?BetaOutputConfig outputConfig
?Speed speed

Inference speed mode. fast provides significantly faster output token generation at premium pricing. Not all models support fast; invalid combinations are rejected at create time.

?Thinking thinking
class BetaFallbackRefusalTrigger { $type = 'refusal'; $category; }
"refusal" type
?Category category

The policy category that triggered a refusal.

One of the following:
class list<BetaFallbackParam> { $model; $maxTokens; $outputConfig; /* 2 more */ }
Model model

The model that will complete your prompt.

See models for additional details and options.

?int maxTokens
?BetaOutputConfig outputConfig
?Speed speed

Inference speed mode. fast provides significantly faster output token generation at premium pricing. Not all models support fast; invalid combinations are rejected at create time.

?Thinking thinking
"default"
class BetaFileDocumentSource { $type = 'file'; $fileID; }
"file" type
string fileID
class BetaFileImageSource { $type = 'file'; $fileID; }
"file" type
string fileID
class BetaImageBlockParam { $type = 'image'; $source; $cacheControl; $transformations; }
"image" type
Source source
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?BetaImageTransformationsParam transformations

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.

class BetaImageTransformationsParam { $oversizedImage; }
?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.

class BetaInputJSONDelta { $type = 'input_json_delta'; $partialJSON; }
"input_json_delta" type
string partialJSON
class BetaInputTokensClearAtLeast { $type = 'input_tokens'; $value; }
"input_tokens" type
int value
class BetaInputTokensTrigger { $type = 'input_tokens'; $value; }
"input_tokens" type
int value
One of the following:
list<BetaIterationsUsageItem>
One of the following:
class BetaJSONOutputFormat { $type = 'json_schema'; $schema; }
"json_schema" type
array<string,mixed> schema

The JSON schema of the format

class BetaMCPToolConfig { $deferLoading; $enabled; }
?bool deferLoading
?bool enabled
class BetaMCPToolDefaultConfig { $deferLoading; $enabled; }
?bool deferLoading
?bool enabled
class BetaMCPToolResultBlock { $type = 'mcp_tool_result'; $content; $isError; $toolUseID; }
"mcp_tool_result" type
Content content
bool isError
string toolUseID
class BetaMCPToolUseBlock { $type = 'mcp_tool_use'; $id; $input; /* 2 more */ }
"mcp_tool_use" type
string id
array<string,mixed> input
string name

The name of the MCP tool

string serverName

The name of the MCP server

class BetaMCPToolUseBlockParam { $type = 'mcp_tool_use'; $id; $input; /* 3 more */ }
"mcp_tool_use" type
string id
array<string,mixed> input
string name
string serverName

The name of the MCP server

?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

class BetaMCPToolset { $type = 'mcp_toolset'; $mcpServerName; $cacheControl; /* 2 more */ }
"mcp_toolset" type
string mcpServerName

Name of the MCP server to configure tools for

?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?array<string,BetaMCPToolConfig> configs

Configuration overrides for specific tools, keyed by tool name

?BetaMCPToolDefaultConfig defaultConfig

Default configuration applied to all tools from this server

class BetaMemoryTool20250818 { $type = 'memory_20250818'; $name; $allowedCallers; /* 4 more */ }
"memory_20250818" type
"memory" name

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?list<array<string,mixed>> inputExamples
?bool strict

When true, guarantees schema validation on tool names and inputs

One of the following:
class BetaMemoryTool20250818CreateCommand { $command; $fileText; $path; }
"create" command

Command type identifier

string fileText

Content to write to the file

string path

Path where the file should be created

class BetaMemoryTool20250818DeleteCommand { $command; $path; }
"delete" command

Command type identifier

string path

Path to the file or directory to delete

class BetaMemoryTool20250818InsertCommand { $command; $insertLine; $insertText; $path; }
"insert" command

Command type identifier

int insertLine

Line number where text should be inserted

string insertText

Text to insert at the specified line

string path

Path to the file where text should be inserted

class BetaMemoryTool20250818RenameCommand { $command; $newPath; $oldPath; }
"rename" command

Command type identifier

string newPath

New path for the file or directory

string oldPath

Current path of the file or directory

class BetaMemoryTool20250818StrReplaceCommand { $command; $newStr; $oldStr; $path; }
"str_replace" command

Command type identifier

string newStr

Text to replace with

string oldStr

Text to search for and replace

string path

Path to the file where text should be replaced

class BetaMemoryTool20250818ViewCommand { $command; $path; $viewRange; }
"view" command

Command type identifier

string path

Path to directory or file to view

?list<int> viewRange

Optional line range for viewing specific lines

class BetaMessage { $type = 'message'; $id; $container; /* 10 more */ }
class BetaMessageDeltaUsage { $cacheCreationInputTokens; $cacheReadInputTokens; $fallbackCredit; /* 5 more */ }
?int cacheCreationInputTokens

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

?int cacheReadInputTokens

The cumulative number of input tokens read from the cache.

?BetaFallbackCreditUsage fallbackCredit

Outcome of the fallback_credit_token presented on this request.

?int inputTokens

The cumulative number of input tokens which were used.

?list<BetaIterationsUsageItem> iterations

Per-iteration token usage breakdown.

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

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

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

int outputTokens

The cumulative number of output tokens which were used.

?BetaOutputTokensDetails outputTokensDetails

Breakdown of output tokens by category.

output_tokens remains the inclusive, authoritative total used for billing. This object provides a read-only decomposition for observability — for example, how many of the billed output tokens were spent on internal reasoning that may have been summarized before being returned to you.

?BetaServerToolUsage serverToolUse

The number of server tool requests.

class BetaMessageIterationUsage { $type = 'message'; $cacheCreation; $cacheCreationInputTokens; /* 4 more */ }
"message" type

Usage for a sampling iteration

?BetaCacheCreation cacheCreation

Breakdown of cached tokens by TTL

int cacheCreationInputTokens

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

int cacheReadInputTokens

The number of input tokens read from the cache.

int inputTokens

The number of input tokens which were used.

?Model model

The model that will complete your prompt.

See models for additional details and options.

int outputTokens

The number of output tokens which were used.

class BetaMessageParam { $content; $role; $clearAt; $outputConfig; }
Content content
Role role
?ClearAt clearAt

How long this system message's text stays in front of the model. "never" (the default) renders it on every request that includes it. "next_user_message" renders it only for the user turn it follows: once a later role: "user" message exists in messages the message stays in the array (send it unchanged) but is no longer shown to the model. Only permitted on role: "system" messages.

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.

class BetaMessageTokensCount { $contextManagement; $inputTokens; }

Information about context management applied to the message.

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

class BetaOutputConfig { $effort; $format; $taskBudget; }
?Effort effort

All possible effort levels.

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

?BetaTokenTaskBudget taskBudget

User-configurable total token budget across contexts.

class BetaOutputTokensDetails { $thinkingTokens; }
int 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.

class BetaPlainTextSource { $type = 'text'; $data; $mediaType; }
"text" type
string data
"text/plain" mediaType
One of the following:
class BetaRawContentBlockDeltaEvent { $type = 'content_block_delta'; $delta; $index; }
"content_block_delta" type
int index
class BetaRawContentBlockStartEvent { $type = 'content_block_start'; $contentBlock; $index; }
"content_block_start" type
ContentBlock contentBlock
int index
class BetaRawContentBlockStopEvent { $type = 'content_block_stop'; $index; }
"content_block_stop" type
int index
class BetaRawMessageDeltaEvent { $type = 'message_delta'; $contextManagement; $delta; /* 2 more */ }
"message_delta" type
?BetaContextManagementResponse contextManagement

Information about context management strategies applied during the request

Delta delta

Billing and rate-limit usage.

Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.

Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in usage will not match one-to-one with the exact visible content of an API request or response.

For example, output_tokens will be non-zero, even for an empty string response from Claude.

Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.

?list<BetaInputTransformation> inputTransformations

Changes the API made to the request's input before showing it to the model, and blocks that failed a binding check but were left unchanged: one entry per block, in request order. Two entry types today. thinking_dropped — a thinking, redacted_thinking or connector_text block from the request's messages that was removed from the prompt instead of being shown to the model because it failed a binding check. thinking_mismatch_allowed — a thinking or redacted_thinking block that failed the conversation check (the conversation before it differs from the one it was created in, or it carries no record of one on a model that requires it) and was shown to the model all the same, because that check is not enforced for this request. More entry types may be added over time; ignore types you do not recognize.

Requires anthropic-beta: thinking-binding-controls-2026-08-01. Present on every such response from a model that supports extended thinking, as [] when there is no entry to report; without the beta, blocks are removed or left in place all the same but nothing is reported. Removed blocks contribute nothing to usage.input_tokens; blocks left in place count as sent. When streaming, the array is final in message_start; the final message_delta event carries it only when a server-side model fallback happened mid-stream, in which case it holds the serving model's entries and replaces the one in message_start.

class BetaRawMessageStartEvent { $type = 'message_start'; $message; }
"message_start" type
BetaMessage message
class BetaRawMessageStopEvent { $type = 'message_stop'; }
"message_stop" type
One of the following:
class BetaRedactedThinkingBlock { $type = 'redacted_thinking'; $data; }
"redacted_thinking" type
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; }
"redacted_thinking" type
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 */ }
"refusal" type
?Category category

The policy category that triggered a refusal.

?string explanation

Human-readable explanation of the refusal.

This text is not guaranteed to be stable. null when no explanation is available for the category.

?string fallbackCreditToken

Opaque code that refunds the cache-miss cost when retrying this refused request on the fallback model. Pass it as fallback_credit_token on the retry request. Expires 5 minutes after the refusal.

The retry is sent either with the same request body (system, messages, tools, and other render-shaping fields), or with the same body plus one appended assistant message whose content is the partial text (with any trailing whitespace stripped from the final text block) and paired server-tool blocks from this refusal — which also authorizes that appended turn as an assistant-prefill continuation on models that otherwise disallow prefill. A token minted mid-server-tool-loop whose partial content was continuable may only be redeemed the second way — if a same-body retry is rejected with a 400 saying the token must be redeemed by continuing the partial response, retry the second way instead. Either way: same workspace, same platform; a mismatch is a 400. Resending a token for an already-warm prefix is permitted but yields no additional credit.

null when the refused model isn't eligible for a fallback credit.

?bool fallbackHasPrefillClaim

Whether the accompanying fallback_credit_token may be redeemed with the appended-assistant retry form. Only set when fallback_credit_token is present.

true: retry by resending the same request body plus one appended assistant message whose content is this response's content with any trailing whitespace stripped from the final text block and unpaired tool_use blocks omitted (the same appended-turn shape described on fallback_credit_token), with the token attached. false: retry by resending the original request body unchanged, with the token attached — the appended-assistant form is not available for this refusal (no continuable partial content, or the request uses output_format or a tool_choice that forces tool use). One exception: when the request used output_format or a forced tool_choice and the refusal arrived after server tools (including MCP connector tools) had already executed, the token may not be redeemable by either retry form; if the exact-body retry is then rejected with a 400 saying the token must be redeemed by continuing the partial response, discard the token and retry without it.

Advisory: if an appended-assistant retry is rejected with a 400 despite true, fall back to resending the original request body with the token.

?string recommendedModel

The server's suggested retry target for this refusal. Populated when a fallback attempt could not be made (the fallback model's rate limit was exhausted, or it was overloaded); names the fallback model the caller can retry directly. Null otherwise.

class BetaRequestDocumentBlock { $type = 'document'; $source; $cacheControl; /* 3 more */ }
"document" type
Source source
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?string context
?string title
class BetaRequestMCPServerToolConfiguration { $allowedTools; $enabled; }
?list<string> allowedTools
?bool enabled
class BetaRequestMCPServerURLDefinition { $type = 'url'; $name; $url; /* 2 more */ }
"url" type
string name
string url
?string authorizationToken
class BetaRequestMCPToolResultBlockParam { $type = 'mcp_tool_result'; $toolUseID; $cacheControl; /* 2 more */ }
"mcp_tool_result" type
string toolUseID
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?Content content
?bool isError
class BetaRequestToolAdditionBlock { $type = 'tool_addition'; $tool; $cacheControl; }
"tool_addition" type
Tool tool
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

class BetaRequestToolRemovalBlock { $type = 'tool_removal'; $tool; $cacheControl; }
"tool_removal" type
Tool tool
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

class BetaSearchResultBlockParam { $type = 'search_result'; $content; $source; /* 3 more */ }
"search_result" type
list<BetaTextBlockParam> content
string source
string title
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

class BetaServerToolCaller { $type = 'code_execution_20250825'; $toolID; }
"code_execution_20250825" type
string toolID
class BetaServerToolCaller20260120 { $type = 'code_execution_20260120'; $toolID; }
"code_execution_20260120" type
string toolID
class BetaServerToolUsage { $webFetchRequests; $webSearchRequests; }
int webFetchRequests

The number of web fetch tool requests.

int webSearchRequests

The number of web search tool requests.

class BetaServerToolUseBlock { $type = 'server_tool_use'; $id; $input; /* 2 more */ }
"server_tool_use" type
string id
array<string,mixed> input
Name name
?Caller caller
class BetaServerToolUseBlockParam { $type = 'server_tool_use'; $id; $input; /* 3 more */ }
"server_tool_use" type
string id
array<string,mixed> input
Name name
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?Caller caller
class BetaSignatureDelta { $type = 'signature_delta'; $signature; }
"signature_delta" type
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; }
Type type

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

string skillID

Skill ID

?string version

Skill version or 'latest' for most recent version

One of the following:
"end_turn"
"max_tokens"
"stop_sequence"
"tool_use"
"pause_turn"
"compaction"
"refusal"
"model_context_window_exceeded"
class BetaSummarizeCompaction { $type = 'summarize'; $instructions; }
"summarize" type
?string instructions

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

class BetaSystemMessageOutputConfig { $effort; }
?Effort effort

All possible effort levels.

class BetaTextBlock { $type = 'text'; $citations; $text; }
"text" type
?list<BetaTextCitation> citations

Citations supporting the text block.

The type of citation returned will depend on the type of document being cited. Citing a PDF results in page_location, plain text results in char_location, and content document results in content_block_location.

string text
class BetaTextBlockParam { $type = 'text'; $text; $cacheControl; $citations; }
"text" type
string text
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?list<BetaTextCitationParam> citations
One of the following:
One of the following:
class BetaTextDelta { $type = 'text_delta'; $text; }
"text_delta" type
string text
class BetaTextEditorCodeExecutionCreateResultBlock { $type = 'text_editor_code_execution_create_result'; $isFileUpdate; }
"text_editor_code_execution_create_result" type
bool isFileUpdate
class BetaTextEditorCodeExecutionCreateResultBlockParam { $type = 'text_editor_code_execution_create_result'; $isFileUpdate; }
"text_editor_code_execution_create_result" type
bool isFileUpdate
class BetaTextEditorCodeExecutionStrReplaceResultBlock { $type = 'text_editor_code_execution_str_replace_result'; $lines; $newLines; /* 3 more */ }
"text_editor_code_execution_str_replace_result" type
?list<string> lines
?int newLines
?int newStart
?int oldLines
?int oldStart
class BetaTextEditorCodeExecutionStrReplaceResultBlockParam { $type = 'text_editor_code_execution_str_replace_result'; $lines; $newLines; /* 3 more */ }
"text_editor_code_execution_str_replace_result" type
?list<string> lines
?int newLines
?int newStart
?int oldLines
?int oldStart
class BetaTextEditorCodeExecutionToolResultBlock { $type = 'text_editor_code_execution_tool_result'; $content; $toolUseID; }
"text_editor_code_execution_tool_result" type
Content content
string toolUseID
class BetaTextEditorCodeExecutionToolResultBlockParam { $type = 'text_editor_code_execution_tool_result'; $content; $toolUseID; $cacheControl; }
"text_editor_code_execution_tool_result" type
Content content
string toolUseID
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

class BetaTextEditorCodeExecutionToolResultError { $type = 'text_editor_code_execution_tool_result_error'; $errorCode; $errorMessage; }
"text_editor_code_execution_tool_result_error" type
ErrorCode errorCode
?string errorMessage
class BetaTextEditorCodeExecutionToolResultErrorParam { $type = 'text_editor_code_execution_tool_result_error'; $errorCode; $errorMessage; }
"text_editor_code_execution_tool_result_error" type
ErrorCode errorCode
?string errorMessage
class BetaTextEditorCodeExecutionViewResultBlock { $type = 'text_editor_code_execution_view_result'; $content; $fileType; /* 3 more */ }
"text_editor_code_execution_view_result" type
string content
FileType fileType
?int numLines
?int startLine
?int totalLines
class BetaTextEditorCodeExecutionViewResultBlockParam { $type = 'text_editor_code_execution_view_result'; $content; $fileType; /* 3 more */ }
"text_editor_code_execution_view_result" type
string content
FileType fileType
?int numLines
?int startLine
?int totalLines
class BetaThinkingBlock { $type = 'thinking'; $signature; $thinking; }
"thinking" type
string signature

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

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

See extended thinking for details.

string thinking

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

class BetaThinkingBlockBinding { $prefixMismatchBehavior; }
?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.

class BetaThinkingBlockParam { $type = 'thinking'; $signature; $thinking; }
"thinking" type
string signature

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

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

string thinking

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

class BetaThinkingConfigAdaptive { $type = 'adaptive'; $blockBinding; $display; }
"adaptive" type
?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.

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

class BetaThinkingConfigDisabled { $type = 'disabled'; }
"disabled" type
class BetaThinkingConfigEnabled { $type = 'enabled'; $budgetTokens; $blockBinding; $display; }
"enabled" type
int 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.

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

?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:
class BetaThinkingDelta { $type = 'thinking_delta'; $estimatedTokens; $thinking; }
"thinking_delta" type
?int estimatedTokens

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

string thinking

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

class BetaThinkingDroppedInputTransformation { $type = 'thinking_dropped'; $path; $reason; }
"thinking_dropped" type

Always thinking_dropped for this entry type.

string path

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

Reason reason

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

class BetaThinkingMismatchAllowedInputTransformation { $type = 'thinking_mismatch_allowed'; $path; $reason; }
"thinking_mismatch_allowed" type

Always thinking_mismatch_allowed for this entry type.

string path

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

Reason reason

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

One of the following:
"error"
"drop_block"
class BetaThinkingTurns { $type = 'thinking_turns'; $value; }
"thinking_turns" type
int value
class BetaTokenTaskBudget { $type = 'tokens'; $total; $remaining; }
"tokens" type

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

int total

Total token budget across all contexts in the session.

?int remaining

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

class BetaTool { $type; $inputSchema; $name; /* 7 more */ }
?Type type
InputSchema inputSchema

JSON schema for this tool's input.

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

string name

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?string description

Description of what this tool does.

Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.

?bool eagerInputStreaming

Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers.

?list<array<string,mixed>> inputExamples
?bool strict

When true, guarantees schema validation on tool names and inputs

class BetaToolBash20241022 { $type = 'bash_20241022'; $name; $allowedCallers; /* 4 more */ }
"bash_20241022" type
"bash" name

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?list<array<string,mixed>> inputExamples
?bool strict

When true, guarantees schema validation on tool names and inputs

class BetaToolBash20250124 { $type = 'bash_20250124'; $name; $allowedCallers; /* 4 more */ }
"bash_20250124" type
"bash" name

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?list<array<string,mixed>> inputExamples
?bool strict

When true, guarantees schema validation on tool names and inputs

class BetaToolChangeMCPToolReference { $type = 'mcp_tool_reference'; $name; $serverName; }
"mcp_tool_reference" type
string name
string serverName
class BetaToolChangeMCPToolsetReference { $type = 'mcp_toolset_reference'; $serverName; }
"mcp_toolset_reference" type
string serverName
class BetaToolChangeToolReference { $type = 'tool_reference'; $name; }
"tool_reference" type
string name
One of the following:
class BetaToolChoiceAny { $type = 'any'; $disableParallelToolUse; }
"any" type
?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; }
"auto" type
?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'; }
"none" type
class BetaToolChoiceTool { $type = 'tool'; $name; $disableParallelToolUse; }
"tool" type
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 */ }
"computer_20241022" type
int displayHeightPx

The height of the display in pixels.

int displayWidthPx

The width of the display in pixels.

"computer" name

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?int displayNumber

The X11 display number (e.g. 0, 1) for the display.

?list<array<string,mixed>> inputExamples
?bool strict

When true, guarantees schema validation on tool names and inputs

class BetaToolComputerUse20250124 { $type = 'computer_20250124'; $displayHeightPx; $displayWidthPx; /* 7 more */ }
"computer_20250124" type
int displayHeightPx

The height of the display in pixels.

int displayWidthPx

The width of the display in pixels.

"computer" name

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?int displayNumber

The X11 display number (e.g. 0, 1) for the display.

?list<array<string,mixed>> inputExamples
?bool strict

When true, guarantees schema validation on tool names and inputs

class BetaToolComputerUse20251124 { $type = 'computer_20251124'; $displayHeightPx; $displayWidthPx; /* 8 more */ }
"computer_20251124" type
int displayHeightPx

The height of the display in pixels.

int displayWidthPx

The width of the display in pixels.

"computer" name

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?int displayNumber

The X11 display number (e.g. 0, 1) for the display.

?bool enableZoom

Whether to enable an action to take a zoomed-in screenshot of the screen.

?list<array<string,mixed>> inputExamples
?bool strict

When true, guarantees schema validation on tool names and inputs

class BetaToolReferenceBlock { $type = 'tool_reference'; $toolName; }
"tool_reference" type
string toolName
class BetaToolReferenceBlockParam { $type = 'tool_reference'; $toolName; $cacheControl; }
"tool_reference" type
string toolName
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

class BetaToolResultBlockParam { $type = 'tool_result'; $toolUseID; $cacheControl; /* 3 more */ }
"tool_result" type
string toolUseID
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?Content content
?bool isError
?string toolsetName

For a toolset member tool_result, the toolset family of the paired tool_use.

class BetaToolSearchToolBm25_20251119 { $type; $name; $allowedCallers; /* 3 more */ }
Type type
"tool_search_tool_bm25" name

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?bool strict

When true, guarantees schema validation on tool names and inputs

class BetaToolSearchToolRegex20251119 { $type; $name; $allowedCallers; /* 3 more */ }
Type type
"tool_search_tool_regex" name

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?bool strict

When true, guarantees schema validation on tool names and inputs

class BetaToolSearchToolResultBlock { $type = 'tool_search_tool_result'; $content; $toolUseID; }
"tool_search_tool_result" type
Content content
string toolUseID
class BetaToolSearchToolResultBlockParam { $type = 'tool_search_tool_result'; $content; $toolUseID; $cacheControl; }
"tool_search_tool_result" type
Content content
string toolUseID
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

class BetaToolSearchToolResultError { $type = 'tool_search_tool_result_error'; $errorCode; $errorMessage; }
"tool_search_tool_result_error" type
ErrorCode errorCode
?string errorMessage
class BetaToolSearchToolResultErrorParam { $type = 'tool_search_tool_result_error'; $errorCode; $errorMessage; }
"tool_search_tool_result_error" type
ErrorCode errorCode
?string errorMessage
class BetaToolSearchToolSearchResultBlock { $type = 'tool_search_tool_search_result'; $toolReferences; }
"tool_search_tool_search_result" type
list<BetaToolReferenceBlock> toolReferences
class BetaToolSearchToolSearchResultBlockParam { $type = 'tool_search_tool_search_result'; $toolReferences; }
"tool_search_tool_search_result" type
list<BetaToolReferenceBlockParam> toolReferences
class BetaToolTextEditor20241022 { $type = 'text_editor_20241022'; $name; $allowedCallers; /* 4 more */ }
"text_editor_20241022" type
"str_replace_editor" name

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?list<array<string,mixed>> inputExamples
?bool strict

When true, guarantees schema validation on tool names and inputs

class BetaToolTextEditor20250124 { $type = 'text_editor_20250124'; $name; $allowedCallers; /* 4 more */ }
"text_editor_20250124" type
"str_replace_editor" name

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?list<array<string,mixed>> inputExamples
?bool strict

When true, guarantees schema validation on tool names and inputs

class BetaToolTextEditor20250429 { $type = 'text_editor_20250429'; $name; $allowedCallers; /* 4 more */ }
"text_editor_20250429" type
"str_replace_based_edit_tool" name

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?list<array<string,mixed>> inputExamples
?bool strict

When true, guarantees schema validation on tool names and inputs

class BetaToolTextEditor20250728 { $type = 'text_editor_20250728'; $name; $allowedCallers; /* 5 more */ }
"text_editor_20250728" type
"str_replace_based_edit_tool" name

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?list<array<string,mixed>> inputExamples
?int maxCharacters

Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.

?bool strict

When true, guarantees schema validation on tool names and inputs

class BetaToolUnion
One of the following:
class BetaToolUseBlock { $type = 'tool_use'; $id; $input; /* 3 more */ }
"tool_use" type
string id
array<string,mixed> input
string name
?Caller caller
?string toolsetName

For a toolset member tool_use, the toolset family.

class BetaToolUseBlockParam { $type = 'tool_use'; $id; $input; /* 4 more */ }
"tool_use" type
string id
array<string,mixed> input
string name
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?Caller caller
?string toolsetName

For a toolset member tool_use, the toolset family this member belongs to.

class BetaToolUsesKeep { $type = 'tool_uses'; $value; }
"tool_uses" type
int value
class BetaToolUsesTrigger { $type = 'tool_uses'; $value; }
"tool_uses" type
int value
class BetaURLImageSource { $type = 'url'; $url; }
"url" type
string url
class BetaURLPDFSource { $type = 'url'; $url; }
"url" type
string url
class BetaUsage { $cacheCreation; $cacheCreationInputTokens; $cacheReadInputTokens; /* 9 more */ }
class BetaUserLocation { $type = 'approximate'; $city; $country; /* 2 more */ }
"approximate" type
?string city

The city of the user.

?string country

The two letter ISO country code of the user.

?string region

The region of the user.

?string timezone

The IANA timezone of the user.

class BetaWebFetchBlock { $type = 'web_fetch_result'; $content; $retrievedAt; $url; }
"web_fetch_result" type
?string retrievedAt

ISO 8601 timestamp when the content was retrieved

string url

Fetched content URL

class BetaWebFetchBlockParam { $type = 'web_fetch_result'; $content; $url; $retrievedAt; }
"web_fetch_result" type
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 */ }
class BetaWebFetchTool20260318 { $type = 'web_fetch_20260318'; $name; $allowedCallers; /* 11 more */ }
class BetaWebFetchToolResultBlock { $type = 'web_fetch_tool_result'; $content; $toolUseID; $caller; }
"web_fetch_tool_result" type
Content content
string toolUseID
?Caller caller
class BetaWebFetchToolResultBlockParam { $type = 'web_fetch_tool_result'; $content; $toolUseID; /* 2 more */ }
"web_fetch_tool_result" type
Content content
string toolUseID
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?Caller caller
class BetaWebFetchToolResultErrorBlock { $type = 'web_fetch_tool_result_error'; $errorCode; }
"web_fetch_tool_result_error" type
class BetaWebFetchToolResultErrorBlockParam { $type = 'web_fetch_tool_result_error'; $errorCode; }
"web_fetch_tool_result_error" type
One of the following:
"invalid_tool_input"
"url_too_long"
"url_not_allowed"
"url_not_in_prior_context"
"url_not_accessible"
"unsupported_content_type"
"too_many_requests"
"max_uses_exceeded"
"unavailable"
"content_too_large"
class BetaWebFetchURLSourceAll { $type = 'all'; }
"all" type
class BetaWebFetchURLSourceExcept { $type = 'except'; $tools; }
"except" type
class BetaWebFetchURLSourceNone { $type = 'none'; }
"none" type
class BetaWebFetchURLSourceOnly { $type = 'only'; $tools; }
"only" type
class BetaWebFetchURLSourceToolReference { $type = 'tool_reference'; $name; }
"tool_reference" type
string name
class BetaWebFetchURLSources { $clientToolResults; $serverToolResults; $userInput; }
?ClientToolResults clientToolResults

Which client tools' results contribute fetchable URLs: "all", "none", or an only or except list of client tool names from tools[].

?ServerToolResults serverToolResults

Which server tools' results contribute fetchable URLs: "all", "none", or an only or except list of server tool names from tools[]; only web_search and web_fetch results ever contribute.

?UserInput userInput

Whether URLs in user messages are fetchable: "all" or "none".

class BetaWebSearchResultBlock { $type = 'web_search_result'; $encryptedContent; $pageAge; /* 2 more */ }
"web_search_result" type
string encryptedContent
?string pageAge
string title
string url
class BetaWebSearchResultBlockParam { $type = 'web_search_result'; $encryptedContent; $title; /* 2 more */ }
"web_search_result" type
string encryptedContent
string title
string url
?string pageAge
class BetaWebSearchTool20250305 { $type = 'web_search_20250305'; $name; $allowedCallers; /* 7 more */ }
"web_search_20250305" type
"web_search" name

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?list<string> allowedDomains

If provided, only these domains will be included in results. Cannot be used alongside blocked_domains.

?list<string> blockedDomains

If provided, these domains will never appear in results. Cannot be used alongside allowed_domains.

?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?int maxUses

Maximum number of times the tool can be used in the API request.

?bool strict

When true, guarantees schema validation on tool names and inputs

?BetaUserLocation userLocation

Parameters for the user's location. Used to provide more relevant search results.

class BetaWebSearchTool20260209 { $type = 'web_search_20260209'; $name; $allowedCallers; /* 7 more */ }
"web_search_20260209" type
"web_search" name

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

?list<AllowedCaller> allowedCallers
?list<string> allowedDomains

If provided, only these domains will be included in results. Cannot be used alongside blocked_domains.

?list<string> blockedDomains

If provided, these domains will never appear in results. Cannot be used alongside allowed_domains.

?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?bool deferLoading

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

?int maxUses

Maximum number of times the tool can be used in the API request.

?bool strict

When true, guarantees schema validation on tool names and inputs

?BetaUserLocation userLocation

Parameters for the user's location. Used to provide more relevant search results.

class BetaWebSearchTool20260318 { $type = 'web_search_20260318'; $name; $allowedCallers; /* 8 more */ }
class BetaWebSearchToolRequestError { $type = 'web_search_tool_result_error'; $errorCode; }
"web_search_tool_result_error" type
class BetaWebSearchToolResultBlock { $type = 'web_search_tool_result'; $content; $toolUseID; $caller; }
"web_search_tool_result" type
string toolUseID
?Caller caller
One of the following:
class BetaWebSearchToolResultError { $type = 'web_search_tool_result_error'; $errorCode; }
"web_search_tool_result_error" type
class list<BetaWebSearchResultBlock> { $type = 'web_search_result'; $encryptedContent; $pageAge; /* 2 more */ }
"web_search_result" type
string encryptedContent
?string pageAge
string title
string url
class BetaWebSearchToolResultBlockParam { $type = 'web_search_tool_result'; $content; $toolUseID; /* 2 more */ }
"web_search_tool_result" type
string toolUseID
?BetaCacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?Caller caller
One of the following:
class list<BetaWebSearchResultBlockParam> { $type = 'web_search_result'; $encryptedContent; $title; /* 2 more */ }
"web_search_result" type
string encryptedContent
string title
string url
?string pageAge
class BetaWebSearchToolRequestError { $type = 'web_search_tool_result_error'; $errorCode; }
"web_search_tool_result_error" type
class BetaWebSearchToolResultError { $type = 'web_search_tool_result_error'; $errorCode; }
"web_search_tool_result_error" type
One of the following:
"invalid_tool_input"
"unavailable"
"max_uses_exceeded"
"too_many_requests"
"query_too_long"
"request_too_large"

NachrichtenBatches

Einen Message Batch erstellen
$client->beta->messages->batches->create(list<Request> requests, ?list<AnthropicBeta> betas, ?string userProfileID, ?string workspaceID): MessageBatch
POST/v1/messages/batches

Sende einen Batch von Anfragen zur Erstellung von Nachrichten.

Einen Message Batch abrufen
$client->beta->messages->batches->retrieve(string messageBatchID, ?list<AnthropicBeta> betas, ?string workspaceID): MessageBatch
GET/v1/messages/batches/{message_batch_id}

Dieser Endpunkt ist idempotent und kann verwendet werden, um den Abschluss eines Message Batch per Polling abzufragen. Um auf die Ergebnisse eines Message Batch zuzugreifen, sende eine Anfrage an die im Feld results_url der Antwort angegebene URL.

Message Batches auflisten
$client->beta->messages->batches->list(?string afterID, ?string beforeID, ?int limit, ?list<AnthropicBeta> betas, ?string workspaceID): Page<MessageBatch>
GET/v1/messages/batches

Liste alle Message Batches innerhalb eines Workspace auf. Die zuletzt erstellten Batches werden zuerst zurückgegeben.

Einen Message Batch abbrechen
$client->beta->messages->batches->cancel(string messageBatchID, ?list<AnthropicBeta> betas, ?string workspaceID): MessageBatch
POST/v1/messages/batches/{message_batch_id}/cancel

Batches können jederzeit vor Ende der Verarbeitung abgebrochen werden. Sobald der Abbruch eingeleitet wurde, wechselt der Batch in den Zustand canceling; in dieser Zeit kann das System laufende, nicht unterbrechbare Anfragen noch abschließen, bevor der Abbruch finalisiert wird.

Einen Message Batch löschen
$client->beta->messages->batches->delete(string messageBatchID, ?list<AnthropicBeta> betas, ?string workspaceID): DeletedMessageBatch
DELETE/v1/messages/batches/{message_batch_id}

Lösche einen Message Batch.

Ergebnisse eines Message Batch abrufen
$client->beta->messages->batches->results(string messageBatchID, ?list<AnthropicBeta> betas, ?string workspaceID): MessageBatchIndividualResponse
GET/v1/messages/batches/{message_batch_id}/results

Streamt die Ergebnisse eines Message Batch als .jsonl-Datei.