Installation
Quick Start
Complete Example
Tool Caching
Enable ephemeral caching to reduce costs:handleToolCalls()
Automatically execute tool calls from Claude’s response:Tool Format
The Anthropic provider wraps tools in this format:Streaming
Best Practices
- Tool Caching: Enable caching for cost savings
- Max Tokens: Set appropriate max_tokens for tool responses
- Error Handling: Handle tool execution errors
- Prompt Design: Craft clear system prompts
- Stop Reasons: Check stop_reason for tool_use
TypeScript Types
Differences from OpenAI
| Feature | OpenAI | Anthropic |
|---|---|---|
| Tool Format | Function | Tool Use |
| Streaming | Delta format | Event stream |
| Caching | No | Ephemeral caching |
| Max Tokens | Optional | Required |
| Tool Execution | Manual | Via handleToolCalls |
Next Steps
OpenAI Provider
Compare with OpenAI
Tools API
Learn about tools
Connected Accounts
Set up authentication
Examples
View examples