v1
latestOpenAPI 3.0.32026-07-175615.8 KBCreate a new message conversation with Claude
Sends a message or a series of messages to Claude and retrieves a response, optionally including thinking traces.
post/v1/messages
Request body
Example request
{
"model": "claude-3-5-sonnet-20241022",
"messages": [
{
"role": "user",
"content": "Hello, how can I assist you today?"
}
],
"max_tokens": 1024,
"temperature": 0.7,
"system": "You are a helpful assistant created by Anthropic.",
"top_p": 0.9,
"top_k": 40
}Response
Successful response with Claude's reply and optional thinking trace
Example response
{
"id": "msg_12345",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hi there! I'm here to help you with any questions."
}
]
}