The official Python library for the slng API
Project description
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:
- Voices in the SLNG docs
- Deepgram Aura voices
- Cartesia Sonic 3 voices
- Kugel voices
- Murf Falcon voices
- Orpheus voices
- Rime Arcana voices
- Sarvam Bulbul voices
- Soniox TTS voices
- Full voice catalogs and samples are available in the SLNG dashboard.
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
- Full API surface: api.md
- General docs: docs.slng.ai
- Models by language: docs.slng.ai/models/by-language
- Source: github.com/slng-ai/voiceai-sdk-python
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file voiceai_sdk-0.1.0.tar.gz.
File metadata
- Download URL: voiceai_sdk-0.1.0.tar.gz
- Upload date:
- Size: 291.4 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad7e51a1bcb128c4491cf2daca963a0940f978bc73c08d7f3082f469968f1ef3
|
|
| MD5 |
7c70783fb483adada8efde1bd0fc4646
|
|
| BLAKE2b-256 |
6661348ec34c81e501f85e21f5464ceb9da3f8fb7b1fe3e6f0d412d16c73996d
|
File details
Details for the file voiceai_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: voiceai_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 149.7 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d48edd3706d187e8d23be5e23339ebf79b4fade39adc9ea579aa7059a7d40dfc
|
|
| MD5 |
afadfb966f3d869dc0eeb77446f1d243
|
|
| BLAKE2b-256 |
841a76b93f73225b9fd0152eb605107f627fa755b332bb496d722a4d32f94cda
|