Time series forecasting API for TypeScript
Call Chronos, TimesFM, Moirai, and other foundation models from any TypeScript runtime. Fully typed request and response shapes, zero native dependencies, works on Node.js and edge runtimes alike.
const res = await fetch("https://api.tsfm.ai/v1/forecast", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.TSFM_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
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] },
}),
});
const forecasts = await res.json();Standard fetch — works in Node.js 18+, Deno, Bun, and Vercel Edge.
Runtime
Node.js, Deno, Bun, Cloudflare Workers, Vercel Edge
Types
Define request and response interfaces once — compiler checks the rest
Bundle
Zero native deps — no node-gyp, no WASM, just fetch
TypeScript integration patterns
The API is a standard REST endpoint. Use whichever HTTP approach fits your stack.
fetch for modern runtimes
Node.js 18+, Deno, Bun, and edge runtimes all have native fetch. No extra packages needed — just type the request body and parse the response.
axios or ky for existing stacks
If your project already uses axios or ky, the API works with them unchanged. Add interceptors for retries, logging, or auth token refresh as you normally would.
Type-safe wrappers
Define ForecastRequest and ForecastResponse interfaces in your project. The API returns a stable JSON shape that maps cleanly to TypeScript types.
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. Store it in your .env file as TSFM_API_KEY.
- 2
Send your first forecast request
Use fetch or your preferred HTTP client to POST to /v1/forecast. Pass your time series as a JSON array in the target field.
- 3
Type the response
Define a TypeScript interface for the response and cast the parsed JSON. The shape is stable across all models so one interface covers every request.
Frequently Asked Questions
Forecast from TypeScript in under a minute
One API key, one fetch call. Get typed forecasts back as JSON — ready for your API routes, dashboards, or data pipelines.