Request Usage

GET/v1/billing/requests/{request_id}

Returns a billing and metering summary for one inference call, keyed by the billing request id — the same UUID you see in response headers X-Request-ID and X-Trace-ID on that call (both headers use the same value).

Call the HTTPS base URL for your environment. Send credentials as Authorization: Bearer <API key> (sk-…) or with a user session JWT, consistent with other authenticated platform APIs.

Authentication

Authorization Bearer

Use an API key in the Authorization header (sk-…) or a user session JWT.

Path Parameters

request_idstringrequired

Billing correlation id: UUID from X-Request-ID / X-Trace-ID on the HTTP response for that inference call.

Query Parameters

typeenum<string>default:all

Optional. Omit entirely to search across all modalities (same as all). Use llm | image | audio | video only when resolving by request id alone could collide and you must narrow the row.

Available options: all llm image audio video

Response

The body uses the standard R<T> envelope (code, msg, data, traceId; serviceCode when present). On success, code is 200 and data is a billing reconciliation summary object (BillingRequestSummaryVO shape below). On failure, data is null.

codeinteger

200 on success; 404 when no record or no access.

msgstring

Human-readable message.

dataobject | null

Summary when successful; null on failure. Fields are as returned; many are optional and depend on what was recorded.

idstring

Canonical row id.

requestIdstring

Billing correlation id (typically matches the path when resolved).

typestring

e.g. llm, image, audio, video.

modelstring

Display model name.

modelNamestring | null

Model name when available.

statusstring

Task or request status when present.

createTimeinteger | string | null

Created time, epoch seconds (UTC); JSON may be string or number depending on serializer.

updateTimeinteger | string | null

Last update, epoch seconds (UTC); JSON may be string or number.

billedboolean | null

Whether usage has been charged (wallet / voucher / token path).

totalAmountnumber | null

Total charged amount when settled.

walletAmountnumber | null

Wallet-funded portion when applicable.

voucherAmountnumber | null

Voucher-funded portion when applicable.

billRecordStatusstring | null

Billing status when present.

statusCodestring | null

Recorded HTTP / status code string on usage row when present.

pricenumber | null

Vendor list price snapshot on the usage row when present.

billingAtinteger | string | null

Billing timestamp as epoch seconds when present; JSON may be string or number.

amountBasenumber | null

Amount before discounts (rating pipeline), when present.

amountFinalnumber | null

Final rated amount before wallet split, when present.

currencystring | null

Currency for rated amounts, when present.

usageobject | null

Merged metering for reconciliation: token counts, nested usage, duration tiers, etc. (no heavy explain / trace blobs).

durationnumber | null

Generation duration in seconds when known.

traceIdstring | null

Server trace id when available.

serviceCodestring | null

Stable service error code when applicable.

Results are limited to the authenticated user and that user’s own API keys (no cross-account access).

Error handling

  • 401 / unauthenticated: missing or invalid Authorization.
  • code 404: unknown request_id, or no access (other users’ ids are not disclosed).
  • Charges can land slightly after the model response; a short-lived 404 may mean the ledger row is not written yet.

Request ID (billing correlation)

  • X-Trace-ID and X-Request-ID on each inference response carry the same UUID; downstream billing stores it as requestId when a billing event exists.
  • You may send X-Request-ID or X-Trace-ID on the request to pin your own correlation id; otherwise the platform generates one.
  • Do not use the chat JSON id (chatcmpl-…) or the video resource id (video_…) as this key. For video, persist headers from POST /v1/videos — each GET poll is a new HTTP trace.
  • For video tasks, GET /v1/videos/{video_id} (or equivalent polling) may include a usage object after the task reaches a terminal status, useful for meter-only checks beside this billing endpoint.

Request

Shell
1curl -sS "https://api.token360.ai/v1/billing/requests/550e8400-e29b-41d4-a716-446655440000" \
2  -H "Authorization: Bearer sk-your-api-key"

Response

JSON
1{
2  "code": 200,
3  "msg": "success",
4  "data": {
5    "amountBase": "0.284******",
6    "amountFinal": "0.284******",
7    "billRecordStatus": "1",
8    "billed": true,
9    "billingAt": "177815****",
10    "createTime": "177815****",
11    "currency": "USD",
12    "duration": 4.0,
13    "id": "550e8400-****-****-****-************",
14    "model": "seedance-2.0",
15    "modelName": "seedance-2.0",
16    "price": "0.284******",
17    "requestId": "550e8400-****-****-****-************",
18    "status": "completed",
19    "statusCode": "200",
20    "totalAmount": "0.284******",
21    "type": "video",
22    "updateTime": "177815****",
23    "usage": {
24      "total_tokens": "40***",
25      "completion_tokens": "40***",
26      "output_tokens": "40***",
27      "seconds": 4,
28      "requested_seconds": 4,
29      "video_count": 1,
30      "sample_count": 1
31    },
32    "voucherAmount": "0.284******",
33    "walletAmount": null
34  },
35  "serviceCode": null,
36  "traceId": null
37}
Was this page helpful?