Tracking Usage
Monitor your API spending with LangMart's comprehensive usage tracking tools. This guide covers the usage dashboard, cost breakdowns, and optimization strategies.
Usage Dashboard
Access your usage analytics at Analytics > Usage Analytics.
Overview Metrics
The dashboard shows key metrics at a glance:
- Total Requests - Number of API calls made
- Success Rate - Percentage of successful requests
- Total Tokens - Combined input and output tokens
- Total Cost - Credits spent in the selected period
- Average Latency - Mean response time
- Models Used - Number of unique models accessed
Time Range Selection
View usage for different periods:
- Last 24 Hours - Recent activity with hourly breakdown
- Last 7 Days - Weekly view with daily breakdown
- Last 30 Days - Monthly overview
Granularity Options
Adjust the detail level:
- Hourly - Available for 24-hour view
- Daily - Default for most views
- Weekly - Aggregate weekly totals
- Monthly - Long-term trends
Cost Breakdown by Model
See exactly which models are consuming your credits:
Top Models by Cost
A ranked list showing:
- Model name and provider
- Number of requests
- Token usage (input/output)
- Total cost
- Percentage of total spend
Model Performance Table
Detailed metrics for each model:
| Metric | Description |
|---|---|
| Requests | Total API calls to this model |
| Tokens | Total tokens processed |
| Cost | Credits spent |
| Avg Latency | Mean response time |
| % of Total | Share of your total spend |
Usage Trends
Time Series Charts
Visualize your usage patterns over time:
- Requests Over Time - See request volume trends
- Token Usage Over Time - Track token consumption
- Cost Over Time - Monitor spending patterns
Cost Projections
Based on your usage patterns, the dashboard projects:
- Next 7 Days - Estimated spend for coming week
- Next 30 Days - Monthly projection
- Daily Average - Your typical daily spend
These projections help you:
- Plan credit purchases
- Identify unexpected cost increases
- Budget for upcoming periods
Latency Distribution
Understand your API performance:
- Response time buckets - How many requests fall into each latency range
- Average latency - Mean response time across all requests
- Time to first token - For streaming requests
Cost Insights
Access detailed optimization recommendations at Analytics > Cost Insights.
Insight Types
The system analyzes your usage and suggests:
Model Switch Recommendations
- Identifies expensive models
- Suggests cheaper alternatives
- Shows potential savings
Token Optimization
- Flags requests with excessive tokens
- Suggests prompt optimization
- Identifies output length issues
Usage Pattern Analysis
- Detects unusual spending
- Identifies peak usage times
- Suggests scheduling optimizations
Provider Comparison
- Compares costs across providers
- Shows price differences for similar models
- Recommends cost-effective alternatives
Severity Levels
Insights are prioritized by potential impact:
- High - Significant savings opportunity (>20% reduction possible)
- Medium - Moderate savings available (5-20% reduction)
- Low - Minor optimizations (< 5% reduction)
Cost Optimization Tips
Choose Models Wisely
- Match model to task - Don't use GPT-4 for simple formatting
- Test with cheaper models first - Upgrade only if needed
- Use model routing - Automatically select cost-effective models
Optimize Prompts
- Be concise - Shorter prompts cost less
- Use system prompts efficiently - Don't repeat instructions
- Set max_tokens - Limit output length when appropriate
Implement Caching
- Cache repeated queries - Avoid redundant API calls
- Use semantic caching - Cache similar requests
- Leverage cached input tokens - Save on repeated context
Monitor Actively
- Set up cost alerts - Get notified before overspending
- Review weekly - Check for unusual patterns
- Audit monthly - Deep dive into usage trends
Batch Requests
- Combine related queries - Reduce per-request overhead
- Use batch endpoints - When processing multiple items
- Schedule non-urgent work - Run during off-peak times
Exporting Data
Export your usage data for external analysis:
- Go to Analytics > Usage Analytics
- Set your desired date range
- Click Export (if available)
- Choose format (CSV, JSON)
Use exported data for:
- Internal reporting
- Budget planning
- Compliance documentation
- Custom analysis
API Access to Usage Data
Access usage data programmatically:
GET /api/billing/usage
GET /api/billing/usage/current
GET /api/billing/usage/by-model
GET /api/account/analytics/usageSee the API documentation for full details.
Related Topics
- Understanding Credits - How credits are calculated
- Purchasing Credits - Add credits to your account
- Cost Alerts - Automate spending notifications