Skip to main content
POST
/
api
/
v1
/
tts
/
sse
TTS Stream
curl --request POST \
  --url https://api.vachana.ai/api/v1/tts/sse \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key-ID: <x-api-key-id>' \
  --data '
{
  "audio_config": {
    "bitrate": "192k",
    "container": "mp3",
    "encoding": "linear_pcm",
    "num_channels": 1,
    "sample_rate": 44100,
    "sample_width": 2
  },
  "model": "vachana-voice-v2",
  "text": "नमस्ते, आप कैसे हैं?"
}
'
"event: audio_chunk\ndata: UklGRiQAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQAAAAA=\n\nevent: completed\ndata: {\"status\": \"success\"}\n"

Documentation Index

Fetch the complete documentation index at: https://docs.inya.ai/llms.txt

Use this file to discover all available pages before exploring further.

Currently in beta. You’re on the priority waitlist and among the first to get access.

Overview

Receive audio in chunks as it’s generated, allowing playback to start immediately. Reduces latency compared to TTS REST.
Passing numbers, IDs, dates, or currency as raw strings causes mispronunciations. See the Input Formatting Guide for correct formatting of phone numbers, account numbers, PINs, Aadhaar, vehicle registration numbers, GSTIN, currency, and more.

Python SDK

The SDK’s streaming client handles SSE parsing and chunk reassembly for you — you just iterate and write.

Installation

pip install gnani-vachana
Requires Python 3.9+.

Authentication

from gnani.tts import GnaniTTSStreamClient

client = GnaniTTSStreamClient(api_key="your-api-key")

Stream Audio to a File

synthesize_stream yields audio chunks as they arrive. Playback or writing can begin before the full response is complete.
from gnani.tts import GnaniTTSStreamClient

client = GnaniTTSStreamClient(api_key="your-api-key")

with open("output.wav", "wb") as f:
    for chunk in client.synthesize_stream(
        "Streaming TTS response in Hindi",
        voice="sia",
    ):
        f.write(chunk)

With Custom Audio Config

from gnani.tts import GnaniTTSStreamClient, AudioConfig

client = GnaniTTSStreamClient(api_key="your-api-key")

with open("output.wav", "wb") as f:
    for chunk in client.synthesize_stream(
        "नमस्ते, आप कैसे हैं?",
        voice="raju",
        audio_config=AudioConfig(
            sample_rate=44100,
            encoding="linear_pcm",
            container="wav",
        ),
    ):
        f.write(chunk)

Headers

X-API-Key-ID
string
required

Body

application/json

Request body for TTS inference.

text
string
required
model
enum<string>
required

Supported TTS models.

Available options:
vachana-voice-v2
audio_config
AudioConfig · object
required

Audio output configuration.

voice
enum<string>

ID of a pre-defined voice. Ignored if speaker_embedding is provided.

Available options:
sia,
raju,
kanika,
nikita,
ravan,
simran,
karan,
neha

Response

Successful Server-Sent Events stream

The response is of type string.