Claude Platform Docs

Messages

Create a Message
Message messages().create(MessageCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/v1/messages
Count tokens in a Message
MessageTokensCount messages().countTokens(MessageCountTokensParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/v1/messages/count_tokens
Models
class Base64ImageSource:
String data
formatbyte
MediaType mediaType
One of the following:
IMAGE_JPEG("image/jpeg")
IMAGE_PNG("image/png")
IMAGE_GIF("image/gif")
IMAGE_WEBP("image/webp")
JsonValue type "base64"constant
class Base64PdfSource:
String data
formatbyte
JsonValue mediaType "application/pdf"constant
JsonValue type "base64"constant
class BashCodeExecutionOutputBlock:
String fileId
JsonValue type "bash_code_execution_output"constant
class BashCodeExecutionOutputBlockParam:
String fileId
JsonValue type "bash_code_execution_output"constant
class BashCodeExecutionResultBlock:
String fileId
JsonValue type "bash_code_execution_output"constant
long returnCode
String stderr
String stdout
JsonValue type "bash_code_execution_result"constant
class BashCodeExecutionResultBlockParam:
String fileId
JsonValue type "bash_code_execution_output"constant
long returnCode
String stderr
String stdout
JsonValue type "bash_code_execution_result"constant
class BashCodeExecutionToolResultBlock:
class BashCodeExecutionToolResultBlockParam:
class BashCodeExecutionToolResultError:
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
OUTPUT_FILE_TOO_LARGE("output_file_too_large")
JsonValue type "bash_code_execution_tool_result_error"constant
enum BashCodeExecutionToolResultErrorCode:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
OUTPUT_FILE_TOO_LARGE("output_file_too_large")
class BashCodeExecutionToolResultErrorParam:
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
OUTPUT_FILE_TOO_LARGE("output_file_too_large")
JsonValue type "bash_code_execution_tool_result_error"constant
class BrowserCloseTabConfig:

close_tab's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

double_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

file_upload's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

find's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

form_input's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

get_page_text's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

hold_key's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

hover's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

javascript_exec's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

key's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

left_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

left_click_drag's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

left_mouse_down's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

left_mouse_up's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

list_tabs's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

middle_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

mouse_move's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

navigate's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

new_tab's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

read_console's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

read_network's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

read_page's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

right_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

screenshot's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

scroll's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

scroll_to's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

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

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

class BrowserStateChange: A class that can be one of several variants.union

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

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

class BrowserStateChangeDownloadCompleted:

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

String downloadId

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

maxLength4096
minLength1
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
JsonValue type "download_completed"constant
String url

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

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
Optional<String> path

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

pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
maxLength4096
Optional<Long> sizeBytes

The completed download's size.

minimum0
class BrowserStateChangeDownloadFailed:

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

String downloadId

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

maxLength4096
minLength1
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
JsonValue type "download_failed"constant
String url

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

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
Optional<String> error

The failure or cancellation detail, when known.

pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
maxLength4096
class BrowserStateChangeDownloadStarted:

A file download that started during this call.

String downloadId

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

maxLength4096
minLength1
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
JsonValue type "download_started"constant
String url

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

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
class BrowserStateChangeTabOpened:

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

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

String tabId

The tab_id of the opened tab, present in tabs.

maxLength4096
minLength1
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
JsonValue type "tab_opened"constant
class BrowserStateTabEntry:

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

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

String tabId

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

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

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

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
String url

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

maxLength4096
pattern^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
Optional<Boolean> 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:

switch_tab's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

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

JsonValue type "browser_toolset_20260801"constant
Optional<List<AllowedCaller>> allowedCallers
One of the following:
DIRECT("direct")
CODE_EXECUTION_20250825("code_execution_20250825")
CODE_EXECUTION_20260120("code_execution_20260120")
CODE_EXECUTION_20260521("code_execution_20260521")
Optional<CacheControlEphemeral> cacheControl

Create a cache control breakpoint at this content block.

JsonValue type "ephemeral"constant
Optional<Ttl> ttl

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

This may be one the following values:

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

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

One of the following:
TTL_5M("5m")
TTL_1H("1h")
Optional<BrowserToolsetConfigs> configs

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:

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 BrowserTripleClickConfig:

triple_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

type's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

wait's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

zoom's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:
JsonValue type "ephemeral"constant
Optional<Ttl> ttl

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

This may be one the following values:

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

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

One of the following:
TTL_5M("5m")
TTL_1H("1h")
class CacheCreation:
long ephemeral1hInputTokens

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

minimum0
long ephemeral5mInputTokens

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

minimum0
class CitationCharLocation:
String citedText
long documentIndex
minimum0
Optional<String> documentTitle
long endCharIndex
Optional<String> fileId
long startCharIndex
minimum0
JsonValue type "char_location"constant
class CitationCharLocationParam:
String citedText
long documentIndex
minimum0
Optional<String> documentTitle
maxLength500
minLength1
long endCharIndex
long startCharIndex
minimum0
JsonValue type "char_location"constant
class CitationContentBlockLocation:
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.

long documentIndex
minimum0
Optional<String> documentTitle
long endBlockIndex

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

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

Optional<String> fileId
long startBlockIndex

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

minimum0
JsonValue type "content_block_location"constant
class CitationContentBlockLocationParam:
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.

long documentIndex
minimum0
Optional<String> documentTitle
maxLength500
minLength1
long endBlockIndex

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

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

long startBlockIndex

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

minimum0
JsonValue type "content_block_location"constant
class CitationPageLocation:
String citedText
long documentIndex
minimum0
Optional<String> documentTitle
long endPageNumber
Optional<String> fileId
long startPageNumber
minimum1
JsonValue type "page_location"constant
class CitationPageLocationParam:
String citedText
long documentIndex
minimum0
Optional<String> documentTitle
maxLength500
minLength1
long endPageNumber
long startPageNumber
minimum1
JsonValue type "page_location"constant
class CitationSearchResultLocationParam:
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.

long endBlockIndex

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

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

long searchResultIndex

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

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

minimum0
String source
long startBlockIndex

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

minimum0
Optional<String> title
JsonValue type "search_result_location"constant
class CitationWebSearchResultLocationParam:
String citedText
String encryptedIndex
Optional<String> title
maxLength512
minLength1
JsonValue type "web_search_result_location"constant
String url
minLength1
class CitationsConfig:
boolean enabled
class CitationsConfigParam:
Optional<Boolean> enabled
class CitationsDelta:
class CitationsSearchResultLocation:
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.

long endBlockIndex

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

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

long searchResultIndex

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

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

minimum0
String source
long startBlockIndex

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

minimum0
Optional<String> title
JsonValue type "search_result_location"constant
class CitationsWebSearchResultLocation:
String citedText
String encryptedIndex
Optional<String> title
maxLength512
JsonValue type "web_search_result_location"constant
String url
class CodeExecutionOutputBlock:
String fileId
JsonValue type "code_execution_output"constant
class CodeExecutionOutputBlockParam:
String fileId
JsonValue type "code_execution_output"constant
class CodeExecutionResultBlock:
String fileId
JsonValue type "code_execution_output"constant
long returnCode
String stderr
String stdout
JsonValue type "code_execution_result"constant
class CodeExecutionResultBlockParam:
String fileId
JsonValue type "code_execution_output"constant
long returnCode
String stderr
String stdout
JsonValue type "code_execution_result"constant
class CodeExecutionTool20250522:
class CodeExecutionTool20250825:
class CodeExecutionTool20260120:

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

class CodeExecutionTool20260521:

Code execution tool with REPL state persistence.

class CodeExecutionToolResultBlock:

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

One of the following:
String toolUseId
pattern^srvtoolu_[a-zA-Z0-9_]+$
JsonValue type "code_execution_tool_result"constant
class CodeExecutionToolResultBlockContent: A class that can be one of several variants.union

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

class CodeExecutionToolResultBlockParam:

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

One of the following:
String toolUseId
pattern^srvtoolu_[a-zA-Z0-9_]+$
JsonValue type "code_execution_tool_result"constant
Optional<CacheControlEphemeral> cacheControl

Create a cache control breakpoint at this content block.

JsonValue type "ephemeral"constant
Optional<Ttl> ttl

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

This may be one the following values:

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

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

One of the following:
TTL_5M("5m")
TTL_1H("1h")
class CodeExecutionToolResultBlockParamContent: A class that can be one of several variants.union

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

class CodeExecutionToolResultError:
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
JsonValue type "code_execution_tool_result_error"constant
enum CodeExecutionToolResultErrorCode:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
class CodeExecutionToolResultErrorParam:
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
JsonValue type "code_execution_tool_result_error"constant
class ComputerCursorPositionConfig:

cursor_position's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

double_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

hold_key's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

key's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

left_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

left_click_drag's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

left_mouse_down's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

left_mouse_up's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

middle_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

mouse_move's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

right_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

screenshot's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

scroll's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

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

class ComputerToolsetConfigs:

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 ComputerTripleClickConfig:

triple_click's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

type's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

wait's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

zoom's config overrides.

Optional<Boolean> deferLoading

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

Optional<Boolean> 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:

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

String id

Identifier for the container used in this request

LocalDateTime expiresAt

The time at which the container will expire.

formatdate-time
Optional<List<ContainerSkill>> skills

Skills loaded in the container

String skillId

Skill ID

maxLength64
minLength1
Type type

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

One of the following:
ANTHROPIC("anthropic")
CUSTOM("custom")
String version

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

maxLength64
minLength1
class ContainerParams:

Container parameters with skills to be loaded.

Optional<String> id

Container id

Optional<List<SkillParams>> skills

List of skills to load in the container

maxItems20
String skillId

Skill ID

maxLength64
minLength1
Type type

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

One of the following:
ANTHROPIC("anthropic")
CUSTOM("custom")
Optional<String> version

Skill version or 'latest' for most recent version

maxLength64
minLength1
class ContainerSkill:

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

String skillId

Skill ID

maxLength64
minLength1
Type type

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

One of the following:
ANTHROPIC("anthropic")
CUSTOM("custom")
String version

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

maxLength64
minLength1
class ContainerUploadBlock:

Response model for a file uploaded to the container.

String fileId
JsonValue type "container_upload"constant
class ContainerUploadBlockParam:

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

String fileId
JsonValue type "container_upload"constant
Optional<CacheControlEphemeral> cacheControl

Create a cache control breakpoint at this content block.

JsonValue type "ephemeral"constant
Optional<Ttl> ttl

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

This may be one the following values:

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

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

One of the following:
TTL_5M("5m")
TTL_1H("1h")
class ContentBlock: A class that can be one of several variants.union

Response model for a file uploaded to the container.

class ContentBlockParam: A class that can be one of several variants.union

Regular text content.

class ContentBlockSource:
Content content
One of the following:
String
One of the following:
class TextBlockParam:
class ImageBlockParam:
JsonValue type "content"constant
class ContentBlockSourceContent: A class that can be one of several variants.union
class TextBlockParam:
class ImageBlockParam:
class DirectCaller:

Tool invocation directly from the model.

JsonValue type "direct"constant
class DocumentBlock:
Optional<CitationsConfig> citations

Citation configuration for the document

boolean enabled
Source source
One of the following:
class Base64PdfSource:
String data
formatbyte
JsonValue mediaType "application/pdf"constant
JsonValue type "base64"constant
class PlainTextSource:
String data
JsonValue mediaType "text/plain"constant
JsonValue type "text"constant
Optional<String> title

The title of the document

JsonValue type "document"constant
class DocumentBlockParam:
class EncryptedCodeExecutionResultBlock:

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

String fileId
JsonValue type "code_execution_output"constant
String encryptedStdout
long returnCode
String stderr
JsonValue type "encrypted_code_execution_result"constant
class EncryptedCodeExecutionResultBlockParam:

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

String fileId
JsonValue type "code_execution_output"constant
String encryptedStdout
long returnCode
String stderr
JsonValue type "encrypted_code_execution_result"constant
class FileDocumentSource:
String fileId
JsonValue type "file"constant
class FileImageSource:
String fileId
JsonValue type "file"constant
class ImageBlockParam:
class ImageTransformationsParam:

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.

Optional<OversizedImage> oversizedImage

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

One of the following:
DOWNSIZE("downsize")
ERROR("error")
class InputJsonDelta:
String partialJson
JsonValue type "input_json_delta"constant
class JsonOutputFormat:
Schema schema

The JSON schema of the format

JsonValue type "json_schema"constant
class MemoryTool20250818:
class Message:
class MessageCountTokensTool: A class that can be one of several variants.union

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

class MessageCreateParamsContainer: A class that can be one of several variants.union

Container identifier for reuse across requests.

class ContainerParams:

Container parameters with skills to be loaded.

Optional<String> id

Container id

Optional<List<SkillParams>> skills

List of skills to load in the container

maxItems20
String skillId

Skill ID

maxLength64
minLength1
Type type

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

One of the following:
ANTHROPIC("anthropic")
CUSTOM("custom")
Optional<String> version

Skill version or 'latest' for most recent version

maxLength64
minLength1
String
class MessageDeltaUsage:
Optional<Long> cacheCreationInputTokens

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

minimum0
Optional<Long> cacheReadInputTokens

The cumulative number of input tokens read from the cache.

minimum0
Optional<Long> inputTokens

The cumulative number of input tokens which were used.

minimum0
long outputTokens

The cumulative number of output tokens which were used.

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

long thinkingTokens

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

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

minimum0
Optional<ServerToolUsage> serverToolUse

The number of server tool requests.

long webFetchRequests

The number of web fetch tool requests.

minimum0
long webSearchRequests

The number of web search tool requests.

minimum0
class MessageParam:
class MessageTokensCount:
long inputTokens

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

class Metadata:
Optional<String> userId

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

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

maxLength512
enum Model:

The model that will complete your prompt.

See models for additional details and options.

CLAUDE_SONNET_5("claude-sonnet-5")

High-performance model for coding and agents

CLAUDE_FABLE_5("claude-fable-5")

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

CLAUDE_MYTHOS_5("claude-mythos-5")

Most capable model for cybersecurity and biology research

CLAUDE_OPUS_5("claude-opus-5")

Powerful intelligence for long-running agents and coding

CLAUDE_OPUS_4_8("claude-opus-4-8")

Powerful intelligence for long-running agents and coding

CLAUDE_OPUS_4_7("claude-opus-4-7")

Powerful intelligence for long-running agents and coding

CLAUDE_MYTHOS_PREVIEW("claude-mythos-preview")

New class of intelligence, strongest in coding and cybersecurity

CLAUDE_OPUS_4_6("claude-opus-4-6")

Powerful intelligence for long-running agents and coding

CLAUDE_SONNET_4_6("claude-sonnet-4-6")

Best combination of speed and intelligence

CLAUDE_HAIKU_4_5("claude-haiku-4-5")

Fastest model with near-frontier intelligence

CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")

Fastest model with near-frontier intelligence

CLAUDE_OPUS_4_5("claude-opus-4-5")

Powerful intelligence for long-running agents and coding

CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")

Powerful intelligence for long-running agents and coding

CLAUDE_SONNET_4_5("claude-sonnet-4-5")

High-performance model for agents and coding

CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")

High-performance model for agents and coding

class OutputConfig:
Optional<Effort> effort

All possible effort levels.

One of the following:
LOW("low")
MEDIUM("medium")
HIGH("high")
XHIGH("xhigh")
MAX("max")
Optional<JsonOutputFormat> format

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

Schema schema

The JSON schema of the format

JsonValue type "json_schema"constant
class OutputTokensDetails:
long thinkingTokens

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

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

minimum0
class PlainTextSource:
String data
JsonValue mediaType "text/plain"constant
JsonValue type "text"constant
class RawContentBlockDelta: A class that can be one of several variants.union
class TextDelta:
String text
JsonValue type "text_delta"constant
class InputJsonDelta:
String partialJson
JsonValue type "input_json_delta"constant
class CitationsDelta:
class ThinkingDelta:
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.

JsonValue type "thinking_delta"constant
class SignatureDelta:
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.

JsonValue type "signature_delta"constant
class RawContentBlockDeltaEvent:
One of the following:
class TextDelta:
String text
JsonValue type "text_delta"constant
class InputJsonDelta:
String partialJson
JsonValue type "input_json_delta"constant
class CitationsDelta:
class ThinkingDelta:
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.

JsonValue type "thinking_delta"constant
class SignatureDelta:
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.

JsonValue type "signature_delta"constant
long index
JsonValue type "content_block_delta"constant
class RawContentBlockStartEvent:
class RawContentBlockStopEvent:
long index
JsonValue type "content_block_stop"constant
class RawMessageDeltaEvent:
class RawMessageStartEvent:
Message message
JsonValue type "message_start"constant
class RawMessageStopEvent:
JsonValue type "message_stop"constant
class RawMessageStreamEvent: A class that can be one of several variants.union
class RedactedThinkingBlock:
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.

JsonValue type "redacted_thinking"constant
class RedactedThinkingBlockParam:
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.

JsonValue type "redacted_thinking"constant
class RefusalStopDetails:

Structured information about a refusal.

Optional<Category> category

The policy category that triggered a refusal.

One of the following:
CYBER("cyber")

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

BIO("bio")

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

FRONTIER_LLM("frontier_llm")

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

REASONING_EXTRACTION("reasoning_extraction")

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

GENERAL_HARMS("general_harms")

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

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

JsonValue type "refusal"constant
class SearchResultBlockParam:
class ServerToolCaller:

Tool invocation generated by a server-side tool.

String toolId
pattern^srvtoolu_[a-zA-Z0-9_]+$
JsonValue type "code_execution_20250825"constant
class ServerToolCaller20260120:
String toolId
pattern^srvtoolu_[a-zA-Z0-9_]+$
JsonValue type "code_execution_20260120"constant
class ServerToolUsage:
long webFetchRequests

The number of web fetch tool requests.

minimum0
long webSearchRequests

The number of web search tool requests.

minimum0
class ServerToolUseBlock:
class ServerToolUseBlockParam:
class SignatureDelta:
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.

JsonValue type "signature_delta"constant
class SkillParams:

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

String skillId

Skill ID

maxLength64
minLength1
Type type

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

One of the following:
ANTHROPIC("anthropic")
CUSTOM("custom")
Optional<String> version

Skill version or 'latest' for most recent version

maxLength64
minLength1
enum StopReason:
END_TURN("end_turn")
MAX_TOKENS("max_tokens")
STOP_SEQUENCE("stop_sequence")
TOOL_USE("tool_use")
PAUSE_TURN("pause_turn")
REFUSAL("refusal")
MODEL_CONTEXT_WINDOW_EXCEEDED("model_context_window_exceeded")
class TextBlock:
class TextBlockParam:
class TextCitation: A class that can be one of several variants.union
class TextCitationParam: A class that can be one of several variants.union
class TextDelta:
String text
JsonValue type "text_delta"constant
class TextEditorCodeExecutionCreateResultBlock:
boolean isFileUpdate
JsonValue type "text_editor_code_execution_create_result"constant
class TextEditorCodeExecutionCreateResultBlockParam:
boolean isFileUpdate
JsonValue type "text_editor_code_execution_create_result"constant
class TextEditorCodeExecutionStrReplaceResultBlock:
Optional<List<String>> lines
Optional<Long> newLines
Optional<Long> newStart
Optional<Long> oldLines
Optional<Long> oldStart
JsonValue type "text_editor_code_execution_str_replace_result"constant
class TextEditorCodeExecutionStrReplaceResultBlockParam:
JsonValue type "text_editor_code_execution_str_replace_result"constant
Optional<List<String>> lines
Optional<Long> newLines
Optional<Long> newStart
Optional<Long> oldLines
Optional<Long> oldStart
class TextEditorCodeExecutionToolResultBlock:
class TextEditorCodeExecutionToolResultBlockParam:
class TextEditorCodeExecutionToolResultError:
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
FILE_NOT_FOUND("file_not_found")
Optional<String> errorMessage
JsonValue type "text_editor_code_execution_tool_result_error"constant
enum TextEditorCodeExecutionToolResultErrorCode:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
FILE_NOT_FOUND("file_not_found")
class TextEditorCodeExecutionToolResultErrorParam:
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
FILE_NOT_FOUND("file_not_found")
JsonValue type "text_editor_code_execution_tool_result_error"constant
Optional<String> errorMessage
class TextEditorCodeExecutionViewResultBlock:
String content
FileType fileType
One of the following:
TEXT("text")
IMAGE("image")
PDF("pdf")
Optional<Long> numLines
Optional<Long> startLine
Optional<Long> totalLines
JsonValue type "text_editor_code_execution_view_result"constant
class TextEditorCodeExecutionViewResultBlockParam:
String content
FileType fileType
One of the following:
TEXT("text")
IMAGE("image")
PDF("pdf")
JsonValue type "text_editor_code_execution_view_result"constant
Optional<Long> numLines
Optional<Long> startLine
Optional<Long> totalLines
class ThinkingBlock:
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.

JsonValue type "thinking"constant
class ThinkingBlockParam:
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.

JsonValue type "thinking"constant
class ThinkingConfigAdaptive:
JsonValue type "adaptive"constant
Optional<Display> display

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

One of the following:
SUMMARIZED("summarized")
OMITTED("omitted")
class ThinkingConfigDisabled:
JsonValue type "disabled"constant
class ThinkingConfigEnabled:
long budgetTokens

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

Must be ≥1024 and less than max_tokens.

See extended thinking for details.

minimum1024
JsonValue type "enabled"constant
Optional<Display> display

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

One of the following:
SUMMARIZED("summarized")
OMITTED("omitted")
class ThinkingConfigParam: A class that can be one of several variants.union

Configuration for enabling Claude's extended thinking.

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

See extended thinking for details.

class ThinkingConfigEnabled:
long budgetTokens

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

Must be ≥1024 and less than max_tokens.

See extended thinking for details.

minimum1024
JsonValue type "enabled"constant
Optional<Display> display

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

One of the following:
SUMMARIZED("summarized")
OMITTED("omitted")
class ThinkingConfigDisabled:
JsonValue type "disabled"constant
class ThinkingConfigAdaptive:
JsonValue type "adaptive"constant
Optional<Display> display

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

One of the following:
SUMMARIZED("summarized")
OMITTED("omitted")
class ThinkingDelta:
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.

JsonValue type "thinking_delta"constant
class Tool:
class ToolBash20250124:
class ToolChoice: A class that can be one of several variants.union

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

class ToolChoiceAuto:

The model will automatically decide whether to use tools.

JsonValue type "auto"constant
Optional<Boolean> disableParallelToolUse

Whether to disable parallel tool use.

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

class ToolChoiceAny:

The model will use any available tools.

JsonValue type "any"constant
Optional<Boolean> disableParallelToolUse

Whether to disable parallel tool use.

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

class ToolChoiceTool:

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

String name

The name of the tool to use.

JsonValue type "tool"constant
Optional<Boolean> disableParallelToolUse

Whether to disable parallel tool use.

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

class ToolChoiceNone:

The model will not be allowed to use tools.

JsonValue type "none"constant
class ToolChoiceAny:

The model will use any available tools.

JsonValue type "any"constant
Optional<Boolean> disableParallelToolUse

Whether to disable parallel tool use.

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

class ToolChoiceAuto:

The model will automatically decide whether to use tools.

JsonValue type "auto"constant
Optional<Boolean> 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:

The model will not be allowed to use tools.

JsonValue type "none"constant
class ToolChoiceTool:

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

String name

The name of the tool to use.

JsonValue type "tool"constant
Optional<Boolean> disableParallelToolUse

Whether to disable parallel tool use.

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

class ToolReferenceBlock:
String toolName
maxLength256
minLength1
pattern^[a-zA-Z0-9_-]{1,256}$
JsonValue type "tool_reference"constant
class ToolReferenceBlockParam:

Tool reference block that can be included in tool_result content.

String toolName
maxLength256
minLength1
pattern^[a-zA-Z0-9_-]{1,256}$
JsonValue type "tool_reference"constant
Optional<CacheControlEphemeral> cacheControl

Create a cache control breakpoint at this content block.

JsonValue type "ephemeral"constant
Optional<Ttl> ttl

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

This may be one the following values:

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

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

One of the following:
TTL_5M("5m")
TTL_1H("1h")
class ToolResultBlockParam:
class ToolSearchToolBm25_20251119:
class ToolSearchToolRegex20251119:
class ToolSearchToolResultBlock:
class ToolSearchToolResultBlockParam:
class ToolSearchToolResultError:
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
Optional<String> errorMessage
JsonValue type "tool_search_tool_result_error"constant
enum ToolSearchToolResultErrorCode:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
class ToolSearchToolResultErrorParam:
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
TOO_MANY_REQUESTS("too_many_requests")
EXECUTION_TIME_EXCEEDED("execution_time_exceeded")
JsonValue type "tool_search_tool_result_error"constant
Optional<String> errorMessage
class ToolSearchToolSearchResultBlock:
List<ToolReferenceBlock> toolReferences
String toolName
maxLength256
minLength1
pattern^[a-zA-Z0-9_-]{1,256}$
JsonValue type "tool_reference"constant
JsonValue type "tool_search_tool_search_result"constant
class ToolSearchToolSearchResultBlockParam:
List<ToolReferenceBlockParam> toolReferences
String toolName
maxLength256
minLength1
pattern^[a-zA-Z0-9_-]{1,256}$
JsonValue type "tool_reference"constant
Optional<CacheControlEphemeral> cacheControl

Create a cache control breakpoint at this content block.

JsonValue type "ephemeral"constant
Optional<Ttl> ttl

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

This may be one the following values:

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

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

One of the following:
TTL_5M("5m")
TTL_1H("1h")
JsonValue type "tool_search_tool_search_result"constant
class ToolTextEditor20250124:
class ToolTextEditor20250429:
class ToolTextEditor20250728:
class ToolUnion: A class that can be one of several variants.union

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

class ToolUseBlock:
String id
pattern^[a-zA-Z0-9_-]+$
Caller caller

Tool invocation directly from the model.

One of the following:
class DirectCaller:

Tool invocation directly from the model.

JsonValue type "direct"constant
class ServerToolCaller:

Tool invocation generated by a server-side tool.

String toolId
pattern^srvtoolu_[a-zA-Z0-9_]+$
JsonValue type "code_execution_20250825"constant
class ServerToolCaller20260120:
String toolId
pattern^srvtoolu_[a-zA-Z0-9_]+$
JsonValue type "code_execution_20260120"constant
Input input
String name
minLength1
JsonValue type "tool_use"constant
Optional<String> toolsetName

For a toolset member tool_use, the toolset family.

maxLength64
minLength1
pattern^[a-zA-Z0-9_-]+$
class ToolUseBlockParam:
class UrlImageSource:
JsonValue type "url"constant
String url
class UrlPdfSource:
JsonValue type "url"constant
String url
class Usage:
class UserLocation:
JsonValue type "approximate"constant
Optional<String> city

The city of the user.

maxLength255
minLength1
Optional<String> country

The two letter ISO country code of the user.

maxLength2
minLength2
Optional<String> region

The region of the user.

maxLength255
minLength1
Optional<String> timezone

The IANA timezone of the user.

maxLength255
minLength1
class WebFetchBlock:
class WebFetchBlockParam:
JsonValue type "web_fetch_result"constant
String url

Fetched content URL

Optional<String> retrievedAt

ISO 8601 timestamp when the content was retrieved

class WebFetchTool20250910:
class WebFetchTool20260209:
class WebFetchTool20260309:

Web fetch tool with use_cache parameter for bypassing cached content.

class WebFetchTool20260318:
class WebFetchToolResultBlock:
class WebFetchToolResultBlockParam:
class WebFetchToolResultErrorBlock:
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
URL_TOO_LONG("url_too_long")
URL_NOT_ALLOWED("url_not_allowed")
URL_NOT_IN_PRIOR_CONTEXT("url_not_in_prior_context")
URL_NOT_ACCESSIBLE("url_not_accessible")
UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")
TOO_MANY_REQUESTS("too_many_requests")
MAX_USES_EXCEEDED("max_uses_exceeded")
UNAVAILABLE("unavailable")
JsonValue type "web_fetch_tool_result_error"constant
class WebFetchToolResultErrorBlockParam:
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
URL_TOO_LONG("url_too_long")
URL_NOT_ALLOWED("url_not_allowed")
URL_NOT_IN_PRIOR_CONTEXT("url_not_in_prior_context")
URL_NOT_ACCESSIBLE("url_not_accessible")
UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")
TOO_MANY_REQUESTS("too_many_requests")
MAX_USES_EXCEEDED("max_uses_exceeded")
UNAVAILABLE("unavailable")
JsonValue type "web_fetch_tool_result_error"constant
enum WebFetchToolResultErrorCode:
INVALID_TOOL_INPUT("invalid_tool_input")
URL_TOO_LONG("url_too_long")
URL_NOT_ALLOWED("url_not_allowed")
URL_NOT_IN_PRIOR_CONTEXT("url_not_in_prior_context")
URL_NOT_ACCESSIBLE("url_not_accessible")
UNSUPPORTED_CONTENT_TYPE("unsupported_content_type")
TOO_MANY_REQUESTS("too_many_requests")
MAX_USES_EXCEEDED("max_uses_exceeded")
UNAVAILABLE("unavailable")
class WebSearchResultBlock:
String encryptedContent
Optional<String> pageAge
String title
JsonValue type "web_search_result"constant
String url
class WebSearchResultBlockParam:
String encryptedContent
String title
JsonValue type "web_search_result"constant
String url
Optional<String> pageAge
class WebSearchTool20250305:
class WebSearchTool20260209:
class WebSearchTool20260318:
class WebSearchToolRequestError:
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
MAX_USES_EXCEEDED("max_uses_exceeded")
TOO_MANY_REQUESTS("too_many_requests")
QUERY_TOO_LONG("query_too_long")
REQUEST_TOO_LARGE("request_too_large")
JsonValue type "web_search_tool_result_error"constant
class WebSearchToolResultBlock:
class WebSearchToolResultBlockContent: A class that can be one of several variants.union
class WebSearchToolResultError:
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
MAX_USES_EXCEEDED("max_uses_exceeded")
TOO_MANY_REQUESTS("too_many_requests")
QUERY_TOO_LONG("query_too_long")
REQUEST_TOO_LARGE("request_too_large")
JsonValue type "web_search_tool_result_error"constant
String encryptedContent
Optional<String> pageAge
String title
JsonValue type "web_search_result"constant
String url
class WebSearchToolResultBlockParam:
class WebSearchToolResultBlockParamContent: A class that can be one of several variants.union
String encryptedContent
String title
JsonValue type "web_search_result"constant
String url
Optional<String> pageAge
class WebSearchToolRequestError:
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
MAX_USES_EXCEEDED("max_uses_exceeded")
TOO_MANY_REQUESTS("too_many_requests")
QUERY_TOO_LONG("query_too_long")
REQUEST_TOO_LARGE("request_too_large")
JsonValue type "web_search_tool_result_error"constant
class WebSearchToolResultError:
One of the following:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
MAX_USES_EXCEEDED("max_uses_exceeded")
TOO_MANY_REQUESTS("too_many_requests")
QUERY_TOO_LONG("query_too_long")
REQUEST_TOO_LARGE("request_too_large")
JsonValue type "web_search_tool_result_error"constant
enum WebSearchToolResultErrorCode:
INVALID_TOOL_INPUT("invalid_tool_input")
UNAVAILABLE("unavailable")
MAX_USES_EXCEEDED("max_uses_exceeded")
TOO_MANY_REQUESTS("too_many_requests")
QUERY_TOO_LONG("query_too_long")
REQUEST_TOO_LARGE("request_too_large")

MessagesBatches

Create a Message Batch
MessageBatch messages().batches().create(BatchCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/v1/messages/batches
Retrieve a Message Batch
MessageBatch messages().batches().retrieve(BatchRetrieveParamsparams = BatchRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
GET/v1/messages/batches/{message_batch_id}
List Message Batches
BatchListPage messages().batches().list(BatchListParamsparams = BatchListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
GET/v1/messages/batches
Cancel a Message Batch
MessageBatch messages().batches().cancel(BatchCancelParamsparams = BatchCancelParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
POST/v1/messages/batches/{message_batch_id}/cancel
Delete a Message Batch
DeletedMessageBatch messages().batches().delete(BatchDeleteParamsparams = BatchDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
DELETE/v1/messages/batches/{message_batch_id}
Retrieve Message Batch results
MessageBatchIndividualResponse messages().batches().resultsStreaming(BatchResultsParamsparams = BatchResultsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
GET/v1/messages/batches/{message_batch_id}/results