createSpekoComponents is the one-call wiring helper for voice.AgentSession. It constructs SpekoSTT, SpekoLLM, SpekoTTS from a single options object and wraps STT and TTS with LiveKit’s StreamAdapter so the buffered Speko proxy can drive a streaming session.
Signature
CreateSpekoComponentsOptions
| Field | Type | Required | Description |
|---|---|---|---|
speko | Speko | ✅ | Initialised @spekoai/sdk client. |
intent | Intent | ✅ | Routing hint shared by STT, LLM, and TTS. |
vad | VAD | ✅ | VAD instance used by the stt.StreamAdapter. Typically await silero.VAD.load(). |
voice | string? | Voice id passed to SpekoTTS (maps to the Speko proxy’s voice param). | |
constraints | PipelineConstraints? | Allow-list constraints applied to all three modalities. | |
sentenceTokenizer | tokenize.SentenceTokenizer? | Tokenizer for chunking LLM output before TTS. Defaults to tokenize.basic.SentenceTokenizer. | |
llm | { temperature?, maxTokens? }? | Tuning forwarded to /v1/complete. | |
ttsOptions | { sampleRate?, speed? }? | Output sample rate and speech speed forwarded to SpekoTTS. |
Returns — SpekoComponents
voice.AgentSession.
Custom sentence tokenizer
Constraints shared across modalities
/v1/transcribe, /v1/complete, /v1/synthesize) receives the same constraints object.
Opting out — use classes directly
If you need finer control, construct the classes yourself.createSpekoComponents is a convenience wrapper; nothing stops you from building the pipeline manually.