Output formats

TTS voice delivery is channel-capability driven. Channel plugins advertise whether voice-style TTS should ask providers for a native voice-note target or keep normal audio-file synthesis, and whether the channel transcodes non-native output before sending.

One-off speech requests from the agent tool and /tts commands use the same channel delivery rules as automatic replies.

Telegram also advertises captioned final TTS. With tts.mode: "final" and Auto-TTS set to always (or eligible inbound mode), streamed text is held until synthesis finishes and sent as the voice-note caption. Text beyond Telegram's caption limit follows the voice note as a normal text message. If synthesis or a proven pre-send delivery step fails, Apus sends the visible text instead. When that fallback follows an immediate delivery result, it comes before later replies from the same turn. Channels that buffer sends until the turn settles may send the fallback after their buffered replies. tagged mode keeps its normal streaming behavior, and text inside a [[tts:text]] block remains audio-only.

After synthesis, Apus persists batch TTS output in the media store under tool-speech-synthesis. The reply uses that stable media path instead of a provider temporary file, and normal media maintenance prunes expired output. Local CLI providers may still use {{OutputPath}} as scratch space before Apus imports the completed bytes. See Media playback for inline-player formats and limits.

Target Format
Feishu / Matrix / Telegram / WhatsApp Voice-note replies prefer Opus (opus_48000_64 from ElevenLabs, opus from OpenAI). 48 kHz / 64 kbps balances clarity and size.
Other channels MP3 (mp3_44100_128 from ElevenLabs, mp3 from OpenAI). 44.1 kHz / 128 kbps is the default balance for speech.
Talk / telephony Provider-native PCM (Inworld 22050 Hz, Google 24 kHz), or ulaw_8000 from Gradium for telephony.

Per-provider notes:

OpenAI and ElevenLabs choose output formats per channel as listed above. An explicit OpenAI responseFormat overrides that selection; a format that is not voice-note compatible may be delivered as an audio file or transcoded by a channel that supports conversion.

Auto-TTS behavior

When tts.auto is enabled, Apus:

If the reply exceeds maxLength, Apus never skips audio outright:

Reply -> TTS enabled?
  no  -> send text
  yes -> has media / short?
          yes -> send text
          no  -> length > limit?
                   no  -> TTS -> attach audio
                   yes -> summary enabled and available?
                            no  -> truncate -> TTS -> attach audio
                            yes -> summarize -> TTS -> attach audio