January 15, 2026
featuresdks
Python & TypeScript SDKs
Official client libraries for TSFM.ai
Python & TypeScript SDKs
We are shipping official client libraries for Python and TypeScript, providing type-safe wrappers around all TSFM.ai API endpoints.
Python
pip install tsfm-ai
from tsfm_ai import TSFMClient
client = TSFMClient(api_key="your-api-key")
# Single forecast
result = client.forecast(
model="chronos-bolt-small",
values=[1.2, 3.4, 5.6, 7.8, 9.0],
freq="h",
prediction_length=24,
)
print(result.mean)
# List available models
models = client.list_models()
for m in models:
print(f"{m.id}: {m.description}")
TypeScript
npm install @tsfm/client
import { TSFMClient } from "@tsfm/client";
const client = new TSFMClient({ apiKey: "your-api-key" });
// Single forecast
const result = await client.forecast({
model: "chronos-bolt-small",
data: { values: [1.2, 3.4, 5.6, 7.8, 9.0], freq: "h" },
predictionLength: 24,
});
console.log(result.mean);
// Batch forecast
const batch = await client.forecastBatch({
requests: [
{ model: "chronos-bolt-small", data: { values: [...], freq: "h" }, predictionLength: 24 },
{ model: "timesfm-2.0", data: { values: [...], freq: "D" }, predictionLength: 7 },
],
});
Features
Both SDKs support:
- All API endpoints — forecast, batch forecast, schedules, and model listing
- Full type safety — Pydantic models in Python, TypeScript interfaces in TS
- Automatic retries — Configurable retry logic with exponential backoff
- Streaming — For large batch responses
- Async support —
AsyncTSFMClientin Python, native Promises in TypeScript