Skip to main content

Get Usage Summary

GET /v1/usage/summary
Returns aggregated cost breakdown for today, last 7 days, and last 30 days, plus breakdowns by model and by user. Auth: JWT or API Key

Response 200

{
  "today": {
    "total_usd": 12.50,
    "total_tokens": 250000,
    "run_count": 45
  },
  "last_7_days": {
    "total_usd": 85.20,
    "total_tokens": 1700000,
    "run_count": 312
  },
  "last_30_days": {
    "total_usd": 340.00,
    "total_tokens": 6800000,
    "run_count": 1250
  },
  "by_model": [
    {
      "model": "gpt-4o",
      "total_usd": 280.00,
      "prompt_tokens": 4500000,
      "completion_tokens": 900000
    },
    {
      "model": "gpt-4o-mini",
      "total_usd": 60.00,
      "prompt_tokens": 1200000,
      "completion_tokens": 200000
    }
  ],
  "by_user": [
    {
      "user_id": "alice",
      "total_usd": 150.00,
      "run_count": 520
    },
    {
      "user_id": "bob",
      "total_usd": 190.00,
      "run_count": 730
    }
  ],
  "monthly_run_count": 1250,
  "monthly_run_limit": 50000
}

Response Fields

FieldTypeDescription
todayCostBreakdownAggregated costs for today
last_7_daysCostBreakdownAggregated costs for the last 7 days
last_30_daysCostBreakdownAggregated costs for the last 30 days
by_modelModelCost[]Cost breakdown by model
by_userUserCost[]Cost breakdown by SDK user
monthly_run_countintegerTotal runs this calendar month
monthly_run_limitinteger | nullMonthly run limit from plan tier (null = unlimited)

CostBreakdown

FieldTypeDescription
total_usdnumberTotal cost in USD
total_tokensintegerTotal tokens consumed
run_countintegerNumber of runs

ModelCost

FieldTypeDescription
modelstringModel identifier
total_usdnumberTotal cost for this model
prompt_tokensintegerTotal prompt tokens
completion_tokensintegerTotal completion tokens

UserCost

FieldTypeDescription
user_idstringSDK user identifier
total_usdnumberTotal cost for this user
run_countintegerNumber of runs by this user