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-…).
Prefer X-Request-ID from the original response. It is the canonical billing ID allocated by the platform for that execution and has the form br-<UUIDv4>. For Async Chat, use the job object’s request_id (also br-*). A caller-defined X-Request-ID is retained only as a correlation ID and does not become the canonical response ID; X-Trace-ID is for tracing, not the preferred billing lookup key.
canonical request_id | Response header X-Request-ID, normally br-*; an Async Chat job returns the same value. Preferred reconciliation key. |
| response ID | JSON response id, such as chatcmpl_*, img_*, or video_*. Supported as a billing lookup alias. |
| client request ID | A caller-supplied X-Request-ID request header. Retained for client correlation only; the platform still returns a new canonical X-Request-ID. |
| trace ID | Response header X-Trace-ID. Used for logs and distributed tracing. |
| provider ID | An upstream provider request/response ID. It is queryable as an alias only when the platform recorded its mapping. |
Path Parameters
request_idstringrequiredPrefer the original response X-Request-ID or the Async Chat job request_id. The response JSON id (for example chatcmpl_*, img_*, or video_*) and recorded upstream aliases are also supported. 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 an alias matched multiple requests: use the canonical X-Request-ID from the original response, or the Async Chat job’s request_id.