Learn how to implement voice endpoints for Mastra and custom backends
useBrowserTTS
is false)settings
field contains a JSON object with the following structure:
language
: Language code for speech recognition/synthesisvoiceId
: Voice identifier for TTS (provider-specific)pitch
, rate
, volume
: Voice modulation parametersuseBrowserTTS
: Whether to use browser’s built-in TTSautoAddToMessages
: Whether to add voice interactions to chat historycontext
field contains stringified additional context from the Cedar state, which may include:
text
: The text response from the assistanttranscription
: The transcribed user inputaudioData
: Base64-encoded audio responseaudioUrl
: URL to an audio fileaudioFormat
: MIME type of the audiousage
: Token usage statisticsobject
: Structured response for actionshandleLLMVoice
function that processes voice responses consistently across all providers:
myCustomState.setValue(42)
in your Cedar state.
200 OK
: Successful response400 Bad Request
: Invalid request format401 Unauthorized
: Missing or invalid API key500 Internal Server Error
: Server-side errorwhisper-1
)tts-1
) with configurable voices