Skip to main content

VoiceAI SDK for Python

The official Python SDK for SLNG Voice AI. Use one client for text-to-speech, speech-to-text, and model discovery across SLNG-hosted and provider-backed speech models.

The package supports Python 3.9 and newer, with sync and async clients powered by httpx.

Install

Until the Python package is published to PyPI, install it from GitHub:

pip install git+https://github.com/slng-ai/voiceai-sdk-python.git

For local development in this repository:

cd sdks/slng-python
uv sync --all-extras

API Key

Create an API key in the SLNG dashboard, then set it in your environment:

export SLNG_API_KEY="zpka_..."
from voiceai_sdk import Slng

client = Slng()

You can also pass api_key directly:

client = Slng(api_key="zpka_...")

Text To Speech

Generate audio from text and save it locally:

from voiceai_sdk import Slng

client = Slng()

audio = client.text_to_speech.create(
    model_variant="slng/deepgram/aura:2-en",
    text="Hello from SLNG.",
    voice="aura-2-thalia-en",
)

audio.write_to_file("hello.wav")

Use region or world_part when you need explicit routing:

client.text_to_speech.create(
    model_variant="slng/deepgram/aura:2-en",
    text="Hello from Europe.",
    voice="aura-2-thalia-en",
    region="eu-north-1",
)

Speech To Text

Transcribe a local audio file:

from pathlib import Path
from voiceai_sdk import Slng

client = Slng()

transcript = client.speech_to_text.create(
    model_variant="slng/deepgram/nova:3-en",
    audio=Path("meeting.wav"),
)

print(transcript.text)

File uploads accept bytes, path-like objects, or (filename, contents, media_type) tuples.

Discover Models

The SDK ships with a static catalog snapshot, so agents and scripts can choose valid models without credentials or network calls.

from voiceai_sdk import get_model, list_models

tts_models = list_models(service="tts", language="en")
stt_models = list_models(service="stt")
aura = get_model("slng/deepgram/aura:2-en")

print([model["id"] for model in tts_models])
print(aura["deployments"] if aura else None)

Model IDs from the catalog can be passed directly to client.text_to_speech.create() or client.speech_to_text.create().

Discover Voices

Use list_voices() to find voice IDs for a TTS model:

from voiceai_sdk import list_voices

voices = list_voices("slng/deepgram/aura:2-en", language="en")

print([f"{voice['name']}: {voice['voiceId']}" for voice in voices])

list_voices() returns an empty list when a model does not have a cataloged voice list.

Useful voice references:

Async Usage

Use AsyncSlng for async applications:

import asyncio
from voiceai_sdk import AsyncSlng


async def main() -> None:
    client = AsyncSlng()
    audio = await client.text_to_speech.create(
        model_variant="slng/deepgram/aura:2-en",
        text="Hello from async SLNG.",
        voice="aura-2-thalia-en",
    )
    await audio.write_to_file("hello.wav")


asyncio.run(main())

For lower-level response streaming, use .with_streaming_response on SDK resources.

Reference

Metadata

Release files for voiceai-sdk 0.1.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 voiceai-sdk 0.1.0
File Size Uploaded
voiceai_sdk-0.1.0.tar.gz 291.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for voiceai-sdk 0.1.0
File Interpreter ABI Platform
voiceai_sdk-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 441.1 kB

Release files / voiceai_sdk-0.1.0.tar.gz

Download URL voiceai_sdk-0.1.0.tar.gz
Size 291.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ad7e51a1bcb128c4491cf2daca963a0940f978bc73c08d7f3082f469968f1ef3
BLAKE2b-256 checksum
How to use checksums
6661348ec34c81e501f85e21f5464ceb9da3f8fb7b1fe3e6f0d412d16c73996d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / voiceai_sdk-0.1.0-py3-none-any.whl

Download URL voiceai_sdk-0.1.0-py3-none-any.whl
Size 149.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d48edd3706d187e8d23be5e23339ebf79b4fade39adc9ea579aa7059a7d40dfc
BLAKE2b-256 checksum
How to use checksums
841a76b93f73225b9fd0152eb605107f627fa755b332bb496d722a4d32f94cda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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