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 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.
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Content block discriminator, such as text, image, video, document, tool_use, or tool_result. |
Anthropic Context Management Config
Anthropic beta context-management config. Known edit types are accepted for compatibility; no server-side context edits are applied.
| Field | Type | Required | Description |
|---|---|---|---|
edits | array of object | No |
Anthropic Count Tokens Request
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | |
max_tokens | integer | No | (minimum: 0) |
messages | array of AnthropicInputMessage | Yes | (minItems: 1) |
system | string | array of AnthropicContentBlock | No | |
stream | boolean | No | (default: false) |
tools | array of AnthropicTool | No | |
tool_choice | AnthropicToolChoice | No | |
metadata | object | No | |
temperature | number | No | (minimum: 0, maximum: 1) |
top_p | number | No | (minimum: 0, maximum: 1) |
top_k | integer | No | |
thinking | object | No | |
stop_sequences | array of string | No | |
service_tier | string | No | |
cache_control | object | No | |
cache_control.type | enum ('ephemeral') | No | |
cache_control.ttl | enum ('5m') | No | |
context_management | AnthropicContextManagementConfig | null | No | |
container | object | No | |
inference_geo | string | No | |
output_config | AnthropicOutputConfig | No |
Anthropic Count Tokens Response
| Field | Type | Required | Description |
|---|---|---|---|
input_tokens | integer | Yes | Number of input tokens in the supplied Messages request. |
Anthropic Input Message
Anthropic Messages input message.
| Field | Type | Required | Description |
|---|---|---|---|
role | enum ('user', 'assistant', 'system', 'developer') | Yes | |
content | string | array of AnthropicContentBlock | Yes |
Anthropic Json Output Format
Anthropic JSON structured-output format.
| Field | Type | Required | Description |
|---|---|---|---|
type | enum ('json_schema') | Yes | |
schema | object | Yes |
Anthropic Message
Anthropic-compatible assistant message response.
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | |
type | enum ('message') | Yes | |
role | enum ('assistant') | Yes | |
content | array of AnthropicContentBlock | Yes | |
model | string | Yes | |
stop_reason | enum ('end_turn', 'max_tokens', 'stop_sequence', 'tool_use', 'pause_turn', 'refusal') | Yes | |
stop_sequence | string | null | Yes | |
usage | AnthropicUsage | Yes |
Anthropic Message Request
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | |
max_tokens | integer | Yes | (minimum: 0) |
messages | array of AnthropicInputMessage | Yes | (minItems: 1) |
system | string | array of AnthropicContentBlock | No | |
stream | boolean | No | (default: false) |
tools | array of AnthropicTool | No | |
tool_choice | AnthropicToolChoice | No | |
metadata | object | No | |
temperature | number | No | (minimum: 0, maximum: 1) |
top_p | number | No | (minimum: 0, maximum: 1) |
top_k | integer | No | |
thinking | object | No | |
stop_sequences | array of string | No | |
service_tier | string | No | |
cache_control | object | No | |
cache_control.type | enum ('ephemeral') | No | |
cache_control.ttl | enum ('5m') | No | |
context_management | AnthropicContextManagementConfig | null | No | |
container | object | No | |
inference_geo | string | No | |
output_config | AnthropicOutputConfig | No |
Anthropic Message Request Base
Anthropic Messages request accepted at /v1/messages.
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | |
max_tokens | integer | No | (minimum: 0) |
messages | array of AnthropicInputMessage | Yes | (minItems: 1) |
system | string | array of AnthropicContentBlock | No | |
stream | boolean | No | (default: false) |
tools | array of AnthropicTool | No | |
tool_choice | AnthropicToolChoice | No | |
metadata | object | No | |
temperature | number | No | (minimum: 0, maximum: 1) |
top_p | number | No | (minimum: 0, maximum: 1) |
top_k | integer | No | |
thinking | object | No | |
stop_sequences | array of string | No | |
service_tier | string | No | |
cache_control | object | No | |
cache_control.type | enum ('ephemeral') | No | |
cache_control.ttl | enum ('5m') | No | |
context_management | AnthropicContextManagementConfig | null | No | |
container | object | No | |
inference_geo | string | No | |
output_config | AnthropicOutputConfig | No |
Anthropic Output Config
Anthropic output controls. effort sets the reasoning effort; max selects the strongest available effort.
| Field | Type | Required | Description |
|---|---|---|---|
effort | enum ('low', 'medium', 'high', 'xhigh', 'max') | No | |
format | AnthropicJsonOutputFormat | No |
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 Tool
Anthropic tool definition. Custom (developer) tools are supported; supported hosted tools are accepted, and unsupported hosted tools return an invalid_request_error.
| Field | Type | Required | Description |
|---|---|---|---|
type | string | No | |
name | string | No | |
description | string | No | |
input_schema | object | No |
Anthropic Tool Choice
| Field | Type | Required | Description |
|---|---|---|---|
type | enum ('auto', 'any', 'none', 'tool') | Yes | |
name | string | No | |
disable_parallel_tool_use | boolean | No |
Anthropic Usage
| Field | Type | Required | Description |
|---|---|---|---|
input_tokens | integer | Yes | |
output_tokens | integer | Yes | |
cache_creation_input_tokens | integer | No | |
cache_read_input_tokens | integer | No | |
output_tokens_details | object | No | |
output_tokens_details.thinking_tokens | integer | No |