Claude Platform Docs

Messages

Créer un message
$client->messages->create(int maxTokens, list<MessageParam> messages, Model model, ?CacheControlEphemeral cacheControl, ?MessageCreateParamsContainer container, ?string inferenceGeo, ?Metadata metadata, ?OutputConfig outputConfig, ?ServiceTier serviceTier, ?list<string> stopSequences, ?System system, ?float temperature, ?ThinkingConfigParam thinking, ?ToolChoice toolChoice, ?list<ToolUnion> tools, ?int topK, ?float topP, ?string userProfileID, ?string workspaceID): Message
POST/v1/messages

Envoyez une liste structurée de messages d'entrée contenant du texte et/ou des images, et le modèle générera le message suivant de la conversation.

Compter les tokens d'un message
$client->messages->countTokens(list<MessageParam> messages, Model model, ?CacheControlEphemeral cacheControl, ?OutputConfig outputConfig, ?System system, ?ThinkingConfigParam thinking, ?ToolChoice toolChoice, ?list<MessageCountTokensTool> tools, ?string userProfileID, ?string workspaceID): MessageTokensCount
POST/v1/messages/count_tokens

Compter le nombre de tokens dans un message.

Models
class Base64ImageSource { $type = 'base64'; $data; $mediaType; }
"base64" type
string data
MediaType mediaType
class Base64PDFSource { $type = 'base64'; $data; $mediaType; }
"base64" type
string data
"application/pdf" mediaType
class BashCodeExecutionOutputBlock { $type = 'bash_code_execution_output'; $fileID; }
"bash_code_execution_output" type
string fileID
class BashCodeExecutionOutputBlockParam { $type = 'bash_code_execution_output'; $fileID; }
"bash_code_execution_output" type
string fileID
class BashCodeExecutionResultBlock { $type = 'bash_code_execution_result'; $content; $returnCode; /* 2 more */ }
"bash_code_execution_result" type
int returnCode
string stderr
string stdout
class BashCodeExecutionResultBlockParam { $type = 'bash_code_execution_result'; $content; $returnCode; /* 2 more */ }
"bash_code_execution_result" type
int returnCode
string stderr
string stdout
class BashCodeExecutionToolResultBlock { $type = 'bash_code_execution_tool_result'; $content; $toolUseID; }
"bash_code_execution_tool_result" type
Content content
string toolUseID
class BashCodeExecutionToolResultBlockParam { $type = 'bash_code_execution_tool_result'; $content; $toolUseID; $cacheControl; }
"bash_code_execution_tool_result" type
Content content
string toolUseID
?CacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

