video

Simli video service for real-time avatar generation.

class pipecat.services.simli.video.SimliVideoSettings(model: str | None | NotGiven = <factory>, extra: dict[str, Any]=<factory>)[source]

Bases: ServiceSettings

Settings for the Simli video service.

class pipecat.services.simli.video.SimliCamera(*, pos_x_off: float | None = None, pos_y_off: float | None = None, pos_z_off: float | None = None, rot_x_off: float | None = None, rot_y_off: float | None = None, rot_z_off: float | None = None, zoom: float | None = None, orbit_x_off: float | None = None, orbit_y_off: float | None = None)[source]

Bases: BaseModel

The camera a Simli Trinity-2 session starts with.

Offsets on top of the avatar’s own framing. A field left unset stays neutral: 0, or 1 for zoom. Simli still applies a value outside its supported range. See https://docs.simli.com/api-reference/trinity-2/camera.

Parameters:
  • pos_x_off – Moves the avatar right, in half canvas widths. Supported range -10 to 10.

  • pos_y_off – Moves the avatar down, in half canvas heights. Supported range -10 to 10.

  • pos_z_off – Metres the camera backs away from the avatar (negative moves in). Supported range -5 to 5.

  • rot_x_off – Degrees the camera tilts up (pitch). Supported range -180 to 180.

  • rot_y_off – Degrees the camera pans right (yaw). Supported range -180 to 180.

  • rot_z_off – Degrees the camera rolls clockwise. Supported range -180 to 180.

  • zoom – Multiplies the avatar’s zoom; 1 is no change. Supported range above 0, up to 4.

  • orbit_x_off – Degrees the camera orbits up over the avatar’s head (elevation). Supported range -80 to 80.

  • orbit_y_off – Degrees the camera orbits round to its right (azimuth). Supported range -180 to 180.

class pipecat.services.simli.video.SimliFraming(*, streaming_width: Annotated[int | None, Ge(ge=512)] = None, streaming_height: Annotated[int | None, Ge(ge=512)] = None, avatar_position_x: Annotated[float | None, Ge(ge=0.0), Le(le=1.0)] = None, avatar_position_y: Annotated[float | None, Ge(ge=0.0), Le(le=1.0)] = None, camera: SimliCamera | None = None, background_id: str | None = None, foreground_id: str | None = None)[source]

Bases: BaseModel

How a Simli Trinity-2 session frames its video.

The video’s size, where the avatar sits in it, the camera, and an uploaded background or foreground. Simli applies them when the session starts. Only Trinity-2 faces use them; other faces keep their own frame size. A field left unset keeps Simli’s default. See https://docs.simli.com/api-reference/trinity-2#framing-the-video.

Set the output transport’s video_out_width and video_out_height to the same size as streaming_width and streaming_height.

Example:

# 16:9 video with the avatar a little left of center.
SimliVideoService.Framing(
    streaming_width=1366,
    streaming_height=768,
    avatar_position_x=0.4,
)
Parameters:
  • streaming_width – Width of the video in pixels, at least 512. With streaming_height it must make a 1:1, 16:9 or 9:16 frame, such as 1366x768; Simli rejects other shapes. Simli’s default is 768.

  • streaming_height – Height of the video in pixels, at least 512. See streaming_width. Simli’s default is 768.

  • avatar_position_x – Where the avatar sits across the video, from 0 (left) to 1 (right). Simli’s default is 0.5.

  • avatar_position_y – Where the avatar sits down the video, from 0 (top) to 1 (bottom). Simli’s default is 1.

  • camera – The camera the session starts with. Unset keeps the avatar’s own framing.

  • background_id – The id of a background uploaded to your Simli account (POST /assets/backgrounds) to show behind the avatar. Unset keeps the avatar’s own.

  • foreground_id – The id of a foreground uploaded to your Simli account (POST /assets/foregrounds) to lay over the avatar. Unset keeps the avatar’s own.

class pipecat.services.simli.video.SimliVideoService(*, api_key: str, face_id: str, simli_url: str = 'https://api.simli.ai', is_trinity_avatar: bool | None = None, params: InputParams | None = None, max_session_length: int | None = None, max_idle_time: int | None = None, enable_logging: bool | None = None, framing: SimliFraming | None = None, settings: SimliVideoSettings | None = None, **kwargs)[source]

Bases: AIService

Simli video service for real-time avatar generation.

Provides real-time avatar video generation by processing audio frames and producing synchronized video output using the Simli API. Handles audio resampling, video frame processing, and connection management.

The avatar speaks the bot’s voice: TTSAudioRawFrame from a TTS service, or SpeechOutputAudioRawFrame from a speech-to-speech service that streams its voice in real time, such as OpenAILiveLLMService. The service sends that audio to Simli and pushes the avatar’s video and its voice, in sync, in place of it.

Settings

alias of SimliVideoSettings

Framing

alias of SimliFraming

Camera

alias of SimliCamera

class InputParams(*, enable_logging: bool | None = None, max_session_length: int | None = None, max_idle_time: int | None = None)[source]

Bases: BaseModel

Input parameters for Simli video configuration.

Deprecated since version 0.0.106: Use SimliVideoService.Settings(...) instead. Will be removed in 2.0.0.

Parameters:
  • enable_logging – Whether to enable Simli logging.

  • max_session_length – Absolute maximum session duration in seconds. Avatar will disconnect after this time even if it’s speaking.

  • max_idle_time – Maximum duration in seconds the avatar is not speaking before the avatar disconnects.

enable_logging: bool | None
max_session_length: int | None
max_idle_time: int | None
__init__(*, api_key: str, face_id: str, simli_url: str = 'https://api.simli.ai', is_trinity_avatar: bool | None = None, params: InputParams | None = None, max_session_length: int | None = None, max_idle_time: int | None = None, enable_logging: bool | None = None, framing: SimliFraming | None = None, settings: SimliVideoSettings | None = None, **kwargs)[source]

Initialize the Simli video service.

Parameters:
  • api_key – Simli API key for authentication.

  • face_id – Simli Face ID. For Trinity avatars, specify “faceId/emotionId” to use a different emotion than the default.

  • simli_url – URL of the simli servers. Can be changed for custom deployments of enterprise users.

  • is_trinity_avatar –

    Has no effect: the bot’s audio goes to Simli as it arrives, whatever the face.

    Deprecated since version 1.16.0: No replacement. Will be removed in 2.0.0.

  • params –

    Additional input parameters for session configuration.

    Deprecated since version 0.0.106: Use settings=SimliVideoService.Settings(...) instead. Will be removed in 2.0.0.

  • max_session_length – Absolute maximum session duration in seconds. Avatar will disconnect after this time even if it’s speaking.

  • max_idle_time – Maximum duration in seconds the avatar is not speaking before the avatar disconnects.

  • enable_logging – Whether to enable Simli logging.

  • framing – Trinity-2 framing for the session: the video’s size, where the avatar sits in it, the camera, and an uploaded background or foreground. Unset keeps Simli’s defaults (768x768, avatar at the bottom center).

  • settings – Service settings.

  • **kwargs – Additional arguments passed to the parent AIService.

async setup(setup: FrameProcessorSetup)[source]

Set up the service.

Parameters:

setup – Configuration object containing setup parameters.

async stop(frame: EndFrame)[source]

Stop the Simli video service.

Parameters:

frame – The end frame.

async cancel(frame: CancelFrame)[source]

Cancel the Simli video service.

Parameters:

frame – The cancel frame.

async cleanup()[source]

Clean up the Simli video service.

async process_frame(frame: Frame, direction: FrameDirection)[source]

Process incoming frames and handle Simli video generation.

Parameters:
  • frame – The frame to process.

  • direction – The direction of frame processing.