Skip to content

fix: pass response_format in TTS API requests and map to correct content_type#87

Merged
lfnovo merged 2 commits intomainfrom
fix/tts-response-format
Feb 17, 2026
Merged

fix: pass response_format in TTS API requests and map to correct content_type#87
lfnovo merged 2 commits intomainfrom
fix/tts-response-format

Conversation

@lfnovo
Copy link
Owner

@lfnovo lfnovo commented Feb 17, 2026

Summary

  • TTS providers now extract response_format from kwargs (defaulting to "mp3"), include it in the API payload, and map it to the correct MIME type for AudioResponse.content_type
  • Previously response_format was never sent and content_type was always hardcoded to "audio/mp3", causing failures when providers return non-MP3 audio (e.g. WAV from mlx-audio/Kokoro)
  • Affected providers: OpenAI, OpenAI-compatible, Azure TTS

Closes #86

Test plan

  • Existing TTS tests pass unchanged (default behavior preserved)
  • New tests verify response_format is included in payload and content_type is mapped correctly (OpenAI + OpenAI-compatible)
  • Manual test with mlx-audio/Kokoro endpoint using response_format="wav"

…ent_type

OpenAI-compatible TTS providers now extract response_format from kwargs,
include it in the API payload, and use the correct MIME type for
AudioResponse.content_type. Previously response_format was never sent
and content_type was always hardcoded to audio/mp3, causing failures
when providers return non-MP3 audio (e.g. WAV from mlx-audio/Kokoro).

Closes #86
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 7 files

@lfnovo lfnovo merged commit dd00452 into main Feb 17, 2026
5 checks passed
leejangthegreat added a commit to leejangthegreat/esperanto that referenced this pull request Feb 21, 2026
leejangthegreat added a commit to leejangthegreat/esperanto that referenced this pull request Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: explicitly pass response_format in OpenAI-compatible TTS API calls

1 participant