Time series forecasting API for Python
Call Chronos, TimesFM, Moirai, and other foundation models from any Python environment. No pip install for model weights, no CUDA drivers — just requests or httpx and an API key.
import requests
resp = requests.post("https://api.tsfm.ai/v1/forecast",
headers={
"Authorization": "Bearer $TSFM_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "amazon/chronos-bolt-base",
"inputs": [{"item_id": "daily-sales",
"target": [428, 435, 441, 438, 446, 452],
"start": "2026-03-01T00:00:00Z"}],
"parameters": {"prediction_length": 14,
"freq": "D", "quantiles": [0.1, 0.5, 0.9]},
},
)
forecasts = resp.json()Standard library HTTP — no model-specific SDK needed.
Setup
pip install requests — that is the only dependency
Compatibility
Works in notebooks, scripts, FastAPI, Django, and Lambda
Response
Typed JSON with point forecasts, quantiles, and metadata
Python integration patterns
The API is a standard REST endpoint. Any HTTP library works, but here are the patterns Python teams reach for most often.
requests for scripts and notebooks
The simplest path. Import requests, POST JSON, and parse the response dict. Works in Jupyter, standalone scripts, and any Python 3.7+ environment.
httpx for async workloads
Use httpx.AsyncClient when you need concurrent forecast calls — for example, fanning out across hundreds of series in a FastAPI endpoint or an asyncio pipeline.
pandas post-processing
The response JSON maps directly into a DataFrame. Parse quantile arrays into columns for downstream analytics, plotting, or export to Parquet.
View response schemaGet started in three steps
- 1
Get an API key
Sign up for a free account and copy your API key from the dashboard. Export it as TSFM_API_KEY in your environment or .env file.
- 2
Send your first forecast request
Use requests.post or httpx.post with the /v1/forecast endpoint. Pass your time series as a JSON array in the target field.
- 3
Parse the response
The API returns a JSON object with point forecasts and quantile arrays. Load it into pandas, plot it with matplotlib, or feed it into your application logic.
Frequently Asked Questions
Forecast from Python in under a minute
One API key, one requests.post call. Get point forecasts and prediction intervals back as JSON — ready for pandas, plotting, or your production pipeline.