Messages schemas

The full schema and model definitions referenced by the Messages endpoints. Each endpoint page links here for the detailed shape of its request and response objects.

Schemas

Anthropic Base64 Source Param

Inline base64-encoded media.

FieldTypeRequiredDescription
typeenum ('base64')No
media_typestringYesMIME type of the data, such as image/png or application/pdf.
datastringYesBase64-encoded bytes.

Anthropic Cache Control Ephemeral Param

Prompt-cache breakpoint. Accepted to improve cache hit rates; a 1h TTL is not supported.

FieldTypeRequiredDescription
typeenum ('ephemeral')Yes
ttlenum ('5m', '1h')No

Anthropic Citations Config Param

Document citation settings. Enabling citations is not supported.

FieldTypeRequiredDescription
enabledbooleanNo

Anthropic Content Block

Anthropic Messages content block. Supported block types are text, image, video (Meta extension), document, tool_use, tool_result, server_tool_use, thinking, and redacted_thinking. cache_control prompt-cache controls are accepted to improve cache hit rates. Unsupported block types return an invalid_request_error.

FieldTypeRequiredDescription
typestringYesContent block discriminator, such as text, image, video, document, tool_use, or tool_result.

Anthropic Content Block Param

Input content block. A block type that a role does not support returns an invalid_request_error.

Type: AnthropicTextBlockParam | AnthropicImageBlockParam | AnthropicVideoBlockParam | AnthropicDocumentBlockParam | AnthropicSearchResultBlockParam | AnthropicToolUseBlockParam | AnthropicToolResultBlockParam | AnthropicServerToolUseBlockParam | AnthropicThinkingBlockParam | AnthropicRedactedThinkingBlockParam

Anthropic Content Source Param

Document built from inline content blocks.

FieldTypeRequiredDescription
typeenum ('content')No
contentYesA string, or an array of content blocks. Non-text blocks are passed as their JSON text.

Anthropic Context Management Config

Anthropic beta context-management config. Known edit types are accepted for compatibility; no server-side context edits are applied.

FieldTypeRequiredDescription
editsarray of AnthropicContextManagementEditParamNo

Anthropic Context Management Edit Param

Context-management edit.

FieldTypeRequiredDescription
typeenum ('clear_tool_uses_20250919', 'clear_thinking_20251015', 'compact_20260112')No

Anthropic Count Tokens Request

FieldTypeRequiredDescription
modelstringYes
messagesarray of AnthropicInputMessageYes(minItems: 1)
systemstring | array of AnthropicTextBlockParamNo
toolsarray of AnthropicToolNo
tool_choiceAnthropicToolChoiceNo
metadataAnthropicMetadataParamNo
temperaturenumberNo(minimum: 0, maximum: 1)
top_pnumberNo(minimum: 0, maximum: 1)
top_kintegerNo
thinkingAnthropicThinkingConfigParamNo
stop_sequencesarray of stringNo
service_tierenum ('auto', 'standard_only')No
cache_controlAnthropicCacheControlEphemeralParamNo
context_managementAnthropicContextManagementConfig | nullNo
containerobjectNo
inference_geostringNo
output_configAnthropicOutputConfigNo

Anthropic Count Tokens Response

FieldTypeRequiredDescription
input_tokensintegerYesNumber of input tokens in the supplied Messages request.

Anthropic Document Block Param

Document input.

FieldTypeRequiredDescription
typeenum ('document')No
sourceAnthropicDocumentSourceParamYes
titlestringNo
contextstringNo
citationsAnthropicCitationsConfigParamNo
cache_controlAnthropicCacheControlEphemeralParamNo

Anthropic Document Source Param

Document source.

Type: AnthropicBase64SourceParam | AnthropicPlainTextSourceParam | AnthropicContentSourceParam | AnthropicUrlSourceParam | AnthropicFileSourceParam

Anthropic File Source Param

Media referenced by an uploaded file ID.

FieldTypeRequiredDescription
typeenum ('file')No
file_idstringYes

