Skip to content
Sign in Create account

Usage summary (aggregated)

GET /api/v1/billing/usage/summary

Returns daily per-provider usage rows and window aggregates for requests, tokens, billed cost, latency percentiles, traffic presence, request-count change, and usage rows without linked receipts. window accepts 24h, 7d, 30d, or 90d; explicit from and to dates take precedence. Latency percentiles and the change value can be null when there is no sample or comparison window. This operation is also available under the versioned path.

Authenticate with a portal session token.

Parameters

  • from string (date) query
  • to string (date) query
  • window string query
    One of: "24h", "7d", "30d", "90d"
  • provider string query
    Length: at most 64 characters. Pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$

Responses

200 Daily provider rows and window aggregates derived from usage records.

application/json object

  • cost_billed_cents integer required
  • from string (date) required
  • has_traffic boolean required
  • input_tokens integer required
  • output_tokens integer required
  • p50_latency_ms integer or null required
  • p95_latency_ms integer or null required
  • p99_latency_ms integer or null required
  • requests integer required
  • requests_delta_pct number or null required
  • summary array of object required

    Each item:

    • cost_cents integer required
    • date string (date) required
    • input_tokens integer required
    • output_tokens integer required
    • provider string required
    • request_count integer required
    • cost_micros integer required
  • to string (date) required
  • tokens_provider integer required
  • total_requests integer required
  • cost_billed_micros integer required
  • no_receipt_count integer required

    Number of usage records without a linked receipt; these rows remain included in totals.

  • cache_usage CacheUsageBreakdown required

Generated sample

{
  "cost_billed_cents": 0,
  "from": "2026-01-01",
  "has_traffic": true,
  "input_tokens": 0,
  "output_tokens": 0,
  "p50_latency_ms": 0,
  "p95_latency_ms": 0,
  "p99_latency_ms": 0,
  "requests": 0,
  "requests_delta_pct": 0,
  "summary": [
    {
      "cost_cents": 0,
      "date": "2026-01-01",
      "input_tokens": 0,
      "output_tokens": 0,
      "provider": "string",
      "request_count": 0,
      "cost_micros": 0
    }
  ],
  "to": "2026-01-01",
  "tokens_provider": 0,
  "total_requests": 0,
  "cost_billed_micros": 0,
  "no_receipt_count": 0,
  "cache_usage": {
    "read": {
      "tokens": 0,
      "rate_cents_per_million": 0,
      "provider_cost_micros": 0,
      "unpriced_tokens": 0
    },
    "write_5m": {
      "tokens": 0,
      "rate_cents_per_million": 0,
      "provider_cost_micros": 0,
      "unpriced_tokens": 0
    },
    "write_1h": {
      "tokens": 0,
      "rate_cents_per_million": 0,
      "provider_cost_micros": 0,
      "unpriced_tokens": 0
    },
    "write_30m": {
      "tokens": 0,
      "rate_cents_per_million": 0,
      "provider_cost_micros": 0,
      "unpriced_tokens": 0
    },
    "write_12h": {
      "tokens": 0,
      "rate_cents_per_million": 0,
      "provider_cost_micros": 0,
      "unpriced_tokens": 0
    },
    "write_total_tokens": 0,
    "per_type_available": true,
    "records_without_audit_detail": 0
  }
}
401 Missing or invalid bearer token.

application/json object

Any keys are accepted.

403 The caller does not meet the route requirements: accepted Terms of Service and Privacy Policy.

application/json object

Any keys are accepted.

422 Invalid date, provider, or window filter.

application/json GenericError

  • error any

    One of

    • string
    • object

      Any keys are accepted.

  • error_code string
  • code string
  • message string
  • detail string
  • status any

    One of

    • string
    • integer
  • errors object

    Any keys are accepted.

429 The request was rate limited. API-generated responses are JSON;

Response headers

  • Retry-After string header

    Seconds to wait before retrying, when provided.

  • X-RateLimit-Scope string header

    Identifies the scope of the request limit, when provided.

application/json GenericError

  • error any

    One of

    • string
    • object

      Any keys are accepted.

  • error_code string
  • code string
  • message string
  • detail string
  • status any

    One of

    • string
    • integer
  • errors object

    Any keys are accepted.

text/html string