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.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 livekit-plugins-sonex 0.2.0
File Size Uploaded Provenance
livekit_plugins_sonex-0.2.0.tar.gz 10.4 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 21.6 kB

Release files / livekit_plugins_sonex-0.2.0.tar.gz

Download URL livekit_plugins_sonex-0.2.0.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6cbf046e4ee2d10c7d0aa11e6512d4fdcee1d6ff11b1d36ea41c7559e5501301
BLAKE2b-256 checksum
How to use checksums
2a1339d920357ac23d47fb499204e5cbc69abe90db8314cfcbef5f752d9f4f82
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.0-py3-none-any.whl

Download URL livekit_plugins_sonex-0.2.0-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
205808d7fd33735e28ffbb1ca4e6c608323d4c9d8c1a63a36622c2bfed33b009
BLAKE2b-256 checksum
How to use checksums
af85b807591fc2cc77892a23477fc7f0d8ddecd42bfc6d287c9ed1f1d2638f31
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.0

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