Usage
Retrieve current-period usage, token counts and credit balance for your organization.
Returns what your organization has spent this billing period, how many tokens that came to, and what credit remains. Use it to surface spend inside your own dashboard, or to alert before a balance runs dry.
Endpoint
GET https://api.elyxir.ai/api/v1/usage
Authentication
This is a Platform API endpoint — OAuth JWT plus organization header, not an elyxir_ key.
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <oauth-jwt> |
X-Organization-Id | Yes | Your organization UUID |
Example
curl https://api.elyxir.ai/api/v1/usage \
-H "Authorization: Bearer <oauth-jwt>" \
-H "X-Organization-Id: 00000000-0000-0000-0000-000000000000"Response
{
"organization": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "Acme Corp",
"slug": "acme-corp",
"plan": "standard"
},
"currentPeriod": {
"start": "2026-08-01T00:00:00.000Z",
"end": "2026-09-01T00:00:00.000Z"
},
"usage": {
"totalCost": "12.45",
"totalTokens": 2450000,
"promptTokens": 1800000,
"completionTokens": 650000
},
"limits": {
"inferenceTokensLimit": 5000000
},
"credits": {
"currentBalance": 37.55,
"totalPurchased": 100.0,
"totalSpent": 62.45
}
}Fields
| Field | Description |
|---|---|
organization.plan | Current plan code |
currentPeriod | The billing window these figures cover |
usage.totalCost | Spend this period, in USD, as a string |
usage.totalTokens | Prompt plus completion tokens |
limits | Ceilings that apply on this plan. Additional keys may appear here over time — read the ones you need rather than assuming the shape is fixed |
credits.currentBalance | Credit-pack balance remaining |
totalCost is a string, not a number — it carries exact decimal precision. Parse it as a decimal rather than a float if you're doing arithmetic on it.
Errors
| Status | Meaning |
|---|---|
| 401 | Invalid or expired JWT |
| 403 | Not a member of this organization |
Notes
Figures cover the current billing period and reset when it rolls over. If you need a longer history, record snapshots yourself — or use the cost dashboard in Studio, which retains history and breaks spend down by model and project.
Related
- API keys — provisioning keys programmatically
- Credits — topping up the balance
- Cost dashboard — spend over time in Studio