You can now query your billing usage programmatically using the new GET /v1/billing/usage_summary endpoint. Pass a date range of up to 31 days to get a breakdown of costs across Dedicated Inference, Training, and Model APIs.
The response includes aggregate totals and a per-resource or per-model breakdown[] array, with daily granularity on each entry. Deleted resources are still returned in breakdown[] with is_deleted: true, so historical cost attribution is preserved.
Example output:
{
"dedicated_usage": {
"subtotal": 123,
"credits_used": 123,
"total": 123,
"minutes": 123,
"breakdown": [{
"billable_resource": {
"id": "<string>",
"kind": "MODEL_DEPLOYMENT",
"name": "<string>",
"is_deleted": true,
"instance_type": "<string>",
"environment_name": "<string>"
},
"subtotal": 123,
"minutes": 123,
"inference_requests": 123,
"daily": [{ "date": "2023-12-25", "subtotal": 123, "minutes": 123, "inference_requests": 123 }]
}]
},
"training_usage": {
"subtotal": 123,
"credits_used": 123,
"total": 123,
"minutes": 123,
"breakdown": [{ ... }]
},
"model_apis_usage": {
"subtotal": 123,
"credits_used": 123,
"total": 123,
"breakdown": [{
"model_name": "<string>",
"model_family": "<string>",
"subtotal": 123,
"input_tokens": 123,
"output_tokens": 123,
"cached_input_tokens": 123,
"daily": [{ "date": "2023-12-25", "subtotal": 123, "input_tokens": 123, "output_tokens": 123 }]
}]
}
}Check out the billing API reference for the full schema and parameters.