Create message
Anthropic
Anthropic
Create message
Create a message completion using Anthropic's /v1/messages API (Claude).
Action
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
model | text | Required | The model to use (e.g. claude-sonnet-4-20250514 (default), claude-opus-4-5-20251101, claude-sonnet-4-6, claude-opus-4-6). Supported model IDs only. |
max_tokens | number | Required | The maximum number of tokens to generate before stopping. |
messages | array of object | Required | Input messages with alternating user and assistant roles. |
role | select | Required | The role of the message. (options: user, assistant) |
content | text | Required | The content of the message. |
system | text | Optional | Optional system prompt that sets the behavior of the assistant. |
temperature | number | Optional | Amount of randomness; use either temperature or top_p, not both. |
top_p | number | Optional | Nucleus sampling: consider tokens with top_p probability mass. |
top_k | number | Optional | Only sample from the top K options for each token. |
Outputs
| Name | Type | Description |
|---|---|---|
statusCode | number | HTTP status code from Anthropic API response. |
body | object | Anthropic message response: id, content (blocks with text), usage. |
id | text | Unique message identifier. |
type | text | Object type (e.g. message). |
role | text | Role of the response (e.g. assistant). |
content | array of object | Array of content blocks (e.g. type text with text). |
type | text | Block type (e.g. text). |
text | text | Generated text content. |
model | text | Model used for the completion. |
stop_reason | text | Why the model stopped (e.g. end_turn, max_tokens). |
stop_sequence | text | Stop sequence if present. |
usage | object | Token usage. |
input_tokens | number | Input tokens used. |
output_tokens | number | Output tokens generated. |