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.
Put the API key in the request header:
Authorization: Bearer sk_live_YOUR_API_KEY
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 Key Use 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.
GET https://www.silvamux.com/api/business/v1/customer/usage
Authorization: Bearer $SILVAMUX_API_KEYRequest parameters Parameter Type & location Required Description Authorizationstring · header Yes Bearer API Key (sk_live_...) X-Organization-Idstring · header No Not required for API key auth fromstring · query Yes RFC3339 start time (inclusive) tostring · query Yes RFC3339 end time (exclusive)
Response 200OK application/json · BillingUsageReportResponse
Field Type Required Description $schemastring (uri) No A URL to the JSON Schema for this object. by_modelarray<UsageReportModelBreakdown> Yes Per-model breakdown, ordered by cost_points desc by_model.billable_prompt_tokensinteger (int64) Yes Summed billable prompt tokens by_model.cache_creation_tokensinteger (int64) Yes Summed cache creation tokens by_model.cache_explicit_read_tokensinteger (int64) Yes Summed explicit cache read tokens by_model.cached_tokensinteger (int64) Yes Summed cached tokens by_model.completion_tokensinteger (int64) Yes Summed completion tokens by_model.cost_pointsstring Yes Total cost in points (after discount) by_model.generated_artifactsinteger (int64) Yes Summed generated artifacts by_model.modelstring Yes Aggregation key: user-supplied request_model, falling back to the configured model ID for legacy rows by_model.original_coststring Yes Total cost in points before discount by_model.prompt_tokensinteger (int64) Yes Summed prompt tokens by_model.request_countinteger (int64) Yes Number of billed requests by_model.total_tokensinteger (int64) Yes Summed total tokens fromstring (date-time) Yes Report start (RFC3339, inclusive) project_idstring Yes Project filter ('' means org-wide) tostring (date-time) Yes Report end (RFC3339, exclusive) totalsUsageReportTotals Yes — 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_pointsstring Yes Total cost in points (after discount) totals.generated_artifactsinteger (int64) Yes — totals.original_coststring Yes Total 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
Field Type Required Description $schemastring (uri) No A URL to the JSON Schema for this object. detailstring No A human-readable explanation specific to this occurrence of the problem. errorsarray<ErrorDetail> No Optional list of individual error details errors.locationstring No Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id' errors.messagestring No Error message text errors.valueany No The value at the given location instancestring (uri) No A URI reference that identifies the specific occurrence of the problem. statusinteger (int64) No HTTP status code titlestring No A short, human-readable summary of the problem type. This value should not change between occurrences of the error. typestring (uri) No A URI reference to human-readable documentation for the error.;Default: about:blank
from, to: required, RFC3339 timestamps defining a half-open interval [from, to); from must be earlier than to.The time range is in UTC. 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 "
# pip install requests
import os
import requests
resp = requests.get(
"https://www.silvamux.com/api/business/v1/customer/usage",
params={
"from": "2026-07-08T00:00:00Z",
"to": "2026-07-09T00:00:00Z",
},
headers={"Authorization": f"Bearer {os.environ['SILVAMUX_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json()["totals"])
// Node 18+ (built-in fetch)
const from = "2026-07-08T00:00:00Z";
const to = "2026-07-09T00:00:00Z";
const query = new URLSearchParams({ from, to });
const resp = await fetch(
`https://www.silvamux.com/api/business/v1/customer/usage?${query}`,
{
headers: { Authorization: `Bearer ${process.env.SILVAMUX_API_KEY}` },
},
);
const data = await resp.json();
console.log(data.totals);
// Standard library only
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
url := "https://www.silvamux.com/api/business/v1/customer/usage?from=2026-07-08T00:00:00Z&to=2026-07-09T00:00:00Z"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("SILVAMUX_API_KEY"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
cURL Python JavaScript Go
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
}
]
}
Field Description 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
HTTP Code Description 401 INVALID_TOKENAPI key missing or invalid 400 INVALID_FROM_DATETIMEfrom missing or not RFC3339400 INVALID_TO_DATETIMEto missing or not RFC3339400 INVALID_TIME_RANGEfrom is not earlier than to