Architecture
Theassistant-api decouples audio I/O from provider-specific logic through a transformer layer. Each provider implements the same generic interface. The factory functions resolve the provider string at call time.
Transformer Interface
Every STT and TTS provider implements the sameTransformers[IN] generic interface:
Provider Identifiers
Provider strings are defined asAudioTransformer constants in api/assistant-api/internal/transformer/transformer.go:
Factory Functions
The factory functions accept the provider string and return the correct implementation:switch on AudioTransformer(provider). Adding a new provider means adding a case to each switch.
Supported Providers
- STT
- TTS
Reference Implementation — Deepgram
The Deepgram transformer is the reference implementation. Its structure is the same for every provider.Option struct (deepgram.go)
Option struct (deepgram.go)
"key") matches what is stored in the credential vault.STT implementation (stt.go)
STT implementation (stt.go)
UserAudioPacket.Audio contains raw PCM 16-bit 16kHz audio bytes.TTS implementation (tts.go)
TTS implementation (tts.go)
onPacket callback is called with each synthesized audio chunk, which is sent directly to the client.Adding a New Provider
Follow these steps to add a new STT or TTS provider.1
Create the provider directory
2
Implement the Option struct
3
Implement SpeechToTextTransformer (stt.go)
4
Register in the factory (transformer.go)
Add a case to both factory functions in No changes to any other service are needed.
api/assistant-api/internal/transformer/transformer.go:5
Add the credential to the vault
In the dashboard under Settings → Integrations, add the provider API key. The credential map key must match what your option struct reads from
vaultCredential.GetValue().AsMap().Next Steps
Telephony
Connect Twilio, Vonage, Asterisk, and SIP.
Configuration
Environment variable reference.
Integration API
LLM provider execution — how assistant-api calls integration-api.
Architecture
Full system topology and data flow.