Cost Tracking
PraisonAI CLI provides comprehensive cost tracking to help you monitor token usage and expenses across your AI coding sessions. Know exactly what you’re spending in real-time.Overview
The cost tracking system monitors:- Token usage - Input, output, and cached tokens
- Cost calculation - Real-time cost based on model pricing
- Session statistics - Aggregated stats across requests
- Model breakdown - Usage per model
Quick Start
Supported Models
Cost tracking supports 18+ models with accurate pricing:OpenAI Models
| Model | Input (per 1M) | Output (per 1M) |
|---|---|---|
| gpt-4o | $2.50 | $10.00 |
| gpt-4o-mini | $0.15 | $0.60 |
| gpt-4-turbo | $10.00 | $30.00 |
| o1 | $15.00 | $60.00 |
| o1-mini | $3.00 | $12.00 |
| o3-mini | $1.10 | $4.40 |
Anthropic Models
| Model | Input (per 1M) | Output (per 1M) |
|---|---|---|
| claude-3-5-sonnet | $3.00 | $15.00 |
| claude-3-opus | $15.00 | $75.00 |
| claude-3-haiku | $0.25 | $1.25 |
Google Models
| Model | Input (per 1M) | Output (per 1M) |
|---|---|---|
| gemini-2.0-flash | $0.10 | $0.40 |
| gemini-1.5-pro | $1.25 | $5.00 |
| gemini-1.5-flash | $0.075 | $0.30 |
Python API
Basic Tracking
Session Statistics
Tracking from LLM Responses
Export Session Data
CLI Integration
Interactive Mode
Token Breakdown
Cost Calculation
How Costs Are Calculated
Custom Pricing
Add pricing for custom or new models:Real-Time Monitoring
Display During Operations
Budget Alerts
Session Management
Multiple Sessions
End Session
Best Practices
Cost Optimization
- Use appropriate models - gpt-4o-mini for simple tasks
- Monitor token usage - Check
/tokensregularly - Enable caching - Reduces input token costs
- Batch operations - Fewer requests = lower overhead
Tracking Tips
- Name sessions - Use descriptive session IDs
- Export regularly - Save session data for analysis
- Set budgets - Implement budget alerts
- Review by model - Identify expensive operations
Environment Variables
Related Features
- Slash Commands - Use
/costcommand - Metrics - Detailed performance metrics
- Telemetry - Usage analytics

