Skip to main content

Architecture

The assistant-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 same Transformers[IN] generic interface:
Type aliases used in practice:

Provider Identifiers

Provider strings are defined as AudioTransformer constants in api/assistant-api/internal/transformer/transformer.go:
These strings are stored in the assistant’s configuration and resolved at call time by the factory functions.

Factory Functions

The factory functions accept the provider string and return the correct implementation:
Both functions use a switch on AudioTransformer(provider). Adding a new provider means adding a case to each switch.

Supported Providers


Reference Implementation — Deepgram

The Deepgram transformer is the reference implementation. Its structure is the same for every provider.
Provider-specific options are read from the vault credential map. The key name ("key") matches what is stored in the credential vault.
UserAudioPacket.Audio contains raw PCM 16-bit 16kHz audio bytes.
The 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

Create these files inside the 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 api/assistant-api/internal/transformer/transformer.go:
No changes to any other service are needed.
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.