Build your voice agent in under an hour
WebSocket-based STT and TTS with Python and Node.js SDKs. Request access, receive credentials, start streaming.
From zero to streaming transcript in minutes
Install smallest-ai to add Smallest AI's Python SDK, including STTClient and its asyncio-based streaming methods for real-time speech-to-text.
pip install smallest-ai
Use SAI_API_KEY as the SDK credential, request it through early-access by emailing [email protected] or submitting the contact form at the contact page, because keys are manually provisioned rather than a self-service dashboard.
export SAI_API_KEY=your_key_here
Open an async WebSocket stream with STTClient, send 16kHz mono PCM audio, and iterate over partial and final transcript tokens from session.receive(), with t.is_final identifying final tokens.
import asyncio, smallest_ai
async def main():
client = smallest_ai.STTClient()
async with client.stream() as session:
await session.send_file("sample.wav")
async for t in session.receive():
print(t.text, "final=", t.is_final)
asyncio.run(main())
# API subject to change in early access
Official clients for Python and Node.js
Both SDKs wrap the WebSocket protocol. The REST fallback is also available directly without a client library.
Request and event schema
Simplified reference for early-access partners. Full OpenAPI spec provided on access approval.
{
"api_key": "your_key",
"config": {
"sample_rate": 16000,
"language": "en",
"partial_transcripts": true
}
}
{
"type": "transcript",
"text": "call me back tomorrow",
"is_final": true,
"latency_ms": 43
}
{
"text": "I will call you back tomorrow afternoon.",
"voice": "agent-en-1",
"format": "pcm16",
"sample_rate": 16000
}
// Server streams PCM audio chunks as binary WebSocket frames
Streaming configuration for lowest latency
Audio format and chunk size are the two variables with the largest impact on round-trip time.
| Parameter | Recommended | Notes |
|---|---|---|
| Input sample rate | 16000 Hz | 8000 Hz also accepted (telephone narrowband) |
| Input encoding | PCM 16-bit signed | Single channel (mono) |
| Chunk size | 20-40ms | Smaller chunks lower latency; larger chunks lower overhead |
| Partial transcripts | true | Allows LLM to start before final transcript arrives |
| Output format (TTS) | pcm16 / 16000 Hz | Feed directly to a 16kHz PCM audio sink on the call leg |
Get your API key
We review access requests manually and provision credentials within 1-2 business days. Early access partners also receive direct engineering support.