The Platform API
Usage & Billing
Manage your videos, ask questions, and build applications with the Platform API. Explore the operations below for request details, responses, and examples.
No matching documentation. Try a different search.
Usage & Billing
Track platform token usage and operation counts. Divide costAt by 1,000 to display the billed amount in tokens. The examples show selected response fields.
GET/api/v1/projects/:projectId/usageGet usage summary
Get usage summary
Returns aggregated usage with a breakdown by operation type.
Optional query params: from (ISO date), to (ISO date) for time range filtering.
{
"data": {
"totals": {
"costAt": 48200,
"count": 47
},
"byOperation": [
{ "operation": "agent", "count": 12, "costAt": 29000 },
{ "operation": "chat", "count": 8, "costAt": 6000 },
{ "operation": "wizard", "count": 2, "costAt": 1200 }
],
"byResource": [...]
}
}GET/api/v1/projects/:projectId/usage/eventsList usage events (paginated)
List usage events (paginated)
Query params: limit (1-200, default 50), offset, from, to, operation, resource_id
{
"data": [
{
"id": "evt_abc123",
"operation": "agent",
"costAt": 1500,
"resourceId": "VIDEO_ID",
"timestamp": "2026-02-23T10:30:00Z"
}
],
"meta": { "returned": 50, "offset": 0, "limit": 50 }
}# Get usage summary
curl -s "https://platform.endlessai.com/api/v1/projects/PROJECT_ID/usage" \
-H "X-Api-Key: YOUR_KEY" | jq '.data.totals'
# Get usage for a time range
curl -s "https://platform.endlessai.com/api/v1/projects/PROJECT_ID/usage?from=2026-02-01&to=2026-02-28" \
-H "X-Api-Key: YOUR_KEY"
# List recent events
curl -s "https://platform.endlessai.com/api/v1/projects/PROJECT_ID/usage/events?limit=10" \
-H "X-Api-Key: YOUR_KEY"import requests
headers = {"X-Api-Key": API_KEY}
# Get summary
summary = requests.get(
f"{BASE}/projects/{PROJECT_ID}/usage",
headers=headers,
).json()["data"]
print(f"Tokens: {summary['totals']['costAt'] / 1000}")
for op in summary["byOperation"]:
print(f" {op['operation']}: {op['count']} calls, {op['costAt'] / 1000} tokens")const res = await fetch(`${BASE}/projects/${PROJECT_ID}/usage`, {
headers: { "X-Api-Key": API_KEY }
});
const { data } = await res.json();
console.log("Tokens:", data.totals.costAt / 1000);