Setup

Get an API key and try TimechoAI’s time-series forecasting in minutes.

Step 1: REST

Run the following command and replace API-Key with your API key:

curl -s -X POST https://ai.timecho.com/ai/api/v1/forecast \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <API-Key>" \
  -d '{
    "targets": [{
      "columns": ["value"],
      "data": [[120],[135],[142],[168],[195],[220],[285],[310],[345],[380],[420],[468],[125],[140],[155],[180],[210],[245],[295],[325],[360],[395],[440],[485]]
    }],
    "output_length": [5]
  }'

Step 2: Python

Use the Python SDK for a cleaner integration. Install the SDK first:

pip install timecho-ai

Sample CSV: sample.csv, then run the code below:

import pandas as pd
from timecho_ai import TimechoAIClient

# Load sample data
raw_df = pd.read_csv("https://ai.timecho.com/data/sample.csv")
print(raw_df.head())

# Task: use 16 points to forecast the next 8 points
INPUT_LENGTH = 16
OUTPUT_LENGTH = 8

# Create a sync client (replace with your API key)
client = TimechoAIClient(api_key="your_timecho-ai_api_key")

# Build target DataFrame
target_df = raw_df[["time", "target"]][:INPUT_LENGTH]

# Forecast the next 8 points for "target"
forecast_dfs = client.forecast(
    targets=target_df,
    output_length=OUTPUT_LENGTH
)

print(forecast_dfs[0])

Step 3: View the result

After a successful call, you will see output like below (forecasting 8 future points for “target”):

{
  "code": 200,
  "message": "Forecast tasks completed successfully",
  "data": {
    "results": [
      {
        "data": [
          [450.21026611328125],
          [383.2858581542969],
          [309.28387451171875],
          [298.32379150390625],
          [264.8620910644531],
          [256.2868347167969],
          [257.38861083984375],
          [266.3112487792969]
        ],
        "columns": ["value"]
      }
    ]
  }
}

Next steps