Skip to main content
GET
https://agentgate.mynewapi.com
/
api
/
v1
/
usage
/
summary
Get Usage Summary
curl --request GET \
  --url https://agentgate.mynewapi.com/api/v1/usage/summary \
  --header 'Authorization: Bearer <token>'
{
  "success": true,
  "data": {
    "totalInputTokens": 123,
    "totalOutputTokens": 123,
    "totalCachedInputTokens": 123,
    "totalCostUsd": 123,
    "executionCount": 123,
    "workOrderCount": 123,
    "totalDurationMs": 123,
    "byModel": {},
    "periodStart": "<string>",
    "periodEnd": "<string>"
  }
}

Get Usage Summary

Returns aggregated usage summary including totals and per-model breakdown.

Request

workOrderId
string
Filter by work order ID
runId
string
Filter by run ID
model
string
Filter by model name
startDate
string
Start date filter (ISO 8601)
endDate
string
End date filter (ISO 8601)
curl "https://agentgate.mynewapi.com/api/v1/usage/summary?startDate=2024-01-01&endDate=2024-01-31" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

success
boolean
required
Indicates if the request was successful
data
object
required
Usage summary data

Example Response

{
  "success": true,
  "data": {
    "totalInputTokens": 1542000,
    "totalOutputTokens": 325000,
    "totalCachedInputTokens": 800000,
    "totalCostUsd": 52.34,
    "executionCount": 145,
    "workOrderCount": 42,
    "totalDurationMs": 4523000,
    "byModel": {
      "claude-sonnet-4-20250514": {
        "inputTokens": 1200000,
        "outputTokens": 250000,
        "cachedInputTokens": 650000,
        "costUsd": 38.50,
        "executionCount": 120
      },
      "claude-opus-4-20250514": {
        "inputTokens": 342000,
        "outputTokens": 75000,
        "cachedInputTokens": 150000,
        "costUsd": 13.84,
        "executionCount": 25
      }
    },
    "periodStart": "2024-01-01T00:00:00.000Z",
    "periodEnd": "2024-01-31T23:59:59.999Z"
  }
}

Use Cases

  • Generate monthly usage reports
  • Compare costs across models
  • Track usage trends over time
  • Budget monitoring and alerts