Create Message
Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
The model that will complete your prompt.
claude-sonnet-5, claude-sonnet-4-6, claude-sonnet-4-5-20250929, claude-sonnet-4-20250514, claude-opus-4-6, claude-opus-4-5-20251101, claude-opus-4-1-20250805, claude-opus-4-20250514, claude-haiku-4-5-20251001, claude-3-7-sonnet-20250219, claude-3-5-sonnet-20241022 "claude-sonnet-5"
Input messages. Each message has a role and content.
1[
{
"role": "user",
"content": "Hello, Claude!"
}
]The maximum number of tokens to generate before stopping.
x >= 11024
System prompt. Provides context and instructions to Claude.
An object describing metadata about the request.
Custom text sequences that will cause the model to stop generating.
Amount of randomness injected into the response. Ranges from 0.0 to 1.0.
0 <= x <= 11
Use nucleus sampling. Recommended to use either temperature or top_p, but not both.
0 <= x <= 1Only sample from the top K options for each subsequent token.
x >= 0Whether to incrementally stream the response using server-sent events.
Definitions of tools that the model may use.
How the model should use the provided tools.
Output controls for models that support adaptive thinking effort.
Thinking configuration. For Claude Sonnet 5, use adaptive thinking or disable thinking; manual extended thinking with budget_tokens is not supported.
Response
Message created successfully
"msg_01XFDUDYJgAACzvnptvVoYEL"
"message"
"assistant"
[
{
"type": "text",
"text": "Hello! How can I help you today?"
}
]"claude-sonnet-5"
Includes refusal when a request is declined.
end_turn, max_tokens, stop_sequence, tool_use, refusal, null