Retrieve Usage
Get Agent Usage
client.agents.retrieveUsage(stringuuid, AgentRetrieveUsageParams { start, stop } query?, RequestOptionsoptions?): AgentRetrieveUsageResponse { log_insights_usage, usage }
/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.
Parameters
uuid: string
Returns
Get Agent Usage
import Gradient from '@digitalocean/gradient';
const client = new Gradient();
const response = await client.agents.retrieveUsage('"123e4567-e89b-12d3-a456-426614174000"');
console.log(response.log_insights_usage);
{
"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"
}
}