Billing
Usage Tracking
Monitor and analyze your Engrami usage with detailed metrics and reporting.
Usage Dashboard
The usage dashboard provides real-time visibility into your credit consumption across all agents, workflows, and features. Access it from Billing → Usage.
- Real-time credit balance
- Daily/weekly/monthly usage trends
- Breakdown by agent, workflow, and operation type
- Cost projections and forecasting
Usage API
Get Usage Summary
curl https://api.engrami.com/api/v1/billing/usage?period=month \
-H "Authorization: Bearer YOUR_TOKEN"
# Response
{
"period": {
"start": "2024-01-01T00:00:00Z",
"end": "2024-01-31T23:59:59Z"
},
"summary": {
"total_credits_used": 45230,
"total_api_calls": 12543,
"total_tokens": 4523000,
"average_daily_usage": 1459
},
"by_category": {
"agent_chat": 35000,
"embeddings": 5000,
"memory_storage": 2230,
"workflows": 3000
}
}Usage by Agent
curl https://api.engrami.com/api/v1/billing/usage/agents?period=month \
-H "Authorization: Bearer YOUR_TOKEN"
# Response
{
"agents": [
{
"agent_id": "agent_support",
"agent_name": "Customer Support",
"credits_used": 25000,
"api_calls": 5234,
"tokens_used": 2500000,
"avg_tokens_per_call": 478
},
{
"agent_id": "agent_research",
"agent_name": "Research Assistant",
"credits_used": 15000,
"api_calls": 2100,
"tokens_used": 1500000,
"avg_tokens_per_call": 714
}
]
}Daily Breakdown
curl https://api.engrami.com/api/v1/billing/usage/daily?start=2024-01-01&end=2024-01-31 \
-H "Authorization: Bearer YOUR_TOKEN"
# Response
{
"daily": [
{
"date": "2024-01-01",
"credits_used": 1234,
"api_calls": 456,
"tokens": 123400
},
{
"date": "2024-01-02",
"credits_used": 1567,
"api_calls": 523,
"tokens": 156700
}
// ... more days
]
}Key Metrics
Credit Consumption
- Total Credits Used - Sum of all credit deductions
- Burn Rate - Average daily/weekly credit consumption
- Days Remaining - Estimated days until credits run out
API Metrics
- API Calls - Total requests to agents and workflows
- Tokens Processed - Input + output tokens for LLM calls
- Latency - Average response time
- Error Rate - Percentage of failed requests
Memory Metrics
- Storage Used - Total memory storage across all types
- Queries - Memory search/retrieval operations
- Write Operations - New memories stored
Usage Reports
Export detailed usage reports for accounting and analysis:
# Export usage report as CSV
curl -X POST https://api.engrami.com/api/v1/billing/usage/export \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"period": {
"start": "2024-01-01",
"end": "2024-01-31"
},
"format": "csv",
"granularity": "daily",
"include": ["agents", "workflows", "memory", "integrations"]
}'
# Response
{
"export_id": "exp_abc123",
"status": "processing",
"download_url": null,
"estimated_completion": "2024-01-20T10:35:00Z"
}
# Check export status
curl https://api.engrami.com/api/v1/billing/usage/export/exp_abc123 \
-H "Authorization: Bearer YOUR_TOKEN"
# When complete
{
"export_id": "exp_abc123",
"status": "completed",
"download_url": "https://exports.engrami.com/exp_abc123.csv",
"expires_at": "2024-01-27T10:35:00Z"
}Cost Forecasting
Project future costs based on historical usage:
curl https://api.engrami.com/api/v1/billing/forecast?months=3 \
-H "Authorization: Bearer YOUR_TOKEN"
# Response
{
"current_balance": 45230,
"monthly_burn_rate": 15000,
"forecast": [
{
"month": "2024-02",
"projected_usage": 16500,
"projected_balance": 28730,
"confidence": 0.85
},
{
"month": "2024-03",
"projected_usage": 18150,
"projected_balance": 10580,
"confidence": 0.75
},
{
"month": "2024-04",
"projected_usage": 19965,
"projected_balance": -9385,
"confidence": 0.65,
"alert": "Projected to run out of credits"
}
],
"recommendation": "Consider purchasing 30,000 credits to maintain service"
}Cost Optimization Tips
- Choose the right model - Use GPT-3.5 for simple tasks, GPT-4 only when needed
- Optimize prompts - Shorter prompts reduce token usage
- Cache responses - Enable response caching for repeated queries
- Set context limits - Limit conversation history length
- Use memory efficiently - Consolidate old memories to reduce storage
- Monitor anomalies - Set up alerts for unusual usage spikes
Usage Alerts
curl -X POST https://api.engrami.com/api/v1/billing/usage/alerts \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"alerts": [
{
"name": "Daily Usage Spike",
"condition": "daily_usage > 5000",
"channels": ["email"]
},
{
"name": "Agent Anomaly",
"condition": "agent_usage > 200% of average",
"channels": ["slack", "email"]
},
{
"name": "Monthly Budget",
"condition": "monthly_usage > 50000",
"channels": ["email", "sms"]
}
]
}'