Cost Tracking
Learn how to track and manage API usage costs with AxCrew
Understanding Cost Tracking
AxCrew provides robust cost tracking capabilities to help you monitor and manage your API usage expenses. The cost tracking system:
- Tracks token usage and associated costs for each agent call
- Maintains both individual agent costs and aggregated crew costs
- Uses high-precision decimal calculations for accuracy
- Supports different pricing tiers for various AI models
New Metrics API
AxCrew provides a modern metrics API for monitoring:
Accessing Cost Information
Individual Agent Last Usage Cost
Get the cost of the most recent call to an agent:
Example output:
Individual Agent Accumulated Costs
Aggregated Crew Costs
Example output:
Resetting Costs
Cost Tracking with Sessions
Track costs across multiple sessions:
Budget Management
Implement budget caps for production:
Best Practices
- Regular Monitoring: Check costs periodically during development
- Budget Limits: Implement budget caps for production environments
- Cost Attribution: Use state to track costs per user or per session
- Logging: Log cost information alongside other metrics
- Provider Selection: Choose models based on cost-performance tradeoff