Request Usage
/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_idstringrequiredBilling correlation id: UUID from X-Request-ID / X-Trace-ID on the HTTP response for that inference call.
Query Parameters
typeenum<string>default:allOptional. 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.
codeinteger200 on success; 404 when no record or no access.
msgstringHuman-readable message.
dataobject | nullSummary when successful; null on failure. Fields are as returned; many are optional and depend on what was recorded.
idstringCanonical row id.
requestIdstringBilling correlation id (typically matches the path when resolved).
typestringe.g. llm, image, audio, video.
modelstringDisplay model name.
modelNamestring | nullModel name when available.
statusstringTask or request status when present.
createTimeinteger | string | nullCreated time, epoch seconds (UTC); JSON may be string or number depending on serializer.
updateTimeinteger | string | nullLast update, epoch seconds (UTC); JSON may be string or number.
billedboolean | nullWhether usage has been charged (wallet / voucher / token path).
totalAmountnumber | nullTotal charged amount when settled.
walletAmountnumber | nullWallet-funded portion when applicable.
voucherAmountnumber | nullVoucher-funded portion when applicable.
billRecordStatusstring | nullBilling status when present.
statusCodestring | nullRecorded HTTP / status code string on usage row when present.
pricenumber | nullVendor list price snapshot on the usage row when present.
billingAtinteger | string | nullBilling timestamp as epoch seconds when present; JSON may be string or number.
amountBasenumber | nullAmount before discounts (rating pipeline), when present.
amountFinalnumber | nullFinal rated amount before wallet split, when present.
currencystring | nullCurrency for rated amounts, when present.
usageobject | nullMerged metering for reconciliation: token counts, nested usage, duration tiers, etc. (no heavy explain / trace blobs).
durationnumber | nullGeneration duration in seconds when known.
traceIdstring | nullServer trace id when available.
serviceCodestring | nullStable 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. code404: unknownrequest_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-IDandX-Request-IDon each inference response carry the same UUID; downstream billing stores it asrequestIdwhen a billing event exists.- You may send
X-Request-IDorX-Trace-IDon the request to pin your own correlation id; otherwise the platform generates one. - Do not use the chat JSON
id(chatcmpl-…) or the video resourceid(video_…) as this key. For video, persist headers fromPOST /v1/videos— eachGETpoll is a new HTTP trace. - For video tasks,
GET /v1/videos/{video_id}(or equivalent polling) may include ausageobject after the task reaches a terminal status, useful for meter-only checks beside this billing endpoint.
Previous
Delete Asset