--- language: en license: mit tags: - time-series - forecasting - arima - chronos - lstm - api --- # TSFA — Time Series Forecasting API **Predict future values with calibrated confidence intervals via a simple REST API.** TSFA handles the full forecasting pipeline: automatic preprocessing, model selection, uncertainty quantification, and diagnostics — no ML expertise required. ## Available on RapidAPI 🚀 **[Try the API on RapidAPI](https://rapidapi.com/dorianmrt/api/tsfa)** Free tier available. No credit card required to start. ## Quick Start ```python import requests resp = requests.post( "https://tsfa.p.rapidapi.com/v1/forecast/univariate", headers={ "X-RapidAPI-Key": "YOUR_KEY", "X-RapidAPI-Host": "tsfa.p.rapidapi.com", }, json={ "series": [120, 132, 128, 145, 139, 152, 148, 160, 155, 168], "horizon": 7, "model": "auto", }, ) print(resp.json()["forecast"]["mean"]) # [171.2, 174.5, 177.8, 181.0, 184.3, 187.6, 190.8] ``` ## Use Cases ![Retail demand forecast — 14-day ahead with 80% and 95% confidence intervals](https://huggingface.co/Eymdeyy/tsfa-forecasting-api/resolve/main/images/01_retail_forecast.png) *Retail demand forecast — 14-day ahead with 80% and 95% confidence intervals* ![EUR/USD exchange rate forecast — 30-day ahead with 95% probability band](https://huggingface.co/Eymdeyy/tsfa-forecasting-api/resolve/main/images/02_financial_forecast.png) *EUR/USD exchange rate forecast — 30-day ahead with 95% probability band* ![Energy consumption forecast — 48h ahead (ETT-h1 real data)](https://huggingface.co/Eymdeyy/tsfa-forecasting-api/resolve/main/images/03_energy_forecast.png) *Energy consumption forecast — 48h ahead (ETT-h1 real data)* ## Models | Model | Credits | Best For | |-------|---------|----------| | `auto` | 1 | Automatic selection — recommended | | `arima` | 1 | Stationary series, interpretable | | `chronos` | 1 | Pre-trained transformer (zero-shot) | | `lstm` | 2 | Long sequences, complex patterns | ## Benchmarks Evaluated via sliding-window backtesting (5 windows) on public datasets. | Dataset | Model | Horizon | MAE | RMSE | MAPE | sMAPE | |---------|-------|---------|-----|------|------|-------| | ett_h1 | arima | 24 | 2.4524 | 2.9405 | 10.12% | 10.74% | | ett_h1 | naive | 24 | 2.4524 | 2.9405 | 10.12% | 10.74% | | ett_h1 | seasonal_naive | 24 | 1.9263 | 2.2837 | 8.25% | 8.74% | | exchange_rate | arima | 30 | 0.0085 | 0.0100 | 1.13% | 1.13% | | exchange_rate | naive | 30 | 0.0085 | 0.0100 | 1.13% | 1.13% | | exchange_rate | seasonal_naive | 30 | 0.0103 | 0.0117 | 1.37% | 1.37% | | m5_sample | arima | 14 | 9.0427 | 10.5617 | 7.63% | 7.43% | | m5_sample | naive | 14 | 14.3541 | 16.7054 | 11.45% | 11.74% | | m5_sample | seasonal_naive | 14 | 5.0372 | 6.2019 | 4.24% | 4.18% | Datasets: ETT-h1 (electricity transformer temperature), Exchange Rate (8 currencies), M5 (retail sales). All results are out-of-sample. ## Endpoints | Method | Path | Description | |--------|------|-------------| | POST | `/v1/forecast/univariate` | Forecast a single series | | POST | `/v1/forecast/batch` | Forecast 50–500 series in parallel | | POST | `/v1/validate` | Backtest with sliding-window cross-validation | | GET | `/v1/models` | List available models | | GET | `/v1/usage` | Check credit consumption | | GET | `/health` | API health status | ## Plans | Plan | Monthly Credits | Rate Limit | Price | |------|----------------|------------|-------| | Free | 500 | 10 req/min | $0 | | Basic | 10,000 | 30 req/min | $49 | | Pro | 50,000 | 100 req/min | $199 | | Ultra | 200,000 | 300 req/min | $499 | ## License MIT — see [GitHub](https://github.com/Eymdey/tsfa)