Query Request Usage

Returns the actual usage of a single request — token counts and cost — identified by its request ID (the X-Request-Id response header value, prefixed with REQ-). Useful for reconciling the real billing of a single call once it completes, e.g. asynchronous video generation tasks.

A request that failed over between providers produces multiple ledger entries: failed attempts are voided (status is upstream_failed, cost 0) and the final successful one is billed. All entries are returned, ordered by creation time ascending.

Authentication

Put the API key in the request header:

Authorization: Bearer sk_live_YOUR_API_KEY

API

GET/api/business/v1/customer/request-usage

Get actual usage for a single request

Return the ledgers (tokens + cost) produced by one gateway request, identified by the request_id query parameter (the X-Request-Id response header value, REQ-...). Fields match the dashboard ledger view. A request that failed over between providers produces multiple ledgers (voided attempts + the final billed one). API key only.

Bearer API KeyUse the Authorization: Bearer sk_live_... header; x-api-key is also supported.

Request structure

The section below confirms the method, URL and authentication scheme. It is an HTTP structure snippet, not a standalone runnable example.

HTTP
GET https://www.silvamux.com/api/business/v1/customer/request-usage
Authorization: Bearer $SILVAMUX_API_KEY

Request parameters

ParameterType & locationRequiredDescription
Authorizationstring · headerYesBearer API Key (sk_live_...)
X-Organization-Idstring · headerNoNot required for API key auth
request_idstring · queryYesRequest ID from the X-Request-Id response header (REQ-...)

Response

200OK

application/json · CustomerRequestUsageResponse

FieldTypeRequiredDescription
$schemastring (uri)NoA URL to the JSON Schema for this object.
ledgersarray<CustomerRequestUsageEntry>YesLedgers produced by this request, ordered by created_at asc
ledgers.cost_pointsstringYesCost in points after discount
ledgers.created_atstring (date-time)YesLedger creation time (RFC3339)
ledgers.first_token_latency_msinteger (int64)YesTime to first token in ms (streamed requests; 0 = unrecorded)
ledgers.generated_artifactsinteger (int64)YesGenerated artifact count (video/image async tasks)
ledgers.is_streambooleanYesWhether the request was streamed
ledgers.original_coststringYesCost in points before discount
ledgers.project_namestringYesProject name
ledgers.request_modelstringYesModel name as supplied in the request
ledgers.statusstringYesLedger status (billed / upstream_failed / pending)
ledgers.tokensRequestTokensYes
ledgers.tokens.billable_prompt_tokensinteger (int64)YesBillable prompt tokens (prompt + cache creation)
ledgers.tokens.cached_tokensinteger (int64)YesCache-read prompt tokens
ledgers.tokens.completion_tokensinteger (int64)YesCompletion tokens
ledgers.tokens.prompt_tokensinteger (int64)YesPrompt tokens (uncached)
ledgers.tokens.total_tokensinteger (int64)YesTotal tokens
ledgers.total_latency_msinteger (int64)YesTotal request latency in ms (0 = unrecorded)
request_idstringYesGateway request ID (X-Request-Id response header)

defaultError

application/problem+json · ErrorModel

FieldTypeRequiredDescription
$schemastring (uri)NoA URL to the JSON Schema for this object.
detailstringNoA human-readable explanation specific to this occurrence of the problem.
errorsarray<ErrorDetail>NoOptional list of individual error details
errors.locationstringNoWhere the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'
errors.messagestringNoError message text
errors.valueanyNoThe value at the given location
instancestring (uri)NoA URI reference that identifies the specific occurrence of the problem.
statusinteger (int64)NoHTTP status code
titlestringNoA short, human-readable summary of the problem type. This value should not change between occurrences of the error.
typestring (uri)NoA URI reference to human-readable documentation for the error.;Default: about:blank

Parameters

  • request_id: required, the X-Request-Id response header value (REQ- prefixed).
  • Only requests belonging to the API key's organization can be queried; anything else returns 404.

Examples

curl "https://www.silvamux.com/api/business/v1/customer/request-usage?request_id=REQ-01M2JBYGGVY77KPRWNZFDFTWZR" \
  -H "Authorization: Bearer $SILVAMUX_API_KEY"

Response:

{
  "request_id": "REQ-01M2JBYGGVY77KPRWNZFDFTWZR",
  "ledgers": [
    {
      "request_model": "deepseek-v4-pro",
      "project_name": "Default Project",
      "status": "billed",
      "tokens": {
        "prompt_tokens": 85,
        "cached_tokens": 0,
        "billable_prompt_tokens": 85,
        "completion_tokens": 10,
        "total_tokens": 95
      },
      "generated_artifacts": 0,
      "is_stream": false,
      "first_token_latency_ms": 0,
      "total_latency_ms": 1358,
      "original_cost": "0.001035",
      "cost_points": "0.001035",
      "created_at": "2026-09-15T11:06:32.861800Z"
    }
  ]
}
FieldDescription
request_idThe queried request ID
ledgersAll ledger entries produced by this request, ordered by creation time ascending
ledgers[].request_modelThe model name as supplied in the request
ledgers[].statusbilled / upstream_failed (voided, cost 0) / pending
ledgers[].tokensToken usage breakdown
ledgers[].generated_artifactsArtifact count for async tasks (video/image)
ledgers[].original_costCost before discount
ledgers[].cost_pointsActual charged cost after discount

Error Handling

HTTPCodeDescription
401INVALID_TOKENAPI key missing or invalid
404REQUEST_USAGE_NOT_FOUNDRequest ID not found, or not owned by the API key's organization
422request_id parameter missing