GET
/api/business/v1/customer/usageReturn aggregated usage (totals + per-model) for the API key's project over a time range. API key only.
Bearer API Key请求头使用 Authorization: Bearer sk_live_...,也支持 x-api-key。
请求结构
下方内容用于确认方法、地址和鉴权方式,属于 HTTP 结构片段,不是可独立执行示例。
HTTP
GET https://silvamux.io/api/business/v1/customer/usage
Authorization: Bearer $SILVAMUX_API_KEY请求参数
| 参数 | 类型与位置 | 必填 | 说明 |
|---|---|---|---|
Authorization | string · header | 是 | Bearer API Key (sk_live_...) |
X-Organization-Id | string · header | 否 | Not required for API key auth |
from | string · query | 是 | RFC3339 start time (inclusive) |
to | string · query | 是 | RFC3339 end time (exclusive) |
响应
200OK
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
$schema | string (uri) | 否 | A URL to the JSON Schema for this object. |
by_model | array<UsageReportModelBreakdown> | 是 | Per-model breakdown, ordered by cost_points desc |
by_model.billable_prompt_tokens | integer (int64) | 是 | Summed billable prompt tokens |
by_model.cache_creation_tokens | integer (int64) | 是 | Summed cache creation tokens |
by_model.cache_explicit_read_tokens | integer (int64) | 是 | Summed explicit cache read tokens |
by_model.cached_tokens | integer (int64) | 是 | Summed cached tokens |
by_model.completion_tokens | integer (int64) | 是 | Summed completion tokens |
by_model.cost_points | string | 是 | Total cost in points (after discount) |
by_model.generated_artifacts | integer (int64) | 是 | Summed generated artifacts |
by_model.model | string | 是 | Aggregation key: user-supplied request_model, falling back to the configured model ID for legacy rows |
by_model.original_cost | string | 是 | Total cost in points before discount |
by_model.prompt_tokens | integer (int64) | 是 | Summed prompt tokens |
by_model.request_count | integer (int64) | 是 | Number of billed requests |
by_model.total_tokens | integer (int64) | 是 | Summed total tokens |
from | string (date-time) | 是 | Report start (RFC3339, inclusive) |
project_id | string | 是 | Project filter ('' means org-wide) |
to | string (date-time) | 是 | Report end (RFC3339, exclusive) |
totals | UsageReportTotals | 是 | — |
totals.billable_prompt_tokens | integer (int64) | 是 | — |
totals.cache_creation_tokens | integer (int64) | 是 | — |
totals.cache_explicit_read_tokens | integer (int64) | 是 | — |
totals.cached_tokens | integer (int64) | 是 | — |
totals.completion_tokens | integer (int64) | 是 | — |
totals.cost_points | string | 是 | Total cost in points (after discount) |
totals.generated_artifacts | integer (int64) | 是 | — |
totals.original_cost | string | 是 | Total cost in points before discount |
totals.prompt_tokens | integer (int64) | 是 | — |
totals.request_count | integer (int64) | 是 | — |
totals.total_tokens | integer (int64) | 是 | — |
defaultError
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
$schema | string (uri) | 否 | A URL to the JSON Schema for this object. |
detail | string | 否 | A human-readable explanation specific to this occurrence of the problem. |
errors | array<ErrorDetail> | 否 | Optional list of individual error details |
errors.location | string | 否 | Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id' |
errors.message | string | 否 | Error message text |
errors.value | any | 否 | The value at the given location |
instance | string (uri) | 否 | A URI reference that identifies the specific occurrence of the problem. |
status | integer (int64) | 否 | HTTP status code |
title | string | 否 | A short, human-readable summary of the problem type. This value should not change between occurrences of the error. |
type | string (uri) | 否 | A URI reference to human-readable documentation for the error.;默认值:about:blank |