Usage

Get usage metrics

Changed on

Returns your organization's usage spend over a window as points: one per hour or day in time_zone (and per group with group_by: product, agent, model, api_key, schedule or device_class), each with the total, phone-session and inference spend in microdollars, the phone seconds and tokens it bought, zero when nothing was billed. The window defaults to the last 7 days and may start at most a year back; hour buckets need a window of 7 days or less.

get/usage/metrics

Request

Query parameters

period_start_atstring date-time

Start of the window (RFC 3339). Defaults to 7 days before period_end_at, and may be at most a year before now.

period_end_atstring date-time

End of the window (RFC 3339). Defaults to now, and a later time is read as now.

granularity'hour' | 'day'

Bucket size: hour or day. hour is allowed for windows of 7 days or less.

time_zonestring

IANA time zone the buckets follow, such as America/Los_Angeles: a day starts at local midnight and an hour on the local hour. An unknown name is an error.

group_by'product' | 'agent' | 'model' | 'api_key' | 'schedule' | 'device_class'

Split each bucket by product (session or inference), agent, model, api_key, schedule or device_class. Omit for one point per bucket.

Response

OK

Changes

    • info

      added the new enum value agent to the query request parameter group_by

    • info

      added the new enum value api_key to the query request parameter group_by

    • info

      added the new enum value device_class to the query request parameter group_by

    • info

      added the new enum value model to the query request parameter group_by

    • info

      added the new enum value schedule to the query request parameter group_by

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the required property // to the response with the status

    • info

      added the required property // to the response with the status

    • info

      added the required property // to the response with the status

    • breaking

      for the query request parameter granularity, default value was changed from daily to day

    • breaking

      removed the enum value daily from the query request parameter granularity

    • breaking

      removed the enum value hourly from the query request parameter granularity

    • breaking

      removed the required property from the response with the status

    • breaking

      removed the required property from the response with the status

    • breaking

      removed the required property from the response with the status

    • breaking

      removed the required property from the response with the status

    • breaking

      removed the required property from the response with the status

    • breaking

      removed the required property from the response with the status

    • breaking

      removed the required property from the response with the status

    • breaking

      removed the required property from the response with the status

    • warning

      deleted the query request parameter end_date

    • warning

      deleted the query request parameter start_date

    • warning

      deleted the query request parameter timezone

    • info

      added the new optional query request parameter group_by

    • info

      added the new optional query request parameter period_end_at

    • info

      added the new optional query request parameter period_start_at

    • info

      added the new optional query request parameter time_zone

    • info

      added the new enum value day to the query request parameter granularity

    • info

      added the new enum value hour to the query request parameter granularity

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the required property to the response with the status