Reconciliation
Pull your bill day by day to check it against your own records: the daily bill gives each day's charges, refunds and net cost, and the bill items list every charge and refund of a day; the two always match.
Authenticate with the sk- key you call models with: send Authorization: Bearer sk-xxx, and the bill covers only that key's charges and refunds.
- To bill several keys at once, separate them with commas, as in
Authorization: Bearer sk-aaa,sk-bbb(at most 50); you get one combined bill, and each item'stoken_namenames the key it came from. - If any key is invalid or disabled, the whole request fails and
messagesays which key (by position). Expired keys and keys out of quota can still pull their bills; deleted keys cannot. - For the bill of your whole account (every key), use an access token instead: after signing in, open Security → Access tokens, create one with the Usage · View permission, and send
Authorization: Bearer <access token>.
How the bill is counted:
- Days are split in China Standard Time (UTC+8). Only charges and refunds count; top-ups and failed requests do not.
- A video task is charged when submitted, refunded in full if it fails, and topped up or partly refunded when it finishes; each entry counts on the day it happened. For a task that crosses midnight, the charge and the refund fall on different days; match them by
task_id. *_quota(an integer) is the exact amount;*_amountis converted at the site's current exchange rate with six decimals:amount = quota / quota_per_unit × exchange_rate.- Today's bill has
final: falseand can still grow. Pull the previous day's bill for reconciliation.
Daily bill
GET /api/bill/daily?start_date=2026-11-16&end_date=2026-11-16
| Parameter | Description |
|---|---|
start_date |
First day, YYYY-MM-DD; defaults to today |
end_date |
Last day (inclusive); defaults to start_date; at most 31 days per request |
curl "https://decode8.com/api/bill/daily?start_date=2026-11-16" \
-H "Authorization: Bearer $DECODE_API_KEY"
{
"success": true,
"data": {
"currency": "CNY",
"quota_per_unit": 500000,
"exchange_rate": 6.67,
"timezone": "UTC+8",
"days": [
{
"date": "2026-11-16",
"final": true,
"consume_quota": 1500000,
"refund_quota": 500000,
"net_quota": 1000000,
"consume_amount": "20.010000",
"refund_amount": "6.670000",
"net_amount": "13.340000",
"consume_count": 12,
"refund_count": 1,
"prompt_tokens": 3200,
"completion_tokens": 800,
"models": [
{
"model_name": "doubao-seedance-2-0-261111",
"consume_quota": 1000000,
"refund_quota": 500000,
"net_quota": 500000,
"net_amount": "6.670000",
"consume_count": 2,
"refund_count": 1
}
]
}
]
}
}
net = consume − refund, the day's actual cost; models repeats the same fields per model.
Bill items
GET /api/bill/items?date=2026-11-16&p=1&page_size=100
| Parameter | Description |
|---|---|
date |
The day, YYYY-MM-DD; defaults to today |
p |
Page number, starting at 1 |
page_size |
Items per page, at most 100 |
Items come oldest first; use total to tell whether more pages follow.
{
"success": true,
"data": {
"page": 1,
"page_size": 100,
"total": 13,
"items": [
{
"created_at": 1794758400,
"type": "refund",
"request_id": "20261116000000123456789",
"task_id": "task_xxx",
"model_name": "doubao-seedance-2-0-261111",
"token_name": "prod",
"group": "doubao",
"quota": -500000,
"amount": "-6.670000",
"prompt_tokens": 0,
"completion_tokens": 0
}
]
}
}
typeisconsume(a charge) orrefund. Refunds have a negativequotaandamount, so a day's item quotas add up to itsnet_quota.- Video tasks carry
task_id(theidreturned when you submitted the task); match other requests byrequest_id. - Invalid parameters (a malformed date, a start after the end, more than 31 days) return
success: falsewith the reason inmessage.