class BashCodeExecutionToolResultError { $type = 'bash_code_execution_tool_result_error'; $errorCode; }
"bash_code_execution_tool_result_error" type
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
"output_file_too_large"
class BashCodeExecutionToolResultErrorParam { $type = 'bash_code_execution_tool_result_error'; $errorCode; }
"bash_code_execution_tool_result_error" type
class BrowserCloseTabConfig { $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 BrowserDoubleClickConfig { $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 BrowserFileUploadConfig { $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 BrowserFindConfig { $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 BrowserFormInputConfig { $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 BrowserGetPageTextConfig { $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 BrowserHoldKeyConfig { $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 BrowserHoverConfig { $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 BrowserJavascriptExecConfig { $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 BrowserKeyConfig { $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 BrowserLeftClickConfig { $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 BrowserLeftClickDragConfig { $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 BrowserLeftMouseDownConfig { $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 BrowserLeftMouseUpConfig { $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 BrowserListTabsConfig { $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 BrowserMiddleClickConfig { $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 BrowserMouseMoveConfig { $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 BrowserNavigateConfig { $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 BrowserNewTabConfig { $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 BrowserReadConsoleConfig { $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 BrowserReadNetworkConfig { $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 BrowserReadPageConfig { $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 BrowserRightClickConfig { $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 BrowserScreenshotConfig { $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 BrowserScrollConfig { $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 BrowserScrollToConfig { $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 BrowserStateBlockParam { $type = 'browser_state'; $tabs; $cacheControl; $stateChanges; }
"browser_state" type
list<BrowserStateTabEntry> tabs

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.

?CacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?list<BrowserStateChange> 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 BrowserStateChangeDownloadCompleted { $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 BrowserStateChangeDownloadFailed { $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 BrowserStateChangeDownloadStarted { $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 BrowserStateChangeTabOpened { $type = 'tab_opened'; $tabID; }
"tab_opened" type
string tabID

The tab_id of the opened tab, present in tabs.

class BrowserStateTabEntry { $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 BrowserSwitchTabConfig { $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 BrowserToolset20260801 { $type = 'browser_toolset_20260801'; $cacheControl; $configs; }
"browser_toolset_20260801" type
?CacheControlEphemeral 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 BrowserToolsetConfigs { $type; $closeTab; $doubleClick; /* 28 more */ }
class BrowserTripleClickConfig { $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 BrowserTypeConfig { $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 BrowserWaitConfig { $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 BrowserZoomConfig { $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 CacheControlEphemeral { $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 CacheCreation { $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 CitationCharLocation { $type = 'char_location'; $citedText; $documentIndex; /* 4 more */ }
"char_location" type
string citedText
int documentIndex
?string documentTitle
int endCharIndex
?string fileID
int startCharIndex
class CitationCharLocationParam { $type = 'char_location'; $citedText; $documentIndex; /* 3 more */ }
"char_location" type
string citedText
int documentIndex
?string documentTitle
int endCharIndex
int startCharIndex
class CitationContentBlockLocation { $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 CitationContentBlockLocationParam { $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 CitationPageLocation { $type = 'page_location'; $citedText; $documentIndex; /* 4 more */ }
"page_location" type
string citedText
int documentIndex
?string documentTitle
int endPageNumber
?string fileID
int startPageNumber
class CitationPageLocationParam { $type = 'page_location'; $citedText; $documentIndex; /* 3 more */ }
"page_location" type
string citedText
int documentIndex
?string documentTitle
int endPageNumber
int startPageNumber
class CitationSearchResultLocationParam { $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 CitationWebSearchResultLocationParam { $type = 'web_search_result_location'; $citedText; $encryptedIndex; /* 2 more */ }
"web_search_result_location" type
string citedText
string encryptedIndex
?string title
string url
class CitationsConfig { $enabled; }
bool enabled
class CitationsConfigParam { $enabled; }
?bool enabled
class CitationsDelta { $type = 'citations_delta'; $citation; }
"citations_delta" type
Citation citation
class CitationsSearchResultLocation { $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 CitationsWebSearchResultLocation { $type = 'web_search_result_location'; $citedText; $encryptedIndex; /* 2 more */ }
"web_search_result_location" type
string citedText
string encryptedIndex
?string title
string url
class CodeExecutionOutputBlock { $type = 'code_execution_output'; $fileID; }
"code_execution_output" type
string fileID
class CodeExecutionOutputBlockParam { $type = 'code_execution_output'; $fileID; }
"code_execution_output" type
string fileID
class CodeExecutionResultBlock { $type = 'code_execution_result'; $content; $returnCode; /* 2 more */ }
"code_execution_result" type
list<CodeExecutionOutputBlock> content
int returnCode
string stderr
string stdout
class CodeExecutionResultBlockParam { $type = 'code_execution_result'; $content; $returnCode; /* 2 more */ }
"code_execution_result" type
int returnCode
string stderr
string stdout
class CodeExecutionTool20250522 { $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
?CacheControlEphemeral 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 CodeExecutionTool20250825 { $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
?CacheControlEphemeral 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 CodeExecutionTool20260120 { $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
?CacheControlEphemeral 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 CodeExecutionTool20260521 { $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
?CacheControlEphemeral 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 CodeExecutionToolResultBlock { $type = 'code_execution_tool_result'; $content; $toolUseID; }
"code_execution_tool_result" type
string toolUseID
One of the following:
class CodeExecutionToolResultBlockParam { $type = 'code_execution_tool_result'; $content; $toolUseID; $cacheControl; }
"code_execution_tool_result" type
string toolUseID
?CacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

One of the following:
class CodeExecutionToolResultError { $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 CodeExecutionToolResultErrorParam { $type = 'code_execution_tool_result_error'; $errorCode; }
"code_execution_tool_result_error" type
class ComputerCursorPositionConfig { $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 ComputerDoubleClickConfig { $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 ComputerHoldKeyConfig { $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 ComputerKeyConfig { $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 ComputerLeftClickConfig { $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 ComputerLeftClickDragConfig { $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 ComputerLeftMouseDownConfig { $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 ComputerLeftMouseUpConfig { $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 ComputerMiddleClickConfig { $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 ComputerMouseMoveConfig { $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 ComputerRightClickConfig { $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 ComputerScreenshotConfig { $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 ComputerScrollConfig { $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 ComputerToolset20260801 { $type = 'computer_toolset_20260801'; $cacheControl; $configs; }
"computer_toolset_20260801" type
?CacheControlEphemeral 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 ComputerToolsetConfigs { $type; $cursorPosition; $doubleClick; /* 14 more */ }
class ComputerTripleClickConfig { $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 ComputerTypeConfig { $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 ComputerWaitConfig { $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 ComputerZoomConfig { $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 Container { $id; $expiresAt; $skills; }
string id

Identifier for the container used in this request

\Datetime expiresAt

The time at which the container will expire.

?list<ContainerSkill> skills

Skills loaded in the container

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

Container id

?list<SkillParams> skills

List of skills to load in the container

class ContainerSkill { $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 ContainerUploadBlock { $type = 'container_upload'; $fileID; }
"container_upload" type
string fileID
class ContainerUploadBlockParam { $type = 'container_upload'; $fileID; $cacheControl; }
"container_upload" type
string fileID
?CacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

class ContentBlock
One of the following:
One of the following:
class ContentBlockSource { $type = 'content'; $content; }
"content" type
Content content
One of the following:
class DirectCaller { $type = 'direct'; }
"direct" type
class DocumentBlock { $type = 'document'; $citations; $source; $title; }
"document" type
?CitationsConfig citations

Citation configuration for the document

Source source
?string title

The title of the document

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

Create a cache control breakpoint at this content block.

?CitationsConfigParam citations
?string context
?string title
class EncryptedCodeExecutionResultBlock { $type = 'encrypted_code_execution_result'; $content; $encryptedStdout; /* 2 more */ }
"encrypted_code_execution_result" type
list<CodeExecutionOutputBlock> content
string encryptedStdout
int returnCode
string stderr
class EncryptedCodeExecutionResultBlockParam { $type = 'encrypted_code_execution_result'; $content; $encryptedStdout; /* 2 more */ }
"encrypted_code_execution_result" type
string encryptedStdout
int returnCode
string stderr
class FileDocumentSource { $type = 'file'; $fileID; }
"file" type
string fileID
class FileImageSource { $type = 'file'; $fileID; }
"file" type
string fileID
class ImageBlockParam { $type = 'image'; $source; $cacheControl; $transformations; }
"image" type
Source source
?CacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?ImageTransformationsParam 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 ImageTransformationsParam { $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 InputJSONDelta { $type = 'input_json_delta'; $partialJSON; }
"input_json_delta" type
string partialJSON
class JSONOutputFormat { $type = 'json_schema'; $schema; }
"json_schema" type
array<string,mixed> schema

The JSON schema of the format

class MemoryTool20250818 { $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
?CacheControlEphemeral 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 Message { $type = 'message'; $id; $container; /* 7 more */ }
One of the following:
One of the following:
class ContainerParams { $id; $skills; }
?string id

Container id

?list<SkillParams> skills

List of skills to load in the container

string
class MessageDeltaUsage { $cacheCreationInputTokens; $cacheReadInputTokens; $inputTokens; /* 3 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.

?int inputTokens

The cumulative number of input tokens which were used.

int outputTokens

The cumulative number of output tokens which were used.

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

?ServerToolUsage serverToolUse

The number of server tool requests.

class MessageParam { $content; $role; }
Content content
Role role
class MessageTokensCount { $inputTokens; }
int inputTokens

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

class Metadata { $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.

enum Model
One of the following:
"claude-fable-5-1"

Frontier intelligence for ambitious tasks across coding, scientific discovery, and enterprise workflows

"claude-mythos-5-1"

Our most capable model for cybersecurity and biology research, available through trusted access programs

"claude-sonnet-5"

High-performance model for coding and agents

"claude-fable-5"

Next generation of intelligence for the hardest knowledge work and coding problems

"claude-mythos-5"

Most capable model for cybersecurity and biology research

"claude-opus-5"

Powerful intelligence for long-running agents and coding

"claude-opus-4-8"

Powerful intelligence for long-running agents and coding

"claude-opus-4-7"

Powerful intelligence for long-running agents and coding

"claude-mythos-preview"

New class of intelligence, strongest in coding and cybersecurity

"claude-opus-4-6"

Powerful intelligence for long-running agents and coding

"claude-sonnet-4-6"

Best combination of speed and intelligence

"claude-haiku-4-5"

Fastest model with near-frontier intelligence

"claude-haiku-4-5-20251001"

Fastest model with near-frontier intelligence

"claude-opus-4-5"

Powerful intelligence for long-running agents and coding

"claude-opus-4-5-20251101"

Powerful intelligence for long-running agents and coding

"claude-sonnet-4-5"

High-performance model for agents and coding

"claude-sonnet-4-5-20250929"

High-performance model for agents and coding

class OutputConfig { $effort; $format; }
?Effort effort

All possible effort levels.

?JSONOutputFormat format

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

class OutputTokensDetails { $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 PlainTextSource { $type = 'text'; $data; $mediaType; }
"text" type
string data
"text/plain" mediaType
One of the following:
class RawContentBlockDeltaEvent { $type = 'content_block_delta'; $delta; $index; }
"content_block_delta" type
int index
class RawContentBlockStartEvent { $type = 'content_block_start'; $contentBlock; $index; }
"content_block_start" type
ContentBlock contentBlock
int index
class RawContentBlockStopEvent { $type = 'content_block_stop'; $index; }
"content_block_stop" type
int index
class RawMessageDeltaEvent { $type = 'message_delta'; $delta; $usage; }
"message_delta" type
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.

class RawMessageStartEvent { $type = 'message_start'; $message; }
"message_start" type
Message message
class RawMessageStopEvent { $type = 'message_stop'; }
"message_stop" type
One of the following:
class RedactedThinkingBlock { $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 RedactedThinkingBlockParam { $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 RefusalStopDetails { $type = 'refusal'; $category; $explanation; }
"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.

class SearchResultBlockParam { $type = 'search_result'; $content; $source; /* 3 more */ }
"search_result" type
list<TextBlockParam> content
string source
string title
?CacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?CitationsConfigParam citations
class ServerToolCaller { $type = 'code_execution_20250825'; $toolID; }
"code_execution_20250825" type
string toolID
class ServerToolCaller20260120 { $type = 'code_execution_20260120'; $toolID; }
"code_execution_20260120" type
string toolID
class ServerToolUsage { $webFetchRequests; $webSearchRequests; }
int webFetchRequests

The number of web fetch tool requests.

int webSearchRequests

The number of web search tool requests.

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

Create a cache control breakpoint at this content block.

?Caller caller
class SignatureDelta { $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 SkillParams { $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

enum StopReason
One of the following:
"end_turn"
"max_tokens"
"stop_sequence"
"tool_use"
"pause_turn"
"refusal"
"model_context_window_exceeded"
class TextBlock { $type = 'text'; $citations; $text; }
"text" type
?list<TextCitation> 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 TextBlockParam { $type = 'text'; $text; $cacheControl; $citations; }
"text" type
string text
?CacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?list<TextCitationParam> citations
class TextCitation
One of the following:
One of the following:
class TextDelta { $type = 'text_delta'; $text; }
"text_delta" type
string text
class TextEditorCodeExecutionCreateResultBlock { $type = 'text_editor_code_execution_create_result'; $isFileUpdate; }
"text_editor_code_execution_create_result" type
bool isFileUpdate
class TextEditorCodeExecutionCreateResultBlockParam { $type = 'text_editor_code_execution_create_result'; $isFileUpdate; }
"text_editor_code_execution_create_result" type
bool isFileUpdate
class TextEditorCodeExecutionStrReplaceResultBlock { $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 TextEditorCodeExecutionStrReplaceResultBlockParam { $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 TextEditorCodeExecutionToolResultBlock { $type = 'text_editor_code_execution_tool_result'; $content; $toolUseID; }
"text_editor_code_execution_tool_result" type
Content content
string toolUseID
class TextEditorCodeExecutionToolResultBlockParam { $type = 'text_editor_code_execution_tool_result'; $content; $toolUseID; $cacheControl; }
"text_editor_code_execution_tool_result" type
Content content
string toolUseID
?CacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

class TextEditorCodeExecutionToolResultError { $type = 'text_editor_code_execution_tool_result_error'; $errorCode; $errorMessage; }
"text_editor_code_execution_tool_result_error" type
?string errorMessage
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
"file_not_found"
class TextEditorCodeExecutionToolResultErrorParam { $type = 'text_editor_code_execution_tool_result_error'; $errorCode; $errorMessage; }
"text_editor_code_execution_tool_result_error" type
?string errorMessage
class TextEditorCodeExecutionViewResultBlock { $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 TextEditorCodeExecutionViewResultBlockParam { $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 ThinkingBlock { $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 ThinkingBlockParam { $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 ThinkingConfigAdaptive { $type = 'adaptive'; $display; }
"adaptive" type
?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 ThinkingConfigDisabled { $type = 'disabled'; }
"disabled" type
class ThinkingConfigEnabled { $type = 'enabled'; $budgetTokens; $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.

?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 ThinkingConfigEnabled { $type = 'enabled'; $budgetTokens; $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.

?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 ThinkingConfigDisabled { $type = 'disabled'; }
"disabled" type
class ThinkingConfigAdaptive { $type = 'adaptive'; $display; }
"adaptive" type
?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 ThinkingDelta { $type = 'thinking_delta'; $thinking; }
"thinking_delta" type
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 Tool { $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
?CacheControlEphemeral 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 ToolBash20250124 { $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
?CacheControlEphemeral 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 ToolChoice
One of the following:
class ToolChoiceAny { $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 ToolChoiceAuto { $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 ToolChoiceNone { $type = 'none'; }
"none" type
class ToolChoiceTool { $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 ToolReferenceBlock { $type = 'tool_reference'; $toolName; }
"tool_reference" type
string toolName
class ToolReferenceBlockParam { $type = 'tool_reference'; $toolName; $cacheControl; }
"tool_reference" type
string toolName
?CacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

class ToolResultBlockParam { $type = 'tool_result'; $toolUseID; $cacheControl; /* 3 more */ }
"tool_result" type
string toolUseID
?CacheControlEphemeral 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 ToolSearchToolBm25_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
?CacheControlEphemeral 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 ToolSearchToolRegex20251119 { $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
?CacheControlEphemeral 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 ToolSearchToolResultBlock { $type = 'tool_search_tool_result'; $content; $toolUseID; }
"tool_search_tool_result" type
Content content
string toolUseID
class ToolSearchToolResultBlockParam { $type = 'tool_search_tool_result'; $content; $toolUseID; $cacheControl; }
"tool_search_tool_result" type
Content content
string toolUseID
?CacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

class ToolSearchToolResultError { $type = 'tool_search_tool_result_error'; $errorCode; $errorMessage; }
"tool_search_tool_result_error" type
?string errorMessage
One of the following:
"invalid_tool_input"
"unavailable"
"too_many_requests"
"execution_time_exceeded"
class ToolSearchToolResultErrorParam { $type = 'tool_search_tool_result_error'; $errorCode; $errorMessage; }
"tool_search_tool_result_error" type
?string errorMessage
class ToolSearchToolSearchResultBlock { $type = 'tool_search_tool_search_result'; $toolReferences; }
"tool_search_tool_search_result" type
list<ToolReferenceBlock> toolReferences
class ToolSearchToolSearchResultBlockParam { $type = 'tool_search_tool_search_result'; $toolReferences; }
"tool_search_tool_search_result" type
list<ToolReferenceBlockParam> toolReferences
class ToolTextEditor20250124 { $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
?CacheControlEphemeral 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 ToolTextEditor20250429 { $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
?CacheControlEphemeral 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 ToolTextEditor20250728 { $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
?CacheControlEphemeral 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 ToolUnion
One of the following:
class ToolUseBlock { $type = 'tool_use'; $id; $caller; /* 3 more */ }
"tool_use" type
string id
Caller caller
array<string,mixed> input
string name
?string toolsetName

For a toolset member tool_use, the toolset family.

class ToolUseBlockParam { $type = 'tool_use'; $id; $input; /* 4 more */ }
"tool_use" type
string id
array<string,mixed> input
string name
?CacheControlEphemeral 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 URLImageSource { $type = 'url'; $url; }
"url" type
string url
class URLPDFSource { $type = 'url'; $url; }
"url" type
string url
class Usage { $cacheCreation; $cacheCreationInputTokens; $cacheReadInputTokens; /* 6 more */ }
?CacheCreation 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.

?string inferenceGeo

The geographic region where inference was performed for this request.

int inputTokens

The number of input tokens which were used.

int outputTokens

The number of output tokens which were used.

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

?ServerToolUsage serverToolUse

The number of server tool requests.

?ServiceTier serviceTier

If the request used the priority, standard, or batch tier.

class UserLocation { $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 WebFetchBlock { $type = 'web_fetch_result'; $content; $retrievedAt; $url; }
"web_fetch_result" type
DocumentBlock content
?string retrievedAt

ISO 8601 timestamp when the content was retrieved

string url

Fetched content URL

class WebFetchBlockParam { $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 WebFetchTool20250910 { $type = 'web_fetch_20250910'; $name; $allowedCallers; /* 9 more */ }
class WebFetchTool20260209 { $type = 'web_fetch_20260209'; $name; $allowedCallers; /* 9 more */ }
class WebFetchTool20260309 { $type = 'web_fetch_20260309'; $name; $allowedCallers; /* 10 more */ }
class WebFetchTool20260318 { $type = 'web_fetch_20260318'; $name; $allowedCallers; /* 11 more */ }
class WebFetchToolResultBlock { $type = 'web_fetch_tool_result'; $caller; $content; $toolUseID; }
"web_fetch_tool_result" type
Caller caller
Content content
string toolUseID
class WebFetchToolResultBlockParam { $type = 'web_fetch_tool_result'; $content; $toolUseID; /* 2 more */ }
"web_fetch_tool_result" type
Content content
string toolUseID
?CacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?Caller caller
class WebFetchToolResultErrorBlock { $type = 'web_fetch_tool_result_error'; $errorCode; }
"web_fetch_tool_result_error" type
class WebFetchToolResultErrorBlockParam { $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 WebFetchURLSourceAll { $type = 'all'; }
"all" type
class WebFetchURLSourceExcept { $type = 'except'; $tools; }
"except" type
class WebFetchURLSourceNone { $type = 'none'; }
"none" type
class WebFetchURLSourceOnly { $type = 'only'; $tools; }
"only" type
class WebFetchURLSourceToolReference { $type = 'tool_reference'; $name; }
"tool_reference" type
string name
class WebFetchURLSources { $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 WebSearchResultBlock { $type = 'web_search_result'; $encryptedContent; $pageAge; /* 2 more */ }
"web_search_result" type
string encryptedContent
?string pageAge
string title
string url
class WebSearchResultBlockParam { $type = 'web_search_result'; $encryptedContent; $title; /* 2 more */ }
"web_search_result" type
string encryptedContent
string title
string url
?string pageAge
class WebSearchTool20250305 { $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.

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

?UserLocation userLocation

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

class WebSearchTool20260209 { $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.

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

?UserLocation userLocation

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

class WebSearchTool20260318 { $type = 'web_search_20260318'; $name; $allowedCallers; /* 8 more */ }
class WebSearchToolRequestError { $type = 'web_search_tool_result_error'; $errorCode; }
"web_search_tool_result_error" type
class WebSearchToolResultBlock { $type = 'web_search_tool_result'; $caller; $content; $toolUseID; }
"web_search_tool_result" type
Caller caller
string toolUseID
One of the following:
class WebSearchToolResultError { $type = 'web_search_tool_result_error'; $errorCode; }
"web_search_tool_result_error" type
class list<WebSearchResultBlock> { $type = 'web_search_result'; $encryptedContent; $pageAge; /* 2 more */ }
"web_search_result" type
string encryptedContent
?string pageAge
string title
string url
class WebSearchToolResultBlockParam { $type = 'web_search_tool_result'; $content; $toolUseID; /* 2 more */ }
"web_search_tool_result" type
string toolUseID
?CacheControlEphemeral cacheControl

Create a cache control breakpoint at this content block.

?Caller caller
One of the following:
class list<WebSearchResultBlockParam> { $type = 'web_search_result'; $encryptedContent; $title; /* 2 more */ }
"web_search_result" type
string encryptedContent
string title
string url
?string pageAge
class WebSearchToolRequestError { $type = 'web_search_tool_result_error'; $errorCode; }
"web_search_tool_result_error" type
class WebSearchToolResultError { $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"

MessagesLots

Créer un lot de messages
$client->messages->batches->create(list<Request> requests, ?string userProfileID, ?string workspaceID): MessageBatch
POST/v1/messages/batches

Envoyez un lot de requêtes de création de messages.

Récupérer un lot de messages
$client->messages->batches->retrieve(string messageBatchID, ?string workspaceID): MessageBatch
GET/v1/messages/batches/{message_batch_id}

Ce point de terminaison est idempotent et peut être utilisé pour interroger l'état d'achèvement d'un lot de messages. Pour accéder aux résultats d'un lot de messages, effectuez une requête vers l'URL indiquée dans le champ results_url de la réponse.

Lister les lots de messages
$client->messages->batches->list(?string afterID, ?string beforeID, ?int limit, ?string workspaceID): Page<MessageBatch>
GET/v1/messages/batches

Lister tous les lots de messages d'un espace de travail. Les lots créés le plus récemment sont renvoyés en premier.

Annuler un lot de messages
$client->messages->batches->cancel(string messageBatchID, ?string workspaceID): MessageBatch
POST/v1/messages/batches/{message_batch_id}/cancel

Les lots peuvent être annulés à tout moment avant la fin du traitement. Une fois l'annulation lancée, le lot passe à l'état canceling, pendant lequel le système peut terminer les requêtes en cours non interruptibles avant de finaliser l'annulation.

Supprimer un lot de messages
$client->messages->batches->delete(string messageBatchID, ?string workspaceID): DeletedMessageBatch
DELETE/v1/messages/batches/{message_batch_id}
Récupérer les résultats d'un lot de messages
$client->messages->batches->results(string messageBatchID, ?string workspaceID): MessageBatchIndividualResponse
GET/v1/messages/batches/{message_batch_id}/results

Diffuse en streaming les résultats d'un lot de messages sous forme de fichier .jsonl.