Tier 1 · documented evidence

Build a Spatius Backend Mode Server with FastAPI

Use the Python Server SDK behind FastAPI when your backend must own session creation, synthesized-audio ingestion, motion generation, and downstream transport. FastAPI is the HTTP/WebSocket shell; Spatius remains the avatar motion service.

Verified 2026-08-10Editorial status: publishedRobots: index, follow

Integration boundary

What connects to what

The public Backend Mode server uses FastAPI WebSockets around an application-owned ASR, LLM, TTS stack and the Python Spatius Server SDK.

FastAPIaudio / session boundarySpatius Motion Servermotion + synchronized audioAvatarKit client rendering

Prerequisites

  • Python 3.10+
  • Spatius Python Server SDK credentials
  • A defined downstream transport such as LiveKit or an owned WebSocket
  • A production secret manager and session authorization model

Implementation path

Build a testable baseline

  1. 1

    Start from the official Backend Mode Python server reference.

  2. 2

    Create a FastAPI lifespan that initializes shared SDK resources once per process.

  3. 3

    Expose an authenticated session endpoint and keep provider secrets server-side.

  4. 4

    Stream assistant TTS audio into the Spatius session and forward synchronized audio and motion through the chosen transport.

  5. 5

    Handle disconnect, cancellation, backpressure, and session cleanup before load testing.

Decision guidance

Best for and not best for

Best for

  • Python voice-agent backends
  • Enterprise teams that require server-side policy and audit controls

Not best for

  • Frontend-only prototypes
  • Teams that do not want to operate session infrastructure

Evidence-aware assessment

Advantages and limitations

Advantages

  • Fits existing Python AI orchestration
  • Keeps secrets and policy enforcement on the server
  • Allows explicit transport and observability choices

Limitations

  • You own scaling, reconnect behavior, and downstream transport
  • A web framework does not solve audio pacing or motion synchronization by itself
  • No first-party FastAPI concurrency benchmark is present in the supplied product pack
Validation disclosure

Do not confuse this runtime with a small Direct Mode token endpoint. You own per-session backpressure, provider secrets, concurrent disconnects, and cleanup. Indexing this guide does not convert an architecture blueprint into a claimed native connector; run and document the validation checklist before production use.

Page-specific FAQ

Implementation questions

Is FastAPI required by Spatius?

No. FastAPI is one application-server option around the Python Server SDK.

Can the API return finished avatar video?

The documented Spatius architecture produces synchronized audio and motion for client-side rendering; it is not described as a finished-video streaming endpoint.

What must be load tested?

At minimum: concurrent sessions, audio backpressure, disconnect cleanup, transport reconnects, memory, and end-to-end failure recovery.

Primary evidence

Sources and verification

Reviewed 2026-08-10. Recheck versions and implementation details before publication.

Continue exploring

Related integration decisions