{
"id": "msg_abc123",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello! How can I help you today?"
}
],
"model": "<string>",
"stop_reason": "end_turn",
"usage": {
"input_tokens": 25,
"output_tokens": 150
}
}{
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"error": {
"message": "Invalid API key",
"type": "authentication_error"
}
}{
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"error": {
"message": "Access denied",
"type": "permission_error"
}
}{
"error": {
"message": "Rate limit exceeded",
"type": "rate_limit_error"
}
}{
"error": {
"message": "Internal server error",
"type": "server_error"
}
}Claude Format - Tool Calling Messages
- Generic Anthropic Messages API reference with tool calling for all compatible models
- Tool calling: supports Function Calling with tool definitions
- Multimodal input: supports text + image mixed input
- Extended thinking: supports thinking/reasoning mode
- Supports streaming and non-streaming responses
{
"id": "msg_abc123",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello! How can I help you today?"
}
],
"model": "<string>",
"stop_reason": "end_turn",
"usage": {
"input_tokens": 25,
"output_tokens": 150
}
}{
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"error": {
"message": "Invalid API key",
"type": "authentication_error"
}
}{
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"error": {
"message": "Access denied",
"type": "permission_error"
}
}{
"error": {
"message": "Rate limit exceeded",
"type": "rate_limit_error"
}
}{
"error": {
"message": "Internal server error",
"type": "server_error"
}
}Authorizations
All APIs require Bearer Token authentication
Add to request header:
Authorization: Bearer YOUR_API_KEY
Body
Model name, e.g. claude-sonnet-4-6
"claude-sonnet-4-6"
List of messages in the conversation
Show child attributes
Show child attributes
Maximum number of tokens to generate (required)
System prompt
Sampling temperature (0-1)
0 <= x <= 1Nucleus sampling parameter (0-1)
0 <= x <= 1Top-K sampling parameter
Whether to stream the response
Custom stop sequences that will cause the model to stop generating
List of tools the model may use
Show child attributes
Show child attributes
How the model should use the provided tools
Show child attributes
Show child attributes
Request metadata
Show child attributes
Show child attributes
Response
Claude Messages API response
Unique message ID
"msg_abc123"
Object type
message Role
assistant Response content blocks
Show child attributes
Show child attributes
Model used
Reason the generation stopped
end_turn, max_tokens, stop_sequence, tool_use "end_turn"
Token usage statistics
Show child attributes
Show child attributes