Python client for the SequenxAI time-series platform API
pip install sequenx-ai==0.1.3 Copy PIP instructions
Python client for the SequenxAI platform API (packages/contracts/openapi.yaml is the single source of truth for the wire format). Published on PyPI as sequenx-ai:
pip install sequenx-ai To work on the client itself, install it from this repository in editable mode (pip install -e packages/sequenx-py).
from sequenx import SequenxClient client = SequenxClient("sqx_live_...") result = client.forecast(series, h=96) # series: list[dict] with unique_id/ds/y print(result["model_used"], result["usage"]["billable_points"]) client.close() Covered endpoints (v1): POST /forecast, POST /forecast/rolling, POST /forecast/batch (+ get / cancel / delete job), POST /clean (dry-run), GET /models. POST /anomaly-detection is intentionally not covered (endpoint not open).
The control plane claims an Idempotency-Key on POST /forecast, POST /forecast/rolling and POST /forecast/batch only: a repeated identical request replays the stored response instead of charging again. The SDK sends the key on exactly those three routes and reuses it across retries, so a transport error or a 5xx is retried safely (max_retries=0 disables retries). A 429 on the requests-per-minute bucket (rate-limit type rpm) is retried the same way; a 429 on the daily points bucket (daily) is not — the SDK raises RateLimitedError immediately (carrying retry_after and limit_type), and you decide when to retry. If the bucket is not identifiable, the SDK also raises immediately rather than waiting on your behalf.
A retry that races the original request can answer 409 (IDEMPOTENCY_IN_PROGRESS): the request that claimed the key is still running. The SDK retries it with the same key (the control plane replays the stored response once it settles). If it still cannot finish, the raised ConflictError carries the idempotency_key it used, so the call can be replayed safely:
from sequenx import ConflictError try: out = client.forecast(series, h=96) except ConflictError as exc: out = client.forecast(series, h=96, idempotency_key=exc.idempotency_key) The SDK generates one key per call; pass your own idempotency_key= to forecast, forecast_rolling or forecast_batch when you want to hold on to it yourself.
Every other route is re-run by the control plane, so the SDK neither sends a key nor retries it automatically: POST /clean (a free dry-run), POST /forecast/batch/{job_id}/cancel and DELETE /forecast/batch/{job_id} (a repeated delete would answer 404 although the first delete succeeded — read the job with batch_job() when the outcome matters). GET requests are retried.
forecast_batch() submits a job; batch_job() polls it, cancel_batch_job() cancels it and delete_batch_job() removes a finished job and its result file. Polling is the caller's loop.
Errors are typed (AuthenticationError, ValidationError, RateLimitedError, ServerError, TransportError, ...) and carry the contract's code / request_id / status.
Responses are typed too (ForecastResponse, RollingForecastResponse, ModelList, BatchJobSummary, BatchJobDetail, CleanResponse, ...); the shapes mirror the contract schemas and the package ships py.typed. Nested objects the SDK does not model (intervals, cleaning report, effective policy) stay plain dictionaries.
pandas and polars frames are accepted as input (pip install -e "packages/sequenx-py[pandas]" or [polars]); neither is required.
pip install -e packages/sequenx-py -r packages/sequenx-py/requirements-dev.txt python -m pytest -q # unit + contract drift tests python -m ruff check src tests SEQUENX_SDK_LIVE_SMOKE=1 SEQUENX_API_KEY=sqx_live_... python scripts/live_smoke.py The live smoke is opt-in and never passes silently: without the flag and key it exits 2 with instructions. The contract drift test reads packages/contracts/openapi.yaml and fails when the SDK and the contract disagree; Gitee Go runs it via scripts/ci/gitee-verify.sh sdk.
LicenseRef-Proprietary View SPDX License List
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




