Skip to content

feat: add OpenAI-compatible speech synthesis#415

Merged
ivan-digital merged 1 commit into
mainfrom
feat/openai-tts-api
Jul 17, 2026
Merged

feat: add OpenAI-compatible speech synthesis#415
ivan-digital merged 1 commit into
mainfrom
feat/openai-tts-api

Conversation

@ivan-digital

Copy link
Copy Markdown
Member

Summary

  • add POST /v1/audio/speech with the standard model, input, voice, response_format, and speed request fields
  • route common OpenAI TTS model aliases through Kokoro while preserving native Speech Swift model and voice aliases
  • return WAV by default or headerless 24 kHz mono PCM16 when requested
  • return OpenAI-shaped error envelopes and reject unsupported compressed formats explicitly
  • document the HTTP audio contract and expose the route in server startup output

Architecture fit

The route is a thin protocol adapter over the existing model registry and dispatchSynthesize path. It adds no model runtime or codec dependency. Voice and speed parameters are carried through the shared dispatcher only where the selected engine supports them.

Compatibility notes

This endpoint supports WAV and PCM output. Explicit MP3, Opus, AAC, and FLAC requests return a clear 400 response rather than mislabeled audio. Generic OpenAI voice names select the local engine default; native Kokoro and Qwen3-TTS voice names pass through.

Tests

  • swift test --skip E2E
  • swift test --filter OpenAISpeechTests
  • swift test --filter E2EOpenAISpeechTests

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.

1 participant