Analytics API

Query GLM 5 API usage analytics with a management key — spend, requests, tokens, and per-model breakdowns across a bounded, explicitly requested time range.

The Analytics API exposes the same bounded query model used by Activity → Explore. Authenticate with a management key, not an inference key.

Discover available dimensions

GEThttps://glm5.app/api/v1/analytics/meta

The response lists supported metrics, dimensions, public models, the current account's inference keys, and the maximum query window.

Query analytics

POSThttps://glm5.app/api/v1/analytics/query
{
  "metric": "credits",
  "dimension": "model",
  "from": "2026-08-01T00:00:00.000Z",
  "to": "2026-08-28T23:59:59.999Z"
}

Supported metrics:

  • requests
  • credits
  • input_tokens
  • output_tokens
  • errors
  • latency

Supported dimensions:

  • day
  • model
  • key
  • status

Queries are scoped to the management-key owner and limited to a 90-day window. The endpoint returns aggregated data only; it does not expose prompt or completion bodies.