Skip to main content
The Anam Python SDK provides real-time AI avatar streaming for Python applications. Receive synchronized audio and video frames, send text or audio input, and build custom integrations using async iterators or event-driven patterns.

Installation

pip install anam
Or with uv:
uv add anam
To include optional display utilities (OpenCV video display, sounddevice audio playback) for local testing:
pip install anam[display]
Requires Python 3.10 or higher.

Quick Start

import asyncio
from anam import AnamClient

async def main():
    client = AnamClient(
        api_key="your-api-key",
        persona_id="your-persona-id",
    )

    async with client.connect() as session:
        async def consume_video():
            async for frame in session.video_frames():
                img = frame.to_ndarray(format="rgb24")
                print(f"Video: {frame.width}x{frame.height}")

        async def consume_audio():
            async for frame in session.audio_frames():
                samples = frame.to_ndarray()
                print(f"Audio: {samples.size} samples")

        await asyncio.gather(consume_video(), consume_audio())

asyncio.run(main())
Never expose your API key in client-side code. The Python SDK is designed for server-side use. See Usage in Production for session token patterns.

Features

  • Real-time audio/video streaming — receive synchronized audio (PCM) and video (RGB) frames as PyAV objects via WebRTC
  • Two-way communication — send text messages as the user and receive generated responses
  • Real-time transcriptions — receive incremental message stream events for user and persona text as it generates
  • Message history — automatic conversation history with incremental updates
  • Audio passthrough — send TTS-generated audio directly for face rendering (BYO TTS)
  • Direct text-to-speech — send text straight to TTS via session.talk(), bypassing the LLM
  • User audio input — send raw microphone audio to Anam for processing (STT, LLM, TTS, avatar)
  • Async iterator APIasync for frame in session.video_frames()
  • Event-driven API — decorator-based handlers via @client.on(AnamEvent.CONNECTION_ESTABLISHED)
  • Fully typed — complete type hints for IDE support
  • Server-side ready — designed for server-side Python applications and backend pipelines

Resources