pip install the wheel, and start streaming audio.
The SDK does not open microphones or speakers for you — you bring your own audio (from a file, socket, or media stream). You push frames in with
process_frame and read processed frames back.Two ways to use the SDK
The SDK runs in one of two modes. The setup flow is identical — you alwayscreate_sdk → activate_api_key → create_audio_processor and wait for PipelineState.RUNNING — but how you select the mode and what you get back differ:
This page covers Language Translation inside the Python SDK (selected via
lt_config). Sanas also offers a standalone, browser-friendly Language Translation API (WebRTC / WebSocket / JavaScript client) for real-time speech-to-speech in the browser — use that instead of the SDK if you’re building a web app.Prerequisites
Before You Begin
Before You Begin
You only need a supported CPython interpreter and
pip — no extra tooling required. The wheel in your archive targets the Python version named in its filename:Get SDK Credentials
Get SDK Credentials
Sign up for an account and generate your API keys.
Step 1: Install the SDK
Your archive is laid out like this:Step 2: Verify Installation
Step 3: Select Your Model
For audio processing, setmodel_name to one of the model keys enabled for your account. Language Translation is selected differently — by the presence of an lt_config (see Step 4).
Step 4: Process Your First Audio Stream
Two things to understand before reading the code:- The pipeline initializes asynchronously. After you create a processor, wait for
PipelineState.RUNNING(via theaudio_pipeline_state_notifycallback) before feeding frames. process_frameis synchronous but expects real-time audio. Feed frames at the rate they would arrive live (one 20 ms frame every 20 ms). The snippets below pace with a monotonic-clock deadline so timing doesn’t drift.
model_name; Language Translation leaves it empty and passes an lt_config instead. Compare them side by side.
- Audio Processing
- Language Translation
Create
sdk_example.py and set model_name to one of your enabled model keys.Cloud inference tuning (optional)
When the SDK runs on cloud / remote inference (the default), you can pass aCloudInferencingParams on AudioAttributes.cloud_inferencing_params to tune the remote path. These parameters are only meaningful for cloud inference and are ignored for local inference. The field is optional — omit it to keep the defaults.
Leave
cloud_inferencing_params unset (or use_pcm16=False) unless you specifically need raw PCM uplink — the rate-default codec is the recommended default for most sessions.Step 5: Run the Examples
Theexamples/ folder is self-contained (standard-library helpers only, no numpy). With your venv active, set the required environment variables and run an example from inside the extracted archive:
SANAS_STORAGE_DIR is where the SDK keeps its data and writes logs (under storage_dir/logs).Key Types
InitParams, create_sdk, Sdk, AudioAttributes, ProcessorAttributes, AudioProcessor, AudioFrame, LanguageTranslationConfig, CloudInferencingParams, PipelineState, SdkResult.
Next Steps
Looking for examples try the Tutorials/Examples:Processing Multiple Streams
Scale to multiple concurrent audio streams with a shared SDK instance.
Need Help?
Email Support
support@sanas.ai Response time: 1 business day
Support Portal
Raise a support ticket for urgent issues