Billing records
Pricing: all features
GET /api/v1/billing/records lists every charge on your account, one record per job or chat completion, so you can track consumption, reconcile what you were charged and bill your own users. It takes an API key, or your session when you are signed in on www.happypony.io (the Credits page shows the same data).
Tag requests with userId
Every create endpoint under /api/v1/jobs/ and POST /v1/chat/completions takes an optional userId in the JSON body: your own identifier for the user the request is for.
| Field | Type | Required | Description |
|---|---|---|---|
userId |
string | no | Your identifier for the user this request belongs to: 1–128 characters, no control characters. Stored with the job and its charge, and returned on the create, status and result responses. |
curl -X POST https://api.happypony.io/api/v1/jobs/text-to-video \
-H "Authorization: Bearer $HP_KEY" -H "Content-Type: application/json" \
-d '{"prompt": "a fox runs through snow", "duration": 5, "userId": "user-1042"}'
A request without userId works exactly as before and is recorded with userId: null: all such requests form one unattributed group for the account. Anything other than a string of at most 128 characters is 400 invalid_request. On chat completions userId is removed before the request reaches the model; OpenAI's own user field is used instead when userId is absent, so an OpenAI SDK can tag requests with user= alone. userId is not accepted on video-agent runs, whose jobs are recorded without one.
List billing records
curl "https://api.happypony.io/api/v1/billing/records?userId=user-1042&from=2026-11-01T00:00:00Z&to=2026-12-01T00:00:00Z" \
-H "Authorization: Bearer $HP_KEY"
| Query | Default | |
|---|---|---|
from, to |
open | ISO timestamps bounding the billing time; from inclusive, to exclusive |
userId |
every record | Only this user's records. Sent empty (userId=), only the records that carry no userId |
model |
every model | Exact model name, as in a record's model |
request_id |
every request | One task: a job's request_id, or a chat completion's x-request-id |
limit |
50 | Records per page, 1 to 200 |
offset |
0 |
{
"totals": { "records": 3, "credits": 30.047, "credits_refunded": 15, "net_credits": 15.047, "net_usd": 0.15047 },
"records": [
{ "request_id": "48213", "userId": "user-1042", "billed_at": "2026-11-28T02:42:41.000Z", "model": "minimax_h3-turbo",
"type": "text-to-video", "status": "COMPLETED", "credits": 15, "credits_refunded": 0, "net_credits": 15, "net_usd": 0.15,
"usage": { "mode": "text-to-video", "tier": "turbo", "resolution": "768p", "aspect_ratio": "16:9", "duration_seconds": 5 } },
{ "request_id": "48209", "userId": "user-1042", "billed_at": "2026-11-28T02:40:04.000Z", "model": "minimax_h3-turbo",
"type": "image-to-video", "status": "FAILED", "credits": 15, "credits_refunded": 15, "net_credits": 0, "net_usd": 0,
"usage": { "mode": "image-to-video", "tier": "turbo", "resolution": "768p", "aspect_ratio": "9:16", "duration_seconds": 5 } },
{ "request_id": "chatcmpl-9f2c…", "userId": "user-1042", "billed_at": "2026-11-28T02:39:12.000Z", "model": "qwen3.8-27b",
"type": "chat-completions", "status": "COMPLETED", "credits": 0.047, "credits_refunded": 0, "net_credits": 0.047, "net_usd": 0.00047,
"usage": { "prompt_tokens": 1000, "cached_tokens": 200, "completion_tokens": 500 } }
],
"limit": 50,
"offset": 0
}
| Field | Type | Description |
|---|---|---|
request_id |
string | The unique task ID: the job's request_id, or the chat completion's x-request-id. |
userId |
string or null | The userId the request carried, null when it had none. |
billed_at |
string | When the charge was made: the time the request was accepted (jobs are charged up front). |
model |
string | The model that ran it. |
type |
string | The job type (text-to-video, image-edit, …) or chat-completions. |
status |
string | IN_QUEUE, IN_PROGRESS, COMPLETED, FAILED or CANCELLED. |
credits |
number | What was charged. 1 credit = $0.01; chat completions cost fractions of a credit. |
credits_refunded |
number | What came back: the whole charge of a job that failed or was cancelled. |
net_credits, net_usd |
number | credits minus credits_refunded, and the same in US dollars. |
usage |
object | What the charge was worked out from. A job lists what applies to it: mode (the generation mode, same as type), tier (turbo or quality), variant, resolution (such as 768p), aspect_ratio, duration_seconds and outputs (how many images or clips). A chat completion lists prompt_tokens, cached_tokens and completion_tokens. |
totals cover everything the filters match, records are one page of it, newest first. Records include jobs made on the website and by video-agent runs, with userId: null. A malformed from, to, userId, limit or offset is 400 invalid_request.
Totals per userId
GET /api/v1/billing/users takes the same filters (without limit and offset) and adds the records up per userId, largest net charge first, at most 500 users. Requests without a userId are one line with userId: null.
{
"users": [
{ "userId": "user-1042", "records": 36, "credits": 540, "credits_refunded": 45, "net_credits": 495, "net_usd": 4.95 },
{ "userId": null, "records": 72, "credits": 108, "credits_refunded": 11, "net_credits": 97, "net_usd": 0.97 }
]
}