Nixtla

raw JSON →
0.7.3 verified Mon Apr 27 auth: no python

Python SDK for the Nixtla API, providing access to TimeGPT, a generative pre-trained forecasting model. Current version 0.7.3, requires Python >=3.10. Regular releases with new features and integrations.

pip install nixtla
error ImportError: cannot import name 'TimeGPT' from 'nixtla'
cause TimeGPT was renamed to NixtlaClient in v0.7.0.
fix
Change import to from nixtla import NixtlaClient.
error nixtla.core.exceptions.ApiError: 401 Client Error: Unauthorized
cause API key is missing or invalid.
fix
Ensure NIXTLA_API_KEY environment variable is set or pass api_key parameter to NixtlaClient.
error KeyError: 'time_col' not found in dataframe columns
cause The `time_col` argument does not match any column in the provided DataFrame.
fix
Check column names and ensure time_col refers to a valid column.
breaking TimeGPT class renamed to NixtlaClient in v0.7.0. Old code using `from nixtla import TimeGPT` will still work temporarily but may break in future releases.
fix Use `from nixtla import NixtlaClient` and replace `TimeGPT` with `NixtlaClient`.
deprecated The `insample` endpoint is deprecated as of v0.7.2.
fix Use `forecast` or `cross_validation` methods instead.
gotcha The SDK sends telemetry by default using PostHog. Environments without internet access may experience delays or errors.
fix Set environment variable `POSTHOG_DISABLE=1` or adjust telemetry settings.

Initialize client with API key from environment variable and generate a 3-step forecast.

import os
from nixtla import NixtlaClient

client = NixtlaClient(api_key=os.environ.get('NIXTLA_API_KEY', ''))

import pandas as pd
df = pd.DataFrame({
    'timestamp': pd.date_range(start='2020-01-01', periods=10, freq='D'),
    'value': range(10)
})

forecast = client.forecast(df, h=3, time_col='timestamp', target_col='value')
print(forecast)