Skip to main content

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]"

Telemetry

The SDK exports anonymous OpenTelemetry metrics and traces by default. Configure the process-wide OTLP base endpoint before using a session, or disable export with an empty string:

from spatius import configure_telemetry, shutdown_telemetry

configure_telemetry("https://telemetry.example.com")
# configure_telemetry("")  # disable metrics and traces

# Useful for short-lived processes that exit immediately after a session.
shutdown_telemetry()

The first audio message for each request carries W3C trace context to the backend. Later chunks omit it. OTel resources include service.name=spatius-python, sdk.platform=python, app_id, and the resolved region. The server SDK exports metrics and traces only; it does not upload telemetry logs.

Warm-up

Session creation performs region scheduling (bootstrap API) and a session-token exchange (console API) before the ingress WebSocket connects. prewarm() moves that work ahead of dispatch — e.g. into a worker's process warm-up hook — so init() reuses the cached results:

from spatius import prewarm

# best-effort, never raises
await prewarm(app_id="your-app-id", api_key="your-api-key")

This resolves and caches the auto region (reused for 5 minutes) and opens throwaway TLS connections to the console and ingress hosts, priming DNS and the process-wide TLS session cache shared by HTTP and WebSocket connections. Pass prefetch_session_token=True to also cache a session token, letting the next init() with matching credentials skip the console API round trip entirely (assumes the backend allows a token to back more than one session).

Documentation

See the full Python SDK guide at docs.spatius.ai/sdk-reference/python-sdk/python-sdk.

License

MIT

Release files for spatius 1.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 spatius 1.1.0
File Size Uploaded
spatius-1.1.0.tar.gz 160.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spatius 1.1.0
File Interpreter ABI Platform
spatius-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 198.9 kB

Release files / spatius-1.1.0.tar.gz

Download URL spatius-1.1.0.tar.gz
Size 160.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5b2d6ce92ce58172dc2ed98f5184de0e961f781ed390f7466b471836c2d04658
BLAKE2b-256 checksum
How to use checksums
27e5bcc84a81d1aa7254d91869f2ebac0bfdf6e9d3c43510ee98abee6b478d04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 28, 2026.

Transparency log

Release files / spatius-1.1.0-py3-none-any.whl

Download URL spatius-1.1.0-py3-none-any.whl
Size 38.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
887ee65021a7dd52470a29bd341b40b4a2ee9c21e423e59d011097329a460b34
BLAKE2b-256 checksum
How to use checksums
2273b13dda4c6376aaeb4cd61eb0c0f340afa35582b81b9c97262f85f2d32064
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 28, 2026.

Transparency log
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