Python CLI SDK for Timecho AI API
Project description
Timecho AI
Python SDK for Timecho AI time series forecasting API. Provides both synchronous and asynchronous clients.
Installation
pip install timecho_ai
Quick Start
Synchronous Client
import pandas as pd
from timecho_ai import TimechoAIClient
# Load your time series data
df = pd.read_csv("your_data.csv")
# Create a client
client = TimechoAIClient(api_key="your-api-key")
# Test connectivity
print(client.hello_timer(name="World"))
# Univariate forecast
results = client.forecast(
targets=df[["time", "OT"]][:2880],
output_length=720,
)
print(results[0].head())
# Forecast with covariates
results = client.forecast(
targets=df[["time", "OT"]][:2880],
history_covs=df[["time", "hufl", "hull", "mufl", "mull", "lufl", "lull"]][:2880],
future_covs=df[["time", "hufl", "hull", "mufl", "mull", "lufl", "lull"]][2880:3600],
output_length=720,
)
print(results[0].head())
Asynchronous Client
import asyncio
import pandas as pd
from timecho_ai import TimechoAIAsyncClient
async def main():
df = pd.read_csv("your_data.csv")
async with TimechoAIAsyncClient(api_key="your-api-key") as client:
print(await client.hello_timer(name="World"))
results = await client.forecast(
targets=df[["time", "OT"]][:2880],
output_length=720,
)
print(results[0].head())
asyncio.run(main())
Configuration
The client can be configured via constructor parameters or environment variables:
| Parameter | Environment Variable | Default | Description |
|---|---|---|---|
api_key |
TIMER_CLIENT_API_KEY |
- | API key for authentication (required) |
base_url |
TIMER_CLIENT_BASE_URL |
https://cloud.timecho.com |
API base URL |
timeout |
TIMER_CLIENT_TIMEOUT |
30.0 |
Request timeout in seconds |
export TIMER_CLIENT_API_KEY="your-api-key"
from timecho_ai import TimechoAIClient
# API key is read from environment variable automatically
client = TimechoAIClient()
Forecast API
The forecast method accepts the following parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
targets |
DataFrame |
Yes | Target time series with a time column and one or more value columns |
history_covs |
DataFrame |
No | Historical covariates (same length as targets) |
future_covs |
DataFrame |
No | Future covariates (same length as output_length) |
model_id |
str |
No | Model identifier |
output_length |
int |
No | Forecast horizon (default: 96) |
output_start_time |
Timestamp |
No | Start time of the forecast output |
output_interval |
str |
No | Time interval of the forecast output |
time_col |
str |
No | Name of the time column (auto-detected if not specified) |
auto_adapt |
bool |
No | Auto-adapt covariate lengths (default: True) |
Returns a list of DataFrame, one per forecast task.
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file timecho_ai-0.1.0.tar.gz.
File metadata
- Download URL: timecho_ai-0.1.0.tar.gz
- Upload date:
- Size: 19.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/8.7.1 pkginfo/1.12.1.2 requests/2.32.5 requests-toolbelt/1.0.0 tqdm/4.67.1 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21e258819266478bae8635b7ea5ebe493c78575e96a33a8db4584b33fe369af5
|
|
| MD5 |
da54e200fe01c869bb1b6963221c8b30
|
|
| BLAKE2b-256 |
a6a33ba5262686e7a4478dfae3560a6fca2f18fcd51cbc54b9f0b465c284de0f
|
File details
Details for the file timecho_ai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: timecho_ai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/8.7.1 pkginfo/1.12.1.2 requests/2.32.5 requests-toolbelt/1.0.0 tqdm/4.67.1 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28a6544209f438226f09aa9554cf9330dee706fd6dbde60c40618982cf5eb00d
|
|
| MD5 |
86fe80063092aac7d2d046ec9dd40583
|
|
| BLAKE2b-256 |
0bb0bc6ac9c71999520d9ddb00b07db9268045185401d210ecfe836ded916418
|