The vital PyPI package (Vital API Python SDK) provides typed bindings of the Vital API in Python that tracks our OpenAPI Schema.

Horizon AI Python SDK is a standalone product offering, separately from the vital PyPI package.

Horizon AI Python SDK bridges Vital’s data aggregation and intelligence capabilities with the rich Python ecosystem for scientific computing and data analysis.

Authentication

Use the same Vital API Keys your system used to interact with Vital API.

To set the Vital API Key for the Horizon AI Python SDK, you can:

  • Pass the Vital API Key explicitly to the Horizon AI SDK entity’s constructor (e.g., the Query Executor); or
  • Set the Vital API Key as the VITAL_API_KEY environment variable.

Sign-in locally on your machine with your Vital Dashboard account. You can do so through the Horizon AI SDK Command Line Tool as detailed below.

Installation

Aggregation API

1

Add a dependency

Add the vitalx-aggregation package to your project.

poetry add vitalx-aggregation

SDK Command Line Tool

1

Add a dependency

Add the vitalx-cli package as a dev dependency to your project.

poetry add -G dev vitalx-cli
2

Start the device authentication process

Create the ~/.vitalx directory, and grant it execute permission. The SDK requires execute permission to maintain a file lock.

mkdir -p ~/.vitalx && chmod +x ~/.vitalx

Call the auth login CLI subcommand on the vitalx-cli package to start the authentication process.

poetry run vitalx-cli auth login
3

Sign in with your Vital Dashboard account

You would be prompted in your default web browser to sign-in to the Vital Dashboard. You will then be asked to confirm the device authorization.

4

Voila!

You have now signed-in. You can now use any Horizon AI SDK entity without a Vital API Key.

Your permanent session is stored at ~/.vitalx/.

Example

tryvital/vitalx-notebook is a pre-configured Jupyter Notebook project with dependencies on Aggregation API and SDK Command Line Tool pre-configured.

The notebook also includes an example to compute Chronotypes using the Aggregation API.