Skip to content
  • Auto
  • Light
  • Dark

Retrieve Usage

Get Agent Usage
get/v2/gen-ai/agents/{uuid}/usage

To get agent usage, send a GET request to /v2/gen-ai/agents/{uuid}/usage. Returns usage metrics for the specified agent within the provided time range.

Path ParametersExpand Collapse
uuid: string
Query ParametersExpand Collapse
start: optional string

Return all usage data from this date.

stop: optional string

Return all usage data up to this date, if omitted, will return up to the current date.

ReturnsExpand Collapse
log_insights_usage: optional object { measurements, resource_uuid, start, stop }

Resource Usage Description

measurements: optional array of object { tokens, usage_type }
tokens: optional number
usage_type: optional string
resource_uuid: optional string
start: optional string
stop: optional string
usage: optional object { measurements, resource_uuid, start, stop }

Resource Usage Description

measurements: optional array of object { tokens, usage_type }
tokens: optional number
usage_type: optional string
resource_uuid: optional string
start: optional string
stop: optional string
Get Agent Usage
curl https://api.digitalocean.com/v2/gen-ai/agents/$UUID/usage \
    -H "Authorization: Bearer $DIGITALOCEAN_ACCESS_TOKEN"
{
  "log_insights_usage": {
    "measurements": [
      {
        "tokens": 123,
        "usage_type": "example string"
      }
    ],
    "resource_uuid": "123e4567-e89b-12d3-a456-426614174000",
    "start": "2023-01-01T00:00:00Z",
    "stop": "2023-01-01T00:00:00Z"
  },
  "usage": {
    "measurements": [
      {
        "tokens": 123,
        "usage_type": "example string"
      }
    ],
    "resource_uuid": "123e4567-e89b-12d3-a456-426614174000",
    "start": "2023-01-01T00:00:00Z",
    "stop": "2023-01-01T00:00:00Z"
  }
}
Returns Examples
{
  "log_insights_usage": {
    "measurements": [
      {
        "tokens": 123,
        "usage_type": "example string"
      }
    ],
    "resource_uuid": "123e4567-e89b-12d3-a456-426614174000",
    "start": "2023-01-01T00:00:00Z",
    "stop": "2023-01-01T00:00:00Z"
  },
  "usage": {
    "measurements": [
      {
        "tokens": 123,
        "usage_type": "example string"
      }
    ],
    "resource_uuid": "123e4567-e89b-12d3-a456-426614174000",
    "start": "2023-01-01T00:00:00Z",
    "stop": "2023-01-01T00:00:00Z"
  }
}