Overview
Tool calling (also called function calling) enables models to request execution of external functions. The model proposes tool calls; your application executes them and returns results to continue the conversation.How It Works
- Model proposes tool call - Model identifies when a tool should be called
- Client executes tool - Your application runs the function locally
- Return results - Send tool output back in the conversation
- Model processes - Model uses results to generate final response
Request Format
Includetools array in your request:
Tool Definition Schema
Tool Choice
Control when tools are called:"auto": Model decides (default)"none": No tools called"required": Model must call a tool{type: "function", function: {name: string}}: Force specific function
Response Format
When a tool is called, the response includestool_calls:
Executing Tools
Parsearguments (JSON string) and execute:
Returning Tool Results
Send results as atool message:
Parallel Tool Calls
Enable multiple tool calls in one response:true. When enabled, model can call multiple tools simultaneously.
Multi-Turn Conversations
Maintain conversation history including all tool calls and results:Supported Models
View Tool-Calling Models
For a complete list of models that support tool calling, visit anannas.ai/models and filter by capability.
- OpenAI: GPT-4, GPT-3.5 Turbo, GPT-5 Mini, o1, o3
- Anthropic: Claude 3 Opus, Claude 3 Sonnet, Claude 3 Haiku, Claude Sonnet 4.5
- Other providers: Check
/v1/modelsfortool_callingcapability
Best Practices
- Clear descriptions: Write detailed function descriptions
- Required fields: Specify
requiredarray for critical parameters - Type constraints: Use
enumfor limited options - Error handling: Handle invalid tool calls gracefully
- Conversation history: Include all tool calls and results in subsequent requests
Example: Complete Tool Calling Flow
See Also
- API Overview - Complete request/response schemas
- Parameters - Tool calling parameters