Query Usage

Returns the consumption summary of the API key's project over a given time range: totals plus per-model breakdowns. Usage is automatically scoped to the key's project and cannot be queried across projects.

Authentication

Put the API key in the request header:

Authorization: Bearer sk_live_YOUR_API_KEY

API

GET/api/business/v1/customer/usage

查询用量

Return aggregated usage (totals + per-model) for the API key's project over a time range. 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/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
fromstring · queryYesRFC3339 start time (inclusive)
tostring · queryYesRFC3339 end time (exclusive)

Response

200OK

application/json · BillingUsageReportResponse

FieldTypeRequiredDescription
$schemastring (uri)NoA URL to the JSON Schema for this object.
by_modelarray<UsageReportModelBreakdown>YesPer-model breakdown, ordered by cost_points desc
by_model.billable_prompt_tokensinteger (int64)YesSummed billable prompt tokens
by_model.cache_creation_tokensinteger (int64)YesSummed cache creation tokens
by_model.cache_explicit_read_tokensinteger (int64)YesSummed explicit cache read tokens
by_model.cached_tokensinteger (int64)YesSummed cached tokens
by_model.completion_tokensinteger (int64)YesSummed completion tokens
by_model.cost_pointsstringYesTotal cost in points (after discount)
by_model.generated_artifactsinteger (int64)YesSummed generated artifacts
by_model.modelstringYesAggregation key: user-supplied request_model, falling back to the configured model ID for legacy rows
by_model.original_coststringYesTotal cost in points before discount
by_model.prompt_tokensinteger (int64)YesSummed prompt tokens
by_model.request_countinteger (int64)YesNumber of billed requests
by_model.total_tokensinteger (int64)YesSummed total tokens
fromstring (date-time)YesReport start (RFC3339, inclusive)
project_idstringYesProject filter ('' means org-wide)
tostring (date-time)YesReport end (RFC3339, exclusive)
totalsUsageReportTotalsYes
totals.billable_prompt_tokensinteger (int64)Yes
totals.cache_creation_tokensinteger (int64)Yes
totals.cache_explicit_read_tokensinteger (int64)Yes
totals.cached_tokensinteger (int64)Yes
totals.completion_tokensinteger (int64)Yes
totals.cost_pointsstringYesTotal cost in points (after discount)
totals.generated_artifactsinteger (int64)Yes
totals.original_coststringYesTotal cost in points before discount
totals.prompt_tokensinteger (int64)Yes
totals.request_countinteger (int64)Yes
totals.total_tokensinteger (int64)Yes

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

  • from, to: required, RFC3339 timestamps defining a half-open interval [from, to); from must be earlier than to.
  • The time range is in UTC.

Examples

curl "https://www.silvamux.com/api/business/v1/customer/usage?from=2026-07-08T00:00:00Z&to=2026-07-09T00:00:00Z" \
  -H "Authorization: Bearer $SILVAMUX_API_KEY"

Response:

{
  "from": "2026-07-08T00:00:00Z",
  "to": "2026-07-09T00:00:00Z",
  "project_id": "PROJ-1",
  "totals": {
    "cost_points": "1.5",
    "prompt_tokens": 100,
    "cached_tokens": 0,
    "billable_prompt_tokens": 100,
    "completion_tokens": 50,
    "cache_creation_tokens": 0,
    "total_tokens": 150,
    "generated_artifacts": 0,
    "request_count": 2
  },
  "by_model": [
    {
      "model": "deepseek-v4-pro@tune",
      "cost_points": "1.5",
      "prompt_tokens": 100,
      "cached_tokens": 0,
      "billable_prompt_tokens": 100,
      "completion_tokens": 50,
      "cache_creation_tokens": 0,
      "total_tokens": 150,
      "generated_artifacts": 0,
      "request_count": 2
    }
  ]
}
FieldDescription
project_idThe project the API key is bound to
totalsSummary across all models in the time range
by_modelPer-model breakdown, ordered by cost_points descending

Error Handling

HTTPCodeDescription
401INVALID_TOKENAPI key missing or invalid
400INVALID_FROM_DATETIMEfrom missing or not RFC3339
400INVALID_TO_DATETIMEto missing or not RFC3339
400INVALID_TIME_RANGEfrom is not earlier than to