usage

Get cost forecast for an API key

Uses historical usage data to predict when the budget will be exhausted. Returns average daily spend, projected exhaustion date, and confidence intervals.

get/admin/v1/api-keys/{key_id}/usage/forecast

Request

  • Base URL: / (relative, and the document was published on a file host, not at the API’s origin)
  • URL: /admin/v1/api-keys/{key_id}/usage/forecast
  • Auth: HTTP bearer

Path parameters

key_idstring uuid required

API key ID

Query parameters

lookback_daysinteger nullable

Number of days of historical data to use (default: 30)

forecast_daysinteger nullable

Number of days to forecast ahead (default: 7)

Response

Cost forecast

avg_daily_spendnumber double required

Average daily spend (dollars) based on historical data

budget_limitnumber double nullable

Budget limit (dollars), null if no budget configured

budget_periodstring nullable

Budget period (daily or monthly)

budget_utilization_percentnumber double nullable

Percentage of budget used in current period

current_spendnumber double required

Current spend in the budget period (dollars)

days_until_exhaustionnumber double nullable

Projected days until budget exhaustion (null if no budget or zero spend rate)

days_until_exhaustion_lowernumber double nullable

Lower bound days until exhaustion (95% confidence, assumes +1 std dev spend)

days_until_exhaustion_uppernumber double nullable

Upper bound days until exhaustion (95% confidence, assumes -1 std dev spend)

projected_exhaustion_datestring nullable

Projected exhaustion date (YYYY-MM-DD, null if no budget or zero spend rate)

projected_period_spendnumber double nullable

Projected end-of-period spend at current rate (dollars)

sample_daysinteger required

Number of days of historical data used

std_dev_daily_spendnumber double required

Standard deviation of daily spend (dollars)

Changes

No recorded changes to this operation across all 1 revision of this API.