Anthropic Messages
Send messages and Content Blocks with the Anthropic Messages-compatible structure.
The Messages API creates model responses from user and assistant messages and Content Blocks. It supports text, images, tool calls, streaming output, and extended thinking. Available content blocks, tools, and advanced parameters depend on the selected model and the models visible to the current API key.
/v1/messagesGenerate the next assistant response from user and assistant messages. Message content can be a string or an array of text, image, tool, and document Content Blocks.
The API supports standard JSON responses and SSE streaming events. Image input, tool calling, and extended thinking depend on the selected model.
Authorization
anthropicApiKey Pass the API Key in the x-api-key Header.
In: header
Header Parameters
Specify the API version to use.
"2023-06-01"Specify the beta version to use. You can use commas to separate multiple values, or send the header multiple times.
Request Body
Messages represents text, images, tools, and extended thinking with Content Blocks. Choose a view for your task.
application/jsonUse user and assistant messages for single-turn or multi-turn conversations; provide system instructions in the top-level field.
- model
- A Messages-capable model ID visible to the current API key.
- max_tokens
- The maximum number of tokens the response may generate.
- messages[]
- User and assistant messages in chronological order.
{
"model": "MODEL_ID",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello! Please introduce yourself."
}
]
}Basic text chat. messages can contain strings or text Content Blocks.
Image, tool, and extended-thinking support can vary by model and provider channel. Start with a minimal text request, then enable advanced fields one at a time.
Response Body
application/json
application/json
application/json
application/json