Forecast API

Forecast API

GET http://<your-kubecost-address>/forecasting/forecast/<monitoringEndpoint>

The Forecast API predicts a range of total future spending for any of Kubecost's three major monitoring data sets; Allocation, Assets, and CloudCosts, as established via the monitoringEndpoint (more below).

Request Body

NameTypeDescription

predictionWindow*

string

Range of future spend to predict. The larger the value of this parameter, the wider the confidence bounds may become. Should be formatted in number of days, ex: predictionWindow=30d

aggregate

string

Does not ever support job, daemonSet, or statefulSet. Does not affect predicted cost values.

{
    "code": 200,
    "data": {
        "arima/type": {
            "TotalPredictedCost": ,
            "aggregate": "type",
            "bestCasePredicted": null,
            "model": "arima",
            "predictions": {
                "all": [
                    {
                        "confidenceInterval": {
                            "confidenceLevel": 0.75,
                            "lowerConfidenceLimit": ,
                            "upperConfidenceLimit": 
                        },
                        "predictedCost": ,
                        "window": {
                            "end": "2024-04-04T00:00:00Z",
                            "start": "2024-04-03T00:00:00Z"
                        }
                    }
                ]
            },
            "status": "trained",
            "worstCasePredicted": null
        }
    }
}

Schema

Regardless of the value of predictionWindow, results will be returned in daily intervals.

predictedCost will be the closest approximation of future costs for the day defined in the window field. The bounds of the confidence interval are displayed with the values lowerConfidenceLimit and upperConfidenceLimit.

Forecast Container

The Forecast Container powers multiple cost prediction features in Kubecost including Forecasting and Anomaly Detection. It reads the last 100 days of cost data to form a reliable model of prediction when querying with the Forecast API.

The Forecasting Container can be disabled by setting the Helm flag:

forecasting:
  enabled: false

Configuring monitoringEndpoint

The Forecast API requires a configurable endpoint which establishes from which monitoring data you want to forecast:

DatasetDescriptionEndpoint

Allocated spend

/allocation

Kubernetes objects and resources

/assets

Cloud services

/cloudcost

Examples

Forecast future cloud cost spend for the next 60 days:

http://<your-kubecost-address>/forecasting/forecast/cloudcost?predictionWindow=60d

Last updated