{"inputSchema":{"type":"object","required":["history","frequency"],"additionalProperties":false,"properties":{"history":{"type":"array","minItems":4,"maxItems":520,"description":"The demand history, one entry per period, oldest first. Periods must be consecutive and each period_start must be unique and ascending.","items":{"type":"object","required":["period_start","quantity"],"additionalProperties":false,"properties":{"period_start":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"First day of the period as YYYY-MM-DD."},"quantity":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Units sold in that period. Zero is allowed and switches the decomposition to additive."},"promotion":{"type":"boolean","default":false,"description":"Whether the SKU was on promotion in that period."},"holiday":{"type":"boolean","default":false,"description":"Whether that period contained a holiday you consider relevant. The calendar is yours; no holiday list is looked up."}}}},"frequency":{"type":"string","enum":["daily","weekly","monthly"],"description":"Length of one period. Sets the default season length: 7 for daily, 52 for weekly, 12 for monthly."},"horizon_periods":{"type":"integer","minimum":1,"maximum":104,"default":8,"description":"How many periods to forecast."},"season_length_periods":{"type":"integer","minimum":0,"maximum":53,"description":"Override the season length in periods. Zero switches seasonality off. Omitted uses the default for the frequency."},"future_events":{"type":"array","maxItems":104,"description":"Promotions and holidays you already know about for the forecast periods. Matched on period_start against the generated periods; an entry that matches no period is reported back as unmatched.","items":{"type":"object","required":["period_start"],"additionalProperties":false,"properties":{"period_start":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"First day of the forecast period this applies to."},"promotion":{"type":"boolean","default":false},"holiday":{"type":"boolean","default":false}}}},"confidence_level":{"type":"number","enum":[0.8,0.9,0.95],"default":0.9,"description":"Confidence level of the prediction interval."},"backtest_periods":{"type":"integer","minimum":0,"maximum":52,"default":0,"description":"How many of the last periods to hold back for the comparison against the baselines. Zero picks a quarter of the history, capped at the horizon."}}},"outputSchema":{"type":"object","properties":{"forecast":{"type":"array"},"method":{"type":"object"},"seasonality":{"type":"object"},"event_factors":{"type":"object"},"backtest":{"type":["object","null"]},"unmatched_future_events":{"type":"array"},"unavailable_fields":{"type":"array"}}},"priceModel":null,"requestExample":{"frequency":"weekly","history":[{"period_start":"2026-01-05","quantity":117},{"period_start":"2026-01-12","quantity":90},{"period_start":"2026-01-19","quantity":102},{"period_start":"2026-01-26","quantity":113},{"period_start":"2026-02-02","quantity":191,"promotion":true},{"period_start":"2026-02-09","quantity":104},{"period_start":"2026-02-16","quantity":115},{"period_start":"2026-02-23","quantity":120},{"period_start":"2026-03-02","quantity":145},{"period_start":"2026-03-09","quantity":150,"holiday":true},{"period_start":"2026-03-16","quantity":125},{"period_start":"2026-03-23","quantity":136},{"period_start":"2026-03-30","quantity":154},{"period_start":"2026-04-06","quantity":188,"promotion":true},{"period_start":"2026-04-13","quantity":137},{"period_start":"2026-04-20","quantity":144},{"period_start":"2026-04-27","quantity":174},{"period_start":"2026-05-04","quantity":133},{"period_start":"2026-05-11","quantity":199,"holiday":true},{"period_start":"2026-05-18","quantity":159},{"period_start":"2026-05-25","quantity":182},{"period_start":"2026-06-01","quantity":150}],"season_length_periods":4,"horizon_periods":4,"future_events":[{"period_start":"2026-06-15","promotion":true}],"confidence_level":0.9,"backtest_periods":4},"price_usdc":"0.006","example_request":{"frequency":"weekly","history":[{"period_start":"2026-01-05","quantity":117},{"period_start":"2026-01-12","quantity":90},{"period_start":"2026-01-19","quantity":102},{"period_start":"2026-01-26","quantity":113},{"period_start":"2026-02-02","quantity":191,"promotion":true},{"period_start":"2026-02-09","quantity":104},{"period_start":"2026-02-16","quantity":115},{"period_start":"2026-02-23","quantity":120},{"period_start":"2026-03-02","quantity":145},{"period_start":"2026-03-09","quantity":150,"holiday":true},{"period_start":"2026-03-16","quantity":125},{"period_start":"2026-03-23","quantity":136},{"period_start":"2026-03-30","quantity":154},{"period_start":"2026-04-06","quantity":188,"promotion":true},{"period_start":"2026-04-13","quantity":137},{"period_start":"2026-04-20","quantity":144},{"period_start":"2026-04-27","quantity":174},{"period_start":"2026-05-04","quantity":133},{"period_start":"2026-05-11","quantity":199,"holiday":true},{"period_start":"2026-05-18","quantity":159},{"period_start":"2026-05-25","quantity":182},{"period_start":"2026-06-01","quantity":150}],"season_length_periods":4,"horizon_periods":4,"future_events":[{"period_start":"2026-06-15","promotion":true}],"confidence_level":0.9,"backtest_periods":4},"serviceName":"demand_forecast","tags":["forecast","demand-planning","inventory","seasonality"],"outputExample":{"forecast":[{"period_start":"2026-06-08","horizon":1,"forecast_qty":161.48,"lower_qty":149.0801,"upper_qty":173.8799,"seasonal_index":0.960742,"promotion":false,"holiday":false,"interval_width_qty":24.7998},{"period_start":"2026-06-15","horizon":2,"forecast_qty":248.7521,"lower_qty":231.216,"upper_qty":266.2883,"seasonal_index":1.006877,"promotion":true,"holiday":false,"interval_width_qty":35.0722},{"period_start":"2026-06-22","horizon":3,"forecast_qty":204.1338,"lower_qty":182.6565,"upper_qty":225.611,"seasonal_index":1.169659,"promotion":false,"holiday":false,"interval_width_qty":42.9545},{"period_start":"2026-06-29","horizon":4,"forecast_qty":153.3464,"lower_qty":128.5466,"upper_qty":178.1462,"seasonal_index":0.862723,"promotion":false,"holiday":false,"interval_width_qty":49.5996}],"method":{"decomposition":"multiplicative","decomposition_reason":"every observation is positive, so a ratio is defined","trend":"Holt linear trend, alpha 0.3, beta 0.1, fixed and not tuned per call","seasonal_estimator":"median ratio per phase against a centred moving average of the season length, event periods excluded","interval":"point +/- z * sigma * sqrt(horizon), z = 1.6449 for confidence_level 0.9, sigma from the in-sample one-step errors with 19 degrees of freedom","sigma":7.5384,"level":164.8556,"slope_per_period":3.2229,"last_observed_qty":150,"deterministic":true,"external_sources":"none: weather, holiday calendars and competitor data are not looked up. The promotion and holiday flags come from the caller.","out_of_scope":["cannibalisation between SKUs","new products without history","intermittent demand models such as Croston"]},"seasonality":{"applied":true,"season_length_periods":4,"reason":null,"indices":[1.169659,0.862723,0.960742,1.006877],"index_meaning":"multiplier on the deseasonalised level"},"event_factors":{"promotion":{"factor":1.442214,"periods_observed":2,"estimable":true,"reason":null},"holiday":{"factor":1.441418,"periods_observed":2,"estimable":true,"reason":null},"meaning":"multiplier against the quiet periods"},"backtest":{"holdout_periods":4,"training_periods":18,"refit":"the identical pipeline was refitted on the training part only, nothing from the holdout entered the fit","metrics":{"decomposition_holt":{"mae":5.0905,"rmse":6.2272,"mape_pct":2.997},"naive_last_value":{"mae":39.5,"rmse":43.9375,"mape_pct":21.944},"seasonal_naive":{"mae":25.5,"rmse":33.2491,"mape_pct":14.08}},"best_by_mae":"decomposition_holt","note":null},"unmatched_future_events":[],"unavailable_fields":[],"limits":{"max_history_periods":520,"min_history_periods":4,"max_horizon_periods":104,"max_future_events":104}}}