> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloudsome-inc.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Usage and spend

`GET /v1/usage` authenticates with `Authorization: Bearer <API Key>` or `x-api-key`; no login JWT or user\_id parameter is needed. The backend derives user and project identity from the key and aggregates only that key. A shared organization key returns combined usage across callers, not per-member or organization-wide totals. The response user\_id identifies the user associated with the key.

Required start and end use YYYY-MM-DD, inclusive in Beijing time (UTC+8), up to 366 calendar days. Missing, invalid or reversed dates return 400; an invalid or expired key returns 401; IP restrictions or incomplete authenticated identity return 403.

```bash theme={null}
curl --get 'https://api.cloudsome-inc.ai/v1/usage' \
  -H "Authorization: Bearer $CLOUDSOME_API_KEY" \
  --data-urlencode 'start=2026-10-01' \
  --data-urlencode 'end=2026-10-31'
```

```json theme={null}
{
  "user_id": "user-example",
  "api_key_id": "key-example",
  "start": "2026-10-01",
  "end": "2026-10-31",
  "timezone": "Asia/Shanghai",
  "currency": "USD",
  "summary": {
    "requests": 12,
    "prompt_tokens": 8000,
    "completion_tokens": 2000,
    "total_tokens": 10000,
    "cache_creation_input_tokens": 1000,
    "cache_read_input_tokens": 3000,
    "price_micros": 1234567,
    "unsettled_requests": 0
  }
}
```

requests counts billing-visible usage records, excluding adjustments and empty attempt logs; it is not all HTTP attempts. Records need nonzero tokens, cache counters or spend, or a settled image billing snapshot. prompt\_tokens, completion\_tokens and total\_tokens are recorded input, output and total tokens. cache\_creation\_input\_tokens and cache\_read\_input\_tokens are recorded cache counters; do not add them to total tokens again.

price\_micros is net settled USD spend: divide by 1,000,000 for dollars. It includes refunds and adjustments, can be negative, and excludes provider costs. Facts are counted by creation date; adjustments use their own creation date. Tokenless image/video requests may still incur spend. Empty ranges return zeros.

unsettled\_requests counts persisted but unconfirmed usage records excluded from other totals. Async writes and later settlement can change results; zero does not guarantee that every call has arrived. Each Relay process allows an average of one query per key every 5 seconds, burst 5. Back off after 429; retry 500/503 later. Queries do not incur charges.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.