Skip to main content
The Messages API supports tool calling to give Claude models access to external functions. Define tools using the Anthropic input_schema format. When the model wants to use a tool, it returns a tool_use content block with stop_reason: "tool_use".
The Messages API (/v1/messages) is fully supported on the Enterprise plan using https://enterprise.blackbox.ai. On standard plans (https://api.blackbox.ai), this endpoint may not work as expected. For the best experience, use an Enterprise API key.
Important — Tool Format: The Messages API uses input_schema for tool parameter definitions. This is different from the Responses API which uses parameters. Using the wrong format will result in errors.
See API Best Practices for how to correctly structure tool call IDs, pair every tool call with a tool result, preserve thinking signatures, and avoid thinking + forced tool_choice conflicts.

Basic Tool Calling

Tool Call Response

When the model wants to call a tool, the response has stop_reason: "tool_use" and includes tool_use content blocks:

Handling Tool Results

After receiving a tool_use response, execute the tool locally and send the result back. The assistant’s full response becomes the next assistant message, and your tool result goes in a user message:
The model then uses the tool result to generate a natural language response:
Final Answer Response

Multiple Tools

You can define multiple tools and the model will call whichever ones it needs — including calling multiple tools in a single response (parallel tool calls):
The model calls both tools in a single response:
Response — Parallel Tool Calls
When the model makes parallel tool calls, you must provide a tool_result for every tool_use block in the response. Send all results in a single user message.

Multi-Turn Tool Calling

For multi-turn conversations with tools, pass the assistant’s response (including tool_use blocks) back as an assistant message, followed by a user message containing tool_result blocks. Continue the loop until stop_reason is "end_turn".

Multi-Turn Conversation Flow

Here’s how the message array builds up across turns:
Each tool_result must reference the tool_use_id from the corresponding tool_use block. The API will return an error if the IDs don’t match.

Tool Definition Format

Tools use the Anthropic input_schema format:

Interleaved Thinking

Add reasoning between tool calls

Best Practices

Tool call IDs, pairing tool results, thinking signatures, and more

Messages API Overview

Headers, parameters, and supported models