Management
Get API Key Billing
Returns aggregated billing breakdowns for a user API key.
Overview
Return total spend, request count, billable usage, and cost grouped by model, model maker, scene, and date.
Notes
-
Monetary fields are USD-only.
-
Workspace top-ups and invoices are not included.
Example
Supports the same model, model vendor, scene, and date filters as API key usage. Returns totals without pagination.
Request
curl -X GET "https://api.tokenlab.sh/v1/management/api-keys/key_abc123def456/billing?startDate=2026-07-01&endDate=2026-07-31" \
-H "Authorization: Bearer mt-your-management-token"Request / Response
This page provides the OpenAPI schema and copyable request examples. Send management requests from your terminal or client with a Management Token; direct sending is not available on this page.
Response
{
"api_key": {
"id": "key_abc123def456",
"name": "Backend Worker",
"key_prefix": "sk-live...",
"status": "active",
"limit_amount": 500,
"limit_amount_decimal": "500",
"used_amount": 148.25,
"used_amount_decimal": "148.25",
"models": [
"gpt-5.6-luna",
"claude-3-7-sonnet"
],
"expires_at": "2026-12-31T23:59:59.000Z",
"last_used_at": "2026-07-08T03:12:45.000Z",
"created_at": "2026-07-01T10:00:00.000Z",
"delivery_policy": null
},
"summary": {
"total_requests": 1,
"total_cost": 0.0012,
"total_cost_decimal": "0.0012",
"total_prompt_tokens": 1000,
"total_completion_tokens": 500,
"total_tokens": 1500,
"usage_unit_breakdown": [
{
"usage_unit": "per_token",
"usage_quantity": 1500
}
]
},
"breakdowns": {
"by_model": [
{
"model": "gpt-5.6-luna",
"logical_model": "gpt-5.6-luna",
"model_vendor": "OpenAI",
"requests": 1,
"cost": 0.0012,
"cost_decimal": "0.0012",
"usage_quantity": 1500,
"usage_quantity_decimal": "1500"
}
],
"by_logical_model": [
{
"model": "gpt-5.6-luna",
"logical_model": "gpt-5.6-luna",
"model_vendor": "OpenAI",
"requests": 1,
"cost": 0.0012,
"cost_decimal": "0.0012",
"usage_quantity": 1500,
"usage_quantity_decimal": "1500"
}
],
"by_model_vendor": [
{
"model_vendor": "OpenAI",
"requests": 1,
"cost": 0.0012
}
],
"by_scene": [
{
"scene": "chat",
"requests": 1,
"cost": 0.0012,
"cost_decimal": "0.0012"
}
],
"daily_cost": [
{
"date": "2026-07-08T00:00:00.000Z",
"cost": 0.0012,
"cost_decimal": "0.0012"
}
]
}
}Important fields
Authorization
ManagementTokenAuth Management token authentication. Create or manage Management Tokens in Dashboard > API > Management Tokens.
In: header
Path Parameters
Query Parameters
Filter by requested model name. Maximum length 100.
length <= 100Filter by public model vendor. Maximum length 100.
length <= 100Filter by public request scene.
Value in
- "chat"
- "image"
- "audio"
- "video"
- "embedding"
- "rerank"
- "translation"
- "music"
- "3d"
- "realtime"
- "systemone"
Response
application/json
application/json
application/json
application/json
application/json