Skip to main content

Purpose

The assistant-api is the runtime core of the Rapida platform. Every active voice call passes through this service. It owns:
  • Real-time audio streaming via WebSocket (browser and telephony)
  • Voice Activity Detection (Silero, TEN, FireRed) — speech detection and barge-in
  • Speech-to-text transcription (streaming, provider-agnostic)
  • End of Speech detection (Silence-Based, Pipecat Smart Turn, LiveKit Turn Detector) — turn boundary detection
  • LLM inference via integration-api (streaming token delivery)
  • Text-to-speech synthesis (streaming, provider-agnostic)
  • Telephony signalling for Twilio, Vonage, Exotel, Asterisk, and SIP
  • Knowledge base retrieval (RAG) via document-api
  • Conversation state and metrics persistence

Port

9007 — HTTP · gRPC · WebSocket (cmux)

Port

4573 — Asterisk AudioSocket (TCP)

Language

Go 1.25 Gin (REST) + gRPC

Voice Pipeline

Every call follows this sequence. STT, LLM, and TTS run as streaming pipelines — the LLM begins generating before STT finishes, and TTS begins speaking before the LLM completes.

Input Channels

PUBLIC_ASSISTANT_HOST must be a publicly reachable hostname or IP. Twilio, Vonage, and Exotel call back to this host for WebSocket media streaming.

STT / TTS Providers

Provider identifiers are the string constants used in AudioTransformer (api/assistant-api/internal/transformer/transformer.go). They map directly to the provider field in the assistant configuration.

Key Components

Each provider lives under api/assistant-api/internal/transformer/<provider>/. All providers implement the same generic interface:
The factory functions resolve the provider string to a concrete implementation at call time:
See STT / TTS Providers for how to add a new provider.
Telephony providers live under api/assistant-api/internal/channel/telephony/internal/<provider>/. The factory in telephony.go creates the correct provider at runtime:
All providers implement the Telephony interface (ReceiveCall, OutboundCall, InboundCall, StatusCallback). See Telephony for provider setup.
Call context (assistant ID, conversation ID, auth token, provider, caller number) is persisted in PostgreSQL via the callcontext.Store interface. The context ID is passed through the call URL path so the WebSocket or AudioSocket handler can resolve the full session without requiring the client to re-authenticate.
The Communication interface in api/assistant-api/internal/type/ is the central contract tying together the STT callback, LLM execution, TTS callback, auth, tracing, and conversation state for a single call. Each channel (WebSocket, telephony, SIP) creates a Communication implementation per call.

Running


Health Endpoints


Next Steps

Configuration

All environment variables with defaults and descriptions.

Voice Activity Detection

Silero, TEN, and FireRed VAD — setup, parameters, and model files.

End of Speech

Silence-Based, Pipecat Smart Turn, and LiveKit Turn Detector — setup and model downloads.

STT / TTS Providers

Supported providers, the transformer interface, and how to add a new provider.

Telephony

Twilio, Vonage, Exotel, Asterisk AudioSocket, and SIP setup.

Integration API

LLM provider execution layer called by assistant-api.