title: Billing API version: 1.0 date: 2026-10-25 author: Core Team status: Active
Track LLM token usage across different services (Agent, VLM, TKG, etc.).
GET /api/v1/billing/usageAuth: Required Scope: user-level
Get token usage for a specific billing period. Returns input/output token counts and service breakdown.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
period |
string | No | Current month | Billing period in YYYY-MM format |
# Get current month usage
curl -s "$API/api/v1/billing/usage" -H "X-API-Key: $KEY"
# Get specific month
curl -s "$API/api/v1/billing/usage?period=2026-09" -H "X-API-Key: $KEY"
{
"key_id": null,
"period": "2026-10",
"tokens": {
"input": 15234,
"output": 8921,
"total": 24155
},
"services": {
"agent": 8500,
"vlm": 12000,
"tkg": 3655
}
}
| Field | Type | Description |
|---|---|---|
key_id |
string | null | API key ID (null for user-level aggregate) |
period |
string | Billing period (YYYY-MM) |
tokens |
object | Token statistics |
tokens.input |
integer | Total input tokens |
tokens.output |
integer | Total output tokens |
tokens.total |
integer | Total tokens (input + output) |
services |
object | Token usage per service |
GET /api/v1/billing/historyAuth: Required Scope: user-level
Get token usage history for the past N months.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
months |
integer | No | 12 | Number of months to retrieve |
# Get last 12 months
curl -s "$API/api/v1/billing/history" -H "X-API-Key: $KEY"
# Get last 6 months
curl -s "$API/api/v1/billing/history?months=6" -H "X-API-Key: $KEY"
{
"periods": [
{
"key_id": null,
"period_month": "2026-10",
"total_input_tokens": 15234,
"total_output_tokens": 8921,
"total_tokens": 24155,
"service_breakdown": {
"agent": 8500,
"vlm": 12000,
"tkg": 3655
}
},
{
"key_id": null,
"period_month": "2026-09",
"total_input_tokens": 18234,
"total_output_tokens": 9456,
"total_tokens": 27690,
"service_breakdown": {
"agent": 10200,
"vlm": 13500,
"tkg": 3990
}
}
]
}
| Service | Description | Token Type |
|---|---|---|
agent |
Agent chat, search, 5W1H | Input + Output |
vlm |
Vision Language Model (image analysis) | Input + Output |
tkg |
Temporal Knowledge Graph queries | Input + Output |
embedding |
Text embeddings | Input only |
chat |
General chat/completions | Input + Output |
curl -s "$API/api/v1/billing/usage" -H "X-API-Key: $KEY" | jq '.tokens'
curl -s "$API/api/v1/billing/history?months=12" -H "X-API-Key: $KEY" | \
jq -r '.periods[] | "\(.period_month),\(.total_tokens)"'
curl -s "$API/api/v1/billing/usage" -H "X-API-Key: $KEY" | \
jq '.services | to_entries | sort_by(.value) | reverse | .[]'
| Version | Date | Changes |
|---|---|---|
| 1.0 | 2026-10-25 | Initial documentation |