SDKs

Python SDK

Installation, setup, and quick reference for the official Shunyalabs Python SDK.


Installation

terminal
pip install shunyalabs[ASR]    # ASR only
pip install shunyalabs[all]    # ASR + TTS
pip install shunyalabs[extras] # Includes sounddevice for mic input

Minimum requirements

  • Python 3.8 or higher
  • pip 21.0 or higher

Importing & client setup

python
from shunyalabs import AsyncShunyaClient
from shunyalabs.asr import TranscriptionConfig, StreamingConfig
from shunyalabs.tts import TTSConfig
from shunyalabs.exceptions import ShunyalabsError

# Preferred — reads SHUNYALABS_API_KEY from env
client = AsyncShunyaClient()

# With all options
client = AsyncShunyaClient(
    api_key="your-api-key",
    timeout=60.0,
    max_retries=2,
)

AsyncShunyaClient — configuration reference

ParameterTypeDefaultDescription
api_keystringNoneFalls back to SHUNYALABS_API_KEY env var.
timeoutfloat60.0Request timeout in seconds.
max_retriesint2Retries on 5xx and connection errors.

All exceptions inherit from ShunyalabsError. See Section 2.8 Batch Error Handling and Section 3.9 Streaming Error Handling for full patterns.

Repositories

PyPI: https://pypi.org/project/shunyalabs

GitHub: https://github.com/Shunyalabsai/shunyalabs-python-sdk