Anthropic Image Block Param

Image input.

FieldTypeRequiredDescription
typeenum ('image')No
sourceAnthropicMediaSourceParamYes
cache_controlAnthropicCacheControlEphemeralParamNo

Anthropic Input Message

Anthropic Messages input message.

FieldTypeRequiredDescription
roleenum ('user', 'assistant', 'system', 'developer')Yes
contentstring | array of AnthropicContentBlockParamYes

Anthropic Json Output Format

Anthropic JSON structured-output format.

FieldTypeRequiredDescription
typeenum ('json_schema')Yes
schemaobjectYes

Anthropic Media Source Param

Image or video source.

Type: AnthropicBase64SourceParam | AnthropicUrlSourceParam | AnthropicFileSourceParam

Anthropic Message

Anthropic-compatible assistant message response.

FieldTypeRequiredDescription
idstringYes
typeenum ('message')Yes
roleenum ('assistant')Yes
contentarray of AnthropicContentBlockYes
modelstringYes
stop_reasonenum ('end_turn', 'max_tokens', 'stop_sequence', 'tool_use', 'pause_turn', 'refusal')Yes
stop_sequencestring | nullYes
usageAnthropicUsageYes

Anthropic Message Request

FieldTypeRequiredDescription
modelstringYes
messagesarray of AnthropicInputMessageYes(minItems: 1)
systemstring | array of AnthropicTextBlockParamNo
toolsarray of AnthropicToolNo
tool_choiceAnthropicToolChoiceNo
metadataAnthropicMetadataParamNo
temperaturenumberNo(minimum: 0, maximum: 1)
top_pnumberNo(minimum: 0, maximum: 1)
top_kintegerNo
thinkingAnthropicThinkingConfigParamNo
stop_sequencesarray of stringNo
service_tierenum ('auto', 'standard_only')No
cache_controlAnthropicCacheControlEphemeralParamNo
context_managementAnthropicContextManagementConfig | nullNo
containerobjectNo
inference_geostringNo
output_configAnthropicOutputConfigNo
max_tokensintegerYes(minimum: 0)
streambooleanNo(default: false)

Anthropic Message Request Base

Anthropic Messages request accepted at /v1/messages.

FieldTypeRequiredDescription
modelstringYes
messagesarray of AnthropicInputMessageYes(minItems: 1)
systemstring | array of AnthropicTextBlockParamNo
toolsarray of AnthropicToolNo
tool_choiceAnthropicToolChoiceNo
metadataAnthropicMetadataParamNo
temperaturenumberNo(minimum: 0, maximum: 1)
top_pnumberNo(minimum: 0, maximum: 1)
top_kintegerNo
thinkingAnthropicThinkingConfigParamNo
stop_sequencesarray of stringNo
service_tierenum ('auto', 'standard_only')No
cache_controlAnthropicCacheControlEphemeralParamNo
context_managementAnthropicContextManagementConfig | nullNo
containerobjectNo
inference_geostringNo
output_configAnthropicOutputConfigNo

Anthropic Metadata Param

Request metadata. user_id identifies the end user; other string values are passed through.

FieldTypeRequiredDescription
user_idstringNo

Anthropic Output Config

Anthropic output controls. effort sets the reasoning effort; max selects the strongest available effort.

FieldTypeRequiredDescription
effortenum ('low', 'medium', 'high', 'xhigh', 'max')No
formatAnthropicJsonOutputFormatNo

Anthropic Plain Text Source Param

Plain-text document.

FieldTypeRequiredDescription
typeenum ('text')No
media_typestringNo
datastringYes

Anthropic Redacted Thinking Block Param

Encrypted reasoning returned by an earlier response, replayed as is.

FieldTypeRequiredDescription
typeenum ('redacted_thinking')No
dataNoThe encrypted reasoning, as returned.

Anthropic Search Result Block Param

Search result passed to the model as its JSON text.

