Activity logs provide detailed usage statistics and analytics for your LLM Gateway usage. Query by date range, project, or API key.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/theopenco/llmgateway/llms.txt
Use this file to discover all available pages before exploring further.
Get Activity Data
Retrieve aggregated activity statistics grouped by day.Number of days to retrieve (overridden if
from and to are specified)Start date in YYYY-MM-DD format (inclusive)
End date in YYYY-MM-DD format (inclusive)
Filter by specific project ID
Filter by specific API key ID
Array of daily activity objects
Understanding Costs
Cost Breakdown
Total cost includes:- Input Cost: Tokens sent to the model
- Output Cost: Tokens generated by the model
- Request Cost: Per-request fees (some providers)
- Data Storage Cost: Log retention charges
- Image Costs: Vision model image processing
- Cached Input Cost: Cached prompt tokens (some providers)
Credits vs Provider Keys
The API tracks costs separately based on how requests were processed:- Credits Cost: Requests routed through Gateway-managed providers
- API Keys Cost: Requests using your configured provider keys
- How much you’re spending on credits
- How much you’re saving by using your own keys
- Which mode (hybrid, credits, api-keys) is most cost-effective
Discounts
Discounts can be applied at the:- Global level: All users for a specific provider/model
- Organization level: Your organization for specific providers/models
discountSavings field shows how much you saved from applied discounts.
Model Breakdown
ThemodelBreakdown array provides per-model statistics:
- Identify your most-used models
- Compare costs across providers
- Optimize model selection for cost
- Track usage patterns
Performance Metrics
Error Rate
- Provider API issues
- Invalid requests
- Rate limiting
- Authentication problems
Cache Hit Rate
- Lower costs (cached responses are free)
- Faster response times
- Reduced provider API load
Filtering Examples
By Project
Track usage for a specific project:By API Key
Monitor a specific API key’s usage:Custom Date Range
Query activity for a specific time period:Data Retention
Activity data is retained based on your organization’s plan:| Plan | Retention Period |
|---|---|
| Free | 3 days |
| Pro | 90 days |
| Enterprise | Custom (up to 1 year) |
Upgrade to Pro or Enterprise for extended data retention and historical analytics.
Error Responses
Best Practices
Monitor Regularly
- Check activity daily to catch anomalies
- Set up alerts for unusual spending
- Review error rates weekly
Optimize Costs
- Analyze model breakdown to find expensive models
- Enable caching for repetitive requests
- Use cheaper models where appropriate
- Leverage discounts when available
Track Performance
- Monitor error rates over time
- Compare cache hit rates across projects
- Identify slow or unreliable providers