Revise API menu

Get usage

GEThttps://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.

See usage reports for integration guidance.

TypeScript#

TypeScript
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" });

Authorization#

Authorizationstringrequired

Bearer <key>, with an API key from the console.

Query parameters#

startstring<date-time>

Inclusive completion time. Defaults to 30 days before end. RFC3339 timezone required.

endstring<date-time>

Exclusive completion time. Defaults to now. Range must be positive and at most 366 days; hourly ranges at most 31 days.

bucketstringdefault: "day"

UTC calendar buckets, or no time bucketing. Empty time buckets are omitted.

one of "hour", "day", "month", "none"

group_bystring

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.

statusstring

one of "succeeded", "failed", "cancelled"

conversation_idstring

Exact conv_ ID.

api_key_idstring

Exact key_ ID of the submitting key. Older unattributed prompts do not match.

metadataobject

Exact AND matches, e.g. metadata[customer]=Acme. Keys up to 64 bytes; values up to 512 bytes.

providerstring

Exact requested provider. Gemini uses the public name gemini.

one of "openai", "anthropic", "xai", "gemini"

modelstring

Exact requested model ID; use with provider to disambiguate.

max length 256

document_accessstring

Exact admitted document permission; not inferred from tool behavior.

one of "read", "comment", "edit"

pricing_versionstring

Exact pricing version pinned at admission.

max length 256

Responses#

200UsageReportComplete filtered usage report
startstring<date-time>required

example "2026-09-06T00:00:00Z"

endstring<date-time>required

example "2026-09-08T00:00:00Z"

time_basisstringrequired

always "completed_at" · example "completed_at"

bucketstringrequired

one of "hour", "day", "month", "none" · example "day"

group_byarray<string>required

max items 3 · example ["metadata.customer"]

totalsUsageTotalsrequired

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"}}}

Properties
request_countintegerrequired

min 0 · example 5

tool_cpu_secondsstringrequired

example "5.000000"

inference_usageAggregatedInferenceUsage | nullrequired

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}}

costCostrequired

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"}}

Properties
total_usdstringrequired

example "0.305000000"

itemizedobjectrequired
Properties
base_fee_usdstringrequired

example "0.250000000"

cpu_fee_usdstringrequired

example "0.005000000"

inference_fee_usdstringrequired

example "0.050000000"

dataarray<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"}}}]

Properties
bucket_startstring | nullrequired

example "2026-09-06T00:00:00Z"

bucket_endstring | nullrequired

example "2026-09-07T00:00:00Z"

dimensionsobjectrequired

example {"metadata.customer":"acme"}

request_countintegerrequired

min 0 · example 2

tool_cpu_secondsstringrequired

example "2.000000"

inference_usageAggregatedInferenceUsage | nullrequired

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}}

costCostrequired

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"}}

Properties
total_usdstringrequired

example "0.305000000"

itemizedobjectrequired
Properties
base_fee_usdstringrequired

example "0.250000000"

cpu_fee_usdstringrequired

example "0.005000000"

inference_fee_usdstringrequired

example "0.050000000"

defaultErrorError
errorobjectrequired
Properties
codestringrequired
messagestringrequired
detailsobject