v1
latestOpenAPI 3.0.02026-07-26117076.0 KBText Series
Claude Messages API
Send requests in the Claude Messages format. For the latest request parameter definitions, refer to the official Anthropic documentation: https://platform.claude.com/docs/en/api/messages/create
post/v1/messages
Request body
Example request
{
"model": "claude-sonnet-4-5-20250929",
"messages": [
{
"role": "user",
"content": "Summarize the purpose of feature canary releases in two sentences."
}
],
"max_tokens": 1024,
"system": "You are a product announcement editor, keep it objective and concise.",
"cache_control": {
"type": "ephemeral",
"ttl": "1h"
},
"output_config": {
"effort": "high",
"format": {
"type": "json_schema"
}
},
"thinking": {
"type": "enabled",
"budget_tokens": 2048,
"display": "summarized"
},
"tools": [
{
"name": "get_weather",
"description": "Fetch the weather by city name."
}
],
"tool_choice": "auto"
}Response
Message created
Example response
{
"code": 200,
"data": {
"id": "msg_013zva2CMHNLnXJNN3QKQ2EF",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello! I'm Claude. Nice to meet you.",
"source": {
"type": "base64",
"media_type": "image/png"
}
}
],
"model": "claude-sonnet-4-5-20250929",
"stop_reason": "end_turn",
"usage": {
"input_tokens": 10,
"output_tokens": 13
}
}
}