Account and Billing
Check your balance and what you've spent.
Balance
GET /api/v0/billing/account returns your balance and how many of your tasks
are queued and running right now, so you can pace submissions against your
account's concurrency limit.
Request
curl -H "Authorization: Bearer $MACHGEN_API_KEY" \
https://api.machgen.ai/api/v0/billing/accountIt takes no parameters.
Response
{
"account_id": "acct-abc123",
"balance_micros": 12500000,
"autoreload_enabled": false,
"pending_tasks": 2,
"running_tasks": 1
}| Field | Type | Required | Default | Description |
|---|---|---|---|---|
account_id | str | Yes | - | ID of this account |
balance_micros | int | Yes | - | Balance of this account (in microdollars) |
autoreload_enabled | bool | - | False | If auto-reload is enabled on this account |
pending_tasks | int | None | - | None | Current number of scheduled but not running tasks under this account |
running_tasks | int | None | - | None | Current number of running tasks under this account |
Usage
GET /api/v0/billing/usage shows how many tasks you ran, how they went,
and what they cost, by day or by hour.
Request
curl -H "Authorization: Bearer $MACHGEN_API_KEY" \
"https://api.machgen.ai/api/v0/billing/usage?since=2026-10-01&until=2026-10-08"Parameters
| Parameter | Default | Description |
|---|---|---|
since | 7 days before until | Start date or time. UTC unless you add an offset. |
until | Now | End date or time, not included. |
granularity | day | day or hour. |
api_key | All keys combined | One key's ID, as shown on your API keys page. |
since and until round out to whole days or hours in UTC, and one request
covers up to 31 days.
Response
{
"api_key": null,
"granularity": "day",
"since": "2026-10-01T00:00:00Z",
"until": "2026-10-08T00:00:00Z",
"as_of": "2026-10-08T04:00:12Z",
"tracked_since": null,
"rows": [
{
"time": "2026-10-01T00:00:00Z",
"model": "MiniMax-H3",
"task_type": "T2V",
"tasks": 12,
"succeeded": 11,
"failed": 1,
"cost_micros": 3850000
}
]
}| Field | Type | Description |
|---|---|---|
api_key | string or null | The key you asked about, or null for all keys combined. |
granularity | string | day or hour. |
since | string | Start of the period covered, UTC. |
until | string | End of the period covered, UTC, not included. |
as_of | string or null | When usage was last updated. It updates hourly. null until the first update. |
tracked_since | string or null | With api_key, when we started recording usage per key. Earlier tasks only count toward all keys. |
rows | array | One row per model and task type in each day or hour. Periods with nothing to report are left out. |
rows[].time | string | Start of the day or hour, UTC. |
rows[].model | string | Model ID. |
rows[].task_type | string | Task type, like T2V. Live sessions show as LIVE, in the all-keys report only. |
rows[].tasks | integer | Tasks you submitted, including ones still running. |
rows[].succeeded | integer | Tasks that finished successfully. |
rows[].failed | integer | Tasks that failed. |
rows[].cost_micros | integer | Cost in millionths of a dollar, after refunds. A task counts when you submitted it, even if it was refunded later. |
Error Codes
| Status | When | Example detail |
|---|---|---|
400 Bad Request | Usage range is over 31 days, or until isn't after since. | The range can be at most 31 days |
401 Unauthorized | Missing, malformed, or unknown API key. | Invalid API key |
404 Not Found | api_key isn't one of your keys. | API key not found |
422 Unprocessable Entity | A usage parameter can't be read, like granularity=week or a bad date. | A list naming each bad parameter |
429 Too Many Requests | Too many requests. Slow down and retry. | Rate limit exceeded; please slow down and retry. |
503 Service Unavailable | Usage data is briefly unavailable. Retry after Retry-After seconds. | Usage data is temporarily unavailable. Please try again later. |