Limits & Quotas
Concurrent Requests
Shunya TTS allows up to 16 concurrent requests per API key. Use a semaphore to stay within the limit when processing batches.
Concurrency Limit
| LIMIT | VALUE |
|---|---|
| Max concurrent requests | 16 per API key |
Semaphore Example
Use asyncio.Semaphore to cap in-flight requests:
python
import asyncio
from shunyalabs import AsyncShunyaClient, TTSConfig
client = AsyncShunyaClient(api_key="your-api-key")
sem = asyncio.Semaphore(16)
async def synthesize(text: str, config: TTSConfig):
async with sem:
return await client.tts.synthesize(text, config=config)
async def main():
config = TTSConfig(model="zero-indic", voice="Nisha", response_format="mp3")
texts = ["Sentence one.", "Sentence two.", "Sentence three.", "..."]
results = await asyncio.gather(
*[synthesize(t, config) for t in texts]
)
for i, result in enumerate(results):
with open(f"output_{i}.mp3", "wb") as f:
f.write(result.audio_data)
asyncio.run(main())