openclaw - ✅(Solved) Fix TTS OpenAI provider: MP3 responseFormat not voice-compatible for Telegram, unlike Edge TTS [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#80317Fetched 2026-05-11 03:16:19
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Author
Timeline (top)
commented ×1cross-referenced ×1

Fix Action

Workaround

Manually patching the source:

// speech-provider-CzRYCn2R.js line ~189
voiceCompatible: req.target === "voice-note" && (responseFormat === "opus" || responseFormat === "mp3")

PR fix notes

PR #80326: fix(openai): treat mp3 responseFormat as voice-compatible for Telegram voice notes

Description (problem / solution / changelog)

Summary

Extends the voiceCompatible flag in the OpenAI TTS provider to accept mp3 in addition to opus when the synthesis target is voice-note. Telegram (and other channels) accept MP3 natively via sendVoice, mirroring the behavior of the Edge TTS / Microsoft provider which already uses isVoiceCompatibleAudio to detect mp3 as voice-compatible.

Closes #80317

Changes

extensions/openai/speech-provider.ts

  • Line 320: voiceCompatible condition extended to responseFormat === "opus" || responseFormat === "mp3"

extensions/openai/speech-provider.test.ts

  • Updated test name from "clears voice-note compatibility when not opus" → "clears voice-note compatibility for non-voice-compatible formats" (wav case unchanged — still false)
  • New test: "marks mp3 responseFormat as voice-compatible for voice-note target" — asserts voiceCompatible === true when responseFormat: "mp3" and target: "voice-note"

Real behavior proof

Behavior or issue addressed: OpenAI-compatible local TTS servers (Piper, Kokoro) configured with responseFormat: "mp3" now route Telegram voice notes through sendVoice (showing native waveform UI) instead of sendAudio (showing as file attachment).

Real environment tested: Ubuntu 22.04 (DGX Spark), Node 22.x, vitest 4.1.5

Exact steps or command run after this patch:

node scripts/test-projects.mjs extensions/openai/speech-provider.test.ts

Evidence: Terminal output:

 Test Files  1 passed (1)
      Tests  10 passed (10)
   Start at  23:38:02
   Duration  365ms (transform 181ms, setup 105ms, import 133ms, tests 53ms, environment 0ms)

New test "marks mp3 responseFormat as voice-compatible for voice-note target" verifies result.voiceCompatible === true when synthesizing with responseFormat: "mp3" and target: "voice-note". The existing wav voice-note test confirms voiceCompatible === false for non-voice-compatible formats.

Observed result after fix: voiceCompatible: true for (target="voice-note", responseFormat="mp3"). All 10 tests pass.

What was not tested: Live Piper/Kokoro TTS server synthesis with actual Telegram sendVoice call; m4a or ogg formats (not in OPENAI_SPEECH_RESPONSE_FORMATS).

Changed files

  • extensions/openai/speech-provider.test.ts (modified, +24/-1)
  • extensions/openai/speech-provider.ts (modified, +2/-1)

Code Example

voiceCompatible: req.target === "voice-note" && responseFormat === "opus"

---

// speech-provider-CzRYCn2R.js line ~189
voiceCompatible: req.target === "voice-note" && (responseFormat === "opus" || responseFormat === "mp3")
RAW_BUFFERClick to expand / collapse

Problem

The OpenAI-compatible TTS provider (used for local TTS servers like Piper/Kokoro) treats responseFormat: "mp3" as not voice-compatible for Telegram voice notes. However, Edge TTS (Microsoft provider) outputs MP3 by default and works fine as Telegram voice messages.

Current behavior

OpenAI provider (speech-provider-CzRYCn2R.js):

voiceCompatible: req.target === "voice-note" && responseFormat === "opus"

When configured with responseFormat: "mp3" for Telegram:

  • voiceCompatible = false
  • OpenClaw falls back to sendAudio instead of sendVoice
  • Telegram displays it as a file attachment with filename, no voice waveform UI

Edge TTS provider (speech-provider-cIDKP9Bn.js):

  • Outputs audio-24khz-48kbitrate-mono-mp3
  • isVoiceCompatibleAudio() checks file extension (.mp3 is in whitelist)
  • Telegram sendVoice accepts MP3 and converts server-side
  • Voice note UI (circle + waveform) works correctly

Expected behavior

MP3 from OpenAI-compatible local TTS should behave identically to Edge TTS:

  • Pass voiceCompatible check
  • Route through sendVoice
  • Show native Telegram voice message UI

Workaround

Manually patching the source:

// speech-provider-CzRYCn2R.js line ~189
voiceCompatible: req.target === "voice-note" && (responseFormat === "opus" || responseFormat === "mp3")

Related

  • Issue #43072 (feat(tts): send Telegram voice messages as OGG/Opus)
  • The architectural fix might be automatic container conversion (WAV/MP3 → OGG/Opus) before sendVoice, rather than relying on Telegram to accept non-Opus formats.

Environment

  • OpenClaw version: 2026.5.6
  • Channel: Telegram
  • Local TTS: Piper TTS (OpenAI-compatible API)
  • Server response formats tested: mp3, opus, ogg

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

MP3 from OpenAI-compatible local TTS should behave identically to Edge TTS:

  • Pass voiceCompatible check
  • Route through sendVoice
  • Show native Telegram voice message UI

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix TTS OpenAI provider: MP3 responseFormat not voice-compatible for Telegram, unlike Edge TTS [1 pull requests, 1 comments, 2 participants]