ReferenceCloud managementAggregate spend / tokens for a window

Aggregate spend / tokens for a window

1 min readEdit this page
GET
/v1/namespaces/{nsid}/usage

Uses immutable billing-audit charges when present and legacy request charges only when no audit exists. Billing anomaly counts keep null charges visible. Defaults to the last 30 days.

Requires the usage:read scope.

Authorization

x-api-key<token>

Anthropic-style API key header.

In: header

Path Parameters

nsid*string

Id of the target namespace. Must be owned by the caller (or equal a namespace-baked credential's own namespace), else 404.

Query Parameters

from?string

Inclusive RFC 3339 timestamp lower bound.

to?string

Exclusive RFC 3339 timestamp upper bound.

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/namespaces/string/usage"
{  "capability_request_counts": {    "property1": 0,    "property2": 0  },  "completion_tokens": 0,  "from": "2019-08-24T14:15:22Z",  "prompt_tokens": 0,  "request_count": 0,  "spend_micro_usd": 0,  "to": "2019-08-24T14:15:22Z"}
{  "error": "string",  "error_description": "string"}
{  "error": "string",  "error_description": "string"}
{  "error": "string",  "error_description": "string"}

How is this guide?