Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.unprice.dev/llms.txt

Use this file to discover all available pages before exploring further.

const { result, error } = await unprice.analytics.usage.get({
  range: "24h",
  customer_id: "cus_1234567890"
});

if (error) {
  console.error(error.message);
  return;
}

console.log(result);
{
  "usage": [
    {
      "project_id": "project_1234567890",
      "customer_id": "cus_1234567890",
      "feature_slug": "tokens",
      "usage": 30,
      "spending": {
        "amount": "0.0003",
        "currency": "USD",
        "display_amount": "$0"
      }
    }
  ]
}

Request

range
string
required
The usage window to inspect. Supported values include 24h, 7d, 30d, and 90d.
customer_id
string
Optional customer ID to filter usage.
project_id
string
Optional project ID. Only main-project keys can request another project.

Response

usage
array
required
Usage data points for the selected range.