The official Python client for the InertialAI API — generate multi-modal embeddings from time-series and text.
Project description
inertialai-python
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.
Links
- Website: https://www.inertialai.com
- Documentation: https://docs.inertialai.com
- Embeddings guide: https://docs.inertialai.com/docs/using-the-embeddings-endpoint
- Dashboard / API keys: https://app.inertialai.com
- Issues: https://github.com/InertialAI/inertialai-python/issues
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
License
Apache 2.0 — see LICENSE.
Project details
Release history Release notifications | RSS feed
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 inertialai_python-0.1.0.tar.gz.
File metadata
- Download URL: inertialai_python-0.1.0.tar.gz
- Upload date:
- Size: 76.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0177ee655c39421a4a38728d741d1739bc8801c37d59dfcadb817410d6ab400c
|
|
| MD5 |
37a8684bcda2ab848f070e79436980d3
|
|
| BLAKE2b-256 |
2f56959a1249b7f782ebce5dd0a8698026d752a4ec33cb3e447079d18863e11a
|
Provenance
The following attestation bundles were made for inertialai_python-0.1.0.tar.gz:
Publisher:
publish-inertialai-python.yml on InertialAI/inertialai-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
inertialai_python-0.1.0.tar.gz -
Subject digest:
0177ee655c39421a4a38728d741d1739bc8801c37d59dfcadb817410d6ab400c - Sigstore transparency entry: 1298277797
- Sigstore integration time:
-
Permalink:
InertialAI/inertialai-python@9b962d5133d429bf3df2ea3ec5d7ac14e9c63bff -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/InertialAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-inertialai-python.yml@9b962d5133d429bf3df2ea3ec5d7ac14e9c63bff -
Trigger Event:
push
-
Statement type:
File details
Details for the file inertialai_python-0.1.0-py3-none-any.whl.
File metadata
- Download URL: inertialai_python-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d4c57fc4b02d17d63e5912029371aae3abb7993e9a8b63862b5abed2094b272
|
|
| MD5 |
df3b03db5f14bada11c8985b6b139acf
|
|
| BLAKE2b-256 |
783490b1fed7248be757bb41706961078f2d80cc16e481402534f8f56eb8684a
|
Provenance
The following attestation bundles were made for inertialai_python-0.1.0-py3-none-any.whl:
Publisher:
publish-inertialai-python.yml on InertialAI/inertialai-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
inertialai_python-0.1.0-py3-none-any.whl -
Subject digest:
1d4c57fc4b02d17d63e5912029371aae3abb7993e9a8b63862b5abed2094b272 - Sigstore transparency entry: 1298277901
- Sigstore integration time:
-
Permalink:
InertialAI/inertialai-python@9b962d5133d429bf3df2ea3ec5d7ac14e9c63bff -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/InertialAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-inertialai-python.yml@9b962d5133d429bf3df2ea3ec5d7ac14e9c63bff -
Trigger Event:
push
-
Statement type: