Tools
Execute tool calls on behalf of users to access internet services and data. Tools can be used directly or integrated with chat models for enhanced AI interactions.
Basic Tool Request
Execute a tool call directly using the /api/tools endpoint. Currently available tools are internet-accessible services that don't require personal user data. Available tools can be found by using the /api/models endpoint.
Try Wikipedia Tool
Parameters
function (required)
The tool function to execute, containing:
name- The name of the tool to execute (e.g., "wikipedia")arguments- An object containing the parameters for the tool
Integration with Chat Models
Tools integrate seamlessly with chat responses. When you provide tool definitions in a chat request, the model can select and use tools as needed and provide it's choices in the tool_calls field of a message. You can pass in each tool call directly to the tools endpoint.
Chat with Tools Example
Tool Call Compatibility: The parameters for the tools endpoint are identical to what models emit in tool_calls, allowing you to send each tool call entry directly to the endpoint.
Tool Definitions
When using tools with chat models, you define available tools using JSON Schema format. This tells the model what to use a tool for and what parameters to provide when calling it.
Example Tool Definition