API reference

Analytics

Everything the dashboard charts is backed by these endpoints. Pull the same numbers into your own dashboards, Slack bots, or end-of-month reports.

Authentication

Analytics endpoints authenticate with a Supabase access token (the JWT you get from POST /v1/auth/login), not with an mt_live_ key. This is because analytics are scoped to the user, not to a specific API key.

GET /v1/analytics/summary

Total usage across all your API keys.

curl https://api.mintoken.in/v1/analytics/summary \
  -H "Authorization: Bearer <supabase-jwt>"
{
  "total_requests": 1423,
  "total_input_tokens": 412890,
  "total_output_tokens": 51293,
  "total_tokens_saved": 117080,
  "total_cost_saved_usd": 2.87,
  "period_start": "",
  "period_end": ""
}
  • total_requests — number of requests compressed.
  • total_output_tokens — tokens you actually paid for.
  • total_tokens_saved — estimated tokens you didn't pay for, computed against a no-mintoken baseline (65% compression ratio average).
  • total_cost_saved_usd — estimated dollar savings, using our model pricing table.

GET /v1/analytics/timeseries

Bucketed usage over time. Useful for line charts. Query parameters:

  • bucket — one of hour, day, week. Default: day.
  • start / end — ISO-8601 timestamps to limit the window.
curl "https://api.mintoken.in/v1/analytics/timeseries?bucket=day" \
  -H "Authorization: Bearer <supabase-jwt>"

GET /v1/analytics/by-key

Per-API-key breakdown — useful when you want to know which environment burns the most tokens.

curl https://api.mintoken.in/v1/analytics/by-key \
  -H "Authorization: Bearer <supabase-jwt>"

GET /v1/analytics/savings

Per-model breakdown of savings in dollars. Groups by (provider, model) and applies the pricing table to each.