On this page
usage.summary
Summarize metered usage by agent, run or day: the billable runs, or (purpose=test) the test runs, metered and not billed
Request
GET /api/v1/usage
- MCP:
usage_summary - SDK:
client.usage.summary(SDK path arguments usepath; MCP usesparams). - Minimum API key role: viewer.
- Idempotency: none.
Use the request schema below. Read IDs from earlier operation results.
Input schema
json
{
"parameters": [
{
"name": "cursor",
"in": "query",
"required": false,
"schema": {
"type": "string",
"maxLength": 1024
}
},
{
"name": "limit",
"in": "query",
"required": false,
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 200,
"default": 50
}
},
{
"name": "group_by",
"in": "query",
"required": true,
"schema": {
"type": "string",
"enum": [
"agent",
"run",
"day"
]
}
},
{
"name": "from",
"in": "query",
"required": true,
"schema": {
"type": "string",
"format": "date-time"
}
},
{
"name": "to",
"in": "query",
"required": true,
"schema": {
"type": "string",
"format": "date-time"
}
},
{
"name": "agent_id",
"in": "query",
"required": false,
"schema": {
"type": "string",
"minLength": 1,
"maxLength": 256,
"pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
}
},
{
"name": "purpose",
"in": "query",
"required": false,
"schema": {
"type": "string",
"enum": [
"billable",
"test"
],
"default": "billable",
"description": "billable: non-test runs (the billable report); test: test runs, metered and not billed"
}
}
],
"requestBody": null
}
Responses
json
{
"200": {
"description": "Summarize metered usage by agent, run or day: the billable runs, or (purpose=test) the test runs, metered and not billed",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UsageSummaryResponse200"
}
}
}
},
"4XX": {
"description": "Typed error (ApiError)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
},
"5XX": {
"description": "Typed error (ApiError)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
}
}
Referenced schemas
json
{
"components": {
"schemas": {
"UsageSummaryResponse200": {
"type": "object",
"properties": {
"window": {
"type": "object",
"properties": {
"from": {
"type": "string",
"format": "date-time"
},
"to": {
"type": "string",
"format": "date-time"
}
},
"required": [
"from",
"to"
],
"additionalProperties": false
},
"group_by": {
"type": "string",
"enum": [
"agent",
"run",
"day"
]
},
"purpose": {
"type": "string",
"enum": [
"billable",
"test"
]
},
"rows": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"runs": {
"type": "integer",
"minimum": 0
},
"connected_ms": {
"type": "integer",
"minimum": 0
},
"llm_input_tokens": {
"type": "integer",
"minimum": 0,
"nullable": true
},
"llm_output_tokens": {
"type": "integer",
"minimum": 0,
"nullable": true
},
"stt_ms": {
"type": "integer",
"minimum": 0,
"nullable": true
},
"tts_characters": {
"type": "integer",
"minimum": 0,
"nullable": true
},
"cost": {
"type": "object",
"properties": {
"currency": {
"type": "string",
"enum": [
"USD"
]
},
"amount": {
"allOf": [
{
"type": "string",
"pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,12})?$"
}
],
"nullable": true
},
"completeness": {
"type": "string",
"enum": [
"complete",
"partial",
"unpriced"
]
}
},
"required": [
"currency",
"amount",
"completeness"
],
"additionalProperties": false
}
},
"required": [
"key",
"runs",
"connected_ms",
"llm_input_tokens",
"llm_output_tokens",
"stt_ms",
"tts_characters",
"cost"
],
"additionalProperties": false
}
},
"completeness": {
"type": "string",
"enum": [
"complete",
"partial"
]
},
"next_cursor": {
"type": "string",
"maxLength": 1024,
"nullable": true
}
},
"required": [
"window",
"group_by",
"purpose",
"rows",
"completeness",
"next_cursor"
],
"additionalProperties": false
},
"ApiError": {
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string",
"enum": [
"unauthenticated",
"forbidden",
"not_found",
"conflict",
"invalid_request",
"idempotency_conflict",
"policy_denied",
"capability_unavailable",
"provider_unavailable",
"knowledge_unavailable",
"publication_invalid",
"run_not_active",
"rate_limited",
"outcome_unknown",
"internal"
]
},
"message": {
"type": "string"
},
"retryable": {
"type": "boolean"
},
"outcome": {
"type": "string",
"enum": [
"none",
"unknown"
]
},
"details": {
"type": "object",
"additionalProperties": {}
}
},
"required": [
"code",
"message",
"retryable",
"outcome"
],
"additionalProperties": false
}
},
"required": [
"error"
],
"additionalProperties": false
}
}
}
}
Errors and recovery
See API error handling and Troubleshooting.
Related guides
Content version 03aab929Markdown source