# Get usage

> Aggregate settled prompts and conversions by completion time.

See [usage reports](https://revise.io/developer/docs/revise-api/pricing#usage-reports) for integration guidance.

## TypeScript

```ts
import { ReviseClient } from "@reviseio/api";

const revise = new ReviseClient({ apiKey: process.env.REVISE_API_KEY! });
const result = await revise.usage.get({ start: "2026-09-01T00:00:00Z", end: "2026-10-01T00:00:00Z" });
```

`GET https://revise.io/api/v1/usage`

Aggregate settled prompts and conversions by completion time. Queued, running, and paused work is excluded. Totals reconcile to historical receipts, not current rates. Filters combine with AND; rows sort by UTC bucket and dimensions. The default window is the last 30 days.

Reports return at most 1,000 rows without pagination. Larger results return 422; narrow the range or use fewer groups/coarser buckets. Queries time out after five seconds with 503. Customer metadata expires with job content: metadata filters then stop matching and metadata dimensions become null, while account totals remain. Store job-to-customer mappings locally for long-term attribution. Model/provider dimensions describe admitted configuration, including deterministic conversions, rather than proving inference occurred. Unknown, empty, or repeated parameters return 400; empty metadata filter values are allowed.

## Authorization

`Authorization: Bearer <key>` with an API key from https://revise.io/console/api-keys.

## Query parameters

- `start` (string<date-time>): Inclusive completion time. Defaults to 30 days before end. RFC3339 timezone required.
- `end` (string<date-time>): Exclusive completion time. Defaults to now. Range must be positive and at most 366 days; hourly ranges at most 31 days.
- `bucket` (string): UTC calendar buckets, or no time bucketing. Empty time buckets are omitted.. one of "hour", "day", "month", "none"
- `group_by` (string): Comma-separated distinct dimensions, maximum three: api_key_id, provider, model, status, document_access, pricing_version, metadata.KEY (KEY 1–64 bytes). Missing values form null groups. Example: api_key_id,metadata.customer.
- `status` (string): one of "succeeded", "failed", "cancelled"
- `conversation_id` (string): Exact conv_ ID.
- `api_key_id` (string): Exact key_ ID of the submitting key. Older unattributed prompts do not match.
- `metadata` (object): Exact AND matches, e.g. metadata[customer]=Acme. Keys up to 64 bytes; values up to 512 bytes.
- `provider` (string): Exact requested provider. Gemini uses the public name gemini.. one of "openai", "anthropic", "xai", "gemini"
- `model` (string): Exact requested model ID; use with provider to disambiguate.. max length 256
- `document_access` (string): Exact admitted document permission; not inferred from tool behavior.. one of "read", "comment", "edit"
- `pricing_version` (string): Exact pricing version pinned at admission.. max length 256

## Responses

### 200 `UsageReport`

Complete filtered usage report

- `start` (string<date-time>, required): example "2026-09-06T00:00:00Z"
- `end` (string<date-time>, required): example "2026-09-08T00:00:00Z"
- `time_basis` (string, required): always "completed_at". example "completed_at"
- `bucket` (string, required): one of "hour", "day", "month", "none". example "day"
- `group_by` (array<string>, required): max items 3. example ["metadata.customer"]
- `totals` (UsageTotals, required): example {"request_count":5,"tool_cpu_seconds":"5.000000","inference_usage":{"input_tokens":6000,"cached_input_tokens":2000,"cache_creation_input_tokens":0,"output_tokens":1000,"web_search_requests_by_unit":{"calls":5,"queries":0,"grounded_prompts":0}},"cost":{"total_usd":"0.550000000","itemized":{"base_fee_usd":"0.250000000","cpu_fee_usd":"0.250000000","inference_fee_usd":"0.050000000"}}}
  - `request_count` (integer, required): min 0. example 5
  - `tool_cpu_seconds` (string, required): example "5.000000"
  - `inference_usage` (AggregatedInferenceUsage | null, required): Null if any receipt in this aggregate lacks inference counters; charge totals remain complete. Empty aggregates have zero counters.. example {"input_tokens":6000,"cached_input_tokens":2000,"cache_creation_input_tokens":0,"output_tokens":1000,"web_search_requests_by_unit":{"calls":5,"queries":0,"grounded_prompts":0}}
  - `cost` (Cost, required): Settled customer charges. Itemized base, CPU and inference fees are disjoint and sum exactly to total_usd. Inference includes model processing and web search. No overlapping platform subtotal. Balances and limits are separate from cost.. example {"total_usd":"0.305000000","itemized":{"base_fee_usd":"0.250000000","cpu_fee_usd":"0.005000000","inference_fee_usd":"0.050000000"}}
    - `total_usd` (string, required): example "0.305000000"
    - `itemized` (object, required)
      - `base_fee_usd` (string, required): example "0.250000000"
      - `cpu_fee_usd` (string, required): example "0.005000000"
      - `inference_fee_usd` (string, required): example "0.050000000"
- `data` (array<UsageBucket>, required): max items 1000. example [{"bucket_start":"2026-09-06T00:00:00Z","bucket_end":"2026-09-07T00:00:00Z","dimensions":{"metadata.customer":"acme"},"request_count":2,"tool_cpu_seconds":"2.000000","inference_usage":{"input_tokens":2400,"cached_input_tokens":800,"cache_creation_input_tokens":0,"output_tokens":400,"web_search_requests_by_unit":{"calls":2,"queries":0,"grounded_prompts":0}},"cost":{"total_usd":"0.220000000","itemized":{"base_fee_usd":"0.100000000","cpu_fee_usd":"0.100000000","inference_fee_usd":"0.020000000"}}},{"bucket_start":"2026-09-07T00:00:00Z","bucket_end":"2026-09-08T00:00:00Z","dimensions":{"metadata.customer":"acme"},"request_count":3,"tool_cpu_seconds":"3.000000","inference_usage":{"input_tokens":3600,"cached_input_tokens":1200,"cache_creation_input_tokens":0,"output_tokens":600,"web_search_requests_by_unit":{"calls":3,"queries":0,"grounded_prompts":0}},"cost":{"total_usd":"0.330000000","itemized":{"base_fee_usd":"0.150000000","cpu_fee_usd":"0.150000000","inference_fee_usd":"0.030000000"}}}]
  - `bucket_start` (string | null, required): example "2026-09-06T00:00:00Z"
  - `bucket_end` (string | null, required): example "2026-09-07T00:00:00Z"
  - `dimensions` (object, required): example {"metadata.customer":"acme"}
  - `request_count` (integer, required): min 0. example 2
  - `tool_cpu_seconds` (string, required): example "2.000000"
  - `inference_usage` (AggregatedInferenceUsage | null, required): Null if any receipt in this aggregate lacks inference counters; charge totals remain complete. Empty aggregates have zero counters.. example {"input_tokens":2400,"cached_input_tokens":800,"cache_creation_input_tokens":0,"output_tokens":400,"web_search_requests_by_unit":{"calls":2,"queries":0,"grounded_prompts":0}}
  - `cost` (Cost, required): Settled customer charges. Itemized base, CPU and inference fees are disjoint and sum exactly to total_usd. Inference includes model processing and web search. No overlapping platform subtotal. Balances and limits are separate from cost.. example {"total_usd":"0.305000000","itemized":{"base_fee_usd":"0.250000000","cpu_fee_usd":"0.005000000","inference_fee_usd":"0.050000000"}}
    - `total_usd` (string, required): example "0.305000000"
    - `itemized` (object, required)
      - `base_fee_usd` (string, required): example "0.250000000"
      - `cpu_fee_usd` (string, required): example "0.005000000"
      - `inference_fee_usd` (string, required): example "0.050000000"

### default `Error`

Error

- `error` (object, required)
  - `code` (string, required)
  - `message` (string, required)
  - `details` (object)
