Text-to-speech (TTS)
OpenClaw can convert outbound replies into audio using ElevenLabs, OpenAI, or Edge TTS. It works anywhere OpenClaw can send audio; Telegram gets a round voice-note bubble.Supported services
- ElevenLabs (primary or fallback provider)
- OpenAI (primary or fallback provider; also used for summaries)
- Edge TTS (primary or fallback provider; uses
node-edge-tts, default when no API keys)
Edge TTS notes
Edge TTS uses Microsoft Edge’s online neural TTS service via thenode-edge-tts
library. It’s a hosted service (not local), uses Microsoft’s endpoints, and does
not require an API key. node-edge-tts exposes speech configuration options and
output formats, but not all options are supported by the Edge service. citeturn2search0
Because Edge TTS is a public web service without a published SLA or quota, treat it
as best-effort. If you need guaranteed limits and support, use OpenAI or ElevenLabs.
Microsoft’s Speech REST API documents a 10‑minute audio limit per request; Edge TTS
does not publish limits, so assume similar or lower limits. citeturn0search3
Optional keys
If you want OpenAI or ElevenLabs:ELEVENLABS_API_KEY(orXI_API_KEY)OPENAI_API_KEY
messages.tts.edge.enabled=false).
If multiple providers are configured, the selected provider is used first and the others are fallback options.
Auto-summary uses the configured summaryModel (or agents.defaults.model.primary),
so that provider must also be authenticated if you enable summaries.
Service links
- OpenAI Text-to-Speech guide
- OpenAI Audio API reference
- ElevenLabs Text to Speech
- ElevenLabs Authentication
- node-edge-tts
- Microsoft Speech output formats
Is it enabled by default?
No. Auto‑TTS is off by default. Enable it in config withmessages.tts.auto or per session with /tts on.
Edge TTS is enabled by default once TTS is on, and is used automatically
when no OpenAI or ElevenLabs API keys are available.
Config
TTS config lives undermessages.tts in openclaw.json.
Full schema is in Gateway configuration.
Minimal config (enable + provider)
OpenAI primary with ElevenLabs fallback
Edge TTS primary (no API key)
Disable Edge TTS
Custom limits + prefs path
Only reply with audio after an inbound voice note
Voice note conversation loop
voiceNoteLoop keeps the conversation in voice-note mode after the agent replies. When the user sends a voice note and TTS generates audio, the mode controls what gets delivered back.
"disabled"(default): reply is text only; TTS still applies perautomode."enabled": when inbound message is a voice note and TTS generates audio, the text is suppressed — only the voice note is delivered back."both": reply delivers both the voice note and text. On WhatsApp, text is sent as a separate follow-up message (WhatsApp audio messages do not support captions).
Disable auto-summary for long replies
Notes on fields
auto: auto‑TTS mode (off,always,inbound,tagged).inboundonly sends audio after an inbound voice note.taggedonly sends audio when the reply includes[[tts]]tags.
enabled: legacy toggle (doctor migrates this toauto).mode:"final"(default) or"all"(includes tool/block replies).provider:"elevenlabs","openai", or"edge"(fallback is automatic).- If
provideris unset, OpenClaw prefersopenai(if key), thenelevenlabs(if key), otherwiseedge. summaryModel: optional cheap model for auto-summary; defaults toagents.defaults.model.primary.- Accepts
provider/modelor a configured model alias.
- Accepts
modelOverrides: allow the model to emit TTS directives (on by default).allowProviderdefaults tofalse(provider switching is opt-in).
maxTextLength: hard cap for TTS input (chars)./tts audiofails if exceeded.timeoutMs: request timeout (ms).prefsPath: override the local prefs JSON path (provider/limit/summary).apiKeyvalues fall back to env vars (ELEVENLABS_API_KEY/XI_API_KEY,OPENAI_API_KEY).elevenlabs.baseUrl: override ElevenLabs API base URL.elevenlabs.voiceSettings:stability,similarityBoost,style:0..1useSpeakerBoost:true|falsespeed:0.5..2.0(1.0 = normal)
elevenlabs.applyTextNormalization:auto|on|offelevenlabs.languageCode: 2-letter ISO 639-1 (e.g.en,de)elevenlabs.seed: integer0..4294967295(best-effort determinism)edge.enabled: allow Edge TTS usage (defaulttrue; no API key).edge.voice: Edge neural voice name (e.g.en-US-MichelleNeural).edge.lang: language code (e.g.en-US).edge.outputFormat: Edge output format (e.g.audio-24khz-48kbitrate-mono-mp3).- See Microsoft Speech output formats for valid values; not all formats are supported by Edge.
edge.rate/edge.pitch/edge.volume: percent strings (e.g.+10%,-5%).edge.saveSubtitles: write JSON subtitles alongside the audio file.edge.proxy: proxy URL for Edge TTS requests.edge.timeoutMs: request timeout override (ms).voiceNoteLoop: voice note conversation loop mode ("disabled"|"enabled"|"both"). Telegram and WhatsApp only. Default"disabled".
Model-driven overrides (default on)
By default, the model can emit TTS directives for a single reply. Whenmessages.tts.auto is tagged, these directives are required to trigger audio.
When enabled, the model can emit [[tts:...]] directives to override the voice
for a single reply, plus an optional [[tts:text]]...[[/tts:text]] block to
provide expressive tags (laughter, singing cues, etc) that should only appear in
the audio.
provider=... directives are ignored unless modelOverrides.allowProvider: true.
Example reply payload:
provider(openai|elevenlabs|edge, requiresallowProvider: true)voice(OpenAI voice) orvoiceId(ElevenLabs)model(OpenAI TTS model or ElevenLabs model id)stability,similarityBoost,style,speed,useSpeakerBoostapplyTextNormalization(auto|on|off)languageCode(ISO 639-1)seed
Per-user preferences
Slash commands write local overrides toprefsPath (default:
~/.openclaw/settings/tts.json, override with OPENCLAW_TTS_PREFS or
messages.tts.prefsPath).
Stored fields:
enabledprovidermaxLength(summary threshold; default 1500 chars)summarize(defaulttrue)
messages.tts.* for that host.
Output formats (fixed)
- Telegram: Opus voice note (
opus_48000_64from ElevenLabs,opusfrom OpenAI).- 48kHz / 64kbps is a good voice-note tradeoff and required for the round bubble.
- Other channels: MP3 (
mp3_44100_128from ElevenLabs,mp3from OpenAI).- 44.1kHz / 128kbps is the default balance for speech clarity.
- Edge TTS: uses
edge.outputFormat(defaultaudio-24khz-48kbitrate-mono-mp3).node-edge-ttsaccepts anoutputFormat, but not all formats are available from the Edge service. citeturn2search0- Output format values follow Microsoft Speech output formats (including Ogg/WebM Opus). citeturn1search0
- Telegram
sendVoiceaccepts OGG/MP3/M4A; use OpenAI/ElevenLabs if you need guaranteed Opus voice notes. citeturn1search1 - If the configured Edge output format fails, OpenClaw retries with MP3.
Auto-TTS behavior
When enabled, OpenClaw:- skips TTS if the reply already contains media or a
MEDIA:directive. - skips very short replies (< 10 chars).
- summarizes long replies when enabled using
agents.defaults.model.primary(orsummaryModel). - attaches the generated audio to the reply.
maxLength and summary is off (or no API key for the
summary model), audio
is skipped and the normal text reply is sent.
Flow diagram
Slash command usage
There is a single command:/tts.
See Slash commands for enablement details.
Discord note: /tts is a built-in Discord command, so OpenClaw registers
/voice as the native command there. Text /tts ... still works.
- Commands require an authorized sender (allowlist/owner rules still apply).
commands.textor native command registration must be enabled.- Bare
/ttsshows the current status. on/offare the per‑session toggle. The finer modes —always,inbound,tagged— are config values formessages.tts.auto, not chat commands.limit(default 1500, max 4096) andsummaryare stored in local prefs, not the main config./tts audiogenerates a one-off audio reply (does not toggle TTS on).
Agent tool
Thetts tool converts text to speech and returns a MEDIA: path. When the
result is Telegram-compatible, the tool includes [[audio_as_voice]] so
Telegram sends a voice bubble.
Gateway RPC
Gateway methods:tts.statustts.enabletts.disabletts.converttts.setProvidertts.providers
Troubleshooting
TTS is enabled but no audio is sent — only text arrives Check thatmessages.tts.auto is set to "always", "inbound", or "tagged" (not "off"). The /tts status command shows the active mode for the current session. Also confirm at least one provider is available: ElevenLabs or OpenAI API key in config or env vars, or Edge TTS enabled (messages.tts.edge.enabled defaults to true). Replies shorter than 10 characters and replies that already contain media are always sent as text.
Audio is generated but Telegram doesn’t show it as a round voice bubble
Telegram requires Opus-encoded OGG for voice notes. OpenClaw uses opus output from OpenAI and opus_48000_64 from ElevenLabs automatically. Edge TTS uses the edge.outputFormat you configure; set it to an Ogg/WebM Opus format if you need guaranteed voice bubbles, or switch to OpenAI or ElevenLabs for Telegram.
Edge TTS fails with a connection error
Edge TTS connects to Microsoft’s online endpoints and has no published SLA. Transient failures are expected; OpenClaw retries with MP3 on format errors. For reliable production use, configure OpenAI or ElevenLabs as the primary provider and let Edge TTS serve as a fallback only.
voiceNoteLoop: "enabled" shows text replies instead of audio-only
voiceNoteLoop only suppresses text when (1) the inbound message was a voice note and (2) TTS successfully generated audio. If TTS fails (API error, text too long, no provider), the text reply is sent as a fallback. Check the gateway logs for TTS errors. Also verify messages.tts.auto is "inbound" or "always" — "tagged" mode requires a [[tts]] tag in the reply to trigger audio.