Get usage
https://revise.io/api/v1/usageAggregate 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#
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#
AuthorizationstringrequiredBearer <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_bystringComma-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.
statusstringone of "succeeded", "failed", "cancelled"
conversation_idstringExact conv_ ID.
api_key_idstringExact key_ ID of the submitting key. Older unattributed prompts do not match.
metadataobjectExact AND matches, e.g. metadata[customer]=Acme. Keys up to 64 bytes; values up to 512 bytes.
providerstringExact requested provider. Gemini uses the public name gemini.
one of "openai", "anthropic", "xai", "gemini"
modelstringExact requested model ID; use with provider to disambiguate.
max length 256
document_accessstringExact admitted document permission; not inferred from tool behavior.
one of "read", "comment", "edit"
pricing_versionstringExact pricing version pinned at admission.
max length 256
Responses#
200UsageReportComplete filtered usage report
startstring<date-time>requiredexample "2026-09-06T00:00:00Z"
endstring<date-time>requiredexample "2026-09-08T00:00:00Z"
time_basisstringrequiredalways "completed_at" · example "completed_at"
bucketstringrequiredone of "hour", "day", "month", "none" · example "day"
group_byarray<string>requiredmax items 3 · example ["metadata.customer"]
totalsUsageTotalsrequiredexample {"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_countintegerrequiredmin 0 · example 5
tool_cpu_secondsstringrequiredexample "5.000000"
inference_usageAggregatedInferenceUsage | nullrequiredNull 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}}
costCostrequiredSettled 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_usdstringrequiredexample "0.305000000"
itemizedobjectrequiredProperties
base_fee_usdstringrequiredexample "0.250000000"
cpu_fee_usdstringrequiredexample "0.005000000"
inference_fee_usdstringrequiredexample "0.050000000"
dataarray<UsageBucket>requiredmax 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 | nullrequiredexample "2026-09-06T00:00:00Z"
bucket_endstring | nullrequiredexample "2026-09-07T00:00:00Z"
dimensionsobjectrequiredexample {"metadata.customer":"acme"}
request_countintegerrequiredmin 0 · example 2
tool_cpu_secondsstringrequiredexample "2.000000"
inference_usageAggregatedInferenceUsage | nullrequiredNull 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}}
costCostrequiredSettled 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_usdstringrequiredexample "0.305000000"
itemizedobjectrequiredProperties
base_fee_usdstringrequiredexample "0.250000000"
cpu_fee_usdstringrequiredexample "0.005000000"
inference_fee_usdstringrequiredexample "0.050000000"
defaultErrorError
errorobjectrequiredProperties
codestringrequiredmessagestringrequireddetailsobject