Unit Economics: Track Cost Per Business Metric
Unit Economics
Section titled “Unit Economics”Unit economics lets you answer questions like “How much does it cost to serve one customer?” or “What’s our cost per API call this month?” Instead of looking at raw cloud spend, you track cost relative to business output.
Why Unit Economics
Section titled “Why Unit Economics”Raw cloud cost going up isn’t necessarily bad — it might mean your business is growing. What matters is whether your cost per unit is stable, improving, or degrading.
| Scenario | Raw Cost | Customers | Cost/Customer | Verdict |
|---|---|---|---|---|
| January | $8,000 | 200 | $40 | Baseline |
| February | $12,000 | 350 | $34 | Improving |
| March | $15,000 | 360 | $42 | Degrading |
In this example, March’s cost increase is a real problem — you’re spending more per customer. February’s increase was healthy growth.
Supported Metric Types
Section titled “Supported Metric Types”| Type | Description | Example |
|---|---|---|
api_calls | API request volume | 2.4M calls/day |
transactions | Business transactions | 50K orders/day |
customers | Active customer count | 1,200 active |
requests | HTTP requests served | 10M requests/day |
custom | Any numeric metric | Deployments, builds, etc. |
How It Works
Section titled “How It Works”- You send unit data — Push your business metrics to Xplorr via API (daily values).
- Xplorr matches with cost — Each day’s unit count is joined with that day’s total cloud cost.
- Cost per unit is calculated —
daily_cost / unit_count = cost_per_unit. - Trends are tracked — Xplorr compares the first half vs. second half of any period to detect whether cost-per-unit is increasing, decreasing, or stable.
Ingesting Metrics
Section titled “Ingesting Metrics”Push unit data via the REST API. You’ll typically run this from a cron job, CI pipeline, or data pipeline.
# Push today's customer countcurl -X POST "https://api.xplorr.io/api/v1/unit-economics/metrics" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Active Customers", "metric_type": "customers", "value": 1247, "date": "2026-03-21" }'// Node.js example — push daily from a scheduled jobconst response = await fetch('https://api.xplorr.io/api/v1/unit-economics/metrics', { method: 'POST', headers: { 'Authorization': `Bearer ${process.env.XPLORR_TOKEN}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ name: 'API Calls', metric_type: 'api_calls', value: 2_400_000, date: new Date().toISOString().split('T')[0], }),});# Python exampleimport requestsfrom datetime import date
requests.post( "https://api.xplorr.io/api/v1/unit-economics/metrics", headers={"Authorization": f"Bearer {token}"}, json={ "name": "Transactions", "metric_type": "transactions", "value": 48500, "date": str(date.today()), },)Upsert behavior: If you push the same (name, date) combination twice, the second value replaces the first. This makes retries safe.
Rate limit: 30 requests per minute.
Querying Cost Per Unit
Section titled “Querying Cost Per Unit”# Get cost per unit for the last 30 dayscurl -H "Authorization: Bearer $TOKEN" \ "https://api.xplorr.io/api/v1/unit-economics?metricName=Active%20Customers"
# Custom date rangecurl -H "Authorization: Bearer $TOKEN" \ "https://api.xplorr.io/api/v1/unit-economics?metricName=API%20Calls&startDate=2026-02-01&endDate=2026-03-01"Response:
[ { "date": "2026-03-20", "metric_name": "Active Customers", "metric_type": "customers", "unit_count": 1247, "daily_cost": 412.50, "cost_per_unit": 0.33, "currency": "USD" }]Trend Analysis
Section titled “Trend Analysis”Check whether cost-per-unit is improving or degrading:
curl -H "Authorization: Bearer $TOKEN" \ "https://api.xplorr.io/api/v1/unit-economics/trend?metricName=Active%20Customers&period=30"Response:
{ "trend": { "direction": "decreasing", "percentChange": -8.2, "avgCostPerUnit": 0.31 }}| Direction | Meaning |
|---|---|
decreasing | Cost per unit is improving (good) |
increasing | Cost per unit is degrading (investigate) |
insufficient_data | Not enough data points to determine trend |
The trend compares the average cost-per-unit in the first half of the period against the second half.
MCP & Slack Access
Section titled “MCP & Slack Access”Unit economics data is also accessible via:
- MCP Server — Use the
get_cost_summarytool and correlate with your own metrics. - Slack Bot — Ask questions like “What’s my cost per customer this month?” (if you’ve ingested customer metrics).
Best Practices
Section titled “Best Practices”- Push daily — Unit economics works best with daily granularity. A daily cron job is the simplest approach.
- Pick 2-3 metrics — Don’t track everything. Pick the metrics that matter most to your business: customers, API calls, or transactions.
- Automate ingestion — Pull from your application database, analytics platform, or Stripe/billing system. Don’t rely on manual entry.
- Review weekly — Check the trend endpoint weekly. A gradual increase in cost-per-unit is easy to miss if you only look at raw spend.
- Correlate with anomalies — If cost-per-unit spikes, check the anomaly detection page to see if a specific service is the cause.