Get Request Usage
/v1/billing/requests/{request_id}Returns a billing and metering summary for one inference call.
Authentication
Authorization Bearer
Use an API key in the Authorization header (sk-…).
Use X-Trace-ID from the original response headers. If it differs from X-Request-ID, prefer X-Trace-ID. For Async Chat, use the job object’s request_id.
Path Parameters
request_idstringrequiredFull request ID from the original response, or the Async Chat job’s request_id. If the ID contains `/`, keep slashes as path separators; URL-encode other reserved characters within each segment once.
Query Parameters
typeenum<string>Optional filter. Allowed values: all (all types, default), llm (LLM calls, including Async Chat and LLM batch lines), image (image generation), audio (audio generation), video (video generation). Omit this parameter or use all to search across all types. A non-matching type returns no result. This filter does not resolve an ambiguous ID.
Response
codeintegerResponse status code.
msgstringResponse message.
dataobject | nulldata.idstringIdentifier returned for this billing result. Treat as an opaque string.
data.request_idstringRequest identifier returned for reconciliation. It may differ from the response or task ID used in the lookup.
data.typestringe.g. llm, image, audio, video.
data.modelstringDisplay model name.
data.model_namestring | nullModel name when available.
data.statusstringTask or request status when present.
data.create_timeinteger | string | nullCreated time, epoch seconds (UTC); JSON may be a string or number.
data.update_timeinteger | string | nullLast update, epoch seconds (UTC); JSON may be string or number.
data.billedboolean | nullWhether usage has been charged.
data.total_amountnumber | nullTotal charged amount when settled.
data.wallet_amountnumber | nullWallet-funded portion when applicable.
data.voucher_amountnumber | nullVoucher-funded portion when applicable.
data.bill_record_statusstring | nullBilling status when present.
data.status_codestring | nullRequest status code as a string, when present.
data.pricenumber | nullApplicable list price, when present.
data.billing_atinteger | string | nullBilling timestamp as epoch seconds when present; JSON may be string or number.
data.amount_basenumber | nullAmount before discounts, when present.
data.amount_finalnumber | nullAmount after discounts, when present.
data.currencystring | nullCurrency for rated amounts, when present.
data.usageobject | nullUsage details, such as token counts or duration. Fields vary by model and endpoint.
data.durationnumber | nullGeneration duration in seconds when known.
trace_idstring | nullDiagnostic request identifier, when available.
service_codestring | nullStable service error code when applicable.
Error handling
Check your API key if authentication fails. A missing result returns code: 404 and data: null; retry later if billing details are not ready. AMBIGUOUS_REQUEST_ID means the ID matches multiple requests: use the original call’s X-Trace-ID, or the Async Chat job’s request_id.