FieldTypeRequiredDescription
typeenum ('search_result')No
sourcestringNo
titlestringNo
contentNoText blocks with the result content.
cache_controlAnthropicCacheControlEphemeralParamNo

Anthropic Server Tool Use Block Param

Earlier server tool call, replayed. Supported names are web_search and tool_search.

FieldTypeRequiredDescription
typeenum ('server_tool_use')No
idstringYes
namestringYes
inputobjectNo
cache_controlAnthropicCacheControlEphemeralParamNo

Anthropic Stream Event

Anthropic Messages server-sent event. Stream event names include message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop, and error.

Type: object

Anthropic Text Block Param

Text content.

FieldTypeRequiredDescription
typeenum ('text')No
textstringYes
citationsNoAccepted and ignored.
cache_controlAnthropicCacheControlEphemeralParamNo

Anthropic Thinking Block Param

Earlier reasoning summary, replayed.

FieldTypeRequiredDescription
typeenum ('thinking')No
thinkingstringYes
signatureNoAccepted and ignored.

Anthropic Thinking Config Adaptive Param

The model decides how much to reason.

FieldTypeRequiredDescription
typeenum ('adaptive')No
displayenum ('summarized', 'omitted')No

Anthropic Thinking Config Disabled Param

Reasoning off, where the model supports it.

FieldTypeRequiredDescription
typeenum ('disabled')No

Anthropic Thinking Config Enabled Param

Reasoning with a token budget.

FieldTypeRequiredDescription
typeenum ('enabled')No
budget_tokensinteger (int64)YesReasoning token budget. Must be less than max_tokens. (minimum: 1024)
displayenum ('summarized', 'omitted')No

Anthropic Thinking Config Param

Extended reasoning settings.

Type: AnthropicThinkingConfigEnabledParam | AnthropicThinkingConfigAdaptiveParam | AnthropicThinkingConfigDisabledParam

Anthropic Tool

Anthropic tool definition. Custom (developer) tools are supported; supported hosted tools are accepted, and unsupported hosted tools return an invalid_request_error.

FieldTypeRequiredDescription
typestringNoTool type. Omitted or custom for a developer tool.
namestringNo
descriptionstringNo
input_schemaobjectNoJSON Schema for a custom tool's input.
strictbooleanNo
defer_loadingbooleanNo
user_locationAnthropicUserLocationParamNo
cache_controlAnthropicCacheControlEphemeralParamNo

Anthropic Tool Choice

FieldTypeRequiredDescription
typeenum ('auto', 'any', 'none', 'tool')Yes
namestringNo
disable_parallel_tool_usebooleanNo

Anthropic Tool Result Block Param

Result of an earlier tool call.

FieldTypeRequiredDescription
typeenum ('tool_result')No
tool_use_idstringYes
contentNoA string, or an array of content blocks (text, image, document, search_result, tool_reference).
is_errorNotrue marks the result as an error.
cache_controlAnthropicCacheControlEphemeralParamNo

Anthropic Tool Use Block Param

Earlier tool call, replayed.

FieldTypeRequiredDescription
typeenum ('tool_use')No
idstringYes
namestringYes
inputNoTool arguments, as an object.
cache_controlAnthropicCacheControlEphemeralParamNo

Anthropic Url Source Param

Media fetched from a URL.

FieldTypeRequiredDescription
typeenum ('url')No
urlstringYes

Anthropic Usage

FieldTypeRequiredDescription
input_tokensintegerYes
output_tokensintegerYes
cache_creation_input_tokensintegerNo
cache_read_input_tokensintegerNo
output_tokens_detailsobjectNo
output_tokens_details.thinking_tokensintegerNo

Anthropic User Location Param

Approximate user location for web search.

FieldTypeRequiredDescription
typeenum ('approximate')No
citystringNo
regionstringNo
countrystringNo
timezonestringNo

Anthropic Video Block Param

Video input (Meta extension).

FieldTypeRequiredDescription
typeenum ('video')No
sourceAnthropicMediaSourceParamYes
fpsnumberNoFrames per second to sample.