Python SDK for avatar WebSocket services with audio streaming and animation frame reception
Project description
Spatius Python SDK
Python server SDK for creating Spatius avatar sessions.
Installation
pip install spatius
Install the optional Ogg Opus encoder support when you want the SDK to encode raw PCM before sending:
pip install "spatius[opus]"
Quick Start
import asyncio
from datetime import datetime, timedelta, timezone
from spatius import new_avatar_session
async def main():
session = new_avatar_session(
api_key="your-api-key",
app_id="your-app-id",
avatar_id="your-avatar-id",
expire_at=datetime.now(timezone.utc) + timedelta(minutes=5),
transport_frames=lambda frame, last: print(
f"Received frame: {len(frame)} bytes, last={last}"
),
on_error=lambda err: print(f"Session error: {err}"),
on_close=lambda: print("Session closed"),
)
await session.init()
connection_id = await session.start()
print(f"Connected: {connection_id}")
audio_data = b"..." # mono PCM s16le audio bytes
request_id = await session.send_audio(audio_data, end=True)
print(f"Sent audio request: {request_id}")
await asyncio.sleep(10)
await session.close()
if __name__ == "__main__":
asyncio.run(main())
Documentation
See the full Python SDK guide at docs.spatius.ai/sdk-reference/python-sdk/python-sdk.
License
MIT
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 spatius-1.0.0.tar.gz.
File metadata
- Download URL: spatius-1.0.0.tar.gz
- Upload date:
- Size: 136.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83204bd2620b52a85c36daf2d0ab35159e5cd6115039557af0925a1db0781636
|
|
| MD5 |
d7460c46f4c79d441cd08d20e4cf4cf7
|
|
| BLAKE2b-256 |
d80dc68653de32edb2700bf5060b684fcbc286c7e7b25a09f1680bb4a3049ebe
|
Provenance
The following attestation bundles were made for spatius-1.0.0.tar.gz:
Publisher:
publish.yml on spatius-ai/spatius-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spatius-1.0.0.tar.gz -
Subject digest:
83204bd2620b52a85c36daf2d0ab35159e5cd6115039557af0925a1db0781636 - Sigstore transparency entry: 1520138209
- Sigstore integration time:
-
Permalink:
spatius-ai/spatius-sdk-python@568cc8a67fde39c35d183e99606fd3b25649334b -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/spatius-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@568cc8a67fde39c35d183e99606fd3b25649334b -
Trigger Event:
release
-
Statement type:
File details
Details for the file spatius-1.0.0-py3-none-any.whl.
File metadata
- Download URL: spatius-1.0.0-py3-none-any.whl
- Upload date:
- Size: 22.1 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 |
ea4a426b10fbaa050117b268295e7396290a3ad76e19b2d058e9cc406fc99e9c
|
|
| MD5 |
e987225bb24fbda4b983301c9b32b50b
|
|
| BLAKE2b-256 |
91e75fd5e0bd2a9cb7e3d77322396eeba38b42a3c1d91ed857c7d231636987d8
|
Provenance
The following attestation bundles were made for spatius-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on spatius-ai/spatius-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spatius-1.0.0-py3-none-any.whl -
Subject digest:
ea4a426b10fbaa050117b268295e7396290a3ad76e19b2d058e9cc406fc99e9c - Sigstore transparency entry: 1520138275
- Sigstore integration time:
-
Permalink:
spatius-ai/spatius-sdk-python@568cc8a67fde39c35d183e99606fd3b25649334b -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/spatius-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@568cc8a67fde39c35d183e99606fd3b25649334b -
Trigger Event:
release
-
Statement type: