Skip to main content

SonexLabs plugin for LiveKit Agents

PyPI Python License: Apache-2.0

Support for real-time voice synthesis with SonexLabs' Panini TTS engine in LiveKit Agents.

See docs.sonexlabs.com for full API reference.

Installation

pip install livekit-plugins-sonex

Pre-requisites

You'll need an API key from SonexLabs. It can be set as an environment variable:

export SONEX_API_KEY=vsk_xxxxxxxxx

Usage

from livekit.agents import AgentSession
from livekit.plugins import sonex

session = AgentSession(
    tts=sonex.TTS(
        voice_id="YOUR_VOICE_ID",
    ),
    # ... llm, stt, vad, turn_handling, etc.
)

Or pass the API key directly instead of using the environment variable:

tts = sonex.TTS(
    api_key="vsk_xxxxxxxxx",
    voice_id="YOUR_VOICE_ID",
)

Streaming and connection reuse

Synthesis requests are sent to SonexLabs' /v1/speech/stream endpoint, so audio is delivered as chunked HTTP as soon as it's generated rather than after the full utterance completes, reducing time-to-first-audio. When no explicit http_session is supplied, the plugin uses LiveKit Agents' shared, process-wide aiohttp.ClientSession, so connections are pooled and reused across requests instead of being re-established on every call.

Parameters

Parameter Type Default Description
api_key str — SonexLabs API key. Falls back to SONEX_API_KEY if not set.
voice_id str — Required. Voice ID from GET /v1/voices.
language str auto-detect Language code (e.g. en, hi). Leave unset to auto-detect.
speed float 1.0 Speech rate multiplier.
sample_rate int 24000 Output sample rate in Hz. Not sent to the API — Panini always returns audio at its native rate; this value is used for LiveKit-side reporting only.
base_url str https://api.sonexlabs.com SonexLabs API base URL.
http_session aiohttp.ClientSession shared session Optional existing session to reuse.

Requirements

  • Python >= 3.10
  • livekit-agents >= 1.6.7

Local development

git clone https://github.com/sonexlabs/livekit-plugins-sonex.git
cd livekit-plugins-sonex
pip install -e .

License

Apache-2.0 — see LICENSE.

Metadata

Release files for livekit-plugins-sonex 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for livekit-plugins-sonex 0.2.1
File Size Uploaded Provenance
livekit_plugins_sonex-0.2.1.tar.gz 10.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for livekit-plugins-sonex 0.2.1
File Interpreter ABI Platform
livekit_plugins_sonex-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 21.7 kB

Release files / livekit_plugins_sonex-0.2.1.tar.gz

Download URL livekit_plugins_sonex-0.2.1.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5876d20c63f1ae4f7b9c843c3e38133b078e48b781fc5a48093e35154974d867
BLAKE2b-256 checksum
How to use checksums
4cea0d11a598d54df3b150a3349db17ccf87bdc8455e9d1d54e08785f42ae33d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.18

Release files / livekit_plugins_sonex-0.2.1-py3-none-any.whl

Download URL livekit_plugins_sonex-0.2.1-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f96be68fd2ed442febe9cc5d6f5562dccf3dad6c0050d3df9664b3df48030379
BLAKE2b-256 checksum
How to use checksums
97f9d707640f7c4c509f5355f92cafd7d9e750778c8eecbc0d5361a2738bcbf7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.18

Security for livekit-plugins-sonex 0.2.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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