Get Request Usage

GET/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_idstringrequired

Full 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

codeinteger

Response status code.

msgstring

Response message.

dataobject | null
data.idstring

Identifier returned for this billing result. Treat as an opaque string.

data.request_idstring

Request identifier returned for reconciliation. It may differ from the response or task ID used in the lookup.

data.typestring

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

data.modelstring

Display model name.

data.model_namestring | null

Model name when available.

data.statusstring

Task or request status when present.

data.create_timeinteger | string | null

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

data.update_timeinteger | string | null

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

data.billedboolean | null

Whether usage has been charged.

data.total_amountnumber | null

Total charged amount when settled.

data.wallet_amountnumber | null

Wallet-funded portion when applicable.

data.voucher_amountnumber | null

Voucher-funded portion when applicable.

data.bill_record_statusstring | null

Billing status when present.

data.status_codestring | null

Request status code as a string, when present.

data.pricenumber | null

Applicable list price, when present.

data.billing_atinteger | string | null

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

data.amount_basenumber | null

Amount before discounts, when present.

data.amount_finalnumber | null

Amount after discounts, when present.

data.currencystring | null

Currency for rated amounts, when present.

data.usageobject | null

Usage details, such as token counts or duration. Fields vary by model and endpoint.

data.durationnumber | null

Generation duration in seconds when known.

trace_idstring | null

Diagnostic request identifier, when available.

service_codestring | null

Stable 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.

Request

1curl -sS "https://api.token360.ai/v1/billing/requests/example-request-id?type=llm" \
2  -H "Authorization: Bearer sk-your-api-key"

Response

JSON
1{
2  "code": 200,
3  "msg": "success",
4  "data": {
5    "id": "example-request-id",
6    "request_id": "example-request-id",
7    "type": "llm",
8    "model": "example-chat-model",
9    "status": "completed",
10    "billed": true,
11    "total_amount": 0.01,
12    "currency": "USD",
13    "usage": {
14      "input_tokens": 100,
15      "output_tokens": 50,
16      "total_tokens": 150
17    }
18  },
19  "service_code": null,
20  "trace_id": null
21}
Was this page helpful?