Skip to main content

inertialai-python

PyPI Python License

The official Python client for the InertialAI API.

InertialAI builds foundation models for time-series and real-world sensor data. This library wraps the InertialAI REST API and gives Python developers a typed, ergonomic way to generate multi-modal embeddings from time-series signals, text, or both.

Beta. The API surface is stable enough for real use but may change before 1.0. Pin to a specific version in production.

Installation

pip install inertialai-python

Requires Python 3.11 or newer.

Authentication

Create an API key in the InertialAI app and expose it as an environment variable:

export INERTIALAI_API_KEY="iai_..."

The client reads INERTIALAI_API_KEY automatically. You can also pass it explicitly via the api_key constructor argument.

Quickstart

Synchronous

from inertialai_python import EmbeddingModel, InertialAI
from inertialai_python.types import EmbeddingMultiModalInput

client = InertialAI()

response = client.embeddings.create(
    model=EmbeddingModel.INERTIAL_EMBED_ALPHA,
    input=[
        EmbeddingMultiModalInput(
            time_series=[
                [0.01, 0.02, 0.04, 0.03, 0.02],  # channel 1 (e.g. accel x)
                [0.00, 0.01, 0.01, 0.02, 0.01],  # channel 2 (e.g. accel y)
            ],
            text="walking, 50 Hz accelerometer",
        ),
    ],
)

vector = response.data[0].embedding
print(f"Got a {len(vector)}-dim embedding using {response.model}")

Asynchronous

import asyncio

from inertialai_python import AsyncInertialAI, EmbeddingModel
from inertialai_python.types import EmbeddingMultiModalInput

async def main() -> None:
    async with AsyncInertialAI() as client:
        response = await client.embeddings.create(
            model=EmbeddingModel.INERTIAL_EMBED_ALPHA,
            input=[EmbeddingMultiModalInput(text="sensor reading from accelerometer")],
        )
        print(response.data[0].embedding[:8])

asyncio.run(main())

Multi-modal input

Each EmbeddingMultiModalInput must contain at least one of:

Field Type Description
time_series list[list[float]] Multi-channel signal. Outer list = channels, inner list = samples per channel.
text str Natural-language description to embed alongside (or instead of) the signal.

You can batch many inputs in a single request by passing a list. Each returned EmbeddingData carries the index of its corresponding input.

Configuring the client

from inertialai_python import InertialAI

client = InertialAI(
    api_key="iai_...",           # overrides INERTIALAI_API_KEY
    base_url="https://inertialai.com",
    timeout=30.0,               # seconds, or an httpx.Timeout instance
    max_retries=2,              # retries for transient errors (429, 5xx, network)
)

Both InertialAI and AsyncInertialAI support context-manager usage to ensure the underlying HTTP connection is closed:

with InertialAI() as client:
    ...

async with AsyncInertialAI() as client:
    ...

Error handling

All API errors derive from InertialAIError:

InertialAIError
├── APIError
│   └── APIStatusError
│       ├── AuthenticationError   (401)
│       ├── ValidationError       (422)
│       ├── RateLimitError        (429)
│       └── InternalServerError   (5xx)
└── APIConnectionError
    └── APITimeoutError
from inertialai_python import (
    AuthenticationError,
    InertialAI,
    RateLimitError,
    ValidationError,
)

client = InertialAI()

try:
    client.embeddings.create(model="inertial-embed-alpha", input=[...])
except AuthenticationError:
    print("Check your INERTIALAI_API_KEY")
except RateLimitError:
    print("Slow down — you've been rate limited")
except ValidationError as e:
    print(f"Invalid request: {e}")

The client automatically retries transient failures (429, 500, 502, 503, 504, network errors, timeouts) with exponential backoff and jitter, honoring the Retry-After header when present.

OpenAI SDK compatibility

The InertialAI embeddings endpoint is interface-compatible with OpenAI's /v1/embeddings API, so the openai Python client will work against it if you json.dumps multi-modal inputs by hand. This library exists to give you a first-class, typed experience — no manual serialization, native EmbeddingMultiModalInput models, and typed error hierarchy.

License

Apache 2.0 — see LICENSE.

Metadata

Release files for inertialai-python 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inertialai-python 0.1.0
File Size Uploaded Provenance Actions
inertialai_python-0.1.0.tar.gz 76.1 kB With provenance Details for inertialai_python-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for inertialai-python 0.1.0
File Interpreter ABI Platform Actions
inertialai_python-0.1.0-py3-none-any.whl Python 3 none any Details for inertialai_python-0.1.0-py3-none-any.whl

Total release size: 91.0 kB

Release files / inertialai_python-0.1.0.tar.gz

Download URL inertialai_python-0.1.0.tar.gz
Size 76.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0177ee655c39421a4a38728d741d1739bc8801c37d59dfcadb817410d6ab400c
BLAKE2b-256 checksum
How to use checksums
2f56959a1249b7f782ebce5dd0a8698026d752a4ec33cb3e447079d18863e11a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 14, 2026.

Transparency log

Release files / inertialai_python-0.1.0-py3-none-any.whl

Download URL inertialai_python-0.1.0-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d4c57fc4b02d17d63e5912029371aae3abb7993e9a8b63862b5abed2094b272
BLAKE2b-256 checksum
How to use checksums
783490b1fed7248be757bb41706961078f2d80cc16e481402534f8f56eb8684a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 14, 2026.

Transparency log

Security for inertialai-python 0.1.0

Provenance

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for inertialai_python-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 14, 2026.

Transparency log

A note on package security

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page